Hi

Am new to Assemply Can someone please tell me whats wrong with this code.
If i run it it will give the correct results but a popup window appears
saying there was errors. I am using Masm32 and Win2k.

I use the following in a make file to assemble and link.

###########Make File##################################################

Test.exe: Test.obj
link /SUBSYSTEM:console Test.obj kernel32.lib



Test.obj: Test.asm
ml /coff /c Test.asm


######################################################################


#############################Test.asm###################################
.386
.model flat, STDCALL
option casemap :none ; case sensitive

include \Masm32\include\Masm32.inc
includelib \Masm32\lib\Masm32.lib



.data

buffer Byte 20 Dup(0),0
result Qword 0.0
months Qword 12.0
prompt Byte "Please enter monthly salary",13,10,0
prompt1 Byte "Your Annual Salary Is: ",0


.code
start:

INVOKE StdOut, ADDR prompt
INVOKE StdIn, ADDR buffer, 20



INVOKE StrToFloat, ADDR buffer, ADDR result

fld result
fmul months


fstp result

INVOKE StdOut, ADDR prompt1
INVOKE FloatToStr2, result, ADDR buffer
INVOKE StdOut, ADDR buffer


end start

end

#######################################################################
Posted on 2003-04-15 04:06:18 by shiny
You forgot abt ExitProcess.
PS wrong forum. Your thread should be in main
Posted on 2003-04-15 04:13:30 by roticv
I'd put the kernel32.lib in the asm file, usinge the inlcudelib. And I think it would be an good idea to include windows.inc and kernel32.inc. I've attached your code with some modifications so it compiles and run, as you intended (I hope).
Posted on 2003-04-15 04:28:55 by scientica
Hi

Thanks a lot scientica. I will try it and give you the feedback.
Posted on 2003-04-15 05:10:58 by shiny
Oh yes, I suppose the error is due to the fact that every exe masm produced is padded with CCh at the end of the codes(which is int 3 in opcodes.) As you did not not call ExitProcess, the exe is excuted till int3 and thus the error.
Posted on 2003-04-15 06:48:59 by roticv
Hi

It worked perfectly. You made my day thanks a lot
Posted on 2003-04-16 03:14:24 by shiny