include \Masm32\MasmBasic\Res\JBasic.inc ; ## builds in 32- or 64-bit mode with UAsm, ML, AsmC ##
q2aBuffer db 80 dup(?)
.code
q2a:
push rsi
push rdi
mov rsi, offset q2aBuffer+32
lea rdi, [rsi-32]
FBSTP REAL10 ptr [rsi]
mov ecx, REAL10
@@: movzx edx, byte ptr [rsi+rcx]
test edx, edx
je NoNumber
mov al, dl
sar al, 4
and al, 15
add al, "0"
stosw
mov al, dl
and al, 15
add al, "0"
stosw
NoNumber:
dec ecx
jns @B
pop rdi
pop rsi
ret
MyQ QWORD 123456789012345678
Init ; OPT_64 1 ; put 0 for 32 bit, 1 for 64 bit assembly
PrintLine Chr$("This program was assembled with ", @AsmUsed$(1), " in ", jbit$, "-bit format.")
fild MyQ
call q2a
jinvoke printf, Chr$("Result=%ls"), offset q2aBuffer
EndOfCode
Output:
This program was assembled with ml64 in 64-bit format.
Result=123456789012345678