您的位置:首页 > 其它

汇编学习日志——add指令

2014-02-08 09:08 281 查看
在学习Intel汇编程序设计时,有下面一段话

The first two lines, because they are directives, contain no executable instructions. But the subsequent lines are assembly language instructions, each 5 bytes long. The hexadecimal values in the second column, such as B8 00010000are the actual instruction
bytes.

TITLE Add and Substract
;This program adds and substracts 32-bit integers.
.386
.model flat,stdcall
.stack 4096
ExitProcess PROTO,dwExitCode:DWORD
DumpRegs PROTO
.code
main PROC
    mov eax,4h
    add ebx,FFh //如果这里为0x7F的话(或者说小于7F),机器码为83 C3 7F,如果大于7F,则为81 C3 00000080
		//如果这里为eax,ecx,edx,小于0x7F 则为83 C0 7F,如果大于0x7F,则为05 00000080
		//所以ebx为基地址寄存器,在加法上,与其他三个寄存器是不同的
    call DumpRegs
	INVOKE ExitProcess,0
main ENDP
END main
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: