News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Pushing immediate QWORD values

Started by jj2007, September 17, 2019, 12:12:44 AM

Previous topic - Next topic

jj2007

include \masm32\include\masm32rt.inc  ; pure Masm32 code

pushFpu macro arg
  if High32(arg)
% echo QWORD: arg
push High32(arg)
push Low32(arg)
fild qword ptr [esp]
add esp, 8
  else
% echo DWORD: arg
push arg
fild dword ptr [esp]
add esp, 4
  endif
ENDM

.data?
somevar REAL8 ?

.code
start:
  pushFpu 123
  fstp somevar
  printf("The value is %f\n", somevar)
  pushFpu 123456789012345
  fstp somevar
  printf("The value is %f\n", somevar)
  inkey "cute..."
  exit

end start


Works like a charm :thumbsup:
The value is 123.000000
The value is 123456789012345.000000


Re HIGH32, see Microsoft docs, operator HIGH32:
QuoteReturns the high 32 bits of expression. MASM expressions are 64-bit values.