📄 eg0416.lst
字号:
Microsoft (R) Macro Assembler Version 6.15.8803 08/18/07 22:28:36
eg0416.asm Page 1 - 1
;eg0416.asm
include io32.inc
C .nolist
C .list
C
00000000 .data
00000000 499602D2 array dword 1234567890,-1234,0,1,-987654321,32767,-32768,5678,-5678,9000
FFFFFB2E
00000000
00000001
C521974F
00007FFF
FFFF8000
0000162E
FFFFE9D2
00002328
00000028 0000000C [ writebuf byte 12 dup(0) ; 显示缓冲区
00
]
00000000 .code
00000000 start:
00000000 B9 0000000A mov ecx,lengthof array
00000005 BB 00000000 mov ebx,0
0000000A 8B 04 9D again: mov eax,array[ebx*4] ; EAX=入口参数
00000000 R
00000011 E8 00000010 call write ; 调用子程序,显示一个数据
00000016 E8 00000000 E call dispcrlf ; 光标回车换行以便显示下一个数据
0000001B 43 inc ebx
0000001C 49 dec ecx
0000001D 75 EB jnz again
exit 0
00000026 write proc ; 显示有符号十进制数的子程序,EAX=入口参数
00000026 53 push ebx ; 保护寄存器
00000027 51 push ecx
00000028 52 push edx
00000029 BB 00000028 R mov ebx,offset writebuf ; EBX指向显示缓冲区
0000002E 85 C0 test eax,eax ; 判断数据是零、正数或负数
00000030 75 06 jnz write1 ; 不是零,跳转
00000032 C6 03 30 mov byte ptr [ebx],'0' ; 是零,设置"0"
00000035 43 inc ebx
00000036 EB 27 jmp write5 ; 转向显示
00000038 79 06 write1: jns write2 ; 是正数,跳转
0000003A C6 03 2D mov byte ptr [ebx],'-' ; 是负数,设置负号"-"
0000003D 43 inc ebx
0000003E F7 D8 neg eax ; 数据求补(绝对值)
00000040 B9 0000000A write2: mov ecx,10
00000045 51 push ecx ; 10压入堆栈,作为退出标志
00000046 83 F8 00 write3: cmp eax,0 ; 数据(商)为零,转向保存
00000049 74 0A jz write4
0000004B 33 D2 xor edx,edx ; 零位扩展被除数为EDX.EAX
0000004D F7 F1 div ecx ; 数据除以10:EDX.EAX÷10
0000004F 83 C2 30 add edx,30h ; 余数(0~9)转换为ASCII码
00000052 52 push edx ; 数据各位先低位后高位压入堆栈
00000053 EB F1 jmp write3
00000055 5A write4: pop edx ; 数据各位先高位后低位弹出堆栈
00000056 3B D1 cmp edx,ecx ; 是结束标志10,转向显示
00000058 74 05 je write5
0000005A 88 13 mov [ebx],dl ; 数据保存到缓冲区
0000005C 43 inc ebx
0000005D EB F6 jmp write4
0000005F C6 03 00 write5: mov byte ptr [ebx],0
00000062 B8 00000028 R mov eax,offset writebuf
00000067 E8 00000000 E call dispmsg
0000006C 5A pop edx ; 恢复寄存器
0000006D 59 pop ecx
0000006E 5B pop ebx
0000006F C3 ret ; 子程序返回
00000070 write endp
end start
Microsoft (R) Macro Assembler Version 6.15.8803 08/18/07 22:28:36
eg0416.asm Symbols 2 - 1
Macros:
N a m e Type
exit . . . . . . . . . . . . . . Proc
Segments and Groups:
N a m e Size Length Align Combine Class
FLAT . . . . . . . . . . . . . . GROUP
_DATA . . . . . . . . . . . . . 32 Bit 00000034 Para Public 'DATA'
_TEXT . . . . . . . . . . . . . 32 Bit 00000070 Para Public 'CODE'
Procedures, parameters and locals:
N a m e Type Value Attr
ExitProcess . . . . . . . . . . P Near 00000000 FLAT Length= 00000000 External STDCALL
write . . . . . . . . . . . . . P Near 00000026 _TEXT Length= 0000004A Public STDCALL
write1 . . . . . . . . . . . . L Near 00000038 _TEXT
write2 . . . . . . . . . . . . L Near 00000040 _TEXT
write3 . . . . . . . . . . . . L Near 00000046 _TEXT
write4 . . . . . . . . . . . . L Near 00000055 _TEXT
write5 . . . . . . . . . . . . L Near 0000005F _TEXT
Symbols:
N a m e Type Value Attr
@CodeSize . . . . . . . . . . . Number 00000000h
@DataSize . . . . . . . . . . . Number 00000000h
@Interface . . . . . . . . . . . Number 00000003h
@Model . . . . . . . . . . . . . Number 00000007h
@code . . . . . . . . . . . . . Text _TEXT
@data . . . . . . . . . . . . . Text FLAT
@fardata? . . . . . . . . . . . Text FLAT
@fardata . . . . . . . . . . . . Text FLAT
@stack . . . . . . . . . . . . . Text FLAT
again . . . . . . . . . . . . . L Near 0000000A _TEXT
array . . . . . . . . . . . . . DWord 00000000 _DATA
dispbb . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
dispbd . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
dispbw . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
dispcrlf . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
dispc . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
disphb . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
disphd . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
disphw . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
dispmsg . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
disprb . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
disprd . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
disprf . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
disprw . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
dispsib . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
dispsid . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
dispsiw . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
dispuib . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
dispuid . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
dispuiw . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readbb . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readbd . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readbw . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readc . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readhb . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readhd . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readhw . . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readmsg . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readsib . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readsid . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readsiw . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readuib . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readuid . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
readuiw . . . . . . . . . . . . L Near 00000000 FLAT External STDCALL
start . . . . . . . . . . . . . L Near 00000000 _TEXT Public STDCALL
writebuf . . . . . . . . . . . . Byte 00000028 _DATA
0 Warnings
0 Errors
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -