tst param / are we substituting for $n bne 2f/ yes mov inbufp,r1 / no, move normal input pointer to r1 cmp r1,einbuf / end of input line? bne 1f / no jsr pc,getbuf / yes, put next console line in buffer br getc 1: movb (r1)+,r0 / move byte from input buffer to r0 mov r1,inbufp / increment routine bis escap,r0 / if last character was \ this adds / 200 to current character clr escap / clear, so escap normally zero cmp r0,$'\\ / note that \\ is equal \ in as beq 1f cmp r0,$'$ / is it $ beq 3f / yes rts pc / no 1: mov $200,escap / mark presence of \ in command line br getc / get next character 2: movb *param,r0 / pick up substitution character put in / r0 beq 1f / if end of substitution arg, branch inc param / if not end, set for next character rts pc / return as though character in ro is normal / input 1: clr param / unset substitution pointer br getc / get next char in normal input 3: jsr pc,getc / get digit after $ sub $'0,r0 / strip off zone bits cmp r0,$9. / compare with digit 9 blos 1f / less than or equal 9 mov $9.,r0 / if larger than 9, force 9 1: mov shellarg,r1 / get pointer to stack for / this call of shell inc r0 / digit +1 cmp r0,(r1) / is it less than # of args in this call bge getc / no, ignore it. so this $n is not replaced asl r0 / yes, multiply by 2 (to skip words) add r1,r0 / form pointer to arg pointer (-2) mov 2(r0),param / move arg pointer to param br getc / go to get substitution arg for $n getbuf: mov $inbuf,r0 / move input buffer address mov r0,inbufp / to input buffer pointer mov r0,einbuf / and initialize pointer to end of / character string dec r0 / decrement pointer so can utilize normal / 100p starting at 1f mov r0,0f / initialize address for reading 1st char