Chapter 2 register Summary

Source: Internet
Author: User

CPU

 

The CPU is composed of memory devices, controllers, registers, and other devices. The memory device processes information, stores information in registers, controls various devices for operation, and connects various devices through the internal bus, transfer Data between them. Programmers can control the CPU by changing the content in various registers.

General registers

 

All registers of the 8086cpu are 16-bit. General registers include ax, BX, CX, and DX. These four registers can be divided into two independent 8-bit registers for use:

?Ax can be divided into AH and Al

?BX can be divided into BH and BL

?CX can be divided into CH and Cl

?DX can be divided into DH and DL

Storage of words in registers

 

Byte: It is counted as byte. A byte consists of eight bits, which can exist in eight-bit registers.

Word: it is recorded as word. A word consists of two bytes. These two bytes are called the high byte and low byte of the word respectively. A word can exist in a 16-bit register.

Several Assembly commands

 

During data transmission or operation, note that the number of digits of the two operation objects of the command should be consistent at that time.

For example:

MoV ax, BL (transfers data between 8-bit registers and 16-bit registers)

MoV BH, CX (transfer data between 16-bit registers and 8-bit registers)

MoV Al, 20000 (8-bit registers can store up to 255 of the data)

MoV Al, 100 h (add a data greater than 8 bits to an 8-bit register)

8086cpu physical address

 

When the 8086cpu needs to read and write memory:

(1) The CPU-related components provide two 16-bit addresses, one called the segment address and the other called the offset address;

(2) The segment address and offset address are sent to a part called the address divider through the internal bus;

(3) The address divider combines two 16-bit addresses into a 20-bit physical address;

(4) The address divider sends 20 physical addresses to the input/output control circuit through the internal bus;

(5) The Input/Output Control Circuit sends 20 physical addresses to the address bus;

(6) 20 physical addresses are transferred to the memory by the address bus;

Address DividerPhysical address = segment address * 16 + offset addressYou can use the segment address and offset address to synthesize the physical address.

The essential meaning of "segment address * 16 + offset address = physical address"

 

When the CPU accesses the memory, it adds a base address (segment address * 16) and an offset address relative to the base address to give the physical address of the memory unit.

Segment Concept

 

When programming, you can think of memory units with consecutive addresses as a segment, and use segment address * 16 to locate the starting address of the segment (Basic address ), use the offset address to locate the memory unit in the segment.

Segment register

 

Including: CS, DS, SS, es

CS and IP

CS is the code segment register, IP is the instruction pointer register, JMP instructions can be modified CS and IP

The function of the "JMP a valid register" command is to modify the IP address with the value in the register.

 

Chapter 2 register Summary

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.