assume cs:code,ds:data,ss:stack
data segment
dd 1000000 ;F4240H
data ends
stack segment stack
db 128 dup (0)
stack ends
code segment
start: mov ax,stack
mov ss,ax
mov sp,128
mov bx,data
mov ds,bx
mov bx,0
mov ax,ds:[bx+0]
mov dx,ds:[bx+2]
push ax
mov bp,sp
mov cx,10
call long_div
mov ax,4C00H
int 21H
; H/N = in(H/N)*65536 + (rem(H/N)*65536+L)/N
;======================================
long_div: mov ax,dx
mov dx,0
div cx ;ax = in(H/N) dx = rem(H/N)*65536
push ax
mov ax,ss:[bp+0] ;L dx此时有rem(H/N)*65536为高位,ax中为低位
; 组成dx ax
div cx ;(rem(H/N)*65536+L)/N ax为低位商,dx中为余数
mov cx,dx
pop dx
ret
code ends
end start
long_div 32位除法
最新推荐文章于 2023-09-04 11:50:13 发布