ReC98/th04/main/pointnum/digits.asm

31 lines
486 B
NASM
Raw Normal View History

public POINTNUM_DIGITS_SET
pointnum_digits_set proc near
@@points = word ptr 2
@@last_digit = word ptr 4
@@bp equ <bx>
mov @@bp, sp
mov dx, ss:[@@bp+@@points]
mov bx, ss:[@@bp+@@last_digit]
push si
mov si, offset _FIVE_DIGIT_POWERS_OF_10 + ((5 - POINTNUM_DIGITS) * word)
mov cx, (POINTNUM_DIGITS - 1)
@@loop:
mov ax, dx
xor dx, dx
div word ptr [si]
mov [bx], al
@@next:
dec bx
add si, word
loop @@loop
mov [bx], dl
pop si
retn 4
pointnum_digits_set endp
nop