汇编语言: 数组删除指定元素
程序员文章站
2022-03-10 11:45:37
...
**
更多习题答案见
https://github.com/Lemonreds/assembly-solution
**
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
上一篇: 微机实验
下一篇: 7-9 求整数均值 (10 分)