.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…