7.更灵活的定位内存地址的方法

1.and指令:逻辑指令,按位进行与运算。与1不变,与0变0,可将对象相应位设为0.
2.or指令:逻辑指令,按为进行或运算。或1变1,或0变0,可将对象位设为1.
3.[BX+idata]的几种表现形式:
(1)mov ax,[200+bx]
(2)mov ax,200[bx]
(3)mov ax,[bx].200
4.[BX+idata]的数组处理案例
assume CS:codesg,DS:datasg

datasg SEGMENT
    DB 'BaSiC'
    DB 'MinIX'
datasg ENDS

codesg SEGMENT
  start:MOV AX,datasg
              MOV DS,AX
              MOV BX,0

              MOV CX,5
      s:    MOV AL,0[BX]
              AND AL,11011111b
              MOV AL,5[BX]
              OR  AL,00100000b
              MOV 5[BX],AL
              INC BX
              LOOP s
codesg ENDS
END start
5.SI和DI是8086CPU中和Bx功能相似的寄存器,只是不能分成两个8位的寄存器来用。
6.[BX+SI]进行内存地址定位的几种形式:
(1)mov ax,[bx][si]
(2)mov ax,[bx+si]
7.[BX+SI+idata]进行内存地址定位的几种形式:
(1)mov ax,[bx+200+si]
(2)mov ax,[200+bx+si]
(3)mov ax,200[bx][si]
(4)mov ax,[bx].200[si]
(5)mov ax,[bx][si].200
8.一般来说,需要暂存数据,我们都应该使用栈。
9.使用栈暂存数据的案例
assume CS:codesg,DS:datasg

datasg SEGMENT
     DB 'ibm               '
     DB 'dec               '
     DB 'dso               '
     DB 'vax               '
datasg ENDS

stacksg SEGMENT
    DW 0,0,0,0,0,0,0,0
stacksg ENDS 

codesg SEGMENT
    start : MOV AX,datasg
                    MOV DS,AX
                    MOV DX,stacksg
                    MOV SS,DX
                    MOV SP,16
                    MOV BX,0
                    MOV CX,4
            s0: PUSH CX
                MOV SI,0
                    MOV CX,3
            s:    MOV AL,[BX+SI]
                    AND AX,11011110b
                    MOV [BX+SI],AL
                    INC SI
                    LOOP s
                    ADD BX,16
                    POP CX
                    INC BX
                    LOOP s0
                    MOV AX,4c00h
                    INT 21h
codesg ENDS 
END start
posted @ 2012-12-10 14:58  烧点饭  阅读(212)  评论(0编辑  收藏  举报