.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCode:DWORD.data
wordArray WORD 0500h,0400h,0300h,0200h,0100h.code
main PROCmov ax,0100hmov edi,OFFSET wordArraymov ecx,LENGTHOF wordArraycld repne scaswjne L1sub edi,TYPE wordArraymov eax,edijmp quit
L1:mov eax,0
quit:INVOKE ExitProcess,0
main ENDP
END main
2: STRUCT : 伪指令STRUCT 结构的使用
.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCode:DWORD.data
;定义结构
COORD STRUCTX WORD ?Y WORD ?
COORD ENDS
Employee STRUCTIdNum BYTE "000000000";9字节LastName BYTE 30DUP(0);30字节ALIGN WORD ;加1个字节Years WORD 0;2ALIGN DWORD ;加2个字节SalaryHistory DWORD 0,0,0,0;16字节
Employee ENDS ;共60point1 COORD <5,10>;x=5,y=10
point2 COORD <20>;x=20,y=?
point3 COORD <>;x=?,y=?
worker Employee<>;默认初始值
person1 Employee<"555223333">;IdNum初始值,其他默认
person2 Employee <,,,2DUP(20000)>;只初始化SalaryHistory前两个值,剩下两个0;对齐结构变量
ALIGN DWORD ;要与结构中最大结构成员对齐
person Employee <>;结构数组
AllPoints COORD 3DUP(<0,0>);3个结构的X,Y都为0department Employee 5DUP(<>).code
main PROCmov eax,TYPE Employee ;60mov eax,SIZEOF Employee;60mov eax,SIZEOF worker ;60;引用成员mov dx,worker.Yearsmov worker.SalaryHistory,20000;第一个工资mov [worker.SalaryHistory+4],3000;第二个工资mov worker.SalaryHistory+4,4000;第二个工资mov edx,OFFSET worker.SalaryHistory ;得到字段的地址;间接寻址操作数mov esi,OFFSET workermov ax,(Employee PTR[esi]).Years;变址操作数可以访问结构数组mov esi,TYPE Employee ;索引 =1mov department[esi].Years ,4INVOKE ExitProcess,0
main ENDP
END main
3:STRUCT_ALLPOINTS : 变址寻址操作数遍历结构数组
include Irvine32.incNumPoints =3.data
ALIGN WORD
AllPoints COORD NumPoints DUP(<0,0>).code
main PROCmov edi,0;数组索引mov ecx,NumPointsmov ax,1;起始X,Y的值
L1:mov (COORD PTR AllPoints[edi]).X,axmov AllPoints[edi].Y,axadd edi,TYPE COORDinc axloop L1exit
main ENDP
END main
include Irvine32.incEmployeeBad STRUCTIdNum BYTE "000000000"LastName BYTE 30DUP(0)Years WORD 0SalaryHistory DWORD 0,0,0,0
EmployeeBad ENDSEmployee STRUCTIdNum BYTE "000000000"LastName BYTE 30DUP(0)ALIGN WORDYears WORD 0ALIGN DWORDSalaryHistory DWORD 0,0,0,0
Employee ENDS.data
ALIGN DWORD
startTime DWORD ?
emp Employee <>;或:EmployeeBad
.code
main PROCcall GetMSecondsmov startTime,eaxmov ecx,0FFFFFFFFh
L1:mov emp.Years,5mov emp.SalaryHistory,35000loop L1call GetMSecondssub eax,startTimecall WriteDecexit
main ENDP
END main
5: SYSTEMTIME : 使用结构获取系统时间函数
include Irvine32.incCOMMENT %
COORD STRUCTX WORD ?Y WORD ?
COORD ENDS SYSTEMTIME STRUCTwYear WORD ?wMonth WORD ?wDayOfWeek WORD ?wDay WORD ?wHour WORD ?wMinute WORD ?wSecond WORD ?wMilliseconds WORD ?
SYSTEMTIME ENDS
%.data
sysTime SYSTEMTIME <>.code
main PROCINVOKE GetLocalTime ,ADDR sysTimemovzx eax,sysTime.wYearcall WriteDecexit
main ENDP
END main
6:结构内包括结构的使用
.386.model flat,stdcall.stack 4096
ExitProcess PROTO,dwExitCode:DWORDCOORD STRUCTX WORD ?Y WORD ?
COORD ENDS
Rectangle STRUCTUpperLeft COORD <>LowerRight COORD <>
Rectangle ENDS
.data
rect1 Rectangle <>
rect2 Rectangle {}
rect3 Rectangle {{10,10},{50,20}}
rect4 Rectangle <<10,10>,<50,20>>.code
main PROCmov rect1.UpperLeft.X ,10mov esi,OFFSET rect1mov (Rectangle PTR [esi]).UpperLeft.Y,10mov edi,OFFSET rect2.LowerRightmov (COORD PTR [edi]).X,50mov edi,OFFSET rect2.LowerRight.Xmov WORD PTR[edi],50INVOKE ExitProcess,0
main ENDP
END main
mcq 队列Q1. What do you call the technique of storing encrypted user passwords in Linux? Q1。 您如何称呼在Linux中存储加密的用户密码的技术? System Password Management 系统密码管理 Shadow Password 影子密码 Encrypted Password 加密密码 None of the…
kotlin 判断数字Given a number N, we have to check whether it is EVEN or ODD. 给定数字N ,我们必须检查它是偶数还是奇数 。 Example: 例: Input:N 13Output:"ODD"Input:N 24Output:"EVEN"程序在Kotlin检查偶数或奇数 (Prog…
线性代数 向量长度Prerequisite: Defining a vector 先决条件: 定义向量 Linear algebra is the branch of mathematics concerning linear equations by using vector spaces and through matrices. In other words, a vector is a matrix in n-dimensional space…