Wang Shuang "assembly language" the third edition of the eighth chapter two basic problems of data processing

Source: Internet
Author: User

Introduction

In this chapter, we are going to discuss these two basic questions for 8086CPU. Although the discussion is based on 8086CPU, these two basic questions are common and exist for any processor.

The collection of Reg includes: AX, BX, CX, DX, ah, AL, BH, BL, CH, cl, DH, DL, SP, BP, Si, di;

The Sreg collection includes: DS, SS, CS, es.

8.1 bx, Si, Di, bp

In 8086CPU, only these 4 registers (BX, BP, Si, di) can be used in the "[...]" to address the memory unit.

In "[...]", these 4 registers (BX, BP, Si, di) can appear individually, or can only appear in four combinations: bx and Si, bx and di, BP and Si, BP and di.

As long as the [...] The register is used in BP, and the instruction does not explicitly give the segment address, the segment address is the default in SS.


8.2 Location of data processed by machine instructions

Before executing the instruction, the data to be processed can be in three places: internal CPU, memory, port.

  


8.3 Expression of data position in assembly language

Assembly language uses three concepts to express the location of the data.
1, immediate number (idata)
2. Register
3. Segment Address (SA) and offset address (EA)


8.4 Addressing Mode

When the data is stored in memory, we can give the offset address of this memory unit in many ways, and this method of locating the memory unit is generally referred to as addressing mode.

  


8.5 How long is the data for the instruction to be processed?

8086CPU instruction that can handle two sizes of data, byte and Word. So in the machine instructions to indicate whether the instruction is a word operation or a byte operation.

1. Specify the size of the data to be processed by the register name.

2. With no register name present, use the operator x ptr to indicate the length of the memory unit, X can be word or byte in the assembly instruction.

Some directives, such as push and pop, default to whether a word cell or a byte cell is accessed.

  
8.6 Comprehensive application of addressing methods


8.7 div Instruction

Div is the division Instruction (Division), when using Div for division:

Divisor Dividend Quotient Remainder

8-bit 16-bit (   AX) Alah

16-bit 32-bit (DX+AX) AXDX

8.8 Pseudo-instruction DD

DD is used to define DWORD (double word) type data.


8.9 dup

The DUP is an operator that, in assembly language, is the same as DB, DW, DD, etc., and is also a symbol that is handled by the compiler.

It is used in conjunction with data definition pseudo-directives such as DB, DW, and DD for data duplication.

The DB 3 dup (0) defines 3 bytes, and their values are 0, which is equivalent to DB 0,0,0.

The DB 3 dup (0,1,2) defines 9 bytes, which are 0, 1, 2, 0, 1, 2, 0, 1, 2, equivalent to DB 0,1,2,0,1,2,0,1,2.

Reference: "Small Turtle Collection 0 Basic Primer"

The third edition of Assembly language

Wang Shuang "assembly language" the third edition of the eighth chapter two basic problems of data processing

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.