Thinking compilation of data processing

The problem of data processing

Two Problems

1. Data processed in any place

2. How long is the data to be processed

`

It represents sreg register reg segment registers represents

reg collection include:ax, bx, cx, dx, ah, al, bh, bl, ch, cl, dh, dl, sp, bp, si, di

sreg set comprising: ds, ss, cs, es'

Only four registers may be used in [...]addressing the memory cells is performed

They arebx, si, di, bp

The following program is correct

mov ax, [bx]
mov ax, [bx + si]
mov ax, [bx + di]
mov ax, [bp]
mov ax, [bp + si]
mov ax, [bp + di]

The following program is wrong

mov ax, [cx]
mov ax, [ax]
mov ax, [dx]
mov ax, [ds] 

Using the operator registers the name of a case without the presence of X ptrknown length of the memory cell, Xmay wordorbyte

  • word ptrRepresenting instructions access memory unit is a word unit
  • byte ptrIt indicates that the memory access instruction is a byte unit element
mov ax, 2000h
mov ds, ax
mov word ptr [1000h], 1 ; worde的使用方式
mov byte ptr [1000h], 1 ; byte 的使用方式

pushA word operation instruction, need not indicate byteorword

div divide instruction (back at school)

  • Divisor: 8 and 16 for the two types in the memory unit or a reg
  • The dividend: default on the dx and ax or ax in
    • If an 8-bit divisor, the dividend is 16 bits, the default is stored in AX
    • If the 16-bit divisor, dividend, compared with 32, and stored in the AX, DX, DX high storage 16, storing the lower 16 bits AX
    • If the divisor is eight, the remainder supplier AL, the AH stored in a divide operation divide operation is stored;
    • If the divisor bit 16, the AX business, DX storage operations division store division operation remainder

mul multiply instruction

mul is multiply instruction, when two things have to do multiplication

  1. Multiplying two numbers: are either eight or 16 bits
    • Are eight
      • AL is placed in a default, or another memory in 8-byte units reg
      • Results: The default placed in AX
    • Are 16
      • A default on the ax, the other on the 16-bit word or memory unit reg
      • Results: high default on the DX, a low stored in AX

The following format

; mul reg
; mul 内存单元
; 例如:8位
mul byte ptr ds:[0] ; (ax) = (al) * ((ds) * 16 + 0)
; 16位
mul word ptr [bx + si + 8] ; (ax) = (ax) * ((ds) * 16 + (bx) + (si) + 8)) 结果的低16为
                           ; (dx) = (ax) * ((ds) * 16 + (bx) + (si) + 8)) 结果的高16为

Dd directive

dd used to define the dword (double word, double word) type data.

data segment
    db 1
    dw 1
    dd 1
data ends

The first data is 01H, the data: 0, the 1 byte

The second data is 0001H, the data: 1, the 1 byte

00000001H third data, the data: 3, the 2 bytes

Directive dup

It db, dw, dd data defining the like with the use of directives, for data repetition

Syntax is as follows:

db repetitions dup (duplicate data)

example

db 3 dup(0) ; 相当于 db 0, 0, 0
db 3 dup(0, 1, 2) ; 相当于0, 1, 2, 0, 1, 2, 0, 1, 2
db 3 dup('abc', 'ABC') ; 相当于db 'abcABCabcABCabcABC'

Guess you like

Origin www.cnblogs.com/songyaqi/p/11887988.html