用汇编语言写一个多字节二进制数减法程序。要求以十六进制显示被减数,减数,结果
1个回答
展开全部
dseg segment
hextab db '0123456789ABCDEF'
a db 1,2,3,4
b db 5,6,7,8
c db 0,0,0,0
len equ $-c
dseg ends
assume cs:cseg, ds:dseg
cseg segment
start:
mov ax, dseg
mov ds, ax
mov cx, len
lea si, a
lea di, b
lea bx, c
clc
s0:
mov al,[di]
sbb al,[si]
mov [bx],al
inc si
inc di
inc bx
loop s0
mov cx, len
mov bx, cx
dec bx
lea si, c
p0:
mov al, [si+bx]
call printHex
dec bx
loop p0
mov ah,4ch
int 21h
printHex proc near
push bx
push cx
lea bx, hextab
mov cx, 204h
mov dl, al
mov ah,0eh
h0:
rol dl, cl
mov al, dl
and al, 0fh
xlat
int 10h
dec ch
jnz h0
pop cx
pop bx
ret
printHex endp
cseg ends
end start
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询