Author Topic: Pushing immediate QWORD values  (Read 195 times)

jj2007

  • Member
  • *****
  • Posts: 9802
  • Assembler is fun ;-)
    • MasmBasic
Pushing immediate QWORD values
« on: September 17, 2019, 12:12:44 AM »
Code: [Select]
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:
Code: [Select]
The value is 123.000000
The value is 123456789012345.000000

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