Com 212 intro to system programming book Theory



Download 0.65 Mb.
View original pdf
Page18/72
Date13.05.2021
Size0.65 Mb.
#56617
1   ...   14   15   16   17   18   19   20   21   ...   72
com-212-introduction-to-system-programming-theory
9833 SS1 FISHERY LESSON NOTE
TYPES OF INSTRUCTIONS
1. Memory <-> Register instructions
ld mem -> reg Load the value of the register from memory. st reg -> mem Store the value of the register into memory. There area few ways to address memory st r -> i Store the value of register r into the memory location of global variable i. st r -> r Treat the value of register r as a pointer to a memory location, and store the value of r in that memory location. st r -> [fp+4] Treat the value of the frame pointer as a pointer to a memory location, and store the value of r in the memory location 4 bytes after that location. You can use any value, positive or negative, not just 4.
However, you cannot use a register (i.e.

Page | 25 you can't dost r -> [fp+r2]).
This only works with the frame pointer. It does notwork with any other register. st r -> [sp]-- Treat the value of register spas a pointer to a memory location, store the value of r into that memory location, and then subtract 4 to the value of sp. st r -> ++[sp] Treat the value of register spas a pointer to a memory location. First, add 4 to that value, then store the value of r into that memory location.

Download 0.65 Mb.

Share with your friends:
1   ...   14   15   16   17   18   19   20   21   ...   72




The database is protected by copyright ©ininet.org 2024
send message

    Main page