Question

i,m working on MASM 5.0 and use UTIL.LIB

i can read the floating numbers and print them fine with the following instructions :

  1. getfp ( to read the floating number from keyboard )
  2. fld st ( to push value on fpu stack )
  3. putfp ( to print them )

yet every thing is nice

but i need to assign a values to a variable eg: x= 5.5 then print them using " putfp "

here is the problem i cant do that yet , i tried the following code but got an error :

.data

  x dd 5.5

.code

  fld x

  putfp
Était-ce utile?

La solution

If you mean the util.lib by William B. Jones (http://fleder44.net/312/how_to_use_util_lib.html) then try it in this way:

extrn putfp:near
.model small
.stack 1000h

.data
    x dd 5.5

.code
start:

    mov ax,@data
    mov ds,ax

    fld x
    call putfp

    mov ax, 4C00h   ; Exit(0)
    int 21h

end start
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top