# Lab2 Note
###### tags: `NCTU` `MPSL`
* 在資料暫存的部分,必須透過 PUSH、POP 兩個指令以及 ESP(stack pointer) register 的搭配;其中 PUSH 會將 ESP 中的位址 - 4,並將內容塞入 [ESP] 的位址;而 POP 則會將 ESP 中的位址 + 4,並將內容塞到指定的地方去
> Caller-saved registers (AKA volatile registers, or call-clobbered)
are used to hold temporary quantities that need not be preserved across calls.
* For that reason, it is the caller's responsibility to push these registers onto the stack or copy them somewhere else *if* it wants to restore this value after a procedure call.
* It's normal to let a `call` destroy temporary values in these registers, though.
> Callee-saved registers (AKA non-volatile registers, or call-preserved) are used to hold long-lived values that should be preserved across calls.
* When the caller makes a procedure call, it can expect that those registers will hold the same value after the callee returns, making it the responsibility of the callee to save them and restore them before returning to the caller. Or to not touch them.
* callee要回傳
- Full Ascending (FA)
指令為 LDMFA/STRFA,代表堆疊往高位址的記憶體空間成長,而基底暫存器指到堆疊最頂端的**有效資料位址**
- Full Descending (FD)
指令為 LDMFD/STRFD,代表堆疊往低位址的記憶體空間下降,而基底暫存器指到堆疊最底端的**有效資料位址**
- Empty Ascending (EA)
指令為 LDMEA/STREA,代表堆疊往高位址的記憶體空間成長,而基底暫存器指到堆疊最頂端**有效資料欄位再往上的空資料位址**
- Empty Descending (ED)
指令為 LDMED/STRED,代表堆疊往低位址的記憶體空間下降,而基底暫存器指到堆疊最底端**有效資料欄位再往下的空資料位址**