for example, option.ini is an ASCII file, containing lines like these:
value1 = "1.2345"
value2 = "12.34567"
what is the most efficient way to read these lines (say option.ini is already mapped in memory 0x08000000h), and convert into:
asmvalue1 dd 1.2345
asmvalue2 dd 12.34567
i have written a function to read fixed length ASCII string (like 012345) and convert them into integer values, but non-fixed-length strings look complicated, especially decimals.
I don't know this is the "most efficient way" - the algo does much more you asked for - posted it a while ago.:
http://www.masm32.com/board/index.php?topic=12934.0
- It returns DOUBLE not quite you want but may can be modified by you good for starting somewhere :toothy-
Quote from: supercoollee on May 19, 2010, 09:34:14 AM
asmvalue2 dd 12.34567
That one will not even assemble correctly, it should be REALx instead of dd.
Re Val(), there is a very flexible Val in MasmBasic:
mov eax, Val("1234.567") ; eax=1234
MovVal MyReal10, "12345.678"
MovVal MyReal8, "-12345.678e-99"
etc... it will eat all kinds of formats, including hex and binary.