Assembly Language Basics 2

Source: Internet
Author: User

Assembly Language Basics (register)

First of all, the structure of a CPU generally contains the operators, controllers, registers, caches, buses, etc. their functions are briefly:

1. Information processing by the arithmetic device

2. Register for information Processing

3. Controller control of the device to work

4. Internal bus connection of various devices


Different CPUs, the number of registers, the structure is not the same. 8086 There are 14 registers each one has a name: AX,BX,CX,DX,SI,DI,SP,BP,IP,CS,SS,DS,ES,PSW.

Its registers are 16-bit and can hold two bytes, AX,BX,CX,DX these 4 registers are usually used to store general data.

Special mention:

8086 is the current mainstream PC processor X86 architecture processor of the originator, although it is 64 bit, but they still have a lot of similarities, X86 has 4 modes, real mode, protection mode, System Management mode, virtual V86 mode.


About Registers:

This is a 16-bit register that can be divided into two eight-bit registers, called AL (Low) and AH (high), which can be used separately, that is, as a two register, as a normal register for general data.

Word:

Word here is a new concept, a data consisting of 16-bit binary data is called a word, which has never been touched before.

A few simple assembly instructions:

Instruction example execution action high-level language representation

MOV mov ax,18 will be 18 fed into register ax AX = 18

Add Add ax,8 adds 8 to the value of the AX register ax+=8

Sub Sub ax,bx The value of BX to Ax AX-=BX

JMP jmp xxxx:yyyy redirect addresses to xxxx:yyyy

Attention:

Assembly language is not case-sensitive, MOV and MOV is the same as casually write that can

The number of bits of the two operands should be consistent when using instructions to transmit data (for example, 8-bit cannot and 16-bit data to each other) and cannot exceed the upper limit.

Physical Address:

Physical Address = Segment Address *16 + offset address

8086 the method of physical address is obtained:

1.CPU provides two 16-bit addresses one is called the segment address, and the other is called the offset address.

2. The segment address and offset address are fed into a part of the address adder via the internal bus and then calculated using the formula above

3. Address Adder synthesizes Two 16-bit addresses to a 20-bit physical address

4. The 20-bit physical address is fed into the input/output control circuit via the internal bus

5. The control circuit of the input and output sends the physical address of the 20-bit to address bus

6.2-bit physical address transmitted to memory by address bus

7. Different segment addresses and offset addresses may synthesize the same physical address

Where the CS register is stored in the segment address, the IP memory is stored in the offset address.


Use:

WinDOS user directly using DOS is good

Linux users need to use DOSBox to emulate a DOS environment



Assembly Language Basics 2

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.