Assembly Language Learning Notes (ii): registers (CPU working principle)

Source: Internet
Author: User
CPU Working principle
CPU by the operator, controller, registers and other components, these devices rely on the internal bus connected
2.1 General Registers
8086 has 14 registers (16 bits): AX,BX,CX,DX,SI,DI,SP,BP,IP,CS,SS,DS,ES,PSW
AX,BX,CX,DX is called a universal register, used to store general data, to ensure backward compatibility, general-purpose registers can be divided into two separate 8-bit registers to use
Example: Ax:ah and Al (high-low position)

2.2 Words in Register store (one word two bytes)
2.3 Assembly Instruction: case-insensitive
MOV ax,18 sends 18 to AX
Add ax,18 adds 8 to the value in the Register AX
2.4 Physical Address
All memory cells consist of a one-dimensional linear space
16-bit:
The operator can handle up to 16 bits of data at a time
The maximum register width is 16 bits (universal Register)
The path between registers and operators is 16-bit.
8086 has 20-bit address bus, can transmit 20-bit address, addressing capability of 1M
8086 internal 16-bit structure, can only transfer 16-bit address, the performance of addressing ability only 64k;8086 in two 16 bits (segment address and offset address) to synthesize a 20-bit: Physical address = Segment Address *16+ offset address
2.5
2.6
2.7 Paragraph (very important)
Memory is not segmented, segment is divided from CPU, because 8086CPU is used for physical address = Segment Address *16+ offset address
1 The starting address of a segment must be a multiple of 16
2 The offset address is 16 bits and the 16-bit address is 64k, so the maximum length of a segment is 64k
2.9 Segment Registers
8086 Main has four segment registers: CS, Ds,ss,es
8086CPU to access memory, there are four memory units that provide the segment address of the memory unit
CS: For code segment registers (segment address)
IP: Instruction pointer register (offset address register)
CS and IP are the most critical registers in 8086, indicating the address that the CPU is currently reading instructions to
Modify the contents of the Cs:ip at the same time: jmp 2ae3:3

2.12 Code Snippets
A code snippet can be defined by a set of codes with a length of n<=64kb, with a set of contiguous addresses, a multiple of the starting address of 16, where the memory is used to store code.

Debug command
R: Changing the contents of the CPU registers (R AX)
D: See what's in memory
E: Command overwrites content in memory
U: Translate the machine instructions in memory into assembly instructions
T: Execute a machine command
A: Write a machine instruction in memory in the format of an assembly instruction

MOV ax,1000h
MOV Ss,ax
MOV sp,0010h
PUSH AX
PUSH BX
PUSH DS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.