Subversion Repositories Kolibri OS

Rev

Rev 7662 | Rev 9568 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7662 Rev 8442
1
;CNC CONTROL
1
;CNC CONTROL
2
;Igor Afanasyev (aka IgorA) and Sergey Efremenkov (aka theonlymirage), 2018
2
;Igor Afanasyev (aka IgorA) and Sergey Efremenkov (aka theonlymirage), 2020
3
 
3
 
4
;02.10.18 - Only prototype UI
4
;02.10.18 - Only prototype UI
5
;08.10.18 - Add ComboBox (Button + KMenu), small text
5
;08.10.18 - Add ComboBox (Button + KMenu), small text
6
 
6
 
7
format binary as ""
7
format binary as ""
8
use32
8
use32
9
	org 0
9
	org 0
10
	db 'MENUET01'
10
	db 'MENUET01'
11
	dd 1,start,i_end,mem,stacktop,file_name,sys_path
11
	dd 1,start,i_end,mem,stacktop,file_name,sys_path
12
 
12
 
13
include '../../macros.inc'
13
include '../../macros.inc'
14
include '../../proc32.inc'
14
include '../../proc32.inc'
15
include '../../KOSfuncs.inc'
15
include '../../KOSfuncs.inc'
16
include '../../load_img.inc'
16
include '../../load_img.inc'
-
 
17
include '../../load_lib.mac'
17
include '../../develop/libraries/libs-dev/libimg/libimg.inc'
18
include '../../develop/libraries/libs-dev/libimg/libimg.inc'
18
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
19
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
19
include 'lang.inc'
20
include 'lang.inc'
20
include 'cnc_control.inc'
21
include 'cnc_control.inc'
21
include '../../develop/info3ds/info_fun_float.inc'
22
include '../../develop/info3ds/info_fun_float.inc'
22
 
23
 
23
KMENUITEM_NORMAL equ 0
24
KMENUITEM_NORMAL equ 0
24
KMENUITEM_SUBMENU equ 1
25
KMENUITEM_SUBMENU equ 1
25
KMENUITEM_SEPARATOR equ 2
26
KMENUITEM_SEPARATOR equ 2
26
 
27
 
27
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
28
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
28
caption db 'CNC Control 22.05.19',0 ;¯®¤¯¨áì ®ª­ 
29
caption db 'CNC Control 18.12.20',0 ;¯®¤¯¨áì ®ª­ 
29
 
30
 
30
run_file_70 FileInfoBlock
31
run_file_70 FileInfoBlock
31
 
32
 
32
offs_last_timer dd 0 ;¯®á«¥¤­¨© ᤢ¨£ ¯®ª § ­ë© ¢ ä㭪樨 â ©¬¥à 
33
offs_last_timer dd 0 ;¯®á«¥¤­¨© ᤢ¨£ ¯®ª § ­ë© ¢ ä㭪樨 â ©¬¥à 
33
 
34
 
34
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
35
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
35
image_data_toolbar dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
36
image_data_toolbar dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
36
icon_tl_sys dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
37
icon_tl_sys dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
37
icon_toolbar dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï ¨ª®­®ª ®¡ê¥ªâ®¢
38
icon_toolbar dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï ¨ª®­®ª ®¡ê¥ªâ®¢
38
 
39
 
39
align 4
40
align 4
40
start:
41
start:
41
	;--- copy cmd line ---
42
	;--- copy cmd line ---
42
	mov esi,file_name
43
	mov esi,file_name
43
	mov edi,openfile_path
44
	mov edi,openfile_path
44
@@:
45
@@:
45
	lodsd
46
	lodsd
46
	or eax,eax
47
	or eax,eax
47
	jz @f ;¢ë室, ¥á«¨ 0
48
	jz @f ;¢ë室, ¥á«¨ 0
48
	stosd
49
	stosd
49
	jmp @b
50
	jmp @b
50
@@:
51
@@:
51
	stosd
52
	stosd
52
 
53
 
53
	load_libraries l_libs_start,l_libs_end
54
	load_libraries l_libs_start,l_libs_end
54
	;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
55
	;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
55
	mov	ebp,lib_0
56
	mov	ebp,lib_0
56
	cmp	dword [ebp+ll_struc_size-4],0
57
	cmp	dword [ebp+ll_struc_size-4],0
57
	jz	@f
58
	jz	@f
58
		mcall SF_TERMINATE_PROCESS
59
		mcall SF_TERMINATE_PROCESS
59
	@@:
60
	@@:
60
	mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
61
	mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
61
	mcall SF_SET_EVENTS_MASK,0xC0000027
62
	mcall SF_SET_EVENTS_MASK,0xC0000027
62
	stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
63
	stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
63
 
64
 
64
	stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
65
	stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
65
 
66
 
66
	;èà¨äâ ¤¥« ¥¬ ¤® ᮧ¤ ­¨ï ¯ ­¥«¨ (¤«ï íª®­®¬¨¨ 㪠§ â¥«ï image_data_toolbar)
67
	;èà¨äâ ¤¥« ¥¬ ¤® ᮧ¤ ­¨ï ¯ ­¥«¨ (¤«ï íª®­®¬¨¨ 㪠§ â¥«ï image_data_toolbar)
67
	include_image_file '..\..\fs\kfar\trunk\font6x9.bmp', image_data_toolbar, buf_1.w,buf_1.h
68
	include_image_file '..\..\fs\kfar\trunk\font6x9.bmp', image_data_toolbar, buf_1.w,buf_1.h
68
	stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;ᮧ¤ ¥¬ ¡ãä¥à
69
	stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;ᮧ¤ ¥¬ ¡ãä¥à
69
	stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
70
	stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
70
	stdcall [buf2d_conv_24_to_8], buf_1,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8 ¡¨â
71
	stdcall [buf2d_conv_24_to_8], buf_1,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8 ¡¨â
71
	stdcall [buf2d_convert_text_matrix], buf_1
72
	stdcall [buf2d_convert_text_matrix], buf_1
72
	mov eax,[buf_1.h]
73
	mov eax,[buf_1.h]
73
	shr eax,8
74
	shr eax,8
74
	mov [font_h],eax
75
	mov [font_h],eax
75
 
76
 
76
	include_image_file 'toolbar.png', image_data_toolbar
77
	include_image_file 'toolbar.png', image_data_toolbar
77
 
78
 
78
	;*** ãáâ ­®¢ª  ¢à¥¬¥­¨ ¤«ï â ©¬¥à 
79
	;*** ãáâ ­®¢ª  ¢à¥¬¥­¨ ¤«ï â ©¬¥à 
79
	mcall SF_SYSTEM_GET,SSF_TIME_COUNT
80
	mcall SF_SYSTEM_GET,SSF_TIME_COUNT
80
	mov [last_time],eax
81
	mov [last_time],eax
81
 
82
 
82
        ;call but_new_file
83
        ;call but_new_file
83
        option_boxes_set_sys_color sc,opt_grlist1
84
        option_boxes_set_sys_color sc,opt_grlist1
84
 
85
 
85
        ;progress bar
86
        ;progress bar
86
        mov    [pb.left],           dword  50
87
        mov    [pb.left],           dword  50
87
        mov    [pb.top],            dword  30
88
        mov    [pb.top],            dword  30
88
        mov    [pb.width],          dword  350
89
        mov    [pb.width],          dword  350
89
        mov    [pb.height],         dword  17
90
        mov    [pb.height],         dword  17
90
        mov    [pb.max],            dword  100;599
91
        mov    [pb.max],            dword  100;599
91
        mov    [pb.min],            dword  0 ;-397
92
        mov    [pb.min],            dword  0 ;-397
92
        mov    [pb.value],          dword  0 ;-397
93
        mov    [pb.value],          dword  0 ;-397
93
        mov    [pb.back_color],     dword 00C8D0D4h
94
        mov    [pb.back_color],     dword 00C8D0D4h
94
        mov    [pb.progress_color], dword 8072B7EBh
95
        mov    [pb.progress_color], dword 8072B7EBh
95
        mov    [pb.frame_color],    dword 00406175h
96
        mov    [pb.frame_color],    dword 00406175h
96
 
97
 
97
        ;port menu
98
        ;port menu
98
        stdcall [kmenu_init], sc    ;kmenu initialisation
99
        stdcall [kmenu_init], sc    ;kmenu initialisation
99
        ;stdcall [ksubmenu_new]
100
        ;stdcall [ksubmenu_new]
100
        ;mov [main_menu], eax
101
        ;mov [main_menu], eax
101
 
102
 
102
        stdcall [ksubmenu_new]
103
        stdcall [ksubmenu_new]
103
        mov [port_menu], eax
104
        mov [port_menu], eax
104
        stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_COMport, 110
105
        stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_COMport, 110
105
        stdcall [ksubmenu_add], [port_menu], eax
106
        stdcall [ksubmenu_add], [port_menu], eax
106
        stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_USBport, 111
107
        stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_USBport, 111
107
        stdcall [ksubmenu_add], [port_menu], eax
108
        stdcall [ksubmenu_add], [port_menu], eax
108
        ;stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0
109
        ;stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0
109
        ;stdcall [ksubmenu_add], [port_menu], eax
110
        ;stdcall [ksubmenu_add], [port_menu], eax
110
        ;stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_OTHERport, 112
111
        ;stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_OTHERport, 112
111
        ;stdcall [ksubmenu_add], [port_menu], eax
112
        ;stdcall [ksubmenu_add], [port_menu], eax
112
        stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_PortMenu, [port_menu]
113
        stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_PortMenu, [port_menu]
113
        ;stdcall [ksubmenu_add], [main_menu], eax
114
        ;stdcall [ksubmenu_add], [main_menu], eax
114
 
115
 
115
	;open file from cmd line
116
	;open file from cmd line
116
	cmp dword[openfile_path],0
117
	cmp dword[openfile_path],0
117
	je @f
118
	je @f
118
		call but_open_file.no_dlg
119
		call but_open_file.no_dlg
119
	@@:
120
	@@:
120
 
121
 
121
align 4
122
align 4
122
red_win:
123
red_win:
123
	call draw_window
124
	call draw_window
124
 
125
 
125
align 4
126
align 4
126
still:
127
still:
127
	mcall SF_SYSTEM_GET,SSF_TIME_COUNT
128
	mcall SF_SYSTEM_GET,SSF_TIME_COUNT
128
	mov ebx,[last_time]
