Author Topic: How to output 128 bits to the screen?  (Read 909 times)

aw27

  • Member
  • ****
  • Posts: 709
Re: How to output 128 bits to the screen?
« Reply #45 on: July 24, 2017, 01:13:03 AM »
Stupid question: Where am I wrong?
Code: [Select]
include \masm32\include\masm32rt.inc
.data
My4 REAL4 -1.23456789012345678901234567890e0
My8 REAL8 -1.23456789012345678901234567890e0

.code
start:
  mov esi, offset My4
  mov eax, [esi]
  sar eax, 23
  and eax, 11111111b ; 8 bits expo
  sub eax, 127  ; bias
  print str$(eax), 9, "expo R4", 13, 10

  mov esi, offset My8
  mov eax, [esi]
  sar eax, 52-32
  and eax, 11111111111b ; 11 bits expo
  sub eax, 1023 ; bias
  print str$(eax), 9, "expo R8", 13, 10
  exit
end start

Should be 2x0, right?
Code: [Select]
0       expo R4
41      expo R8

real8 is a qword   :idea:

mov esi, offset My8
mov eax, [esi+4]

FORTRANS

  • Member
  • ****
  • Posts: 945
Re: How to output 128 bits to the screen?
« Reply #46 on: July 24, 2017, 01:15:19 AM »
Hi,

   Little-endian, ESI+4?

Regards,

Steve

jj2007

  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: How to output 128 bits to the screen?
« Reply #47 on: July 24, 2017, 03:41:57 AM »
Of course! Stupid mistake...