; > echo.mac ; ; Echo typed in characters to output org 0 ; Relocatable code ; mov pc,r1 add #hello-$,r1 ; Calculate address of 'hello' jsr pc,PrintR1 ; Print welcome message .loop mov pc,r1 add #prompt-P%,r1 ; Calculate address of prompt jsr pc,PrintR1 ; Print prompt mov pc,r1 add #buffer-P%,r1 ; Get relative address of input buffer jsr pc,IO_READLINE ; Read a line of text bcc loop ; Loop until Escape rts pc ; Exit .hello equs "Characters typed will be echoed.",13 equs "Press ESCAPE to terminate.",13 equb 0 .prompt equs "-> " equb 0 align #include "UnixIO.mac" .buffer