129
	mov ebx,[last_time]
129
	add ebx,10 ;§ ¤¥à¦ª 
130
	add ebx,10 ;§ ¤¥à¦ª 
130
	cmp ebx,eax
131
	cmp ebx,eax
131
	jge @f
132
	jge @f
132
		mov ebx,eax
133
		mov ebx,eax
133
	@@:
134
	@@:
134
	sub ebx,eax
135
	sub ebx,eax
135
	mcall SF_WAIT_EVENT_TIMEOUT
136
	mcall SF_WAIT_EVENT_TIMEOUT
136
	cmp eax,0
137
	cmp eax,0
137
	jne @f
138
	jne @f
138
		call timer_funct
139
		call timer_funct
139
		jmp still
140
		jmp still
140
	@@:
141
	@@:
141
 
142
 
142
	cmp al,1
143
	cmp al,1
143
	jz red_win
144
	jz red_win
144
	cmp al,2
145
	cmp al,2
145
	jz key
146
	jz key
146
	cmp al,3
147
	cmp al,3
147
	jz button
148
	jz button
148
	cmp al,6
149
	cmp al,6
149
	jne @f
150
	jne @f
150
		mcall SF_THREAD_INFO,procinfo,-1
151
		mcall SF_THREAD_INFO,procinfo,-1
151
		cmp ax,word[procinfo.window_stack_position]
152
		cmp ax,word[procinfo.window_stack_position]
152
		jne @f ;®ª­® ­¥  ªâ¨¢­®
153
		jne @f ;®ª­® ­¥  ªâ¨¢­®
153
		call mouse
154
		call mouse
154
	@@:
155
	@@:
155
	jmp still
156
	jmp still
156
 
157
 
157
align 4
158
align 4
158
mouse:
159
mouse:
159
        stdcall [option_box_mouse], opt_grlist1
160
        stdcall [option_box_mouse], opt_grlist1
160
        stdcall [edit_box_mouse], editFileName
161
        stdcall [edit_box_mouse], editFileName
161
        stdcall [edit_box_mouse], editCommand
162
        stdcall [edit_box_mouse], editCommand
162
        stdcall [kmainmenu_dispatch_cursorevent], [port_menu] ;[main_menu]
163
        stdcall [kmainmenu_dispatch_cursorevent], [port_menu] ;[main_menu]
163
 
164
 
164
	push eax ebx ecx
165
	push eax ebx ecx
165
	mcall SF_MOUSE_GET,SSF_BUTTON_EXT
166
	mcall SF_MOUSE_GET,SSF_BUTTON_EXT
166
	bt eax,8
167
	bt eax,8
167
	jnc @f
168
	jnc @f
168
		;mouse l. but. press
169
		;mouse l. but. press
169
		call mouse_left_d
170
		call mouse_left_d
170
		jmp .end_l
171
		jmp .end_l
171
	@@:
172
	@@:
172
	bt eax,16
173
	bt eax,16
173
	jnc .end_l
174
	jnc .end_l
174
		;mouse l. but. up
175
		;mouse l. but. up
175
		call mouse_left_u
176
		call mouse_left_u
176
		;jmp .end_l
177
		;jmp .end_l
177
	.end_l:
178
	.end_l:
178
 
179
 
179
 
180
 
180
	call buf_get_mouse_coord
181
	call buf_get_mouse_coord
181
	cmp eax,-1
182
	cmp eax,-1
182
	je .end0
183
	je .end0
183
		shl eax,1
184
		shl eax,1
184
		sub eax,[buf_0.w]
185
		sub eax,[buf_0.w]
185
		sar eax,1
186
		sar eax,1
186
		mov [mouse_prop_x],eax
187
		mov [mouse_prop_x],eax
187
		mov ecx,ObjData
188
		mov ecx,ObjData
188
		shl ebx,1
189
		shl ebx,1
189
		sub ebx,[buf_0.h]
190
		sub ebx,[buf_0.h]
190
		sar ebx,1
191
		sar ebx,1
191
		mov [mouse_prop_y],ebx
192
		mov [mouse_prop_y],ebx
192
 
193
 
193
		mcall SF_MOUSE_GET,SSF_SCROLL_DATA
194
		mcall SF_MOUSE_GET,SSF_SCROLL_DATA
194
		test ax,ax
195
		test ax,ax
195
		jz .end0
196
		jz .end0
196
		finit
197
		finit
197
		fld qword[zoom_plus]
198
		fld qword[zoom_plus]
198
		fld1
199
		fld1
199
		fsubp
200
		fsubp
200
		fld st0 ;for Y coord
201
		fld st0 ;for Y coord
201
 
202
 
202
		;for X coord
203
		;for X coord
203
		fild dword[mouse_prop_x]
204
		fild dword[mouse_prop_x]
204
		fmulp st1,st0
205
		fmulp st1,st0
205
 
206
 
206
		mov ebx,eax
207
		mov ebx,eax
207
		test ax,0x8000
208
		test ax,0x8000
208
		jnz .decr
209
		jnz .decr
209
			;㢥«¨ç¥­¨¥ ¬ áèâ ¡ 
210
			;㢥«¨ç¥­¨¥ ¬ áèâ ¡ 
210
			fchs
211
			fchs
211
			fild dword[ecx+Figure.MCentrX] ;add old value
212
			fild dword[ecx+Figure.MCentrX] ;add old value
212
			fmul qword[zoom_plus]
213
			fmul qword[zoom_plus]
213
			faddp
214
			faddp
214
 
215
 
215
			fld qword[ecx+Figure.MScale]
216
			fld qword[ecx+Figure.MScale]
216
			fmul qword[zoom_plus]
217
			fmul qword[zoom_plus]
217
			;if (Figure.MScale>16.0)
218
			;if (Figure.MScale>16.0)
218
			;...
219
			;...
219
			jmp @f
220
			jmp @f
220
		.decr:
221
		.decr:
221
			;㬥­ì襭¨¥ ¬ áèâ ¡ 
222
			;㬥­ì襭¨¥ ¬ áèâ ¡ 
222
			fild dword[ecx+Figure.MCentrX] ;add old value
223
			fild dword[ecx+Figure.MCentrX] ;add old value
223
			fdiv qword[zoom_plus]
224
			fdiv qword[zoom_plus]
224
			faddp
225
			faddp
225
 
226
 
226
			fld qword[ecx+Figure.MScale]
227
			fld qword[ecx+Figure.MScale]
227
			fdiv qword[zoom_plus]
228
			fdiv qword[zoom_plus]
228
			fld1
229
			fld1
229
			fcomp
230
			fcomp
230
			fstsw ax
231
			fstsw ax
231
			sahf
232
			sahf
232
			jbe @f
233
			jbe @f
233
				;if (Figure.MScale<1.0)
234
				;if (Figure.MScale<1.0)
234
				ffree st0
235
				ffree st0
235
				fincstp
236
				fincstp
236
				ffree st0
237
				ffree st0
237
				fincstp
238
				fincstp
238
				fldz ;default Figure.MCentrX
239
				fldz ;default Figure.MCentrX
239
				fld1 ;default Figure.MScale
240
				fld1 ;default Figure.MScale
240
				mov dword[ecx+Figure.MCentrY],0
241
				mov dword[ecx+Figure.MCentrY],0
241
		@@:
242
		@@:
242
		fstp qword[ecx+Figure.MScale]
243
		fstp qword[ecx+Figure.MScale]
243
		fistp dword[ecx+Figure.MCentrX]
244
		fistp dword[ecx+Figure.MCentrX]
244
 
245
 
245
		;for Y coord
246
		;for Y coord
246
		fild dword[mouse_prop_y]
247
		fild dword[mouse_prop_y]
247
		fmulp st1,st0
248
		fmulp st1,st0
248
		test bx,0x8000
249
		test bx,0x8000
249
		jnz .decr_y
250
		jnz .decr_y
250
			;㢥«¨ç¥­¨¥ ¬ áèâ ¡ 
251
			;㢥«¨ç¥­¨¥ ¬ áèâ ¡ 
251
			fild dword[ecx+Figure.MCentrY] ;add old value
252
			fild dword[ecx+Figure.MCentrY] ;add old value
252
			fmul qword[zoom_plus]
253
			fmul qword[zoom_plus]
253
			faddp
254
			faddp
254
			jmp @f
255
			jmp @f
255
		.decr_y:
256
		.decr_y:
256
			;㬥­ì襭¨¥ ¬ áèâ ¡ 
257
			;㬥­ì襭¨¥ ¬ áèâ ¡ 
257
			fchs
258
			fchs
258
			fild dword[ecx+Figure.MCentrY] ;add old value
259
			fild dword[ecx+Figure.MCentrY] ;add old value
259
			fdiv qword[zoom_plus]
260
			fdiv qword[zoom_plus]
260
			faddp
261
			faddp
261
		@@:
262
		@@:
262
		fistp dword[ecx+Figure.MCentrY]
263
		fistp dword[ecx+Figure.MCentrY]
263
 
264
 
264
		mov dword[offs_last_timer],0
265
		mov dword[offs_last_timer],0
265
	.end0:
266
	.end0:
266
 
267
 
267
	pop ecx ebx eax
268
	pop ecx ebx eax
268
	ret
269
	ret
269
 
270
 
