汇编语言入门记录
想安装一个16位的机子
ms-dos教程
汇编代码高亮
环境问题
terraform安装
DEBUG
- t 执行完一条语句之后显示寄存器的值
- p for语句直接循环完
第一个可以过的程序
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| .386 .model flat,stdcall option casemap:none include \masmplus\include\windows.inc include \masmplus\include\kernel32.inc includelib \masmplus\lib\kernel32.lib include \masmplus\include\user32.inc includelib \masmplus\lib\user32.lib .data MsgBoxCaption db "Iczelion Tutorial No.2",0 MsgBoxText db "Win32 Assembly is Great!",0 .code start: invoke MessageBox, NULL, addr MsgBoxText, addr MsgBoxCaption, MB_OK invoke ExitProcess, NULL end start
|
Dump register
1 2
| Includelib Kernel32.lib Includelib Irvine32.lib
|
DGROUP 错误
应该是只能16位的编译器才能够编译
1 2 3 4 5 6 7 8 9 10 11 12
| .MODEL SMALL .386 .STACK .DATA MSG DB 'HELLO',0DH,0AH,'$' .CODE .STARTUP MOV DX,OFFSET MSG MOV AH,09H INT 21H .EXIT END
|
vs 中编程测框架
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| .386 .model flat,stdcall ExitProcess PROTO, exitCode:DWORD .data wordVal SWORD -5000 .code start PROC mov ax,wordVal ; dividend, low cwd ; extend AX into DX mov bx,256 ; divisor idiv bx push 0 call ExitProcess start ENDP end start
|
一些疑惑的说明:
关于常量不占用内存,其实变量名经过汇编以后,是数字所在的地址(感觉占用的内存更多啊,因为是32位的地址)
mov ax, 256 ;这个当常量占用的字节不为2字节的倍数的时候,汇编会自动的进行相应的填充。比如256至少会占用3字节,但实际上会占用4字节
未解决的问题