代码
(5) 将a段和b段中的数据依次相加,将结果存到c段。
assume cs:code
a segment
db 1,2,3,4,5,6,7,8
a ends
b segment
db 1,2,3,4,5,6,7,8
b ends
c segment
db 0,0,0,0,0,0,0,0
c ends
code segment
start: mov ax,c
mov es,ax
mov bx,0
mov cx,8
s: mov dx,0
mov ax,a
mov ds,ax
mov dx,ds:[bx]
mov ax,b
mov ds,ax
add dx,ds:[bx]
mov es:[bx],dx
inc bx
loop s
mov ax, 4c00h
int 21h
code ends
end start
(6)用push指令将a段中的前8个字型数据,逆序存储到b段中。
assume cs:code
a segment
dw 1,2,3,4,5,6,7,8,9,0ah,0bh,0ch,0dh,0eh,0fh,0ffh
a ends
b segment
dw 0,0,0,0,0,0,0,0
b ends
code segment
start: mov ax,b
mov ss,ax
mov sp,16
mov ax,a
mov ds,ax
mov bx,0
mov cx,8
s: push ds:[bx]
inc bx
inc bx
loop s
mov ax,4c00h
int 21h
code ends
end start