Problem #3 Write a short programn in 68K assembly language that fills all of mem
ID: 2267891 • Letter: P
Question
Problem #3 Write a short programn in 68K assembly language that fills all of memory between two specified addresses with the alternating byte pattern $55 SAA $55 SAA and so forth. The memory region that you will fill is $0000 A000 to $0000A2FF, inclusive. You should fill only the region specified. No spillover allowed. Notes on problem #3: This time you probably should plan on using a loop. But how do you know when to stop the loop? You could set up a loop counter, but that requires that you figure out how many times you need to run the loop. Another way might be to check the current address of where you are writing to in memory and then compare that with the last address that you want to write to before you stop. How would you do that? Simple, use the CMPA (compare address instruction)Explanation / Answer
Answer :- The assembly code for 68000 can be written as-
MOVE #$0000A000, A0 ;copy starting address in register A0
MOVE #$0000A2FF, A1 ;copy ending address in register A1
LoopMemCopy: ;label name starts here
MOVE #$55, (A0)+ ;write $55 at location in A0, then increment the value in register A0 by 1
MOVE #$AA, (A0)+ ;write $AA at location in A0, then increment the value in register A0 by 1
CMPA A0, A1 ;compare address in A0 and A1
BLE LoopMemCopy ;if A0 is less or equal to A1 then goto label name LoopMemCopy
Here : BRA Here ;end of program, infinite loop here
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.