I've been reading an article on the booting process. The part about detecting the memory amount really confused me.
wrnum:
push si
push dx
push cx
push ax
mov si,num_buf
; extended precision division from section 9.3.5
; of Randall Hyde's "Art of Assembly"
; start: DX=dividend MSW, AX=dividend LSW, BX=divisor
wrnum1:
push ax
mov ax,dx
xor dx,dx
; before div: DX=0, AX=dividend MSW, BX=divisor
; after div: AX=quotient MSW, DX=intermediate remainder
div bx
mov cx,ax
pop ax
; before div: DX=intermediate remainder, AX=dividend LSW, BX=divisor
; after div: AX=quotient LSW, DX=remainder
div bx
; end: DX=quotient MSW, AX=quotient LSW, CX=remainder
xchg dx,cx
add cl,'0'
cmp cl,'9'
jbe wrnum2
add cl,('A'-('9'+1))
wrnum2:
dec si
mov [si],cl
mov cx,ax
or cx,dx
jne wrnum1
call cputs
pop ax
pop cx
pop dx
pop si
ret
Can anyone help me?
Many thx!
The original code can be found at http://my.execpc.com/~geezer/osd/boot/size.asmSorry for my english :-(
--
My blog: http://lijie.org