3-26-2015
n1 dq 0
looper dd 0
saveesi dd 0
buf7 db ' ',0
Value db ' ',0 ; number keyed in
const
codecode STRUCT
cc1 db ?
cc2 db ?
cc3 db ?
cc4 db ?
codecode ENDS
; program re-enters here 9 times to build the
; keyed input into Value
: keyed in test values: 010000.00 or 010000.11
.ValueLoop
mov ecx,[wParam] ; wParam contains 1 keyed digit of Value
mov D[cc],ecx
mov cl,B[cc.cc1]
mov esi,[saveesi]
mov B[Value+esi],cl
inc esi
mov [saveesi],esi
inc D[looper]
cmp D[looper],9
jne >>.goon ; goes out and comes back to ValueLoop 9 times
invoke msvcrt:_atodbl, addr n1,addr Value ;convert string to double
invoke msvcrt:sprintf_s, addr buf,sizeof buf,\
"%g",[n1]
invoke TextOut, [hdc],200,425,addr buf7,9 ; prints 010000
invoke TextOut, [hdc],200,425,addr Value,9 ; prints 010000.00/010000.11
The above drops the ".00"
If I change the keyed Value to '010000.11',0 it still loses the ".11"
msvcrt:_atodbl can be found on the Microsoft site by keying in _atodbl.
Hope I did a better job this time.