組合語言: 陣列刪除指定元素
阿新 • • 發佈:2019-02-12
**
更多習題答案見
**
data segment
mem dw 26,0,71,200,0,5,'$'
N EQU ($-mem)/2
data ends
stack segment stack
dw 32h dup(0)
top label word
stack ends
code segment
assume ds:data,ss:stack,cs:code
p proc far
mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
lea sp,top
lea si,mem
lea di,mem
mov cx,n
l1: mov ax,[si]
cmp ax,0
je l2
jmp l3
l2: inc si
inc si
loop l1
l3: mov dx,[si]
mov [di],dx
inc di
inc di
inc si
inc si
loop l1
mov bx,si
sub bx,di
mov cx,bx
l4: mov ax,9
inc di
inc di
mov [di],ax
loop l4
lea dx,mem
mov ah,09h
int 21h
mov ah,4ch
int 21h
p endp
code ends
end p