计算ffff:0~ffff:b数据的和,结果存在dx中

时间:2023-12-24 17:20:07

代码:

 assume cs:sad
 sad segment
 start:
     mov ax, 0ffffh
     mov ds, ax
     mov dx,
     ; add ds:0bh~ds:1h
     mov cx, 0bh
 s:
     mov ah,
     mov bx, cx
     mov al, ds:[bx]
     add dx, ax
     loop s

     ; add ds:0h
     mov bh,
     mov bl, ds:[]
     add dx, bx

     mov ax, 4c00h
     int 21h
 sad ends
 end

自己写的==

下面是看了书上的之后,写的:

 assume cs:sad
 sad segment
 start:
     mov ax, 0ffffh
     mov ds, ax
     mov dx,
     mov bx,
     ; c = b +
     mov cx, 0ch
 s:
     mov ah,
     mov al, [bx]
     inc bx
     add dx, ax
     loop s

     mov ax, 4c00h
     int 21h

 sad ends
 end

主要是加上了inc bx的用法==