NTNU 系統程式
SystemProgramming
110-1
CSIE
選修
NTNU
Mnemonic | Number | Special use |
---|---|---|
A | 0 | Accumulator |
X | 1 | Index register |
L | 2 | Linkage register |
PC | 8 | Program counter |
SW | 9 | Status word |
opcode | x | address |
---|---|---|
8 | 1 | 15 |
Mode | Indication | Target Address calculation |
---|---|---|
Direct | x=0 | TA=address |
Indexed | x=1 | TA=address=() |
op |
---|
8 |
Mneminic | Format | Opcode | Effect |
---|---|---|---|
FIX | 1 | C4 | A <- (F)[convert to integer] |
op | r1 | r2 |
---|---|---|
8 | 4 | 4 |
Format 1 & 2 are instructions that do not reference memory at all.
Format 3(3 bytes)
op | n | i | x | b | p | e | disp |
---|---|---|---|---|---|---|---|
6 | 1 | 1 | 1 | 1 | 1 | 1 | 12 |
Format 4(4 bytes)
op | n | i | x | b | p | e | address |
---|---|---|---|---|---|---|---|
6 | 1 | 1 | 1 | 1 | 1 | 1 | 20 |
Addressing mode for format 3
Mode | Indication | Target address calculation | Notes |
---|---|---|---|
Base relative | b=1, p=0 | TA=(B)+disp () |
|
Program-counter relative | b=0, p=1 | TA=(PC)+disp () |
指令跟指令的間隔通常小於 |
Mnemonic | Number | Special Use |
---|---|---|
B | 3 | Base register |
S | 4 | General working register |
T | 5 | General working register |
F | 6 | Floating point accumulator(48 bits) |
About n, i, x, b, p, e !
Target address
n, i: how to use the target address(TA)
n | i | |
---|---|---|
1 | 1 | Direct(Simple) addressing |
1 | 0 | Indirect addressing (尋寶遊戲) |
0 | 1 | Immediate addressing (no memory access) |
0 | 0 | 相容 SIC |
e
e | Format |
---|---|
0 | format 3 |
1 | format 4 |
About TA 計算
Mode | Indication | Target address calculation | Notes |
---|---|---|---|
Base relative mode | b=1, p=0 | TA=(B)+disp+(X) () |
|
Program-counter relative mode | b=0, p=1 | TA=(PC)+disp+(X) () |
指令跟指令的間隔通常小於 |
x = a + b * c
y = x * a