Question
use Esay 68k assembly modify the code to print out the string in reverse order. You are not allowed to skip the @ by matching/searching
use Esay 68k assembly
modify the code to print out the string in reverse order. You are not allowed to skip the @ by matching/searching the value but by tracing out the memory location of @ and skip
*----------------------------------------------------------- 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started