A typical CPU consists of an operator, a controller, a register, and an internal bus that connects parts of the device
Registers are parts that programmers can read and write with instructions, and control the CPU by altering the contents of the registers.
The number structure of different CPU registers is not the same, 8086 has 14 registers
2.1 General-Purpose registers
8086 all registers are 16 bits, can hold 2 bytes, AX, BX, CX, DX for storing general data, become General register
To be compatible with the old 8-bit registers, each 16-bit register can be divided into 2 separate 8-bit registers to use, with the names of Ah, Al to represent high 8-bit and low 8-bit
Storage of 2.2 words in registers
Bytes byte: Can be stored in a 8-bit register
Word Word: is two bytes, which can be stored in a 16-bit register, the high 8-bit byte of the modifier and the low 8-bit byte are stored in high 8-bit registers and low 8-bit registers
A font data 20000 is stored in Microsoft Dynamics AX, the height of 8 bits is 78, the low 8 bits is 32, can be regarded as a font data 20000, can also be seen as two separate registers stored 78 and 32 respectively
hexadecimal data Each two bits represents a 8-bit, the hexadecimal representation of the data to see the high and low register is very convenient as in Ax is 4e20h, then AH is 4eh,al is 20H.
2.3 Several assembly instructions
MOV ax,18: send 18 into Register AX Advanced language: ax=18
Add ax,8: Add 8 Advanced language to data in register AX: ax=ax+8
Note: If the result of the operation exceeds the range of values that the register can represent, it will be truncated
The number of operand bits of the assembly instruction must be the same
Detection 2.1:
1> writes out the values in the relevant registers after each assembly instruction is completed:
mov ax,62627 ax=f4a3h
mov ah,31h ax=31a3h
mov al,23h ax=3123H
Add Ax,ax ax=6246H
mov bx,826ch bx=826CH
mov cx,ax cx=6246H
mov ax,bx ax=826CH
Add ax,bx ax=04d8h
mov al,bh ax=0482H
mov ah,bl ax=6c82h
Add Ah,ah ax=d882h
Add al,6 ax=d888h
Add Al,al ax=d810h
mov ax,cx ax=6246H
The 2> uses only mov,add instructions and does not exceed 4 instructions to calculate 2 of the 4-time Square
MOV ax,0002h
Add Ax,ax
Add Ax,ax
Add Ax,ax
Assembly language: Chapter II Register