【发布时间】:2019-07-09 18:44:50
【问题描述】:
下面的代码打印出 3、5、6。你能帮我理解为什么(以及为什么不是 33、35、36?)
global_start
section .data
00000000 03000000 x: dd 3
00000004 8B0D[00000000] _start: mov ecx, [x]
0000000A 000D[16000000] r: add byte [l+6], cl
00000010 C605[00000000]30 l: mov byte [x], 48
00000017 51 push ecx
00000018 B804000000 mov eax, 4 ; For "write" system call
0000001D BB01000000 mov ebx, 1 ; to standard output
00000022 B9[000000000] mov ecx, x ; "buffer"
00000027 BA01000000 mov edx, 1 ; byte count
0000002C CD80 int 0x80
0000002E 59 pop ecx
0000002F E209 loop r, ecx ; decrement ecx, jump relative if not zero
00000031 BB00000000 mov ebx, 0
00000036 B801000000 mov eax, 1 ; for "exit" system call
0000003B CD80 int 0x80
此代码是用 Assembly 8086 x32bit (NASM LISTING) 编写的。 RAM 使用小印度。
【问题讨论】:
-
你可能想要
global _start。
标签: assembly x86 nasm system-calls endianness