forked from ccccourse1/sp110b
-
Notifications
You must be signed in to change notification settings - Fork 0
w5.md
yucing edited this page May 6, 2022
·
13 revisions
- c6.c
- -w : 忽略所有警告
- -W : 顯示警告
- ./c6.exe -s test/--.c : 印出組合語言
1: #include <stdio.h>
2:
3: int main()
4: {
5: printf("hello, world\n");
1:A30054 ENT 0 --> 沒有參數,不用保留區域變數,所以為 0
3:A3005C ADDR 0:A70058 --> A70058 : 字串"hello, world"位置
5:A30064 PSH --> 將字串推到堆疊裡面
6:A30068 PRTF --> 印出
7:A3006C ADJ 1 --> 將參數清掉,還原
6: }
9:A30074 LEV --> 離開
- LEA : 載入區域變數
- IMM : 載入立即值
- ADDR: 載入位址
- JMP : 跳躍指令
- JSR : 跳到副程式
- BZ : 等於 0 時,跳 if (a==0) goto m[pc]
- BNZ : 不等於 0 時,跳 if(a!=0) goto m[pc]
- ENT : 進入副程式
- ADJ : 調整堆疊
- LEV : 離開副程式
- LI : 載入整數
- LC : 載入字元
- SI : 儲存整數
- SC : 儲存字元
- PSH : 推入堆疊