easy 68k Assembly Language

profilebyorv20n7
iAlreadyDidIt.X68

*----------------------------------------------------------- * Title : * Written by : * Date : * Description: *----------------------------------------------------------- ORG $000400 ;Define origin of Data LEA BUFFER(PC), A0 ;Preset A- as a pointer Register NEXTIN BSR GET_CHAR ;Get a Character from user MOVE.B D1, (A0)+ ;Store Character (D1) in (A0) and move pointer to next CMP.B #'@', D1 ;IF character = @ THEN go to PRINT BNE NEXTIN ;Else Repeat NEXTIN PRINT LEA BUFFER(PC), A0 ; Reset Pointer to Start of Buffer NEXTOUT MOVE.B (A0)+, D1 ; Get character from pointer (A0) store in D1, update pointer to next CMP.B #'@', D1 ; IF character = @ THEN go to DONE BEQ Done BSR PUT_CHAR ; ELSE Print Character BRA NEXTOUT ; REPEAT DONE STOP #$2700 ; HALT 68K * GET_CHAR MOVE.B #5, D0 ; Input Routine (code = 5) TRAP #15 ; Load input command into D0 and call O/s RTS ; Return to SubRoutine * PUT_CHAR MOVE.B #6, D0 ; Output routine (code = 6) TRAP #15 ; Load input command in D0 and call O/s RTS ; RTS * ORG $500 BUFFER DS.B 40 ; Reserve 40 bytes of storage END $400 *~Font name~Courier New~ *~Font size~10~ *~Tab type~1~ *~Tab size~4~