al,[bx][si]
cmp al,''''0''''
jz qb1
mov al,''''0''''
mov [bx][si],al
jmp qb2
qb1:
mov al,''''1''''
mov [bx][si],al
qb2:
inc si
cmp si,16
jl qbroat
qnext:
mov dh,1 ;加1处理.方法类似减法
mov si,15
qbincre:
mov al,[bx][si]
sub al,''''0''''
add al,dh
mov dh,0
cmp al,2
jnz qbi1
mov al,0
mov dh,1
qbi1:
add al,''''0''''
mov [bx][si],al
dec si
cmp si,0
jnl qbincre
qbret:
ret
questBuma endp
;*******************************************
bsubproc proc near ;功能:16位二进制数减法模拟.
;算法:逐位相减,flag为借位标志(BX)
push ax
push bx
push cx
push si
mov bx,0 ;//flag
mov si,15
broat: mov al,num1[si]
add al,bh
mov bh,0 ;//clear bh
cmp al,num2[si]
jnl bnext
add al,2
dec bh
bnext:
sub al,num2[si]
add al,''''0''''
mov sum[si],al
dec si
cmp si,0
jnl broat &