Exemplary assembly language data transfer

  ; Exemplary data transfer .386 .model flat, stdcall .stack 4096 ExitProcess PROTO, dwExitCode: DWORD .data val1 WORD 1000h val2 WORD 2000h arrayB BYTE 10h, 20h, 30h, 40h, 50h arrayW WORD 100h, 200h, 300h arrayD DWORD 10000h, 20000h .code main PROC; demo MOVZX instruction mov bx, 0A69Bh movzx eax, bx; EAX = 0000A69Bh movzx edx, bl; EDX = 0000009Bh movzx cx, bl; CX = 009Bh; mOVSX presentation instruction mov bx, 0A69Bh movsx eax, bx; EAX = FFFFA69Bh movsx edx, bl; EDX = FFFFFF9Bh mov bl, 7Bh movsx cx, bl; CX = 007Bh; memory - memory exchange mov ax, val1; AX = 1000h xchg ax val2; AX = 2000h, val2 = 1000h mov val1 , ax; val1 = 2000h; direct - addressing offset (byte array) mov al, arrayB; AL = 10h mov al, [arrayB + 1]; AL = 20h mov al, [arrayB + 2]; AL = 30h; direct - the offset address (word array) mov ax,arrayW; AX = 100h mov ax, [arrayW + 2]; AX = 200h; Direct - offset addressing (double word) mov eax, arrayD; EAX = 10000h mov eax, [arrayD + 4]; EAX = 20000h mov eax, [arrayD + 4]; EAX = 20000h INVOKE ExitProcess, 0 main ENDP END main

The program does not generate screen output, but (debugger) running with a debugger.

CPU flags displayed in the Visual Studio debugger

When the CPU status flags displayed during debugging, select Debug Windows submenu in the menu, then select Register. In the Register window, right click the drop-down list Flags. To view these menu options, you must debugger. The following table is used in the Register window flag symbols:

Flag Name Yi-Chu direction Interrupt symbol zero Auxiliary carry Odd-even carry
symbol OV UP NO PL ZR AC ON CY

Each flag bit has two values: 0 (clear) or 1 (set). Examples are as follows:

OV = 0 = 0 UP HIS = 1
PL = 0 ZR = 1 AM = 0
PE = 1 CY = 0   

During the commissioning process, when you step through code, as long as the instruction changes the value of the flag, the flag will be displayed in red. This can be understood by step through how instruction is affecting flag, and can pay close attention to changes in the value of these bits of flags.

4.1  Operand Type
4.2  MOV instructions
4.3  MOVZX to doing it and instructions MOVSX
4.4  LAHF SAHF instruction and
4.5 of 5  XCHG instructions
4.6  immediate offset operands
4.7  assembly language data transfer Example
4.8  addition and subtraction Detailed
4.9  the OFFSET operator
4.10  the ALIGN directive
4.11  the PTR operator
4.12  the TYPE operator
4.13  lengthof operator
4.14  the LABEL directive
4.15  indirect addressing
4.16  the JMP and LOOP instruction
4.17  64 MOV instruction
4.18  64-bit addition and subtraction

Guess you like

Origin blog.csdn.net/Javaxuxuexi/article/details/93401578