Two basic problems of data processing in Chapter 8 of the assembly language (Wang Shuang version) study notes (1)

introduction

This chapter is a summary of all the previous content. We know that a computer is a machine that performs data processing and calculation, so there are two basic problems involved:
(1) Where is the processed data?
(2) How long is the data to be processed?

For simplicity of description, we will use two descriptive symbols reg and sreg in future courses. reg means register, sreg means segment register.

reg包括:ax,bx,cx,dx,ah,al,bh,bl,ch,cl,dh,dl,sp,bp,si,di
sreg包括:ds,ss,cs,es

8.1 bx, yes, of, bp

(1) In the 8086 CPU, only these four registers can be used in [...] to address the memory unit. For example, you can use [bx], but you cannot use [ax]

Insert picture description here

(2) In "[...]", these four registers can appear individually or in one of the following four combinations:
1.bx and si
2.bx and di
3.bp and si
4.bp and di

Insert picture description here

(3) As long as the register bp is used in [...], and the segment address is not explicitly given in the instruction, the segment address defaults to ss

Insert picture description here


8.2 Location of data processed by machine instructions

Most machine instructions are instructions for data processing. Processing can be roughly divided into three categories: read, write, and operation.
Before the instruction is executed, the data to be processed can be in three places: CPU internal, memory, port

Insert picture description here


8.3 Expression of data location in assembly language

Three concepts are used in assembly language to express the location of data:

  1. Immediate data (idata)
  2. register
  3. Segment address (SA) and offset address (EA)

Immediate data (idata)

The data directly contained in the machine instruction (in the instruction buffer of the CPU before execution) is called in assembly language: immediate data (idata), which is directly given in the assembly instruction.
Insert picture description here

register

The data to be processed by the instruction is in the register, and the corresponding register name is given in the assembly instruction.
Insert picture description here

Segment address (SA) and offset address (EA)

The data to be processed by the instruction is in the memory, and the EA can be given in the format of [X] in the assembly instruction.

  • The register holding the segment address can be the default
  • The register holding the segment address can also be given explicitly

Default segment address register
Insert picture description here
Insert picture description here

Explicitly give the register holding the segment address
Insert picture description here


8.4 Addressing mode

When the data is stored in the memory, we can use multiple ways to give the offset address of this memory unit, this method of positioning the memory unit is generally called the addressing mode.

Insert picture description here


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

The 8086CPU's instructions can handle two sizes of data, byte (byte operation, 8 bits) and word (word operation, 16 bits). Therefore, it should be indicated in the machine instruction whether the instruction performs word operation or byte operation.

(1) Specify the size of the data to be processed by the register name
Insert picture description here
(2) In the absence of the register name, use the operator X ptr to indicate the length of the memory unit, X can be word or byte in the assembly instruction.
Insert picture description here
(3) Other methods

Some instructions default to accessing word units or byte units. For example, push [1000H] defaults to word units, because push instructions only perform word operations. Pop is also only for word operations, because each change of sp is in units of 2.

Published 116 original articles · Like 82 · Visits 10,000+

Guess you like

Origin blog.csdn.net/weixin_43092232/article/details/105502239