.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCode:DWORD.data
saveflags BYTE ?.code
main PROClahfmov saveflags ,ahmov ah,saveflagssahfINVOKE ExitProcess,0
main ENDP
END main
2:交换两个操作数内容
.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCoed:DWORD.data
val1 WORD 1234h
val2 WORD 5678h.code
main PROCmov ax,val1xchg ax,val2mov val1,axINVOKE ExitProcess,0
main ENDP
END main
3:直接寻址,数组名加[]和偏移量访问元素
.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCoed:DWORD.data
arrayB BYTE 10h,20h,30h,40h,50h
arrayW WORD 100h,200h,300h,400h,500h
arrayD DWORD 1000h,2000h,3000h,4000h,5000h.code
main PROCmov al,arrayBmov al,[arrayB+1]mov al,[arrayB+2]mov ax,arrayWmov ax,[arrayW+2]mov eax,arrayDmov eax,[arrayD+4]INVOKE ExitProcess,0
main ENDP
END main
4:算术表达式例子 Rval = -Xval + (Yval - Zval)
.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCode:DWORD.data
Rval SDWORD ?
Xval SDWORD 26
Yval SDWORD 30
Zval SDWORD 40.code
main PROCmov eax,Xvalneg eaxmov ebx,Yvalsub ebx,Zvaladd eax,ebxmov Rval,eaxINVOKE ExitProcess,0
main ENDP
END main
5:标志位例子展示
.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCode:DWORD.data
val1 BYTE 10h.code
main PROC;零标志mov cx,1sub cx,1mov ax,0FFFFhinc ax;符号标志位mov cx,0sub cx,1mov ax,7FFFhadd ax,2;进位标志位mov al,0FFhadd al,1;溢出标志位mov al,+127add al,1mov al,-128sub al,1INVOKE ExitProcess,0
main ENDP
END main
6:OFFSET伪指令,返回数据标号的距离数据段起始地址的偏移量
.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCode:DWORD.data
bVal BYTE ?
wVal WORD ?
dVal DWORD ?
dVal2 DWORD ?myArray WORD 1,2,3,4,5.code
main PROCmov esi,OFFSET bValmov esi,OFFSET wValmov esi,OFFSET dValmov esi,OFFSET dVal2;OFFSET访问数组元素mov esi,OFFSET myArray+4INVOKE ExitProcess,0
main ENDP
END main
7:ALIGN伪指令,将一个变量对齐到1,2,4,8,16个字节
.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCode:DWORD.data
bVal BYTE ?;00404000h
ALIGN 2
wVal WORD ?;00404002h
bVal2 BYTE ?;00404004h
ALIGN 4
dVal DWORD ?;00404008h
dVal2 DWORD ?;0040400ch.code
main PROCINVOKE ExitProcess,0
main ENDP
END main
8:重写一个已经声明过的操作数的大小类型,就类似指针,指向某地址再取值
.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCoed:DWORD.data
myDouble DWORD 12345678h
wordList WORD 5678h,1234h.code
main PROC; mov ax,myDouble ;汇编器不允许这样mov ax,WORD PTR myDoublemov ax,WORD PTR [myDouble+2];1234hmov bl,BYTE PTR myDouble ;78hmov eax,DWORD PTR wordList ;12345678hINVOKE ExitProcess,0
main ENDP
END main
9:LENGTHOF伪指令,计算数组元素个数
.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCoed:DWORD.data
byte1 BYTE 10,20,30;LENGTHOF为3
array1 WORD 30DUP(?),0,0;LENGTHOF为30+2
array2 WORD 5DUP(3DUP(?));如果嵌套DUP,那LENGTHOF返回的是两个数值的乘积 LENGTHOF为5*3,类似二维数组
array3 DWORD 1,2,3,4;LENGTHOF为4
digitStr BYTE "12345678",0;LENGTHOF为9myArray BYTE 10,20,30,40,50;LENGTHOF为5,占用多行只针对第一行BYTE 60,70,80,90,100myArray2 BYTE 10,20,30,40,50,;LENGTHOF为10,第一行用逗号,后面继续初始化60,70,80,90,100.code
main PROCINVOKE ExitProcess,0
main ENDP
END main
10:SIZEOF伪指令,计算数组总字节数,LENGTHOF 与 TYPE 的乘积
.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCoed:DWORD.data
intArray WORD 32DUP(0).code
main PROCmov eax,SIZEOF intArrayINVOKE ExitProcess,0
main ENDP
END main
In the previous article, we learned how to setup Kotlin in the android studio? Now moving to journey ahead we are going to develop our first app with Kotlin. It is the basic app, but it will let you know the structure of the program. 在上一篇文章中&#x…
c# 声明类的时候初始化类The task is to create/declare a list with an initializer list in C#. 任务是在C#中使用初始化列表创建/声明一个列表 。 C#清单 (C# List) A list is used to represent the list of the objects, it is represented as Lis…
/* 1.输入年月日,编写程序计算所输日期是当年的第几天 *//* 2.已知列车隔日发车,且1/1/2006不发车(无ticket),如果所输入数据在此日期之后,则输出有没有车票,否则仅输出上一步结果。*/ /* month/date/year is which day of the ye…
bcd码二进制转十进制Prerequisite: Number systems 先决条件: 数字系统 BCD Code (8421 Code): In BCD 8421 code, each decimal digit is represented using a 4-bit binary number. The 4-bit binary numbers have their weights attached as 8, 4, 2, 1 from MS…
C#类和结构 (C# class and structure) In C# and other programming languages, structure and classes are used to define a custom data type, that we can organize according to our need with different types of variables, methods etc. 在C#和其…
原文地址:SQL Plus 一些使用技巧作者:☆水『若寒Sql*plus的使用 Sql*plus介绍 Sql*plus是oracle提供的一个工具程序,既可以在oracle服务器使用,也可以在oracle客户端使用。在windows下分两种,sqlplus.exe是命令行程序&…
If you assign a string to the character variable, it may cause a warning or error (in some of the compilers) or segmentation fault error occurs. 如果将字符串分配给字符变量,则可能会导致警告或错误(在某些编译器中)或发生分段错误。 Consider the code…