64-bit manipulation

From: wannabe_assembler (archna_sindwani_at_email.com)
Date: 02/28/04


Date: Sat, 28 Feb 2004 18:44:39 +0000 (UTC)

Okay. I'm not looking for answers, just guidance. My prof isn't great
at explaining. I'm having the darndest time trying to understand
quadwords in assembly. Part of a program I'm writing has to print the
Fibonacci's using iteration. I've put in code where I can see that
there is in fact values being passed to edx. My goal was to try to get
the value into edx:eax, but I'm not sure I'm doing the carries
correctly. Also, I have to pass the complete 64 bit value to the
write64 proc given to us by the professor. Now I assume you do this
with a fild (or so my professor has alluded), but when I do it I get
ascii characters. I'd appreciate any help at all, even if it's just a
link explaining quadword input and output in assembly. (I've looked
myself, but at nothing that made it clearer to me). Btw this is
Masm615 on a Windows box. Thanks.

recurrence proc
        clc
        mov [esi], eax
        mov [esi+4], edx
        add eax, [edi]
        adc edx, [edi+4]
        mov [ebx], eax ;ebx is the offset of fib
        mov [ebx+4], edx
        fild fib
        call write64
        call column
        call column
        pushad
        mov eax, edx
        call writedec
        popad
        call column
        call column
        call writedec
        pushad
        mov eax, [esi]
        mov edx, [esi+4]
        mov [edi], eax
        mov [edi+4], edx
        popad
        ret
recurrence endp

;****************GIVEN BY PROFESSOR***************
write64 proc
        pushad
        mov ebx,0
        fld ten
        fld st(1)
        mov ecx,19
l:
        fprem
        fist hld
        movzx eax,hld
        mov edx,offset hld
        fsubp st(2),st
        fxch
        fdiv st,st(1)
        fst st(2)
        mov ax,hld
        mov buf[ecx-1],al
        loop l
        fcompp
        fcomp
        mov ecx,18
        mov ebx,0
l1: test buf[ebx],0ffh
        mov al,buf[ebx]
        jnz nblank
        mov buf[ebx],' '
        inc ebx
        loop l1
nblank: inc ecx
@@: or buf[ebx],30h
        inc ebx
        loop @b
        mov edx,offset buf
        call writestring
        popad
        ret
write64 endp