+ -
当前位置:首页 → 问答吧 → 汇编伪指令 LABEL PARA 的作用与用法?

汇编伪指令 LABEL PARA 的作用与用法?

时间:2010-11-19

来源:互联网


RT 虽然没学到 但是看见了不懂就想问!

作者: znxllyuan   发布时间: 2010-11-19

C语言里有一种结构叫union,可以用不同的类型表示同一段内存空间,这里的label的作用也相当于这样。 
先看需要,在程序中很可能需要 
mov eax, dword ptr buffer 
mov ax, word ptr buffer 
mov al, byte prt buffer 
而buffer定义为 buffer db 10h dup(?) 
为了书写和可读性的方便,如果能用 dwbuffer, wbuffer指向同一个地方,那么就可以写为: 
mov eax, dwbuffer 
mov ax, wbuffer 
mov al, buffer 
这里就可以用LABEL来做到,在定义buffer的前面用: 
dwbuffer label dword 
wbuffer label word 
这个还可以用this来做到同样的事: 
dwbuffer equ this dword 
wbuffer equ this word 

网上有一本《汇编语言》的chm文档,有详细的描述

作者: kartik   发布时间: 2010-11-19