Something about Assembly language 2
2010-11-26 00:25
218 查看
http://www.emu8086.com/assembler_tutorial/asm_tutorial_02.html
指定偏移量数据类型的前缀:
字节:byte ptr(或b.)
字(两字节):word ptr(或w.)
例:
byte ptr [BX] ;字节存取
word ptr [BX] ;字存取
某些情况下,汇编程序可以自动计算数据类型
-------------------------------------------------------------
in order to say the compiler about data type,
these prefixes should be used:
byte ptr - for byte.
word ptr - for word (two bytes).
for example:
assembler supports shorter prefixes as well:
b. - for byte ptr
w. - for word ptr
in certain cases the assembler can calculate the data type automatically.
-------------------------------------------------------------------------------------------
获取变量地址:
方法:
LEA (Load Effective Address),更好,因为还能获取下表变量(an indexed variable)地址;
OFFSET (alternative)。
用途:
如向某一个过程传递参数时。
举例:
[/code]
指定偏移量数据类型的前缀:
字节:byte ptr(或b.)
字(两字节):word ptr(或w.)
例:
byte ptr [BX] ;字节存取
word ptr [BX] ;字存取
某些情况下,汇编程序可以自动计算数据类型
-------------------------------------------------------------
in order to say the compiler about data type,
these prefixes should be used:
byte ptr - for byte.
word ptr - for word (two bytes).
for example:
byte ptr [BX] ; byte access. or word ptr [BX] ; word access.
assembler supports shorter prefixes as well:
b. - for byte ptr
w. - for word ptr
in certain cases the assembler can calculate the data type automatically.
-------------------------------------------------------------------------------------------
获取变量地址:
方法:
LEA (Load Effective Address),更好,因为还能获取下表变量(an indexed variable)地址;
OFFSET (alternative)。
用途:
如向某一个过程传递参数时。
举例:
例一(LEA):
ORG 100h MOV AL, VAR1 ; check value of VAR1 by moving it to AL. LEA BX, VAR1 ; get address of VAR1 in BX. MOV BYTE PTR [BX], 44h ; modify the contents of VAR1. MOV AL, VAR1 ; check value of VAR1 by moving it to AL. RET VAR1 DB 22h END
例二(OFFSET):
ORG 100h MOV AL, VAR1 ; check value of VAR1 by moving it to AL. MOV BX, OFFSET VAR1 ; get address of VAR1 in BX. MOV BYTE PTR [BX], 44h ; modify the contents of VAR1. MOV AL, VAR1 ; check value of VAR1 by moving it to AL. RET VAR1 DB 22h END
注意:
LEA BX, VAR1 MOV BX, OFFSET VAR1 被编译成相同的机器语言:MOV BX,num(num是16位的var1偏移量)
[/code]
相关文章推荐
- Something about Assembly language 1
- 'Professional Assembly Language' is a nice book about Intel_AT&T
- [UNIX Network Programming Vo.1]--Something About Daytimeserver
- something about PCIe
- something about vertex in graph
- [知其然不知其所以然-23] Something about the printk loglevel and var_list
- something new about google(1): Froogle
- something about Educational Codeforces Round 11
- Something about PhD-Grind——by 李皈颖
- something about struts
- Auth ID about DDL language in Dynamic SQL
- ARM Assembly Language Programming (part 5)
- [汇编学习笔记]if/else,while,for,switch in Assembly Language
- Something about $ony without $
- Intel 80x86(IA-32) Assembly Language OpCodes
- Something about C pointers and arrays
- Some important things about C language
- About AssemblyINfo.cs Access
- 《Professional_Assembly_Language》学习笔记
- javascript---something about function