Posted: Wed Mar 26, 2003 12:59 pm
Restored from previous forum. Originally posted by tejon.
why does this code not work?
why does this code not work?
Code: Select all
OpenConsole()
ConsoleTitle ("inline asm test ")
Dim a.w(3)
Procedure.s myHex(n.w)
c.w=PeekB(@n+1)
h.w=c/16
l.w=c-h*16
If h<10
hb.s=Chr(h+48)
Else
hb.s=Chr(h+55)
EndIf
If l<10
lb.s=Chr(l+48)
Else
lb.s=Chr(l+55)
EndIf
mhex$=hb+lb
c.w=PeekB(@n)
h.w=c/16
l.w=c-h*16
If h<10
hb.s=Chr(h+48)
Else
hb.s=Chr(h+55)
EndIf
If l<10
lb.s=Chr(l+48)
Else
lb.s=Chr(l+55)
EndIf
mhex$=mhex$+hb+lb
ProcedureReturn mhex$
EndProcedure
aptr.l=@a(0)
FINIT ;initialize FPU
FLD1 ;load 1 into st(0)
FADD st,st ;make st(0) = 2
FSQRT ;sqrt(2)
MOV ebx,aptr ;put address of array a into EBX
FST qword [ebx];store sqrt(2) into array a
; array a now has
;a(3)=16374 ;3FF6
;a(2)=41118 ;A09E
;a(1)=26239 ;667F
;a(0)=15309 ;3BCD
For i=3 To 0 Step -1
a$=myHex(a(i))
a$=a$+" "
Print(a$)
; should print 3FF6 A09E 667F 3BCD
Next i
b$=Input()
CloseConsole()