Assembly language: The fifth Chapter [BX] and loop instructions

Source: Internet
Author: User
Tags microsoft dynamics

1.[BX] and memory unit

[BX] refers to the segment address in the DS, offset address in BX in the memory unit

2.loop

Used to describe loops

3. We define the descriptive symbol "()"

Register: (ax/al) represents the contents of the Ax/al register

Segment Register: ((DS) *16+ (BX)) indicates that the segment address is DS content, and the contents of the memory unit with the offset address of BX content

Memory Unit: (20000H) represents the contents of a 20000H memory unit

4. Convention symbol Idata represents a constant

mov ax,idata means mov ax,1 mov ax,2 etc.

mov ax,[idata] means mov ax,[1] mov ax,[2] etc.

Segment register machine is not available in this way MOV

5.1[BX]

mov Ax,[bx] The DS content as the segment address, BX content as the offset address of the 2 memory unit content into Microsoft Dynamics AX

mov [bx],ax put ax content into DS content as segment address, BX content as an offset address in 2 memory units

5.2 Loop Command

Format: Loop label

Loop execution steps: 1. (CX) = (CX)-1 2. Determine CX, not 0 go to the label position to execute

Example: Calculate 2 of the 12-time Square

Assume Cs:code

Code segment

MOV ax,2

MOV cx,11

S:add Ax,ax

Loop s

Code ends

End

5.3 Tracking the Loop command with debug

Debug 1.exe

-R

-T

-T

..

-P (int 21H is performed with P)

1. If you want to jump directly to the cs:xx position, execute with-G XX

2. If you want to jump in the loop, that is, stop waiting for-t after the loop, use the-p command

5.4 Debug and assembler compiler for different processing of instructions

Same instruction:

MOV ax,[0] In debug means to put ds:0 and Ds:1 memory unit contents into AX

In the MASM equals the mob ax,0

How to troubleshoot assembly source problems:

1. mov bx,0 mov ax,[bx]

2. mov Ax,ds:[0]

Combined application of 5.5 loop and [BX]

Assembly language: The fifth Chapter [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.