Assume we have CPU instructions that look like this: load register, address
save register, address
Where the instruction load copies the data pointed to by the
address into the register, and the instruction save copies the data
from the register into the location pointed to by address. Assume
“register” can be the values R0 and R1, where each “R#” is the name
of a single register that can store a single byte. Assume the
“address” is an integer constant number.
Assume at address 52 is the beginning of a string “ABC”. Assume at address 1 is the printer. (Assembler Language)
So we need to just use the above two commands in order to store the "ABC" to the printer. So we need to go to each character one by one. As it is starting at 52 so next one would be 53 and then would be 54
LOAD R1, 0x34
STORE R1, 0x01
LOAD R1, 0x35
STORE R1, 0x01
LOAD R1, 0x36
STORE R1, 0x01
So the first line will load the character 'A' of one byte to
Register R1, then it is stored to the printer and then 'B' loaded
to Register R2 and then 'C' loaded to Printer using Register R1
only.
Thus in this way, three bytes of 'ABC' are written to the
printer.
That was a nice question
to answer
Friend, If you have any doubts in understanding do let me know in
the comment section. I will be happy to help you further.
Thanks
Get Answers For Free
Most questions answered within 1 hours.