; ; Accept a line from the keyboard and print it with its ; characters reversed. ; mainloop: MOV #0xe0,R0 MOV #32,R1 CALL gets CALL reverse MOV #0xe0,R0 CALL puts JMP mainloop reverse: MOV R0,R1 ; R0 => start of string seeknull: CMP #0,@R1+ JNE seeknull SUB #1,R1 ; R1 => null at end of string JMP reventry revloop: MOV @R0,R2 ; char from head in R2 MOV @-R1,@R0+ ; char from tail to head MOV R2,@R1 ; original head to tail reventry: CMP R1,R0 JC revloop RET