kolibrios/programs/develop/str_double/trunk/str_double.asm

613 lines
15 KiB
NASM
Raw Normal View History

; <20>ணࠬ<E0AEA3><E0A0AC> <20><><EFBFBD> <20><EFBFBD><EFBFBD><E0A0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><20><> <20><><EFBFBD>
; <20> <20><><EFBFBD> float, double, <20><><E2A0AA> <20><> 10 <20><><EFBFBD> 16 <20><><EFBFBD><E7ADAE>
; <20><> float.
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><EFBFBD><E1ADAE> hex2dec2bin <20> <20><EFBFBD><20><><><E4A0A9> list2_05.inc
; (<28><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E3ABA0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECA5A2> 24.05.2002),
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ChE <20><><EFBFBD><E0A5A4><EFBFBD><EFBFBD> <20> 16 <20><> 32 <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><E1A5AC><EFBFBD><EFBFBD> fasm.
; <20>ணࠬ<E0AEA3><E0A0AC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E2A0AA> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
; 1) <20><><20> <20><><EFBFBD><E0AEAA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><E0A5A2><EFBFBD><EFBFBD> <20> 4 <20><><EFBFBD><EFBFBD><EFBFBD> (float) <20> <20><><EFBFBD><E8A8AD><EFBFBD> <20><><EFBFBD>
; 2) <20><><20> <20><><EFBFBD><E0AEAA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><E0A5A2><EFBFBD><EFBFBD> <20> 8 <20><><EFBFBD><EFBFBD> (double) <20> <20><><EFBFBD><E8A8AD><EFBFBD> <20><><EFBFBD>
; 3) <20><><20> <20><><EFBFBD><E8A8AD><EFBFBD> <20><><EFBFBD><EFBFBD> (float) <20><><EFBFBD><E0A5A2><EFBFBD><EFBFBD> <20> <20><><EFBFBD><E0AEAA><EFBFBD><EFBFBD> <20><><EFBFBD> (5 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><20><><EFBFBD><EFBFBD>⮩)
use32
org 0x0
db 'MENUET01'
dd 0x01,start,i_end,e_end,e_end,0,sys_path
include '../../../proc32.inc'
include '../../../macros.inc'
include '../../../develop/libraries/box_lib/load_lib.mac'
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
include 'lang.inc'
@use_library
align 4
start:
load_libraries l_libs_start,l_libs_end
;<3B><EFBFBD><20><><>쪮 㤠筮 <20><><EFBFBD><EFBFBD><E3A7A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov ebp,lib_0
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
mcall 40,0x27
mcall 48, 3, sys_colors, 40
edit_boxes_set_sys_color edit1,editboxes_end,sys_colors
option_boxes_set_sys_color sys_colors,Option_boxes1
align 4
red:
call draw_window
align 4
still:
mcall 10 ; <20><EFBFBD><E3ADAA><EFBFBD> 10 - <20><><EFBFBD><EFBFBD><EFBFBD><><E1AEA1><EFBFBD><EFBFBD>
cmp eax,1 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1AEA2><EFBFBD> <20><><EFBFBD><EFBFBD> ?
je red ; <20><20><> - <20><> <20><><EFBFBD><EFBFBD><EFBFBD> red
cmp eax,2 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ?
je key ; <20><20><> - <20><> key
cmp eax,3 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ?
je button ; <20><20><> - <20><> button
cmp eax,6
je mouse
jmp still ; <20><20><><EFBFBD><>⨥ - <20> <20><><EFBFBD><><E6A8AA>
;---------------------------------------------------------------------
key: ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mcall 2
;cmp ah,13
stdcall [edit_box_key], dword edit1
jmp still ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><><E6A8AA>
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><20><><20><><EFBFBD><EFBFBD>⮩ (1-17)
NumberSymbolsAD DW 5
; <20><><EFBFBD><EFBFBD><EFBFBD><E2A0AD> (10 <20> <20><EFBFBD><E2A5AF><EFBFBD> N)
MConst DQ 1.0E1,1.0E2,1.0E3,1.0E4,1.0E5
DQ 1.0E6,1.0E7,1.0E8,1.0E9,1.0E10
DQ 1.0E11,1.0E12,1.0E13,1.0E14,1.0E15
DQ 1.0E16,1.0E17,1.0E18,1.0E19,1.0E20
DQ 1.0E21,1.0E22,1.0E23,1.0E24,1.0E25
DQ 1.0E26,1.0E27,1.0E28,1.0E29,1.0E30
DQ 1.0E31,1.0E32,1.0E33,1.0E34,1.0E35
DQ 1.0E36,1.0E37,1.0E38,1.0E39,1.0E40
DQ 1.0E41,1.0E42,1.0E43,1.0E44,1.0E45
DQ 1.0E46,1.0E47,1.0E48,1.0E49,1.0E50
DQ 1.0E51,1.0E52,1.0E53,1.0E54,1.0E55
DQ 1.0E56,1.0E57,1.0E58,1.0E59,1.0E60
DQ 1.0E61,1.0E62,1.0E63,1.0E64,1.0E65
DQ 1.0E66,1.0E67,1.0E68,1.0E69,1.0E70
DQ 1.0E71,1.0E72,1.0E73,1.0E74,1.0E75
DQ 1.0E76,1.0E77,1.0E78,1.0E79,1.0E80
DQ 1.0E81,1.0E82,1.0E83,1.0E84,1.0E85
DQ 1.0E86,1.0E87,1.0E88,1.0E89,1.0E90
DQ 1.0E91,1.0E92,1.0E93,1.0E94,1.0E95
DQ 1.0E96,1.0E97,1.0E98,1.0E99,1.0E100
DQ 1.0E101,1.0E102,1.0E103,1.0E104,1.0E105
DQ 1.0E106,1.0E107,1.0E108,1.0E109,1.0E110
DQ 1.0E111,1.0E112,1.0E113,1.0E114,1.0E115
DQ 1.0E116,1.0E117,1.0E118,1.0E119,1.0E120
DQ 1.0E121,1.0E122,1.0E123,1.0E124,1.0E125
DQ 1.0E126,1.0E127,1.0E128
; <20><><20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E7ADAE><EFBFBD>
Data_Double DQ ?
; <20><><20> BCD-<2D><><EFBFBD><E0ACA0>
Data_BCD DT ?
; <20><EFBFBD><E1AFAE><EFBFBD><EFBFBD><EFBFBD><E2A5AB><EFBFBD><EFBFBD><>
Data_Flag DB ?
; <20><><EFBFBD><EFBFBD><><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><20><> 0 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥫쭮<E2A5AB> <20><>᫮)
Data_Sign DB ?
; <20><><EFBFBD> <20><><EFBFBD> <20><EFBFBD><E0A0AD><EFBFBD><EFBFBD> <20><><20> <20><><EFBFBD><EFBFBD> ASCII
Data_String DB 32 DUP (?)
string1 db 32 dup (0)
string1_end:
;*******************************************************
;* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
;* <20><><20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><E3A4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E7ADAE><EFBFBD><EFBFBD>, १<><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
;* <20><EFBFBD><EBA4A0><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20> "<22><><EFBFBD><E2AEA2>" <20><><EFBFBD><E0ACA0> <20> *
;* 䨪<><E4A8AA><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><20><><EFBFBD><EFBFBD>⮩. *
;* <20><EFBFBD><E5AEA4><EFBFBD> <20><><EFBFBD><E0A0AC><EFBFBD><EFBFBD>: *
;* Data_Double - <20><EFBFBD>ࠧ㥬<E0A0A7><E3A5AC> <20><>᫮; *
;* NumberSymbolsAD - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>᫥ *
;* <20><><EFBFBD><EFBFBD>⮩ (0-17). *
;* <20><><EFBFBD><E5AEA4><EFBFBD> <20><><EFBFBD><E0A0AC><EFBFBD><EFBFBD>: *
;* Data_String - <20><><EFBFBD>-१<><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
;*******************************************************
DoubleFloat_to_String:
pushad
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20> <20><><EFBFBD> Data_String
mov EDI, Data_String
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><20><><EFBFBD><EFBFBD><EFBFBD> <20><> NumberSymbolsAD
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD>
fninit ;<3B><><EFBFBD><EFBFBD><EFBFBD><><E1AEAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
fld [Data_Double] ;<3B><><EFBFBD><EFBFBD><EFBFBD><E3A7A8> <20><>
xor ebx,ebx
mov BX,[NumberSymbolsAD]
cmp BX, 0
je .NoShifts ;<3B><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><20><><EFBFBD><EFBFBD>
jl .Error ;<3B><EFBFBD><E8A8A1>
dec BX
shl BX, 3 ;㬭<><E3ACAD><EFBFBD><EFBFBD><EFBFBD> <20><> 8
add EBX, MConst
fmul qword [EBX] ;㬭<><E3ACAD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><E2A0AD>
.NoShifts:
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><20> <20><><EFBFBD><EFBFBD> BCD
fbstp [Data_BCD]
; <20><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD><><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><E0A5AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov AX,word [Data_BCD + 8]
cmp AX,0FFFFh ;"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" <20><><EFBFBD><E0A5AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
je .Overflow
; <20><EFBFBD><EBA4A5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> ASCII-<2D><><EFBFBD><EFBFBD>
mov AL, byte [Data_BCD + 9]
and AL,AL
jz .NoSign
mov AL,'-'
stosb
.NoSign:
; <20><><EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><20> <20><><EFBFBD> ASCII
mov ebx,8 ;ᬥ饭<E1ACA5><E9A5AD> <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
mov ecx,9 ;<3B><><EFBFBD><EFBFBD><20><><EFBFBD> <20><><EFBFBD><EFBFBD>
; <20><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><20> <20><>
mov DX,18
sub DX,[NumberSymbolsAD]
js .Error ;<3B><EFBFBD><E8A8A1>, <20><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥫쭠<E2A5AB>
jz .Error ;<3B><><EFBFBD> <20><EFBFBD><E3ABA5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.NextPair:
; <20><><EFBFBD><EFBFBD><EFBFBD><E3A7A8> <20><><EFBFBD><EFBFBD><E0A5A4><EFBFBD> <20><><EFBFBD><EFBFBD><><EFBFBD>
mov AL, byte [ebx + Data_BCD]
mov AH,AL
; <20><EFBFBD><EBA4A5><EFBFBD><EFBFBD>, <20><><EFBFBD><E0A5A2><EFBFBD><EFBFBD> <20> ASCII <20>
; <20><><EFBFBD><EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
shr AL,4
add AL,'0'
stosb
dec DX
jnz .N0
mov AL,'.'
stosb
.N0: ; <20><EFBFBD><EBA4A5><EFBFBD><EFBFBD>, <20><><EFBFBD><E0A5A2><EFBFBD><EFBFBD> <20> ASCII <20>
; <20><><EFBFBD><EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
mov AL,AH
and AL,0Fh
add AL,'0'
stosb
dec DX
jnz .N1
mov AL,'.'
stosb
.N1:
dec BX
loop .NextPair
mov AL,0
stosb
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20>㫨 ᫥<><E1ABA5>
mov EDI, Data_String
mov ESI, Data_String
; <20><EFBFBD><E0AEAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>᫠, <20><20><> <20><><EFBFBD><EFBFBD>
cmp byte [ESI],'-'
jne .N2
inc ESI
inc EDI
.N2: ; <20><><EFBFBD><EFBFBD><EFBFBD><E3A7A8> <20> <20><><EFBFBD><EFBFBD>稪 横<><E6A8AA> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⢮ ࠧ<><EFBFBD>
; <20><><20><><EFBFBD><EFBFBD> 1 (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>窨)
mov ecx,18+1+1
; <20><EFBFBD><E0AEAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20>
.N3:
cmp byte [ESI],'0'
jne .N4
cmp byte [ESI+1],'.'
je .N4
inc ESI
loop .N3
; <20><EFBFBD><E8A8A1> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
jmp .Error
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><20> <20><><EFBFBD> <20><><EFBFBD>
.N4: rep movsb
jmp .End
; <20><EFBFBD><E8A8A1>
.Error:
mov AL,'E'
stosb
mov AL,'R'
stosb
mov AL,'R'
stosb
xor AL,AL
stosb
jmp .End
; <20><><EFBFBD><E0A5AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD><EFA4AD> <20><>
.Overflow:
mov AL,'#'
stosb
xor AL,AL
stosb
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E6A5A4><EFBFBD>
.End:
popad
ret
;****************************************************
;* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
;* (<28><><20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, "<22><><EFBFBD><E2AEA2>" <20><><EFBFBD>) *
;* <20><EFBFBD><E5AEA4><EFBFBD> <20><><EFBFBD><E0A0AC><EFBFBD><EFBFBD>: *
;* Data_String - <20><><20> <20><><EFBFBD><EFBFBD> ASCII. *
;* <20><><EFBFBD><E5AEA4><EFBFBD> <20><><EFBFBD><E0A0AC><EFBFBD><EFBFBD>: *
;* Data_Double - <20><><20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. *
;****************************************************
String_to_DoubleFloat:
pushad
cld
; <20><><EFBFBD><EFBFBD> Data_BCD
mov dword [Data_BCD],0
mov dword [Data_BCD+4],0
mov word [Data_BCD+8],0
; <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
mov [Data_Sign],0
; <20><><EFBFBD><EFBFBD><20> SI 㪠<><E3AAA0><EFBFBD> <20><> <20><><EFBFBD>
mov ESI, Data_String
; <20><EFBFBD><EFBFBD><E1AAA0> <20><EFBFBD><E0AEA1><EFBFBD> <20><><20><><EFBFBD>
mov ecx,64 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><E6A8AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.ShiftIgnore:
lodsb
cmp AL,' '
jne .ShiftIgnoreEnd
loop .ShiftIgnore
jmp .Error
.ShiftIgnoreEnd:
; <20><EFBFBD><E0AEA2><20><><EFBFBD><EFBFBD> <20><>
cmp AL,'-'
jne .Positive
mov [Data_Sign],80h
lodsb
.Positive:
mov [Data_Flag],0 ;<3B><EFBFBD><E0A8A7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
mov DX,0 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
mov ecx,18 ;<3B><><EFBFBD><EFBFBD>. <20><>᫮ ࠧ<><EFBFBD>
.ASCIItoBCDConversion:
cmp AL,'.' ;<3B><>窠?
jne .NotDot
cmp [Data_Flag],0 ;<3B><><20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7A0AB><EFBFBD>?
jne .Error
mov [Data_Flag],1
lodsb
cmp AL,0 ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>?
jne .NotDot
jmp .ASCIItoBCDConversionEnd
.NotDot:
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 1 <20><><EFBFBD><EFBFBD><E7A5AD> <20><><EFBFBD><EFBFBD><20><>窨,
; <20><20><><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7A0AB><EFBFBD>
cmp [Data_Flag],0
jnz .Figures
inc DX
.Figures:
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
cmp AL,'0'
jb .Error
cmp AL,'9'
ja .Error
; <20><><20><><EFBFBD><EFBFBD><E0A5A4><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> BCD
and AL,0Fh
or byte [Data_BCD],AL
; <20><EFBFBD><20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
cmp byte [ESI],0
je .ASCIItoBCDConversionEnd
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BCD <20><> 4 ࠧ<><20><><EFBFBD><EFBFBD><EFBFBD>
; (ᤢ<><E1A4A2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>訥 2 <20><><EFBFBD><EFBFBD><EFBFBD>)
mov AX,word [Data_BCD+6]
shld word [Data_BCD+8],AX,4
; (ᤢ<><E1A4A2><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A5A4><EFBFBD> 4 <20><><EFBFBD><EFBFBD><EFBFBD>)
mov EAX, dword [Data_BCD]
shld dword [Data_BCD+4],EAX,4
; (ᤢ<><E1A4A2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>訥 4 <20><><EFBFBD><EFBFBD><EFBFBD>)
shl dword [Data_BCD],4
; <20><><EFBFBD><EFBFBD><EFBFBD><E3A6A0><><E1ABA5><EFBFBD>騩 ᨬ<><E1A8AC><EFBFBD> <20> AL
lodsb
loop .ASCIItoBCDConversion
; <20>᫨ 19-<2D><><E1A8AC><EFBFBD> <20><> 0 <20> <20><> <20><>窠,
; <20><> <20><EFBFBD><E8A8A1> <20><><EFBFBD><E0A5AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cmp AL,'.'
jne .NotDot2
inc ecx
lodsb
.NotDot2:
cmp AL,0
jne .Error ;<3B><><EFBFBD><E0A5AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD><EFA4AD> <20><>
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> BCD <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
.ASCIItoBCDConversionEnd:
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD>
mov AL,[Data_Sign]
mov byte [Data_BCD+9],AL
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E0A5A3><EFBFBD><EFBFBD><EFBFBD><><E1AEAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
fninit
; <20><><EFBFBD><EFBFBD><EFBFBD><E3A7A8> <20><><E1AEAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><20> BCD-<2D><><EFBFBD><E0ACA0>
fbld [Data_BCD]
; <20><><EFBFBD><EFBFBD><EFBFBD><E1ABA8> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
mov EBX,18+1
sub BX,CX
sub BX,DX
cmp EBX,0
je .NoDiv
dec EBX
shl EBX,3 ;㬭<><E3ACAD><EFBFBD><EFBFBD><EFBFBD> <20><> 8
add EBX, MConst
fdiv qword [EBX] ;ࠧ<><E0A0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><E2A0AD>
.NoDiv:; <20><><EFBFBD><EFBFBD><EFBFBD><E3A7A8> <20><><20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0ACA0>
fstp [Data_Double]
jmp .End
.Error:; <20><><EFBFBD> <20><EFBFBD> <20><EFBFBD><E8A8A1> <20><><EFBFBD><EFBFBD><E3ABA8><><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
fldz ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20>⥪ ᮯ<><E1AEAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
fstp [Data_Double]
.End:
popad
ret
;input:
; buf - 㪠<><E3AAA0><EFBFBD> <20><> <20><><EFBFBD>, <20><><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> 10 <20><><EFBFBD> 16 <20><><EFBFBD> <20><><EFBFBD><EFBFBD>
;output:
; eax - <20><>
align 4
proc conv_str_to_int, buf:dword
xor eax,eax
push ebx ecx esi
xor ebx,ebx
mov esi,[buf]
;<3B><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A5AB><EFBFBD><EFBFBD> <20><>
xor ecx,ecx
inc ecx
cmp byte[esi],'-'
jne @f
dec ecx
inc esi
@@:
cmp word[esi],'0x'
je .load_digit_16
.load_digit_10: ;<3B><><EFBFBD><EFBFBD><EFBFBD><EBA2A0><EFBFBD> 10-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
mov bl,byte[esi]
cmp bl,'0'
jl @f
cmp bl,'9'
jg @f
sub bl,'0'
imul eax,10
add eax,ebx
inc esi
jmp .load_digit_10
jmp @f
.load_digit_16: ;<3B><><EFBFBD><EFBFBD><EFBFBD><EBA2A0><EFBFBD> 16-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
add esi,2
.cycle_16:
mov bl,byte[esi]
cmp bl,'0'
jl @f
cmp bl,'f'
jg @f
cmp bl,'9'
jle .us1
cmp bl,'A'
jl @f ;<3B><><EFBFBD><E1A5A8><EFBFBD><EFBFBD><><E1A8AC><EFBFBD><EFBFBD> >'9' <20> <'A'
.us1: ;<3B><><EFBFBD><EFBFBD><E2A0A2><EFBFBD> <20><EFBFBD><E1ABAE><EFBFBD>
cmp bl,'F'
jle .us2
cmp bl,'a'
jl @f ;<3B><><EFBFBD><E1A5A8><EFBFBD><EFBFBD><><E1A8AC><EFBFBD><EFBFBD> >'F' <20> <'a'
sub bl,32 ;<3B><><EFBFBD><E0A5A2><EFBFBD><EFBFBD><><E1A8AC><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><><E0A5A3><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E9A5AD> <20><> <20><><EFBFBD><E1ABA5><20><><EFBFBD>
.us2: ;<3B><><EFBFBD><EFBFBD><E2A0A2><EFBFBD> <20><EFBFBD><E1ABAE><EFBFBD>
sub bl,'0'
cmp bl,9
jle .cor1
sub bl,7 ;convert 'A' to '10'
.cor1:
shl eax,4
add eax,ebx
inc esi
jmp .cycle_16
@@:
cmp ecx,0 ;<3B><20><><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥫쭮<E2A5AB>
jne @f
sub ecx,eax
mov eax,ecx
@@:
pop esi ecx ebx
ret
endp
;---------------------------------------------------------------------
align 4
button:
mcall 17 ; 17 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cmp ah, 1 ; <20><20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>஬ 1,
jne @f
mcall -1
@@:
cmp ah, 5
jne @f
cmp dword[option_group1],opt3
jne .opt_3_end
stdcall conv_str_to_int,dword[edit1.text]
mov dword[Data_Double],eax
finit
fld dword[Data_Double]
fstp qword[Data_Double]
; Data_Double - <20><EFBFBD>ࠧ㥬<E0A0A7><E3A5AC> <20><>
; NumberSymbolsAD - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><20><><EFBFBD><EFBFBD>⮩ (0-17)
call DoubleFloat_to_String
mov dword[Data_Double],eax ;<3B><><EFBFBD><EFBFBD><EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E7A5AD> <20> <20><><EFBFBD><E0ACA0> float
jmp .opt_all_end
.opt_3_end:
mov esi,string1
mov edi,Data_String
cld
mov ecx,32
rep movsb
call String_to_DoubleFloat
cmp dword[option_group1],opt1
jne .opt_all_end ;<3B><20><><EFBFBD>࠭ float, <20><> <20><EFBFBD>ࠧ㥬 <20><><><E0A0AD> <20><><EFBFBD><EFBFBD><EFBFBD><E7A5AD><EFBFBD><EFBFBD> double
finit
fld qword[Data_Double] ;<3B><><EFBFBD> <20><> double
fstp dword[Data_Double] ;<3B> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> float
.opt_all_end:
jmp red
@@:
jmp still
mouse:
stdcall [edit_box_mouse], edit1
stdcall [option_box_mouse], Option_boxes1
jmp still
;------------------------------------------------
align 4
draw_window:
mcall 48, 3, sys_colors, sizeof.system_colors
mcall 12, 1
mov edx, 0x14000000
or edx, [sys_colors.work]
mcall 0, 200*65536+300, 200*65536+175, ,,title
mcall 8, (300-53)*65536+38,145*65536+ 15, 5,[sys_colors.work_button] ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ok
mov ecx, 0x80000000
or ecx, [sys_colors.work_text]
mcall 4, 15*65536 +30,, binstr,
mcall , 15*65536 +58,, decstr,
mcall , (240-56*3)*65536 +58,, Data_String,
mcall , 15*65536 +72,, hexstr,
mcall , 15*65536+150,, numstr,
mov ecx, 0x80000000
or ecx, [sys_colors.work_button_text]
mcall , (300-42)*65536+149, , Okstr,3
cmp dword[option_group1],opt1
je @f ;<3B><20><><EFBFBD>࠭ float, <20><> <20><><EFBFBD><EFBFBD>訥 4 <20><><EFBFBD><EFBFBD><EFBFBD> (<28><> double) <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
cmp dword[option_group1],opt3
je @f ;<3B><20><><EFBFBD>࠭ float, <20><> <20><><EFBFBD><EFBFBD>訥 4 <20><><EFBFBD><EFBFBD><EFBFBD> (<28><> double) <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
mov ecx, dword[Data_Double+4]
mcall 47, 8*65536+256,,185*65536+72,[sys_colors.work_text] ; 16-<2D><><EFBFBD>
mov ecx, dword[Data_Double+4]
mcall ,8*65536+512,,240*65536+30, ; 2-<2D><><EFBFBD>
ror ecx, 8
mcall ,,,(240-56)*65536+30,
ror ecx, 8
mcall ,,,(240-56*2)*65536+30,
ror ecx, 8
mcall ,,,(240-56*3)*65536+30,
ror ecx, 8
@@:
mov ecx,dword[Data_Double]
mcall 47, 8*65536+256,,240*65536+72,[sys_colors.work_text] ; 16-<2D><><EFBFBD>
mov ecx,dword[Data_Double]
mcall , 8*65536+512,,240*65536+44, ; 2-<2D><><EFBFBD>
ror ecx, 8
mcall ,,,(240-56)*65536+44,
ror ecx, 8
mcall ,,,(240-56*2)*65536+44,
ror ecx, 8
mcall ,,,(240-56*3)*65536+44,
ror ecx, 8
mcall 38, 15*65536+300-15, 137*65536+137, [sys_colors.work_graph]
stdcall [edit_box_draw], edit1
stdcall [option_box_draw], Option_boxes1
mcall 12, 2 ; <20><EFBFBD><E3ADAA><EFBFBD> 12: ᮮ<><E1AEAE><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><E1AEA2> <20><><EFBFBD><EFBFBD>
ret
;-------------------------------------------------
title db 'string to double 07.09.11',0
hexstr db 'hex:',0
decstr db 'dec:',0
binstr db 'bin:',0
if lang eq ru
numstr db '<27><>᫮:',0
Okstr db '<27><><EFBFBD><EFBFBD>',0
head_f_i:
head_f_l db '<27><><EFBFBD><EFBFBD><E2A5AC><EFBFBD> <20><EFBFBD><E8A8A1>',0
else
numstr db 'Number:',0
Okstr db 'Ok',0
head_f_i:
head_f_l db 'System error',0
end if
mouse_dd dd 0
edit1 edit_box 182, 59, 146, 0xffffff, 0xff, 0x80ff, 0, 0x8000, (string1_end-string1), string1, mouse_dd, 0
editboxes_end:
;option_boxes
opt1 option_box option_group1, 15, 90, 8, 12, 0xffffff, 0x80ff, 0, op_text.1, 17
opt2 option_box option_group1, 15, 106, 8, 12, 0xffffff, 0x80ff, 0, op_text.2, 18
opt3 option_box option_group1, 15, 122, 8, 12, 0xffffff, 0x80ff, 0, op_text.3, 21
op_text: ;⥪<><E2A5AA> <20><><EFBFBD><><E0A0A4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.1 db 'str(dec) -> float'
.2 db 'str(dec) -> double'
.3 db 'float(dec,hex) -> str'
;㪠<><E3AAA0><EFBFBD> <20><><EFBFBD> option_box
option_group1 dd opt1
Option_boxes1 dd opt1, opt2, opt3, 0
system_dir_0 db '/sys/lib/'
lib_name_0 db 'box_lib.obj',0
err_msg_found_lib_0 db '<27><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ',39,'box_lib.obj',39,0
err_msg_import_0 db '<27><EFBFBD><E8A8A1> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ',39,'box_lib',39,0
l_libs_start:
lib_0 l_libs lib_name_0, sys_path, library_path, system_dir_0,\
err_msg_found_lib_0,head_f_l,import_box_lib,err_msg_import_0,head_f_i
l_libs_end:
align 4
import_box_lib:
;dd sz_init1
edit_box_draw dd sz_edit_box_draw
edit_box_key dd sz_edit_box_key
edit_box_mouse dd sz_edit_box_mouse
;edit_box_set_text dd sz_edit_box_set_text
option_box_draw dd aOption_box_draw
option_box_mouse dd aOption_box_mouse
;version_op dd aVersion_op
dd 0,0
;sz_init1 db 'lib_init',0
sz_edit_box_draw db 'edit_box',0
sz_edit_box_key db 'edit_box_key',0
sz_edit_box_mouse db 'edit_box_mouse',0
;sz_edit_box_set_text db 'edit_box_set_text',0
aOption_box_draw db 'option_box_draw',0
aOption_box_mouse db 'option_box_mouse',0
;aVersion_op db 'version_op',0
i_end:
sys_colors system_colors
rb 0x400 ;stack
sys_path rb 4096
library_path rb 4096
e_end: ; <20><><20><><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>