Question

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

  1. 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

Address 52 is the beginning of a string "ABC". Since each ASCII character is one byte, we can assume than address 52 and two consecutive addresses stores "A", "B","C", i.e. address 52 stores "A", address 53 stores "B", address 54 stores "C".

So code to send each byte of the string to the printer,

load R0, 52 (Copies data at address 52 to register 0)

save R0, 1   (Copies data from the register 0 to the printer at address 1)

load R1, 53 (Copies data at address 53 to register 1)

save R1, 1   (Copies data from the register 1 to the printer at address 1)

load R2, 54 (Copies data at address 54 to register 2)

save R2, 1 (Copies data from the register 2 to the printer at address 1)

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....
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