码迷,mamicode.com
首页 > 其他好文 > 详细

EQU伪指令

时间:2014-12-26 20:05:40      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:

EQU的三种格式

1.name EQU expression

2.name EQU symbol

3.name EQU <text>

 

1.expression必须是有效的整数表达式 不能有变量的存在

TITLE name EQU expression 

include irvine32.inc
    val1 EQU  <10*10>
.data 
val2 dword val1
.code
main PROC
 
    mov eax,val1
    call DumpRegs
    exit 
    main ENDP
    end main
TITLE name EQU expression 

include irvine32.inc

.data
    val1 DWORD 10000H
    val2 DWORD 20000H
.code
main PROC
    val3 EQU 10*20
    mov eax,val3
    call DumpRegs
    exit 
    main ENDP
    end main

2.符号symbol必须是已用”= ”或EQU定义的符号名

TITLE name EQU expression 

include irvine32.inc

.code
main PROC
    COUNT1 = 100h                ;用"="已定义
    val1     EQU COUNT1 
    mov eax,val1
    COUNT2 EQU  200h            ;用EQU已定义
    COUNT3 EQU COUNT2
    mov ebx ,COUNT3
    call DumpRegs
    exit 
    main ENDP
    end main

3.<>括号内可以填写任意的文本

eg1

TITLE name EQU expression 

include irvine32.inc
    val1 EQU  <10*10>
.data 
val2 dword val1
.code
main PROC
 
    mov eax,val1
    call DumpRegs
    exit 
    main ENDP
    end main

 

eg2:

TITLE name EQU expression 

include irvine32.inc
    val1 EQU  <"memeda",0>
.data 
val2 byte val1
.code
main PROC
 
    mov al,val2
    call DumpRegs
    exit 
    main ENDP
    end main

 

注:EQU与“=”差不多相同,但是EQU不能重定义

 

TEXTOUT的使用:

1:格式将文本赋给符号

2:格式将已定义的文本宏内容赋给符号

3:格式将整数表达式常量赋给符号

eg:

TITLE TEXTOUT eg

include Irvine32.inc

Welcome TEXTEQU <"Welcome to assembly">
.data
    val1 BYTE Welcome 
    val2 TEXTEQU %(100h)
    rowSize=5
.code
main PROC
    
    count TEXTEQU  %(rowSize*2)
    count1 TEXTEQU val2
    move TEXTEQU  <mov>
    setupAL TEXTEQU <move al,count>
    call DumpRegs
    exit 
    main ENDP
    end main

EQU伪指令

标签:

原文地址:http://www.cnblogs.com/kangxiaopao/p/4187419.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!