270
;output:
271
;output:
271
; eax - buffer coord X (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
272
; eax - buffer coord X (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
272
; ebx - buffer coord Y (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
273
; ebx - buffer coord Y (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
273
align 4
274
align 4
274
proc buf_get_mouse_coord
275
proc buf_get_mouse_coord
275
	mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
276
	mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
276
	cmp ax,word[buf_0.t]
277
	cmp ax,word[buf_0.t]
277
	jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ y
278
	jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ y
278
	mov ebx,eax
279
	mov ebx,eax
279
	shr ebx,16
280
	shr ebx,16
280
	cmp bx,word[buf_0.l]
281
	cmp bx,word[buf_0.l]
281
	jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ x
282
	jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ x
282
 
283
 
283
	and eax,0xffff ;®áâ ¢«ï¥¬ ª®®à¤¨­ âã y
284
	and eax,0xffff ;®áâ ¢«ï¥¬ ª®®à¤¨­ âã y
284
	sub ax,word[buf_0.t]
285
	sub ax,word[buf_0.t]
285
	cmp eax,[buf_0.h]
286
	cmp eax,[buf_0.h]
286
	jg .no_buf
287
	jg .no_buf
287
	sub bx,word[buf_0.l]
288
	sub bx,word[buf_0.l]
288
	cmp ebx,[buf_0.w]
289
	cmp ebx,[buf_0.w]
289
	jg .no_buf
290
	jg .no_buf
290
	xchg eax,ebx
291
	xchg eax,ebx
291
	jmp .end_f
292
	jmp .end_f
292
	.no_buf:
293
	.no_buf:
293
		xor eax,eax
294
		xor eax,eax
294
		not eax
295
		not eax
295
		xor ebx,ebx
296
		xor ebx,ebx
296
		not ebx
297
		not ebx
297
	.end_f:
298
	.end_f:
298
	ret
299
	ret
299
endp
300
endp
300
 
301
 
301
align 4
302
align 4
302
proc timer_funct uses eax ebx
303
proc timer_funct uses eax ebx
303
	mcall SF_SYSTEM_GET,SSF_TIME_COUNT
304
	mcall SF_SYSTEM_GET,SSF_TIME_COUNT
304
	mov [last_time],eax
305
	mov [last_time],eax
305
 
306
 
306
	cmp dword[offs_last_timer],ObjData
307
	cmp dword[offs_last_timer],ObjData
307
	je @f
308
	je @f
308
		mov dword[offs_last_timer],ObjData
309
		mov dword[offs_last_timer],ObjData
309
		stdcall draw_obj2d,ObjData
310
		stdcall draw_obj2d,ObjData
310
		stdcall [buf2d_draw], buf_0
311
		stdcall [buf2d_draw], buf_0
311
	@@:
312
	@@:
312
	ret
313
	ret
313
endp
314
endp
314
 
315
 
315
WINDOW_WIDTH  = 775
316
WINDOW_WIDTH  = 775
316
WINDOW_HEIGHT = 445
317
WINDOW_HEIGHT = 445
317
 
318
 
318
align 4
319
align 4
319
draw_window:
320
draw_window:
320
pushad
321
pushad
321
	mcall SF_REDRAW,SSF_BEGIN_DRAW
322
	mcall SF_REDRAW,SSF_BEGIN_DRAW
322
 
323
 
323
	; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
324
	; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
324
	mov edx,[sc.work]
325
	mov edx,[sc.work]
325
	or  edx,0x33000000
326
	or  edx,0x33000000
326
	mov edi,caption
327
	mov edi,caption
327
        mcall SF_CREATE_WINDOW,(20 shl 16)+WINDOW_WIDTH,(20 shl 16)+WINDOW_HEIGHT
328
        mcall SF_CREATE_WINDOW,(20 shl 16)+WINDOW_WIDTH,(20 shl 16)+WINDOW_HEIGHT
328
 
329
 
329
	mov ecx,[ObjData.FigCount]
330
	mov ecx,[ObjData.FigCount]
330
	or ecx,ecx
331
	or ecx,ecx
331
	jz .end0
332
	jz .end0
332
		mov eax,[ObjData.FigData]
333
		mov eax,[ObjData.FigData]
333
		xor edx,edx
334
		xor edx,edx
334
		.cycle0:
335
		.cycle0:
335
			stdcall FigCalculateSizes,[eax+4*edx],0
336
			stdcall FigCalculateSizes,[eax+4*edx],0
336
			inc edx
337
			inc edx
337
			loop .cycle0
338
			loop .cycle0
338
		stdcall ObjCalculateScale,ObjData
339
		stdcall ObjCalculateScale,ObjData
339
		mov dword[offs_last_timer],0
340
		mov dword[offs_last_timer],0
340
		call timer_funct
341
		call timer_funct
341
	.end0:
342
	.end0:
342
 
343
 
343
	stdcall [edit_box_draw], editFileName
344
	stdcall [edit_box_draw], editFileName
344
	stdcall [edit_box_draw], editCommand
345
	stdcall [edit_box_draw], editCommand
345
 
346
 
346
        stdcall [option_box_draw], opt_grlist1
347
        stdcall [option_box_draw], opt_grlist1
347
        push   pb
348
        push   pb
348
        call   [progressbar_draw]
349
        call   [progressbar_draw]
349
 
350
 
350
	; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
351
	; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
351
	mcall SF_DEFINE_BUTTON,(731 shl 16)+20,(75 shl 16)+20,3, [sc.work_button]
352
	mcall SF_DEFINE_BUTTON,(731 shl 16)+20,(75 shl 16)+20,3, [sc.work_button]
352
	mcall , (15 shl 16)+20,(27 shl 16)+20,4 ;restore
353
	mcall , (15 shl 16)+20,(27 shl 16)+20,4 ;restore
353
	mcall ,(538 shl 16)+20,,5 ;connect
354
	mcall ,(538 shl 16)+20,,5 ;connect
354
	mcall ,(563 shl 16)+20,,6 ;close connect
355
	mcall ,(563 shl 16)+20,,6 ;close connect
355
	mcall ,(437 shl 16)+86,(378 shl 16)+20,7 ;cancel
356
	mcall ,(437 shl 16)+86,(378 shl 16)+20,7 ;cancel
356
	mcall ,(616 shl 16)+136,(378 shl 16)+20,8 ;run
357
	mcall ,(616 shl 16)+136,(378 shl 16)+20,8 ;run
357
 
358
 
358
	; ***
359
	; ***
359
	mov ecx,[sc.work_text]
360
	mov ecx,[sc.work_text]
360
        or ecx,0x80000000 ;0x81000000
361
        or ecx,0x80000000 ;0x81000000
361
        textYcoord = 13;5
362
        textYcoord = 13;5
362
        mcall SF_DRAW_TEXT,(15 shl 16)+textYcoord,,txt_preview
363
        mcall SF_DRAW_TEXT,(15 shl 16)+textYcoord,,txt_preview
363
        mcall ,(424 shl 16)+textYcoord,,txt_port
364
        mcall ,(424 shl 16)+textYcoord,,txt_port
364
	mov ecx,[sc.work_button_text]
365
	mov ecx,[sc.work_button_text]
365
	or ecx,0x81000000
366
	or ecx,0x81000000
366
	mcall ,(440 shl 16)+381,,txt_but_cancel
367
	mcall ,(440 shl 16)+381,,txt_but_cancel
367
	mcall ,(619 shl 16)+381,,txt_but_run
368
	mcall ,(619 shl 16)+381,,txt_but_run
368
 
369
 
369
	; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
370
	; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
370
	mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16,(733 shl 16)+77 ;icon open
371
	mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16,(733 shl 16)+77 ;icon open
371
 
372
 
372
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
373
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
373
	mcall ,,,(17 shl 16)+29 ;restore scale
374
	mcall ,,,(17 shl 16)+29 ;restore scale
374
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
375
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
375
	mcall ,,,(540 shl 16)+29 ;connect
376
	mcall ,,,(540 shl 16)+29 ;connect
376
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
377
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
377
	mcall ,,,(565 shl 16)+29 ;close connect
378
	mcall ,,,(565 shl 16)+29 ;close connect
378
	;;add ebx,IMAGE_TOOLBAR_ICON_SIZE
379
	;;add ebx,IMAGE_TOOLBAR_ICON_SIZE
379
	;;mcall ,,,(439 shl 16)+380 ;cancel
380
	;;mcall ,,,(439 shl 16)+380 ;cancel
380
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
381
	add ebx,IMAGE_TOOLBAR_ICON_SIZE
381
	mcall ,,,((638+97) shl 16)+380 ;run
382
	mcall ,,,((638+97) shl 16)+380 ;run
382
 
383
 
383
	stdcall [buf2d_draw], buf_0
384
	stdcall [buf2d_draw], buf_0
384
 
385
 
385
        ;delete port button, if it exist
386
        ;delete port button, if it exist
386
        mov edx, 0x80000008
387
        mov edx, 0x80000008
387
        mcall 8
388
        mcall SF_DEFINE_BUTTON
388
        ;draw button PORT
389
        ;draw button PORT
389
        buttonPortX = 433
390
        buttonPortX = 433
390
        buttonPortY = 27 ;50
391
        buttonPortY = 27 ;50
391
        buttonPortTextXoffset = 5
392
        buttonPortTextXoffset = 5
392
        mov ebx, buttonPortX*65536 + 95   ;X + Width
-
 
393
        mov ecx, buttonPortY*65536 + 20   ;Y + Height
-
 
394
        mov edx, 0x00000008       ;button id
-
 
395
        mov esi, 0x00AABBCC       ;color button
393
        mov esi, 0x00AABBCC       ;color button
396
        mcall 8
394
        mcall SF_DEFINE_BUTTON, buttonPortX*65536 + 95, buttonPortY*65536 + 20, 8
397
        ;draw text for button PORT
395
        ;draw text for button PORT
398
        mov     ebx, (buttonPortX+buttonPortTextXoffset) * 65536 + (buttonPortY+6)    ;(x, y)
396
        mov     ebx, (buttonPortX+buttonPortTextXoffset) * 65536 + (buttonPortY+6)    ;(x, y)
399
        mov     ecx, 0xFFFFFF
-
 
400
        mov     edx, sz_PortMenu
-
 
401
        mov     esi, 11
397
        mov     esi, 11
402
        mcall 4
398
        mcall SF_DRAW_TEXT,, 0xFFFFFF, sz_PortMenu
403
        ;stdcall [kmainmenu_draw], [main_menu]
399
        ;stdcall [kmainmenu_draw], [main_menu]
404
        ;mov word[coord.x], 0
400
        ;mov word[coord.x], 0
405
        ;mov word[coord.y], 0
401
        ;mov word[coord.y], 0
406
        ;stdcall [ksubmenu_draw], [port_menu], coord
402
        ;stdcall [ksubmenu_draw], [port_menu], coord
407
 
403
 
408
	mcall SF_REDRAW,SSF_END_DRAW
404
	mcall SF_REDRAW,SSF_END_DRAW
409
popad
405
popad
410
	ret
406
	ret
411
 
407
 
412
align 4
408
align 4
413
key:
409
key:
414
	mcall SF_GET_KEY
410
	mcall SF_GET_KEY
415
	
411
	
416
        stdcall [edit_box_key], editFileName
412
        stdcall [edit_box_key], editFileName
417
        stdcall [edit_box_key], editCommand
413
        stdcall [edit_box_key], editCommand
418
        
414
        
419
	mov ecx,eax
415
	mov ecx,eax
420
	mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS
416
	mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS
421
	bt eax,2 ;left Ctrl
417
	bt eax,2 ;left Ctrl
422
	jc .key_Ctrl
418
	jc .key_Ctrl
423
	bt eax,3 ;right Ctrl
419
	bt eax,3 ;right Ctrl
424
	jc .key_Ctrl
420
	jc .key_Ctrl
425
	jmp .end0
421
	jmp .end0
426
	.key_Ctrl:
422
	.key_Ctrl:
427
		cmp ch,15 ;111 ;Ctrl+O
423
		cmp ch,15 ;111 ;Ctrl+O
428
		jne @f
424
		jne @f
429
			call but_open_file
425
			call but_open_file
430
		@@:
426
		@@:
431
	.end0:
427
	.end0:
432
	jmp still
428
	jmp still
433
 
429
 
434
align 4
430
align 4
435
button:
431
button:
436
	mcall SF_GET_BUTTON
432
	mcall SF_GET_BUTTON
437
 
433
 
438
	cmp ah,3
434
	cmp ah,3
439
	jne @f
435
	jne @f
440
		call but_open_file
436
		call but_open_file
441
		jmp still
437
		jmp still
442
	@@:
438
	@@:
443
	cmp ah,4
439
	cmp ah,4
444
	jne @f
440
	jne @f
445
		call but_restore_zoom
441
		call but_restore_zoom
446
		jmp still
442
		jmp still
447
	@@:
443
	@@:
448
        cmp ah, 8
444
        cmp ah, 8
449
        jne @f
445
        jne @f
450
                push eax ebx ecx
446
                push eax ebx ecx
451
                mcall 9, pi, -1 ;get window coord
447
                mcall SF_THREAD_INFO, pi, -1 ;get window coord
452
 
448
 
453
                mov eax, dword[pi+34]
449
                mov eax, dword[pi+34]
454
                add eax, buttonPortX + 5
450
                add eax, buttonPortX + 5
455
                mov word[coord.x], ax
451
                mov word[coord.x], ax
456
 
452
 
457
                mov eax, dword[pi+38]
453
                mov eax, dword[pi+38]
458
                add eax, buttonPortY + 42
454
                add eax, buttonPortY + 42
459
                mov word[coord.y], ax
455
                mov word[coord.y], ax
460
 
456
 
461
                stdcall [ksubmenu_draw], [port_menu], coord
457
                stdcall [ksubmenu_draw], [port_menu], coord
462
                pop ecx ebx eax
458
                pop ecx ebx eax
463
        @@:
459
        @@:
464
	;cmp ah,5
460
	;cmp ah,5
465
	;jne @f
461
	;jne @f
466
		;call but_...
462
		;call but_...
467
		;jmp still
463
		;jmp still
468
	;@@:
464
	;@@:
469
	cmp ah,1
465
	cmp ah,1
470
	jne still
466
	jne still
471
.exit:
467
.exit:
472
	stdcall [buf2d_delete],buf_0
468
	stdcall [buf2d_delete],buf_0
473
	stdcall mem.Free,[image_data_toolbar]
469
	stdcall mem.Free,[image_data_toolbar]
474
	stdcall mem.Free,[open_file_data]
470
	stdcall mem.Free,[open_file_data]
475
	mcall SF_TERMINATE_PROCESS
471
	mcall SF_TERMINATE_PROCESS
476
 
472
 
477
 
473
 
478
 
474
 
479
align 4
475
align 4
480
open_file_data dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ä ©«®¢
476
open_file_data dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ä ©«®¢
481
open_file_size dd 0 ;à §¬¥à ®âªàë⮣® ä ©« 
477
open_file_size dd 0 ;à §¬¥à ®âªàë⮣® ä ©« 
482
 
478
 
483
align 4
479
align 4
484
but_open_file:
480
but_open_file:
485
	copy_path open_dialog_name,communication_area_default_path,file_name,0
481
	copy_path open_dialog_name,communication_area_default_path,file_name,0
486
	pushad
482
	pushad
487
	mov [OpenDialog_data.type],0
483
	mov [OpenDialog_data.type],0
488
	stdcall [OpenDialog_Start],OpenDialog_data
484
	stdcall [OpenDialog_Start],OpenDialog_data
489
	cmp [OpenDialog_data.status],2
485
	cmp [OpenDialog_data.status],2
490
	je .end_open_file
486
	je .end_open_file
491
	;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
487
	;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
492
	jmp .end0
488
	jmp .end0
493
.no_dlg: ;¥á«¨ ¬¨­ã¥¬ ¤¨ «®£ ®âªàëâ¨ï ä ©« 
489
.no_dlg: ;¥á«¨ ¬¨­ã¥¬ ¤¨ «®£ ®âªàëâ¨ï ä ©« 
494
		pushad
490
		pushad
495
		mov esi,openfile_path
491
		mov esi,openfile_path
496
		stdcall str_len,esi
492
		stdcall str_len,esi
497
		add esi,eax
493
		add esi,eax
498
		@@: ;横« ¤«ï ¯®¨áª  ­ ç «  ¨¬¥­¨ ä ©« 
494
		@@: ;横« ¤«ï ¯®¨áª  ­ ç «  ¨¬¥­¨ ä ©« 
499
			dec esi
495
			dec esi
500
			cmp byte[esi],'/'
496
			cmp byte[esi],'/'
501
			je @f
497
			je @f
502
			cmp byte[esi],0x5c ;'\'
498
			cmp byte[esi],0x5c ;'\'
503
			je @f
499
			je @f
504
			cmp esi,openfile_path
500
			cmp esi,openfile_path
505
			jg @b
501
			jg @b
506
		@@:
502
		@@:
507
		inc esi
503
		inc esi
508
		stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;ª®¯¨à㥬 ¨¬ï ä ©«  ¢ ¤¨ «®£ á®åà ­¥­¨ï
504
		stdcall [OpenDialog_Set_file_name],OpenDialog_data,esi ;ª®¯¨à㥬 ¨¬ï ä ©«  ¢ ¤¨ «®£ á®åà ­¥­¨ï
509
	.end0:
505
	.end0:
510
        push eax ebx ecx edx    ;copy file name path from OpenDialog
506
        push eax ebx ecx edx    ;copy file name path from OpenDialog
511
        mov eax, openfile_path
507
        mov eax, openfile_path
512
        mov ebx, fileNameBuffer ;.data
508
        mov ebx, fileNameBuffer ;.data
513
        mov ecx, 0
509
        mov ecx, 0
514
      @@:
510
      @@:
515
        mov dl, byte[eax]
511
        mov dl, byte[eax]
516
        cmp dl, 0 ;byte[eax], 0
512
        cmp dl, 0 ;byte[eax], 0
517
        je @f
513
        je @f
518
        mov byte[ebx], dl
514
        mov byte[ebx], dl
519
        inc eax
515
        inc eax
520
        inc ebx
516
        inc ebx
521
        inc ecx
517
        inc ecx
522
        jmp @b
518
        jmp @b
523
      @@:
519
      @@:
524
        mov byte[ebx], 0
520
        mov byte[ebx], 0
525
        mov dword[fileNameBuffer.size], ecx
521
        mov dword[fileNameBuffer.size], ecx
526
        mov dword[editFileName.size], ecx
522
        mov dword[editFileName.size], ecx
527
        mov dword[editFileName.pos], ecx
523
        mov dword[editFileName.pos], ecx
528
        pop edx ecx ebx eax
524
        pop edx ecx ebx eax
529
 
525
 
530
	mov [run_file_70.Function], SSF_GET_INFO
526
	mov [run_file_70.Function], SSF_GET_INFO
531
	mov [run_file_70.Position], 0
527
	mov [run_file_70.Position], 0
532
	mov [run_file_70.Flags], 0
528
	mov [run_file_70.Flags], 0
533
	mov dword[run_file_70.Count], 0
529
	mov dword[run_file_70.Count], 0
534
	mov dword[run_file_70.Buffer], open_b
530
	mov dword[run_file_70.Buffer], open_b
535
	mov byte[run_file_70+20], 0
531
	mov byte[run_file_70+20], 0
536
	mov dword[run_file_70.FileName], openfile_path
532
	mov dword[run_file_70.FileName], openfile_path
537
	mcall SF_FILE,run_file_70
533
	mcall SF_FILE,run_file_70
538
 
534
 
539
	mov ecx,dword[open_b+32] ;+32 qword: à §¬¥à ä ©«  ¢ ¡ ©â å
535
	mov ecx,dword[open_b+32] ;+32 qword: à §¬¥à ä ©«  ¢ ¡ ©â å
540
	inc ecx ;for text files
536
	inc ecx ;for text files
541
	stdcall mem.ReAlloc,[open_file_data],ecx
537
	stdcall mem.ReAlloc,[open_file_data],ecx
542
	mov [open_file_data],eax
538
	mov [open_file_data],eax
543
	dec ecx ;for text files
539
	dec ecx ;for text files
544
	mov byte[eax+ecx],0 ;for text files
540
	mov byte[eax+ecx],0 ;for text files
545
 
541
 
546
	mov [run_file_70.Function], SSF_READ_FILE
542
	mov [run_file_70.Function], SSF_READ_FILE
547
	mov [run_file_70.Position], 0
543
	mov [run_file_70.Position], 0
548
	mov [run_file_70.Flags], 0
544
	mov [run_file_70.Flags], 0
549
	mov dword[run_file_70.Count], ecx
545
	mov dword[run_file_70.Count], ecx
550
	m2m dword[run_file_70.Buffer], dword[open_file_data]
546
	m2m dword[run_file_70.Buffer], dword[open_file_data]
551
	mov byte[run_file_70+20], 0
547
	mov byte[run_file_70+20], 0
552
	mov dword[run_file_70.FileName], openfile_path
548
	mov dword[run_file_70.FileName], openfile_path
553
	mcall SF_FILE,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
549
	mcall SF_FILE,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
554
	test eax,eax
550
	test eax,eax
555
	jnz .end_open_file
551
	jnz .end_open_file
556
	cmp ebx,0xffffffff
552
	cmp ebx,0xffffffff
557
	je .end_open_file
553
	je .end_open_file
558
		mov [open_file_size],ebx
554
		mov [open_file_size],ebx
559
		mcall SF_SET_CAPTION,1,openfile_path
555
		mcall SF_SET_CAPTION,1,openfile_path
560
 
556
 
561
		stdcall FileInit,[open_file_data],[open_file_size]
557
		stdcall FileInit,[open_file_data],[open_file_size]
562
		stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
558
		stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
563
		stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
559
		stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
564
	.end_open_file:
560
	.end_open_file:
565
	popad
561
	popad
566
	ret
562
	ret
567
 
563
 
568
;output:
564
;output:
569
; ecx - memory size for save file
565
; ecx - memory size for save file
570
align 4
566
align 4
571
proc get_file_save_size uses eax ebx edx esi
567
proc get_file_save_size uses eax ebx edx esi
572
	mov ecx,100 ;title
568
	mov ecx,100 ;title
573
	mov ebx,ObjData
569
	mov ebx,ObjData
574
	add ecx,50 ;object
570
	add ecx,50 ;object
575
	mov edx,[ebx+Object.FigCount]
571
	mov edx,[ebx+Object.FigCount]
576
	or edx,edx
572
	or edx,edx
577
	jz .cycle1end
573
	jz .cycle1end
578
	mov esi,[ebx+Object.FigData]
574
	mov esi,[ebx+Object.FigData]
579
align 4
575
align 4
580
	.cycle1: ; 横« ¯® 䨣ãà ¬
576
	.cycle1: ; 横« ¯® 䨣ãà ¬
581
		add ecx,80 ;figure
577
		add ecx,80 ;figure
582
		mov eax,[esi]
578
		mov eax,[esi]
583
		or eax,eax
579
		or eax,eax
584
		jz @f
580
		jz @f
585
			mov eax,[eax+Figure.PoiCount]
581
			mov eax,[eax+Figure.PoiCount]
586
			imul eax,70
582
			imul eax,70
587
			add ecx,eax ;points
583
			add ecx,eax ;points
588
		@@:
584
		@@:
589
		add esi,4
585
		add esi,4
590
		dec edx
586
		dec edx
591
		jnz .cycle1
587
		jnz .cycle1
592
	.cycle1end:
588
	.cycle1end:
593
	ret
589
	ret
594
endp
590
endp
595
 
591
 
596
align 4
592
align 4
597
proc but_restore_zoom
593
proc but_restore_zoom
598
	finit
594
	finit
599
	fld1
595
	fld1
600
	fstp qword[ObjData.MScale]
596
	fstp qword[ObjData.MScale]
601
	mov dword[ObjData.MCentrX],0
597
	mov dword[ObjData.MCentrX],0
602
	mov dword[ObjData.MCentrY],0
598
	mov dword[ObjData.MCentrY],0
603
	mov dword[offs_last_timer],0
599
	mov dword[offs_last_timer],0
604
	ret
600
	ret
605
endp
601
endp
606
 
602
 
607
;input:
603
;input:
608
; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
604
; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
609
;output:
605
;output:
610
; eax - ç¨á«®
606
; eax - ç¨á«®
611
align 4
607
align 4
612
proc conv_str_to_int uses ebx ecx esi, buf:dword
608
proc conv_str_to_int uses ebx ecx esi, buf:dword
613
	xor eax,eax
609
	xor eax,eax
614
	xor ebx,ebx
610
	xor ebx,ebx
615
	mov esi,[buf]
611
	mov esi,[buf]
616
 
612
 
617
	;­  á«ãç © ¥á«¨ ¯¥à¥¤ ç¨á«®¬ ­ å®¤ïâáï ¯à®¡¥«ë
613
	;­  á«ãç © ¥á«¨ ¯¥à¥¤ ç¨á«®¬ ­ å®¤ïâáï ¯à®¡¥«ë
618
	@@:
614
	@@:
619
	cmp byte[esi],' '
615
	cmp byte[esi],' '
620
	jne @f
616
	jne @f
621
		inc esi
617
		inc esi
622
		jmp @b
618
		jmp @b
623
	@@:
619
	@@:
624
 
620
 
625
	;®¯à¥¤¥«¥­¨¥ ®âà¨æ â¥«ì­ëå ç¨á¥«
621
	;®¯à¥¤¥«¥­¨¥ ®âà¨æ â¥«ì­ëå ç¨á¥«
626
	xor ecx,ecx
622
	xor ecx,ecx
627
	inc ecx
623
	inc ecx
628
	cmp byte[esi],'-'
624
	cmp byte[esi],'-'
629
	jne @f
625
	jne @f
630
		dec ecx
626
		dec ecx
631
		inc esi
627
		inc esi
632
	@@:
628
	@@:
633
 
629
 
634
	cmp word[esi],'0x'
630
	cmp word[esi],'0x'
635
	je .load_digit_16
631
	je .load_digit_16
636
 
632
 
637
	.load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
633
	.load_digit_10: ;áç¨â뢠­¨¥ 10-â¨ç­ëå æ¨äà
638
		mov bl,byte[esi]
634
		mov bl,byte[esi]
639
		cmp bl,'0'
635
		cmp bl,'0'
640
		jl @f
636
		jl @f
641
		cmp bl,'9'
637
		cmp bl,'9'
642
		jg @f
638
		jg @f
643
			sub bl,'0'
639
			sub bl,'0'
644
			imul eax,10
640
			imul eax,10
645
			add eax,ebx
641
			add eax,ebx
646
			inc esi
642
			inc esi
647
			jmp .load_digit_10
643
			jmp .load_digit_10
648
	jmp @f
644
	jmp @f
649
 
645
 
650
	.load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
646
	.load_digit_16: ;áç¨â뢠­¨¥ 16-à¨ç­ëå æ¨äà
651
		add esi,2
647
		add esi,2
652
	.cycle_16:
648
	.cycle_16:
653
		mov bl,byte[esi]
649
		mov bl,byte[esi]
654
		cmp bl,'0'
650
		cmp bl,'0'
655
		jl @f
651
		jl @f
656
		cmp bl,'f'
652
		cmp bl,'f'
657
		jg @f
653
		jg @f
658
		cmp bl,'9'
654
		cmp bl,'9'
659
		jle .us1
655
		jle .us1
660
			cmp bl,'A'
656
			cmp bl,'A'
661
			jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
657
			jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'9' ¨ <'A'
662
		.us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
658
		.us1: ;á®áâ ¢­®¥ ãá«®¢¨¥
663
		cmp bl,'F'
659
		cmp bl,'F'
664
		jle .us2
660
		jle .us2
665
			cmp bl,'a'
661
			cmp bl,'a'
666
			jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
662
			jl @f ;®âᥨ¢ ¥¬ ᨬ¢®«ë >'F' ¨ <'a'
667
			sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
663
			sub bl,32 ;¯¥à¥¢®¤¨¬ ᨬ¢®«ë ¢ ¢¥àå­¨© ॣ¨áâà, ¤«ï ã¯à®é¥­¨ï ¨å ¯®á«¥¤ã饩 ®¡à ¡®âª¨
668
		.us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
664
		.us2: ;á®áâ ¢­®¥ ãá«®¢¨¥
669
			sub bl,'0'
665
			sub bl,'0'
670
			cmp bl,9
666
			cmp bl,9
671
			jle .cor1
667
			jle .cor1
672
				sub bl,7 ;convert 'A' to '10'
668
				sub bl,7 ;convert 'A' to '10'
673
			.cor1:
669
			.cor1:
674
			shl eax,4
670
			shl eax,4
675
			add eax,ebx
671
			add eax,ebx
676
			inc esi
672
			inc esi
677
			jmp .cycle_16
673
			jmp .cycle_16
678
	@@:
674
	@@:
679
	cmp ecx,0 ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
675
	or ecx,ecx ;¥á«¨ ç¨á«® ®âà¨æ â¥«ì­®¥
680
	jne @f
676
	jnz @f
681
		sub ecx,eax
677
		sub ecx,eax
682
		mov eax,ecx
678
		mov eax,ecx
683
	@@:
679
	@@:
684
	ret
680
	ret
685
endp
681
endp
686
 
682
 
687
 
683
 
688
;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
684
;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
689
align 4
685
align 4
690
OpenDialog_data:
686
OpenDialog_data:
691
.type			dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
687
.type			dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
692
.procinfo		dd procinfo	;+4
688
.procinfo		dd procinfo	;+4
693
.com_area_name		dd communication_area_name	;+8
689
.com_area_name		dd communication_area_name	;+8
694
.com_area		dd 0	;+12
690
.com_area		dd 0	;+12
695
.opendir_path		dd plugin_path	;+16
691
.opendir_path		dd plugin_path	;+16
696
.dir_default_path	dd default_dir ;+20
692
.dir_default_path	dd default_dir ;+20
697
.start_path		dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
693
.start_path		dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
698
.draw_window		dd draw_window	;+28
694
.draw_window		dd draw_window	;+28
699
.status 		dd 0	;+32
695
.status 		dd 0	;+32
700
.openfile_path		dd openfile_path	;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
696
.openfile_path		dd openfile_path	;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
701
.filename_area		dd filename_area	;+40
697
.filename_area		dd filename_area	;+40
702
.filter_area		dd Filter
698
.filter_area		dd Filter
703
.x:
699
.x:
704
.x_size 		dw 420 ;+48 ; Window X size
700
.x_size 		dw 420 ;+48 ; Window X size
705
.x_start		dw 10 ;+50 ; Window X position
701
.x_start		dw 10 ;+50 ; Window X position
706
.y:
702
.y:
707
.y_size 		dw 320 ;+52 ; Window y size
703
.y_size 		dw 320 ;+52 ; Window y size
708
.y_start		dw 10 ;+54 ; Window Y position
704
.y_start		dw 10 ;+54 ; Window Y position
709
 
705
 
710
default_dir db '/rd/1',0
706
default_dir db '/rd/1',0
711
 
707
 
712
communication_area_name:
708
communication_area_name:
713
	db 'FFFFFFFF_open_dialog',0
709
	db 'FFFFFFFF_open_dialog',0
714
open_dialog_name:
710
open_dialog_name:
715
	db 'opendial',0
711
	db 'opendial',0
716
communication_area_default_path:
712
communication_area_default_path:
717
	db '/rd/1/File managers/',0
713
	db '/rd/1/File managers/',0
718
 
714
 
719
Filter:
715
Filter:
720
dd Filter.end - Filter ;.1
716
dd Filter.end - Filter ;.1
721
.1:
717
.1:
722
db 'NC',0
718
db 'NC',0
723
db 'PNG',0
719
db 'PNG',0
724
.end:
720
.end:
725
db 0
721
db 0
726
 
722
 
727
 
723
 
728
;[
724
;[
729
;for test
725
;for test
730
main_menu dd 0
726
main_menu dd 0
731
port_menu dd 0
727
port_menu dd 0
732
 
728
 
733
sz_PortMenu  db 'COM 12     ',0
729
sz_PortMenu  db 'COM 12     ',0
734
sz_COMport   db 'COM port 12',0
730
sz_COMport   db 'COM port 12',0
735
sz_USBport   db 'USB port   ',0
731
sz_USBport   db 'USB port   ',0
736
sz_OTHERport db 'Other port ',0
732
sz_OTHERport db 'Other port ',0
737
 
733
 
738
coord:
734
coord:
739
  .x dw 100
735
  .x dw 100
740
  .y dw 200
736
  .y dw 200
741
;]
737
;]
742
 
738
 
743
align 4
739
align 4
744
system_dir_0 db '/sys/lib/'
740
system_dir_0 db '/sys/lib/'
745
lib_name_0 db 'proc_lib.obj',0
741
lib_name_0 db 'proc_lib.obj',0
746
system_dir_1 db '/sys/lib/'
742
system_dir_1 db '/sys/lib/'
747
lib_name_1 db 'libimg.obj',0
743
lib_name_1 db 'libimg.obj',0
748
system_dir_2 db '/sys/lib/'
744
system_dir_2 db '/sys/lib/'
749
lib_name_2 db 'buf2d.obj',0
745
lib_name_2 db 'buf2d.obj',0
750
system_dir_3 db '/sys/lib/'
746
system_dir_3 db '/sys/lib/'
751
lib_name_3 db 'box_lib.obj',0
747
lib_name_3 db 'box_lib.obj',0
752
system_dir_4 db '/sys/lib/'
748
system_dir_4 db '/sys/lib/'
753
lib_name_4 db 'kmenu.obj',0
749
lib_name_4 db 'kmenu.obj',0
754
 
-
 
755
head_f_i:
-
 
756
if lang eq ru
-
 
757
	head_f_l db '"‘¨á⥬­ ï ®è¨¡ª ',0
-
 
758
	err_message_found_lib_0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,'" -tE',0
-
 
759
	err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,'" -tW',0
-
 
760
	err_message_found_lib_1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,'" -tE',0
-
 
761
	err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,'" -tW',0
-
 
762
	err_msg_found_lib_2 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,'" -tE',0
-
 
763
	err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,'" -tW',0
-
 
764
	err_msg_found_lib_3 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'box_lib.obj',39,'" -tE',0
-
 
765
	err_msg_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'box_lib',39,'" -tW',0
-
 
766
	err_msg_found_lib_4 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'kmenu.obj',39,'" -tE',0
-
 
767
	err_msg_import_4 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'kmenu',39,'" -tW',0
-
 
768
else
-
 
769
	head_f_l db '"System error',0
-
 
770
	err_message_found_lib_0 db 'Sorry I cannot found library ',39,'proc_lib.obj',39,'" -tE',0
-
 
771
	err_message_import_0 db 'Error on load import library ',39,'proc_lib.obj',39,'" -tW',0
-
 
772
	err_message_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,'" -tE',0
-
 
773
	err_message_import_1 db 'Error on load import library ',39,'libimg.obj',39,'" -tW',0
-
 
774
	err_msg_found_lib_2 db 'Sorry I cannot found library ',39,'buf2d.obj',39,'" -tE',0
-
 
775
	err_msg_import_2 db 'Error on load import library ',39,'buf2d',39,'" -tW',0
-
 
776
	err_msg_found_lib_3 db 'Sorry I cannot found library ',39,'box_lib.obj',39,'" -tE',0
-
 
777
	err_msg_import_3 db 'Error on load import library ',39,'box_lib',39,'" -tW',0
-
 
778
	err_msg_found_lib_4 db 'Sorry I cannot found library ',39,'kmenu.obj',39,'" -tE',0
-
 
779
	err_msg_import_4 db 'Error on load import library ',39,'kmenu',39,'" -tW',0
-
 
780
end if
-
 
781
 
750
 
782
align 4
751
align 4
783
l_libs_start:
752
l_libs_start:
784
	lib_0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
-
 
785
		err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
753
	lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib
786
	lib_1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\
-
 
787
		err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
754
	lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg
788
	lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\
-
 
789
		err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i
755
	lib_2 l_libs lib_name_2, file_name, system_dir_2, import_buf2d
790
	lib_3 l_libs lib_name_3, sys_path, file_name,  system_dir_3,\
-
 
791
		err_msg_found_lib_3, head_f_l, import_box_lib,err_msg_import_3,head_f_i
756
	lib_3 l_libs lib_name_3, file_name, system_dir_3, import_box_lib
792
        lib_4 l_libs lib_name_4, sys_path, file_name, system_dir_4,\
-
 
793
                err_msg_found_lib_4, head_f_l, import_libkmenu,err_msg_import_4,head_f_i
757
	lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libkmenu
794
l_libs_end:
758
l_libs_end:
795
 
759
 
796
align 4
760
align 4
797
import_libimg:
761
import_libimg:
798
	dd alib_init1
762
	dd alib_init1
799
	img_is_img  dd aimg_is_img
763
	img_is_img  dd aimg_is_img
800
	img_info    dd aimg_info
764
	img_info    dd aimg_info
801
	img_from_file dd aimg_from_file
765
	img_from_file dd aimg_from_file
802
	img_to_file dd aimg_to_file
766
	img_to_file dd aimg_to_file
803
	img_from_rgb dd aimg_from_rgb
767
	img_from_rgb dd aimg_from_rgb
804
	img_to_rgb  dd aimg_to_rgb
768
	img_to_rgb  dd aimg_to_rgb
805
	img_to_rgb2 dd aimg_to_rgb2
769
	img_to_rgb2 dd aimg_to_rgb2
806
	img_decode  dd aimg_decode
770
	img_decode  dd aimg_decode
807
	img_encode  dd aimg_encode
771
	img_encode  dd aimg_encode
808
	img_create  dd aimg_create
772
	img_create  dd aimg_create
809
	img_destroy dd aimg_destroy
773
	img_destroy dd aimg_destroy
810
	img_destroy_layer dd aimg_destroy_layer
774
	img_destroy_layer dd aimg_destroy_layer
811
	img_count   dd aimg_count
775
	img_count   dd aimg_count
812
	img_lock_bits dd aimg_lock_bits
776
	img_lock_bits dd aimg_lock_bits
813
	img_unlock_bits dd aimg_unlock_bits
777
	img_unlock_bits dd aimg_unlock_bits
814
	img_flip    dd aimg_flip
778
	img_flip    dd aimg_flip
815
	img_flip_layer dd aimg_flip_layer
779
	img_flip_layer dd aimg_flip_layer
816
	img_rotate  dd aimg_rotate
780
	img_rotate  dd aimg_rotate
817
	img_rotate_layer dd aimg_rotate_layer
781
	img_rotate_layer dd aimg_rotate_layer
818
	img_draw    dd aimg_draw
782
	img_draw    dd aimg_draw
819
 
783
 
820
	dd 0,0
784
	dd 0,0
821
	alib_init1   db 'lib_init',0
785
	alib_init1   db 'lib_init',0
822
	aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
786
	aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
823
	aimg_info    db 'img_info',0
787
	aimg_info    db 'img_info',0
824
	aimg_from_file db 'img_from_file',0
788
	aimg_from_file db 'img_from_file',0
825
	aimg_to_file db 'img_to_file',0
789
	aimg_to_file db 'img_to_file',0
826
	aimg_from_rgb db 'img_from_rgb',0
790
	aimg_from_rgb db 'img_from_rgb',0
827
	aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
791
	aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
828
	aimg_to_rgb2 db 'img_to_rgb2',0
792
	aimg_to_rgb2 db 'img_to_rgb2',0
829
	aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
793
	aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
830
	aimg_encode  db 'img_encode',0
794
	aimg_encode  db 'img_encode',0
831
	aimg_create  db 'img_create',0
795
	aimg_create  db 'img_create',0
832
	aimg_destroy db 'img_destroy',0
796
	aimg_destroy db 'img_destroy',0
833
	aimg_destroy_layer db 'img_destroy_layer',0
797
	aimg_destroy_layer db 'img_destroy_layer',0
834
	aimg_count   db 'img_count',0
798
	aimg_count   db 'img_count',0
835
	aimg_lock_bits db 'img_lock_bits',0
799
	aimg_lock_bits db 'img_lock_bits',0
836
	aimg_unlock_bits db 'img_unlock_bits',0
800
	aimg_unlock_bits db 'img_unlock_bits',0
837
	aimg_flip    db 'img_flip',0
801
	aimg_flip    db 'img_flip',0
838
	aimg_flip_layer db 'img_flip_layer',0
802
	aimg_flip_layer db 'img_flip_layer',0
839
	aimg_rotate  db 'img_rotate',0
803
	aimg_rotate  db 'img_rotate',0
840
	aimg_rotate_layer db 'img_rotate_layer',0
804
	aimg_rotate_layer db 'img_rotate_layer',0
841
	aimg_draw    db 'img_draw',0
805
	aimg_draw    db 'img_draw',0
842
 
806
 
843
align 4
807
align 4
844
proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
808
import_proclib:
845
	OpenDialog_Init dd aOpenDialog_Init
809
	OpenDialog_Init dd aOpenDialog_Init
846
	OpenDialog_Start dd aOpenDialog_Start
810
	OpenDialog_Start dd aOpenDialog_Start
847
	OpenDialog_Set_file_name dd aOpenDialog_Set_file_name
811
	OpenDialog_Set_file_name dd aOpenDialog_Set_file_name
848
	;OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext
812
	;OpenDialog_Set_file_ext dd aOpenDialog_Set_file_ext
849
dd 0,0
813
dd 0,0
850
	aOpenDialog_Init db 'OpenDialog_init',0
814
	aOpenDialog_Init db 'OpenDialog_init',0
851
	aOpenDialog_Start db 'OpenDialog_start',0
815
	aOpenDialog_Start db 'OpenDialog_start',0
852
	aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0
816
	aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0
853
	;aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0
817
	;aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0
854
 
818
 
855
align 4
819
align 4
856
import_buf2d:
820
import_buf2d:
857
	init dd sz_init
821
	init dd sz_init
858
	buf2d_create dd sz_buf2d_create
822
	buf2d_create dd sz_buf2d_create
859
	buf2d_create_f_img dd sz_buf2d_create_f_img
823
	buf2d_create_f_img dd sz_buf2d_create_f_img
860
	buf2d_clear dd sz_buf2d_clear
824
	buf2d_clear dd sz_buf2d_clear
861
	buf2d_draw dd sz_buf2d_draw
825
	buf2d_draw dd sz_buf2d_draw
862
	buf2d_delete dd sz_buf2d_delete
826
	buf2d_delete dd sz_buf2d_delete
863
	buf2d_resize dd sz_buf2d_resize
827
	buf2d_resize dd sz_buf2d_resize
864
	buf2d_line dd sz_buf2d_line
828
	buf2d_line dd sz_buf2d_line
865
	buf2d_line_sm dd sz_buf2d_line_sm
829
	buf2d_line_sm dd sz_buf2d_line_sm
866
	buf2d_rect_by_size dd sz_buf2d_rect_by_size
830
	buf2d_rect_by_size dd sz_buf2d_rect_by_size
867
	buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
831
	buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
868
	buf2d_circle dd sz_buf2d_circle
832
	buf2d_circle dd sz_buf2d_circle
869
	buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
833
	buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
870
	buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
834
	buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
871
	buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
835
	buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
872
	buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
836
	buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
873
	buf2d_bit_blt dd sz_buf2d_bit_blt
837
	buf2d_bit_blt dd sz_buf2d_bit_blt
874
	buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
838
	buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
875
	buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
839
	buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
876
	buf2d_curve_bezier dd sz_buf2d_curve_bezier
840
	buf2d_curve_bezier dd sz_buf2d_curve_bezier
877
	buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
841
	buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
878
	buf2d_draw_text dd sz_buf2d_draw_text
842
	buf2d_draw_text dd sz_buf2d_draw_text
879
	buf2d_crop_color dd sz_buf2d_crop_color
843
	buf2d_crop_color dd sz_buf2d_crop_color
880
	buf2d_flip_h dd sz_buf2d_flip_h
844
	buf2d_flip_h dd sz_buf2d_flip_h
881
	buf2d_flip_v dd sz_buf2d_flip_v
845
	buf2d_flip_v dd sz_buf2d_flip_v
882
	buf2d_offset_h dd sz_buf2d_offset_h
846
	buf2d_offset_h dd sz_buf2d_offset_h
883
	buf2d_flood_fill dd sz_buf2d_flood_fill
847
	buf2d_flood_fill dd sz_buf2d_flood_fill
884
	buf2d_set_pixel dd sz_buf2d_set_pixel
848
	buf2d_set_pixel dd sz_buf2d_set_pixel
885
	dd 0,0
849
	dd 0,0
886
	sz_init db 'lib_init',0
850
	sz_init db 'lib_init',0
887
	sz_buf2d_create db 'buf2d_create',0
851
	sz_buf2d_create db 'buf2d_create',0
888
	sz_buf2d_create_f_img db 'buf2d_create_f_img',0
852
	sz_buf2d_create_f_img db 'buf2d_create_f_img',0
889
	sz_buf2d_clear db 'buf2d_clear',0
853
	sz_buf2d_clear db 'buf2d_clear',0
890
	sz_buf2d_draw db 'buf2d_draw',0
854
	sz_buf2d_draw db 'buf2d_draw',0
891
	sz_buf2d_delete db 'buf2d_delete',0
855
	sz_buf2d_delete db 'buf2d_delete',0
892
	sz_buf2d_resize db 'buf2d_resize',0
856
	sz_buf2d_resize db 'buf2d_resize',0
893
	sz_buf2d_line db 'buf2d_line',0
857
	sz_buf2d_line db 'buf2d_line',0
894
	sz_buf2d_line_sm db 'buf2d_line_sm',0
858
	sz_buf2d_line_sm db 'buf2d_line_sm',0
895
	sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
859
	sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
896
	sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
860
	sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
897
	sz_buf2d_circle db 'buf2d_circle',0
861
	sz_buf2d_circle db 'buf2d_circle',0
898
	sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
862
	sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
899
	sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
863
	sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
900
	sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
864
	sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
901
	sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
865
	sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
902
	sz_buf2d_bit_blt db 'buf2d_bit_blt',0
866
	sz_buf2d_bit_blt db 'buf2d_bit_blt',0
903
	sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
867
	sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
904
	sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
868
	sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
905
	sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
869
	sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
906
	sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
870
	sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
907
	sz_buf2d_draw_text db 'buf2d_draw_text',0
871
	sz_buf2d_draw_text db 'buf2d_draw_text',0
908
	sz_buf2d_crop_color db 'buf2d_crop_color',0
872
	sz_buf2d_crop_color db 'buf2d_crop_color',0
909
	sz_buf2d_flip_h db 'buf2d_flip_h',0
873
	sz_buf2d_flip_h db 'buf2d_flip_h',0
910
	sz_buf2d_flip_v db 'buf2d_flip_v',0
874
	sz_buf2d_flip_v db 'buf2d_flip_v',0
911
	sz_buf2d_offset_h db 'buf2d_offset_h',0
875
	sz_buf2d_offset_h db 'buf2d_offset_h',0
912
	sz_buf2d_flood_fill db 'buf2d_flood_fill',0
876
	sz_buf2d_flood_fill db 'buf2d_flood_fill',0
913
	sz_buf2d_set_pixel db 'buf2d_set_pixel',0
877
	sz_buf2d_set_pixel db 'buf2d_set_pixel',0
914
 
878
 
915
align 4
879
align 4
916
import_box_lib:
880
import_box_lib:
917
	dd sz_init1
881
	dd sz_init1
918
 
882
 
919
	init_checkbox   dd sz_Init_checkbox
883
	init_checkbox   dd sz_Init_checkbox
920
	check_box_draw  dd sz_Check_box_draw
884
	check_box_draw  dd sz_Check_box_draw
921
	check_box_mouse dd sz_Check_box_mouse
885
	check_box_mouse dd sz_Check_box_mouse
922
	;version_ch     dd sz_Version_ch
886
	;version_ch     dd sz_Version_ch
923
 
887
 
924
	option_box_draw	 dd sz_Option_box_draw
888
	option_box_draw	 dd sz_Option_box_draw
925
	option_box_mouse dd sz_Option_box_mouse
889
	option_box_mouse dd sz_Option_box_mouse
926
	;version_op      dd sz_Version_op
890
	;version_op      dd sz_Version_op
927
 
891
 
928
	edit_box_draw      dd sz_edit_box_draw
892
	edit_box_draw      dd sz_edit_box_draw
929
	edit_box_key       dd sz_edit_box_key
893
	edit_box_key       dd sz_edit_box_key
930
	edit_box_mouse     dd sz_edit_box_mouse
894
	edit_box_mouse     dd sz_edit_box_mouse
931
	edit_box_set_text  dd sz_edit_box_set_text
895
	edit_box_set_text  dd sz_edit_box_set_text
932
	scrollbar_ver_draw dd sz_scrollbar_ver_draw
896
	scrollbar_ver_draw dd sz_scrollbar_ver_draw
933
	scrollbar_hor_draw dd sz_scrollbar_hor_draw
897
	scrollbar_hor_draw dd sz_scrollbar_hor_draw
934
 
898
 
935
        progressbar_draw     dd sz_progressbar_draw
899
        progressbar_draw     dd sz_progressbar_draw
936
        progressbar_progress dd sz_progressbar_progress
900
        progressbar_progress dd sz_progressbar_progress
937
 
901
 
938
	dd 0,0
902
	dd 0,0
939
	sz_init1 db 'lib_init',0
903
	sz_init1 db 'lib_init',0
940
 
904
 
941
	sz_Init_checkbox   db 'init_checkbox2',0
905
	sz_Init_checkbox   db 'init_checkbox2',0
942
	sz_Check_box_draw  db 'check_box_draw2',0
906
	sz_Check_box_draw  db 'check_box_draw2',0
943
	sz_Check_box_mouse db 'check_box_mouse2',0
907
	sz_Check_box_mouse db 'check_box_mouse2',0
944
	;sz_Version_ch     db 'version_ch2',0
908
	;sz_Version_ch     db 'version_ch2',0
945
 
909
 
946
	sz_Option_box_draw	db 'option_box_draw',0
910
	sz_Option_box_draw	db 'option_box_draw',0
947
	sz_Option_box_mouse	db 'option_box_mouse',0
911
	sz_Option_box_mouse	db 'option_box_mouse',0
948
	;sz_Version_op      db 'version_op',0
912
	;sz_Version_op      db 'version_op',0
949
 
913
 
950
	sz_edit_box_draw      db 'edit_box',0
914
	sz_edit_box_draw      db 'edit_box',0
951
	sz_edit_box_key       db 'edit_box_key',0
915
	sz_edit_box_key       db 'edit_box_key',0
952
	sz_edit_box_mouse     db 'edit_box_mouse',0
916
	sz_edit_box_mouse     db 'edit_box_mouse',0
953
	sz_edit_box_set_text  db 'edit_box_set_text',0
917
	sz_edit_box_set_text  db 'edit_box_set_text',0
954
	sz_scrollbar_ver_draw db 'scrollbar_v_draw',0
918
	sz_scrollbar_ver_draw db 'scrollbar_v_draw',0
955
	sz_scrollbar_hor_draw db 'scrollbar_h_draw',0
919
	sz_scrollbar_hor_draw db 'scrollbar_h_draw',0
956
 
920
 
957
        sz_progressbar_draw     db 'progressbar_draw', 0
921
        sz_progressbar_draw     db 'progressbar_draw', 0
958
        sz_progressbar_progress db 'progressbar_progress', 0
922
        sz_progressbar_progress db 'progressbar_progress', 0
959
 
923
 
960
align 4
924
align 4
961
import_libkmenu:
925
import_libkmenu:
962
        kmenu_init      dd akmenu_init
926
        kmenu_init      dd akmenu_init
963
        kmainmenu_draw  dd akmainmenu_draw
927
        kmainmenu_draw  dd akmainmenu_draw
964
        kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent
928
        kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent
965
        ksubmenu_new    dd aksubmenu_new
929
        ksubmenu_new    dd aksubmenu_new
966
        ksubmenu_delete dd aksubmenu_delete
930
        ksubmenu_delete dd aksubmenu_delete
967
        ksubmenu_draw   dd aksubmenu_draw
931
        ksubmenu_draw   dd aksubmenu_draw
968
        ksubmenu_add    dd aksubmenu_add
932
        ksubmenu_add    dd aksubmenu_add
969
        kmenuitem_new   dd akmenuitem_new
933
        kmenuitem_new   dd akmenuitem_new
970
        kmenuitem_delete dd akmenuitem_delete
934
        kmenuitem_delete dd akmenuitem_delete
971
        kmenuitem_draw  dd akmenuitem_draw
935
        kmenuitem_draw  dd akmenuitem_draw
972
dd 0,0
936
dd 0,0
973
        akmenu_init     db 'kmenu_init',0
937
        akmenu_init     db 'kmenu_init',0
974
        akmainmenu_draw db 'kmainmenu_draw',0
938
        akmainmenu_draw db 'kmainmenu_draw',0
975
        akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0
939
        akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0
976
        aksubmenu_new   db 'ksubmenu_new',0
940
        aksubmenu_new   db 'ksubmenu_new',0
977
        aksubmenu_delete db 'ksubmenu_delete',0
941
        aksubmenu_delete db 'ksubmenu_delete',0
978
        aksubmenu_draw  db 'ksubmenu_draw',0
942
        aksubmenu_draw  db 'ksubmenu_draw',0
979
        aksubmenu_add   db 'ksubmenu_add',0
943
        aksubmenu_add   db 'ksubmenu_add',0
980
        akmenuitem_new  db 'kmenuitem_new',0
944
        akmenuitem_new  db 'kmenuitem_new',0
981
        akmenuitem_delete db 'kmenuitem_delete',0
945
        akmenuitem_delete db 'kmenuitem_delete',0
982
        akmenuitem_draw  db 'kmenuitem_draw',0
946
        akmenuitem_draw  db 'kmenuitem_draw',0
983
 
947
 
984
button_press  dd 0     ;for kmenu
948
button_press  dd 0     ;for kmenu
985
 
949
 
986
align 4
950
align 4
987
mouse_dd dd 0
951
mouse_dd dd 0
988
last_time dd 0
952
last_time dd 0
989
 
953
 
990
align 16
954
align 16
991
sc system_colors 
955
sc system_colors 
992
 
956
 
993
align 16
957
align 16
994
procinfo process_information 
958
procinfo process_information 
995
 
959
 
996
align 4
960
align 4
997
buf_0: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
961
buf_0: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
998
.l: dw 15 ;+4 left
962
.l: dw 15 ;+4 left
999
.t: dw 50 ;+6 top
963
.t: dw 50 ;+6 top
1000
.w: dd 384 ;+8 w
964
.w: dd 384 ;+8 w
1001
.h: dd 350 ;+12 h
965
.h: dd 350 ;+12 h
1002
.color: dd 0xffffd0 ;+16 color
966
.color: dd 0xffffd0 ;+16 color
1003
	db 24 ;+20 bit in pixel
967
	db 24 ;+20 bit in pixel
1004
 
968
 
1005
align 4
969
align 4
1006
buf_1:
970
buf_1:
1007
	dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
971
	dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
1008
	dd 0 ;+4 left,top
972
	dd 0 ;+4 left,top
1009
.w: dd 0
973
.w: dd 0
1010
.h: dd 0,0,24 ;+12 color,bit in pixel
974
.h: dd 0,0,24 ;+12 color,bit in pixel
1011
 
975
 
1012
font_h dd 0 ;¢ëá®â  èà¨äâ 
976
font_h dd 0 ;¢ëá®â  èà¨äâ 
1013
 
977
 
1014
;input:
978
;input:
1015
; eax - ç¨á«®
979
; eax - ç¨á«®
1016
; edi - ¡ãä¥à ¤«ï áâப¨
980
; edi - ¡ãä¥à ¤«ï áâப¨
1017
; len - ¤«¨­­  ¡ãä¥à 
981
; len - ¤«¨­­  ¡ãä¥à 
1018
;output:
982
;output:
1019
align 4
983
align 4
1020
proc convert_int_to_str uses eax ecx edx edi esi, len:dword
984
proc convert_int_to_str uses eax ecx edx edi esi, len:dword
1021
	mov esi,[len]
985
	mov esi,[len]
1022
	add esi,edi
986
	add esi,edi
1023
	dec esi
987
	dec esi
1024
	call .str
988
	call .str
1025
	ret
989
	ret
1026
endp
990
endp
1027
 
991
 
1028
align 4
992
align 4
1029
.str:
993
.str:
1030
	mov ecx,10
994
	mov ecx,10
1031
	cmp eax,ecx
995
	cmp eax,ecx
1032
	jb @f
996
	jb @f
1033
		xor edx,edx
997
		xor edx,edx
1034
		div ecx
998
		div ecx
1035
		push edx
999
		push edx
1036
		;dec edi  ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
1000
		;dec edi  ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
1037
		call .str
1001
		call .str
1038
		pop eax
1002
		pop eax
1039
	@@:
1003
	@@:
1040
	cmp edi,esi
1004
	cmp edi,esi
1041
	jge @f
1005
	jge @f
1042
		or al,0x30
1006
		or al,0x30
1043
		stosb
1007
		stosb
1044
		mov byte[edi],0 ;¢ ª®­¥æ áâப¨ áâ ¢¨¬ 0, çâ®-¡ë ­¥ ¢ë« §¨« ¬ãá®à
1008
		mov byte[edi],0 ;¢ ª®­¥æ áâப¨ áâ ¢¨¬ 0, çâ®-¡ë ­¥ ¢ë« §¨« ¬ãá®à
1045
	@@:
1009
	@@:
1046
	ret
1010
	ret
1047
 
1011
 
1048
align 4
1012
align 4
1049
proc mem_copy uses ecx esi edi, destination:dword, source:dword, len:dword
1013
proc mem_copy uses ecx esi edi, destination:dword, source:dword, len:dword
1050
	cld
1014
	cld
1051
	mov esi, dword[source]
1015
	mov esi, [source]
1052
	mov edi, dword[destination]
1016
	mov edi, [destination]
1053
	mov ecx, dword[len]
1017
	mov ecx, [len]
1054
	rep movsb
1018
	rep movsb
1055
	ret
1019
	ret
1056
endp
1020
endp
1057
 
1021
 
1058
edMaxSize = 511
1022
edMaxSize = 511
1059
edMax = 0 ;max, size, pos
1023
edMax = 0 ;max, size, pos
1060
 
1024
 
1061
align 4
1025
align 4
1062
editFileName  edit_box 270,450,78, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0, edMaxSize, fileNameBuffer.data, mouse_dd, 0, edMax, edMax
1026
editFileName  edit_box 270,450,78, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0, edMaxSize, fileNameBuffer.data, mouse_dd, 0, edMax, edMax
1063
editCommand   edit_box 150,450,121, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0, edMaxSize, commandBuffer.data, mouse_dd, 0, edMax, edMax
1027
editCommand   edit_box 150,450,121, 0xffffff, 0x6a9480, 0, 0xAABBCC, 0, edMaxSize, commandBuffer.data, mouse_dd, 0, edMax, edMax
1064
 
1028
 
1065
opt1 option_box opt_gr1, 433,64, 6,12,0xd0d0ff, 0xff, 0x80ff,txt_filename,txt_filename.end-txt_filename
1029
opt1 option_box opt_gr1, 433,64, 6,12,0xd0d0ff, 0xff, 0x80ff,txt_filename,txt_filename.end-txt_filename
1066
opt2 option_box opt_gr1, 433,107,6,12,0xd0d0ff, 0xff, 0x80ff,txt_command,txt_command.end-txt_command
1030
opt2 option_box opt_gr1, 433,107,6,12,0xd0d0ff, 0xff, 0x80ff,txt_command,txt_command.end-txt_command
1067
opt_gr1 dd opt1
1031
opt_gr1 dd opt1
1068
align 4
1032
align 4
1069
opt_grlist1 dd opt1,opt2,0 ;end option group
1033
opt_grlist1 dd opt1,opt2,0 ;end option group
1070
 
1034
 
1071
pb:
1035
pb:
1072
.value          dd 0
1036
.value          dd 0
1073
.left           dd 0
1037
.left           dd 0
1074
.top            dd 0
1038
.top            dd 0
1075
.width          dd 0
1039
.width          dd 0
1076
.height         dd 0
1040
.height         dd 0
1077
.style          dd 0
1041
.style          dd 0
1078
.min            dd 0
1042
.min            dd 0
1079
.max            dd 0
1043
.max            dd 0
1080
.back_color     dd 0
1044
.back_color     dd 0
1081
.progress_color dd 0
1045
.progress_color dd 0
1082
.frame_color    dd 0
1046
.frame_color    dd 0
1083
 
1047
 
1084
fileNameBuffer:
1048
fileNameBuffer:
1085
.data: rb 512
1049
.data: rb 512
1086
.size: rd 1
1050
.size: rd 1
1087
fileNameBufferEnd:
1051
fileNameBufferEnd:
1088
 
1052
 
1089
commandBuffer:
1053
commandBuffer:
1090
.data: rb 512
1054
.data: rb 512
1091
.size: rd 1
1055
.size: rd 1
1092
commandBufferEnd:
1056
commandBufferEnd:
1093
 
1057
 
1094
align 16
1058
align 16
1095
i_end:
1059
i_end:
1096
	rb 2048
1060
	rb 2048
1097
thread_coords:
1061
thread_coords:
1098
	rb 2048
1062
	rb 2048
1099
thread_scale:
1063
thread_scale:
1100
	rb 2048
1064
	rb 2048
1101
thread_n_file:
1065
thread_n_file:
1102
	rb 2048
1066
	rb 2048
1103
stacktop:
1067
stacktop:
1104
	sys_path rb 1024
1068
	sys_path rb 1024
1105
	file_name:
1069
	file_name rb 2048
1106
		rb 1024
-
 
1107
	library_path rb 1024
-
 
1108
	plugin_path rb 4096
1070
	plugin_path rb 4096
1109
	openfile_path rb 4096
1071
	openfile_path rb 4096
1110
	filename_area rb 256
1072
	filename_area rb 256
1111
        pi rb 1024
1073
	pi rb 1024
1112
mem:
1074
mem:
1113
>
1075
>
1114
>
1076
>
1115
>
1077
>