Assembly language (Wang Shuang) Chapter 5th [BX] and loop instructions

Source: Internet
Author: User

MOV Ax,[0] put an internal deposit element to register AX, memory unit length 2 bytes, offset address 0, segment address DS

MOV Al,[0] put an internal deposit element to register AL, memory unit length 1 bytes, offset address 0, segment address DS

So: To describe a memory unit, you need 1.ds and offset address 2. Memory Unit length

[BX] also represents a memory unit, offset address in the register BX just

We use () to represent the contents of a register or a memory unit

() can be register, segment register, physical address of memory unit

5.1 [BX]

MOV Ax,[bx] put the segment register DS and offset address in BX in the contents of the memory unit to AX

Just do one of the following very simple programs

5.2 Loop

Cycle

S is the label, representing the address of the instruction

Loop S performs the process of 1 CX--, 2 to determine if CX is 0, not the words jump to the s label out of execution, is 0 words directly execute the following statement

5.3 are practical, write code directly

5.4 How to do the memory unit in the compiler

MOV ax,[0] in the compiler will be interpreted as MOV ax,0

mov ax,[bx] and mov ax, DS:[BX] will be interpreted as the contents of the physical address represented by the offset address in the segment address DS*16+BX to the AX register

Combined application of 5.5 loop and [BX]

The only thing to note here is the method of adding 8 bits of data to the 16-bit register.

Here's a dirt way.

MOV ah,0

MOV al,ds:[0]

MOV Bx,ax

A register with a high position set 0, low receive data, and then assigned to another register

5.6 Segment Prefix

MOV Ax,ds:[0] ds is the segment prefix

Is ds,cs,ss,es these things, which appear in the instruction, the thing that indicates the segment address is called the segment prefix

5.7-Segment Secure space

Some of the memory is not writable, write the words will be error

Do not manually change the contents of the memory

When the program runs, the CPU automatically allocates memory to the program.

Pull over.

Eof

Assembly language (Wang Shuang) Chapter 5th [BX] and loop instructions

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.