• 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
  • 相关阅读:
    代替gets()的新操作
    前缀和(一维与二维) 差分
    高精度(高精加,高精减,高精乘,高精除)
    提高cin cout的速度
    二分算法(以 数的范围 为例)
    归并排序(merge_sort)
    快速排序(quick_sort)
    由后缀表达式题目:stoi atoi 函数新发现
    Redis(二)
    每日算法练习(2020-1-11)
  • 原文地址:https://www.cnblogs.com/zxj159/p/2811392.html
Copyright © 2020-2023  润新知