RISC-style program:
A RISC-style program that computes SUM = 580 + 68400 + 80000
Move | R2, #NUMBERS | Get the address of the numbers. | |
Load | R3, (R2) | Load 580 | |
Load | R4, 4(R2) | Load 68400 | |
Add | R3, R3, R4 | Generate 580 + 68400 | |
Load | R4, 8(R2) | Load 80000 | |
Add | R3, R3, R4 | Generate the final sum | |
Store | R3, 12(R2) | Store the sum | |
Next instruction | |||
ORIGIN | 0 * 500 | ||
NUMBERS: | DATA WORD | 580, 68400, 80000 | Numbers to be added |
SUM: | RESERVE | 4 | Space for the sum |
CISC-style program:
A CISC-style program that computes SUM = 580 + 68400 + 80000
Move | R2, #NUMBERS | Get the address of the numbers. | |
Move | R3, (R2)+ | Load 580 | |
Add | R3, (R2)+ | Generate 580 + 68400 | |
Add | R3, (R2) | Generate the final sum | |
Move | SUM, R3 | Store the sum | |
Next instruction | |||
ORIGIN | 0 * 500 | ||
NUMBERS: | DATA WORD | 580, 68400, 80000 | Numbers to be added |
SUM: | RESERVE | 4 | Space for the sum |