import struct,sys
va=int(sys.argv[1],16)
f=open('content/BTL4OPT.EXE','rb').read()
pe=struct.unpack_from('<I',f,0x3c)[0]
numsec=struct.unpack_from('<H',f,pe+6)[0]; optsz=struct.unpack_from('<H',f,pe+20)[0]
imgbase=struct.unpack_from('<I',f,pe+0x34)[0]; sectab=pe+24+optsz
for i in range(numsec):
    o=sectab+i*40; vsz,va2,rsz,ra=struct.unpack_from('<IIII',f,o+8)
    if imgbase+va2<=va<imgbase+va2+max(vsz,rsz):
        fo=ra+(va-imgbase-va2); raw=f[fo:fo+10]
        # 80-bit extended: 64-bit mantissa + 15-bit exp + sign
        m=struct.unpack('<Q',raw[0:8])[0]; se=struct.unpack('<H',raw[8:10])[0]
        sign=-1 if se&0x8000 else 1; exp=(se&0x7fff)-16383
        val=sign*(m/2**63)*2.0**exp
        print(f"VA {va:#x} tbyte={raw.hex()} = {val!r}")
        break
