[Asm] 纯文本查看 复制代码
data segment
array db 34,10,11,22,21,9,66,88,1,3
cont equ $-array
endd dw 0
xx db 0
yy db 0
zz db 0
x1 db 0
y1 db 0
tn db 0
data ends
code segment
assume cs:code,ds:data
tt:
mov ax,data
mov ds,ax
lea bx,array
mov cx,cont
lop:
cmp byte PTR[BX],0
jg great
jl little
inc zz
jmp next
great:
inc xx
jmp next
little:
inc yy
next:
inc bx
loop lop
; mov cx,cont
; loop1:
; mov endd,offset array
; add endd,cx
; dec endd
; lea di,array
; loop2:
; cmp di,endd
; jg cc
; mov dl,byte PTR[di]
; mov x1,dl
; mov si,di
; inc si
; mov dl,byte PTR[si]
; ;mov y1,dl
; cmp dl,x1
; jle flag
; mov dl,byte PTR[di]
; mov tn,dl
; mov dl,byte PTR[si]
; mov [di],dl
; mov dl,tn
; mov [si],dl
; ;mov tn,dl
; ;xchg tn,[si]
; ;xchg tn,[di]
; flag:
; inc di
; jmp loop2
; cc:
; dec cx
; loop loop1
lea di,array
mov cx,cont
mov bl,10d
mov ax,0
nextprint:
mov ax,0
mov al,byte PTR[di]
mov dl,al
mov ah,02h
int 21h
print:
mov ah,0
;cmp al,10d
;jb flag2
div bl
mov dl,al
mov al,ah
add dl,30h
mov ah,02h
int 21h ;此处中断调用会更改al的值
mov dl,al
add dl,30h
mov ah,02h
int 21h ;此处也会更改
;inc di
;loop nextprint
mov ah,4ch
int 21h
code ends
end tt