i cannot find any tutorials with information relevant to this, so i'm trying to learn asm from the FASM documentation. I am having trouble figuring out stuff about the FPU instructions. would someone please look at the following code and tell me if, inside a program, it would take 32 as a Fahrenheit temperature and CORRECTLY convert it to a Celsius temperature (0) in such a way that it would work on any two-digit Fahrenheit temperature, and if it would then put that value into the edx register.

TempIn db "32"
mov al,
sub al,48
mov dl,10
mul dl

mov ah,
sub ah,48
add al,ah
mov ah,0

fild qword
mov dl,32
fsub qword
mov dl,5
fmul qword
mov dl,9
fdiv qword
fistp qword

if it doesn't tell me what's wrong and explain this whole "stack" thing to me
and if you know a better way to do anything here, please tell me also.

And someone explain something else to me: "qword" tells it that it is 64-bit precision, right? isn't edx a 32-bit register? how can qword fit inside it, then?
Posted on 2003-05-07 10:37:42 by KaS_m
KaS_m,
The FASM documentation is the wrong place to start learning win32asm. Programming x86 assembly is not fasm specific, so you can start following the links in FAQ section of this board.

Regarding your questions, I give you some hints:
1. "stack" thing is well explained in Randall Hyde's "The Art of Assembly" and he also implements a FP stack in the UCR std lib that you can get at his site. He is also a moderator on this forum, find HLA section.

2. qword tells how many bytes to load at memory position pointed by edx. In other words, the value in edx (32 bit value) points to a qword (64 bits) located in memory. The instruction fild loads that value into the top of the FPU stack.

Best Regards,
Posted on 2003-05-07 11:53:58 by pelaillo