Question

Assume we have CPU instructions that look like this: load register, address save register, address Where...

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.

Using only the above two instructions, write code that sends each byte of the string to the printer.

Homework Answers

Answer #1

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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Assume we have CPU instructions that look like this: load register, address save register, address Where...
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....
Consider a program having following sequence of instructions, where the syntax consists of an opcode followed...
Consider a program having following sequence of instructions, where the syntax consists of an opcode followed by the destination register followed by one or two source registers: Instruction no Instructions 1 ADD R3, R1, R2 2 LOAD R6, [R3] 3 AND R7, R5, 3 4 ADD R1, R6, R0 5 SUB R2, R1, R6 6 AND R3, R7, 15 7 SUB R5, R3, R4 8 ADD R0, R1, R10 9 LOAD R6, [R5] 10 SRL R7, R0, 8 Assume the...
Please read the article and answear about questions. Determining the Value of the Business After you...
Please read the article and answear about questions. Determining the Value of the Business After you have completed a thorough and exacting investigation, you need to analyze all the infor- mation you have gathered. This is the time to consult with your business, financial, and legal advis- ers to arrive at an estimate of the value of the business. Outside advisers are impartial and are more likely to see the bad things about the business than are you. You should...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT