Rev 6343 | Rev 7996 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
122 | diamond | 1 | ;----------------------------------------------------------------------------- |
31 | halyavin | 2 | ; project name: TINYPAD |
5241 | punk_joker | 3 | ; compiler: flat assembler 1.67.21 |
297 | mikedld | 4 | ; memory to compile: 3.0/9.0 MBytes (without/with size optimizations) |
5636 | leency | 5 | ; version: SVN (4.1) |
6 | ; last update: 2015-07-17 (Jul 17, 2015) |
||
4505 | mario79 | 7 | ; minimal kernel: revision #4199 (svn://kolibrios.org/kernel/trunk) |
122 | diamond | 8 | ;----------------------------------------------------------------------------- |
9 | ; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi |
||
258 | mikedld | 10 | ; maintained by: Mike Semenyako >> mike.dld@gmail.com |
11 | ; Ivan Poddubny >> ivan-yar@bk.ru |
||
4505 | mario79 | 12 | ; Marat Zakiyanov aka Mario79 |
5636 | leency | 13 | ; Pathoswithin |
122 | diamond | 14 | ;----------------------------------------------------------------------------- |
5636 | leency | 15 | ; TODO: |
617 | mikedld | 16 | ; - add vertical selection, undo, goto position, overwrite mode, smart tabulation |
178 | heavyiron | 17 | ; - improve window drawing with small dimensions |
617 | mikedld | 18 | ; - save/load settings to/from ini file, not executable |
19 | ; - path autocompletion for open/save dialogs |
||
259 | mikedld | 20 | ; - other bug-fixes and speed/size optimizations |
122 | diamond | 21 | ;----------------------------------------------------------------------------- |
617 | mikedld | 22 | ; See history.txt for complete changelog |
23 | ;----------------------------------------------------------------------------- |
||
31 | halyavin | 24 | |
178 | heavyiron | 25 | include 'lang.inc' |
617 | mikedld | 26 | |
5241 | punk_joker | 27 | include '../../../config.inc' ;for nightbuild |
28 | include '../../../macros.inc' ; useful stuff |
||
617 | mikedld | 29 | include '../../../struct.inc' |
30 | include '../../../proc32.inc' |
||
31 | |||
32 | include 'external/libio.inc' |
||
33 | |||
122 | diamond | 34 | include 'tinypad.inc' |
617 | mikedld | 35 | |
297 | mikedld | 36 | ;purge mov,add,sub ; SPEED |
31 | halyavin | 37 | |
7134 | dunkaist | 38 | __header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,ini_path |
31 | halyavin | 39 | |
5636 | leency | 40 | APP_VERSION equ '4.1' |
258 | mikedld | 41 | |
617 | mikedld | 42 | TRUE = 1 |
43 | FALSE = 0 |
||
44 | |||
280 | mikedld | 45 | ;define __DEBUG__ 1 |
46 | ;define __DEBUG_LEVEL__ 1 |
||
4487 | mario79 | 47 | ;include '../../../debug-fdo.inc' |
31 | halyavin | 48 | |
987 | mikedld | 49 | ; compiled-in options |
50 | |||
280 | mikedld | 51 | ASEPC = '-' ; separator character (char) |
52 | ATOPH = 19 ; menu bar height (pixels) |
||
53 | SCRLW = 16 ; scrollbar widht/height (pixels) |
||
54 | ATABW = 8 ; tab key indent width (chars) |
||
55 | LINEH = 10 ; line height (pixels) |
||
56 | PATHL = 256 ; maximum path length (chars) !!! don't change !!! |
||
57 | AMINS = 8 ; minimal scroll thumb size (pixels) |
||
58 | LCHGW = 3 ; changed/saved marker width (pixels) |
||
31 | halyavin | 59 | |
280 | mikedld | 60 | STATH = 16 ; status bar height (pixels) |
61 | TBARH = 18 ; tab bar height (pixels) |
||
31 | halyavin | 62 | |
987 | mikedld | 63 | INI_SEC_PREFIX equ '' |
31 | halyavin | 64 | |
122 | diamond | 65 | ;----------------------------------------------------------------------------- |
7134 | dunkaist | 66 | __section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
122 | diamond | 67 | ;----------------------------------------------------------------------------- |
5241 | punk_joker | 68 | cld |
69 | mov edi,@UDATA |
||
70 | mov ecx,@PARAMS-@UDATA |
||
71 | mov al,0 |
||
72 | rep stosb |
||
31 | halyavin | 73 | |
5241 | punk_joker | 74 | mcall 68,11 |
75 | or eax,eax |
||
76 | jz key.alt_x.close |
||
259 | mikedld | 77 | |
5241 | punk_joker | 78 | stdcall dll.Load,@IMPORT |
79 | or eax,eax |
||
80 | jnz key.alt_x.close |
||
617 | mikedld | 81 | |
5241 | punk_joker | 82 | mov edi,ini_path |
83 | xor al,al |
||
84 | mov ecx,PATHL |
||
85 | repne scasb |
||
86 | mov dword[edi-1],'.ini' |
||
87 | mov byte[edi+3],0 |
||
987 | mikedld | 88 | |
5241 | punk_joker | 89 | stdcall load_settings |
987 | mikedld | 90 | |
5241 | punk_joker | 91 | stdcall mem.Alloc,65536 |
92 | mov [temp_buf],eax |
||
259 | mikedld | 93 | |
5241 | punk_joker | 94 | inc [do_not_draw] |
178 | heavyiron | 95 | |
5241 | punk_joker | 96 | mov dword[app_start],7 |
297 | mikedld | 97 | |
5241 | punk_joker | 98 | mov esi,s_example |
99 | mov edi,tb_opensave.text |
||
100 | mov ecx,s_example.size |
||
101 | mov [tb_opensave.length],cl |
||
102 | rep movsb |
||
31 | halyavin | 103 | |
5241 | punk_joker | 104 | mov esi,s_still |
105 | mov edi,s_search |
||
106 | mov ecx,s_still.size |
||
107 | mov [s_search.size],ecx |
||
108 | rep movsb |
||
31 | halyavin | 109 | |
5241 | punk_joker | 110 | cmp byte[@PARAMS],0 |
111 | jz no_params |
||
31 | halyavin | 112 | |
122 | diamond | 113 | ;// Willow's code to support DOCPAK [ |
31 | halyavin | 114 | |
5241 | punk_joker | 115 | cmp byte[@PARAMS],'*' |
116 | jne .noipc |
||
178 | heavyiron | 117 | |
118 | ;// diamond [ (convert size from decimal representation to dword) |
||
119 | ;-- mov edx,dword[@PARAMS+1] |
||
5241 | punk_joker | 120 | mov esi,@PARAMS+1 |
121 | xor edx,edx |
||
122 | xor eax,eax |
||
178 | heavyiron | 123 | @@: lodsb |
5241 | punk_joker | 124 | test al,al |
125 | jz @f |
||
126 | lea edx,[edx*4+edx] |
||
127 | lea edx,[edx*2+eax-'0'] |
||
128 | jmp @b |
||
178 | heavyiron | 129 | @@: |
130 | ;// diamond ] |
||
131 | |||
5241 | punk_joker | 132 | add edx,20 |
259 | mikedld | 133 | |
5241 | punk_joker | 134 | stdcall mem.Alloc,edx |
135 | mov ebp,eax |
||
136 | push eax |
||
259 | mikedld | 137 | |
5241 | punk_joker | 138 | mov dword[ebp+0],0 |
139 | mov dword[ebp+4],8 |
||
140 | mcall 60,1,ebp |
||
141 | mcall 40,1000000b |
||
280 | mikedld | 142 | |
5241 | punk_joker | 143 | mcall 23,200 |
280 | mikedld | 144 | |
5241 | punk_joker | 145 | cmp eax,7 |
146 | jne key.alt_x.close |
||
147 | mov byte[ebp],1 |
||
259 | mikedld | 148 | |
5241 | punk_joker | 149 | mov ecx,[ebp+12] |
150 | lea esi,[ebp+16] |
||
151 | call create_tab |
||
152 | call load_from_memory |
||
259 | mikedld | 153 | |
5241 | punk_joker | 154 | pop ebp |
155 | stdcall mem.Free,ebp |
||
259 | mikedld | 156 | |
5241 | punk_joker | 157 | jmp @f |
122 | diamond | 158 | .noipc: |
31 | halyavin | 159 | |
122 | diamond | 160 | ;// Willow's code to support DOCPAK ] |
31 | halyavin | 161 | |
5241 | punk_joker | 162 | mov esi,@PARAMS |
163 | mov edi,tb_opensave.text |
||
164 | mov ecx,PATHL |
||
165 | rep movsb |
||
166 | mov edi,tb_opensave.text |
||
167 | mov ecx,PATHL |
||
168 | xor al,al |
||
169 | repne scasb |
||
170 | jne key.alt_x.close |
||
171 | lea eax,[edi-tb_opensave.text-1] |
||
172 | mov [tb_opensave.length],al |
||
173 | call load_file |
||
174 | jnc @f |
||
31 | halyavin | 175 | |
122 | diamond | 176 | no_params: |
5241 | punk_joker | 177 | call create_tab |
31 | halyavin | 178 | |
179 | @@: |
||
5241 | punk_joker | 180 | mov [s_status],0 |
181 | dec [do_not_draw] |
||
987 | mikedld | 182 | |
5241 | punk_joker | 183 | mov al,[tabs_pos] |
184 | mov [tab_bar.Style],al |
||
987 | mikedld | 185 | |
1624 | mario79 | 186 | ;--------------------------------------------------------------------- |
5241 | punk_joker | 187 | mov edi,filename_area |
188 | mov esi,s_example+5 |
||
189 | call copy_str_1 |
||
1624 | mario79 | 190 | |
5241 | punk_joker | 191 | mov esi,tb_opensave.text |
192 | mov edi,fname_Info |
||
193 | call copy_str_1 |
||
194 | xor eax,eax |
||
195 | mov [edi],al |
||
1624 | mario79 | 196 | ;--------------------------------------------------------------------- |
4274 | tserj | 197 | ;OpenDialog initialisation |
5241 | punk_joker | 198 | push dword OpenDialog_data |
199 | call [OpenDialog_Init] |
||
1624 | mario79 | 200 | ;--------------------------------------------------------------------- |
201 | |||
202 | |||
5241 | punk_joker | 203 | mcall 66,1,1 |
204 | mcall 40,00100111b |
||
178 | heavyiron | 205 | red: |
5241 | punk_joker | 206 | call drawwindow |
31 | halyavin | 207 | |
122 | diamond | 208 | ;----------------------------------------------------------------------------- |
31 | halyavin | 209 | |
122 | diamond | 210 | still: |
5241 | punk_joker | 211 | call draw_statusbar ; write current position & number of strings |
31 | halyavin | 212 | |
122 | diamond | 213 | .skip_write: |
5241 | punk_joker | 214 | cmp [open_dialog],1 |
215 | je .open_dialog |
||
216 | mcall 10 ; wait here until event |
||
3265 | mario79 | 217 | |
5241 | punk_joker | 218 | cmp [main_closed],0 |
219 | jne key.alt_x |
||
220 | dec eax ; redraw ? |
||
221 | jz red |
||
222 | dec eax ; key ? |
||
223 | jz key |
||
224 | dec eax ; button ? |
||
225 | jz button |
||
226 | sub eax,3 ; mouse ? |
||
227 | jz mouse |
||
31 | halyavin | 228 | |
5241 | punk_joker | 229 | jmp still.skip_write |
1624 | mario79 | 230 | ;--------------------------------------------------------------------- |
231 | .open_dialog: |
||
5241 | punk_joker | 232 | pusha |
31 | halyavin | 233 | |
5241 | punk_joker | 234 | call btn.bot.cancel |
1624 | mario79 | 235 | |
5241 | punk_joker | 236 | mov esi,tb_opensave.text |
237 | mov edi,[OpenDialog_data.openfile_pach] |
||
238 | movzx ecx,[tb_opensave.length] |
||
239 | mov edx,[OpenDialog_data.filename_area] |
||
240 | mov ebx,[OpenDialog_data.opendir_pach] |
||
241 | call copy_str_2 |
||
242 | movzx eax,byte [bot_mode2] |
||
243 | mov [OpenDialog_data.type],eax |
||
244 | popa |
||
1624 | mario79 | 245 | ; invoke OpenDialog |
5241 | punk_joker | 246 | push dword OpenDialog_data |
247 | call [OpenDialog_Start] |
||
1624 | mario79 | 248 | |
5241 | punk_joker | 249 | cmp [OpenDialog_data.status],1 |
250 | jne .3 |
||
1624 | mario79 | 251 | |
5241 | punk_joker | 252 | pusha |
253 | mov edi,tb_opensave.text |
||
254 | mov esi,[OpenDialog_data.openfile_pach] |
||
255 | call copy_str_1 |
||
256 | sub edi,tb_opensave.text |
||
257 | dec edi |
||
258 | mov eax,edi |
||
259 | mov [tb_opensave.length],al |
||
260 | popa |
||
4274 | tserj | 261 | |
5241 | punk_joker | 262 | cmp [bot_mode2],0 |
263 | je .2 |
||
264 | call save_file |
||
265 | jmp .3 |
||
1624 | mario79 | 266 | .2: |
5241 | punk_joker | 267 | call load_file |
1624 | mario79 | 268 | .3: |
5241 | punk_joker | 269 | mov [open_dialog],0 |
270 | jmp red |
||
122 | diamond | 271 | ;----------------------------------------------------------------------------- |
1624 | mario79 | 272 | draw_window_for_OD: |
5241 | punk_joker | 273 | call drawwindow |
274 | call draw_statusbar |
||
275 | ret |
||
1624 | mario79 | 276 | ;----------------------------------------------------------------------------- |
277 | copy_str_2: |
||
5241 | punk_joker | 278 | cld |
279 | push esi ecx |
||
280 | rep movsb ; edi openfile_pach |
||
281 | xor eax,eax |
||
282 | mov [edi],al |
||
283 | pop ecx esi |
||
284 | mov edi,ebx |
||
285 | rep movsb ; edi opendir_pach |
||
286 | mov [edi],al |
||
287 | mov esi,edi |
||
288 | std |
||
1624 | mario79 | 289 | @@: |
5241 | punk_joker | 290 | lodsb |
291 | cmp al,byte '/' |
||
292 | jne @b |
||
293 | inc esi |
||
294 | xor eax,eax |
||
295 | mov [esi],al |
||
296 | inc esi |
||
297 | mov edi,edx ; edi filename_area |
||
298 | call copy_str_1 |
||
299 | ret |
||
1624 | mario79 | 300 | ;----------------------------------------------------------------------------- |
301 | copy_str_1: |
||
5241 | punk_joker | 302 | xor eax,eax |
303 | cld |
||
1624 | mario79 | 304 | @@: |
5241 | punk_joker | 305 | lodsb |
306 | stosb |
||
307 | test eax,eax |
||
308 | jnz @b |
||
309 | ret |
||
1624 | mario79 | 310 | ;----------------------------------------------------------------------------- |
617 | mikedld | 311 | proc get_event ctx ;////////////////////////////////////////////////////////// |
122 | diamond | 312 | ;----------------------------------------------------------------------------- |
5241 | punk_joker | 313 | mcall 10 |
314 | dec eax ; redraw ? |
||
315 | jz .redraw |
||
316 | dec eax ; key ? |
||
317 | jz .key |
||
318 | dec eax ; button ? |
||
319 | jz .button |
||
320 | sub eax,2 ; background ? |
||
321 | jz .background |
||
322 | dec eax ; mouse ? |
||
323 | jz .mouse |
||
324 | dec eax ; ipc ? |
||
325 | jz .ipc |
||
326 | dec eax ; network ? |
||
327 | jz .network |
||
328 | dec eax ; debug ? |
||
329 | jz .debug |
||
330 | sub eax,7 ; irq ? |
||
331 | js .nothing |
||
332 | cmp eax,15 |
||
333 | jg .nothing |
||
334 | jmp .irq |
||
617 | mikedld | 335 | |
336 | .nothing: |
||
5241 | punk_joker | 337 | mov eax,EV_IDLE |
338 | ret |
||
617 | mikedld | 339 | |
340 | .redraw: |
||
5241 | punk_joker | 341 | mov eax,EV_REDRAW |
342 | ret |
||
617 | mikedld | 343 | |
344 | .key: |
||
5241 | punk_joker | 345 | mov eax,EV_KEY |
346 | ret |
||
617 | mikedld | 347 | |
348 | .button: |
||
5241 | punk_joker | 349 | mov eax,EV_BUTTON |
350 | ret |
||
617 | mikedld | 351 | |
352 | .background: |
||
5241 | punk_joker | 353 | mov eax,EV_BACKGROUND |
354 | ret |
||
617 | mikedld | 355 | |
356 | .mouse: |
||
5241 | punk_joker | 357 | mov eax,EV_MOUSE |
358 | ret |
||
617 | mikedld | 359 | |
360 | .ipc: |
||
5241 | punk_joker | 361 | mov eax,EV_IPC |
362 | ret |
||
617 | mikedld | 363 | |
364 | .network: |
||
5241 | punk_joker | 365 | mov eax,EV_NETWORK |
366 | ret |
||
617 | mikedld | 367 | |
368 | .debug: |
||
5241 | punk_joker | 369 | mov eax,EV_DEBUG |
370 | ret |
||
617 | mikedld | 371 | endp |
372 | |||
373 | ;----------------------------------------------------------------------------- |
||
987 | mikedld | 374 | proc load_settings ;////////////////////////////////////////////////////////// |
375 | ;----------------------------------------------------------------------------- |
||
5241 | punk_joker | 376 | pushad |
987 | mikedld | 377 | |
5241 | punk_joker | 378 | invoke ini.get_int,ini_path,ini_sec_options,ini_options_tabs_pos,2 |
379 | mov [tabs_pos],al |
||
380 | invoke ini.get_int,ini_path,ini_sec_options,ini_options_secure_sel,0 |
||
381 | mov [secure_sel],al |
||
382 | invoke ini.get_int,ini_path,ini_sec_options,ini_options_auto_braces,0 |
||
383 | mov [auto_braces],al |
||
384 | invoke ini.get_int,ini_path,ini_sec_options,ini_options_auto_indent,1 |
||
385 | mov [auto_indent],al |
||
386 | invoke ini.get_int,ini_path,ini_sec_options,ini_options_optim_save,1 |
||
387 | mov [optim_save],al |
||
388 | invoke ini.get_int,ini_path,ini_sec_options,ini_options_line_nums,0 |
||
389 | mov [line_nums],al |
||
987 | mikedld | 390 | |
5241 | punk_joker | 391 | invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_text,0x00000000 |
392 | mov [color_tbl.text],eax |
||
393 | invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_back,0x00ffffff |
||
394 | mov [color_tbl.back],eax |
||
395 | invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_text_sel,0x00ffffff |
||
396 | mov [color_tbl.text.sel],eax |
||
397 | invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_back_sel,0x000a246a |
||
398 | mov [color_tbl.back.sel],eax |
||
399 | invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_symbol,0x003030f0 |
||
400 | mov [color_tbl.symbol],eax |
||
401 | invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_number,0x00009000 |
||
402 | mov [color_tbl.number],eax |
||
403 | invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_string,0x00b00000 |
||
404 | mov [color_tbl.string],eax |
||
405 | invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_comment,0x00808080 |
||
406 | mov [color_tbl.comment],eax |
||
407 | invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_line_moded,0x00ffee62 |
||
408 | mov [color_tbl.line.moded],eax |
||
409 | invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_line_saved,0x006ce26c |
||
410 | mov [color_tbl.line.saved],eax |
||
987 | mikedld | 411 | |
5241 | punk_joker | 412 | invoke ini.get_int,ini_path,ini_sec_window,ini_window_left,250 |
413 | mov [mainwnd_pos.x],eax |
||
414 | invoke ini.get_int,ini_path,ini_sec_window,ini_window_top,75 |
||
415 | mov [mainwnd_pos.y],eax |
||
416 | invoke ini.get_int,ini_path,ini_sec_window,ini_window_width,6*80+6+SCRLW+5 |
||
417 | mov [mainwnd_pos.w],eax |
||
418 | invoke ini.get_int,ini_path,ini_sec_window,ini_window_height,402 |
||
419 | mov [mainwnd_pos.h],eax |
||
987 | mikedld | 420 | |
5241 | punk_joker | 421 | popad |
422 | ret |
||
987 | mikedld | 423 | endp |
424 | |||
425 | ;----------------------------------------------------------------------------- |
||
426 | proc save_settings ;////////////////////////////////////////////////////////// |
||
427 | ;----------------------------------------------------------------------------- |
||
5241 | punk_joker | 428 | pushad |
987 | mikedld | 429 | |
5241 | punk_joker | 430 | movzx eax,[tabs_pos] |
431 | invoke ini.set_int,ini_path,ini_sec_options,ini_options_tabs_pos,eax |
||
432 | movzx eax,[secure_sel] |
||
433 | invoke ini.set_int,ini_path,ini_sec_options,ini_options_secure_sel,eax |
||
434 | movzx eax,[auto_braces] |
||
435 | invoke ini.set_int,ini_path,ini_sec_options,ini_options_auto_braces,eax |
||
436 | movzx eax,[auto_indent] |
||
437 | invoke ini.set_int,ini_path,ini_sec_options,ini_options_auto_indent,eax |
||
438 | movzx eax,[optim_save] |
||
439 | invoke ini.set_int,ini_path,ini_sec_options,ini_options_optim_save,eax |
||
440 | movzx eax,[line_nums] |
||
441 | invoke ini.set_int,ini_path,ini_sec_options,ini_options_line_nums,eax |
||
987 | mikedld | 442 | |
5241 | punk_joker | 443 | invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_text,[color_tbl.text] |
444 | invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_back,[color_tbl.back] |
||
445 | invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_text_sel,[color_tbl.text.sel] |
||
446 | invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_back_sel,[color_tbl.back.sel] |
||
447 | invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_symbol,[color_tbl.symbol] |
||
448 | invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_number,[color_tbl.number] |
||
449 | invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_string,[color_tbl.string] |
||
450 | invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_comment,[color_tbl.comment] |
||
451 | invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_line_moded,[color_tbl.line.moded] |
||
452 | invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_line_saved,[color_tbl.line.saved] |
||
987 | mikedld | 453 | |
5241 | punk_joker | 454 | invoke ini.set_int,ini_path,ini_sec_window,ini_window_left,[mainwnd_pos.x] |
455 | invoke ini.set_int,ini_path,ini_sec_window,ini_window_top,[mainwnd_pos.y] |
||
456 | invoke ini.set_int,ini_path,ini_sec_window,ini_window_width,[mainwnd_pos.w] |
||
457 | invoke ini.set_int,ini_path,ini_sec_window,ini_window_height,[mainwnd_pos.h] |
||
987 | mikedld | 458 | |
5241 | punk_joker | 459 | popad |
460 | ret |
||
987 | mikedld | 461 | endp |
462 | |||
463 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 464 | proc start_fasm ;///////////////////////////////////////////////////////////// |
465 | ;----------------------------------------------------------------------------- |
||
4274 | tserj | 466 | ; BL = 0 - compile |
467 | ; BL = 1 - run after compile |
||
468 | ; BL = 2 - run under mtdbg after compile |
||
122 | diamond | 469 | ;----------------------------------------------------------------------------- |
297 | mikedld | 470 | ; FASM infile,outfile,/path/to/files[,run] |
471 | ;----------------------------------------------------------------------------- |
||
5241 | punk_joker | 472 | cmp [cur_editor.AsmMode],0 |
473 | jne @f |
||
474 | ret |
||
297 | mikedld | 475 | @@: |
5241 | punk_joker | 476 | mov eax,[tab_bar.Default.Ptr] |
477 | or eax,eax |
||
478 | jnz @f |
||
479 | mov eax,[tab_bar.Current.Ptr] |
||
480 | @@: cmp byte[eax+TABITEM.Editor.FilePath],'/' |
||
481 | je @f |
||
482 | ret |
||
297 | mikedld | 483 | @@: |
5241 | punk_joker | 484 | mov edi,fasm_parameters |
485 | push eax |
||
31 | halyavin | 486 | |
5241 | punk_joker | 487 | cld |
31 | halyavin | 488 | |
5241 | punk_joker | 489 | lea esi,[eax+TABITEM.Editor.FilePath] |
490 | add esi,[eax+TABITEM.Editor.FileName] |
||
491 | push esi esi |
||
297 | mikedld | 492 | @@: lodsb |
5241 | punk_joker | 493 | cmp al,0 |
494 | je @f |
||
495 | stosb |
||
496 | cmp al,'.' |
||
497 | jne @b |
||
498 | mov ecx,esi |
||
499 | jmp @b |
||
297 | mikedld | 500 | @@: |
5241 | punk_joker | 501 | mov al,',' |
502 | stosb |
||
31 | halyavin | 503 | |
5241 | punk_joker | 504 | pop esi |
505 | sub ecx,esi |
||
506 | dec ecx |
||
507 | jz @f |
||
508 | rep movsb |
||
297 | mikedld | 509 | @@: |
5241 | punk_joker | 510 | mov al,',' |
511 | stosb |
||
31 | halyavin | 512 | |
5241 | punk_joker | 513 | pop ecx esi |
514 | add esi,TABITEM.Editor.FilePath |
||
515 | sub ecx,esi |
||
516 | rep movsb |
||
31 | halyavin | 517 | |
5241 | punk_joker | 518 | cmp bl,0 ; compile outfile ? |
519 | je @f |
||
520 | mov dword[edi],',run' |
||
521 | cmp bl,1 ; run outfile ? |
||
522 | je do_run |
||
523 | mov dword[edi],',dbg' |
||
4274 | tserj | 524 | do_run: |
5241 | punk_joker | 525 | add edi,4 |
6343 | serge | 526 | @@: |
5241 | punk_joker | 527 | mov al,0 |
528 | stosb |
||
31 | halyavin | 529 | |
5241 | punk_joker | 530 | mov [app_start.filename],app_fasm |
531 | mov [app_start.params],fasm_parameters |
||
178 | heavyiron | 532 | start_ret: |
5241 | punk_joker | 533 | mcall 70,app_start |
534 | ret |
||
617 | mikedld | 535 | endp |
31 | halyavin | 536 | |
122 | diamond | 537 | ;----------------------------------------------------------------------------- |
617 | mikedld | 538 | proc open_debug_board ;/////////////////////////////////////////////////////// |
122 | diamond | 539 | ;----------------------------------------------------------------------------- |
5241 | punk_joker | 540 | mov [app_start.filename],app_board |
541 | mov [app_start.params],0 |
||
542 | jmp start_ret |
||
617 | mikedld | 543 | endp |
31 | halyavin | 544 | |
122 | diamond | 545 | ;----------------------------------------------------------------------------- |
617 | mikedld | 546 | proc open_sysfuncs_txt ;////////////////////////////////////////////////////// |
122 | diamond | 547 | ;----------------------------------------------------------------------------- |
5241 | punk_joker | 548 | mov [app_start.filename],app_docpak |
549 | mov [app_start.params],sysfuncs_param |
||
550 | call start_ret |
||
551 | cmp eax,0xfffffff0 |
||
552 | jb @f |
||
553 | mov [app_start.filename],app_tinypad |
||
554 | mov [app_start.params],sysfuncs_filename |
||
555 | call start_ret |
||
122 | diamond | 556 | @@: ret |
617 | mikedld | 557 | endp |
31 | halyavin | 558 | |
297 | mikedld | 559 | set_opt: |
178 | heavyiron | 560 | |
297 | mikedld | 561 | .dialog: |
5241 | punk_joker | 562 | mov [bot_mode],1 |
563 | mov [bot_dlg_height],128 |
||
564 | mov [bot_dlg_handler],optsdlg_handler |
||
565 | mov [focused_tb],tb_color |
||
566 | mov al,[tb_color.length] |
||
567 | mov [tb_color.pos.x],al |
||
568 | mov [tb_color.sel.x],0 |
||
569 | mov [tb_casesen],1 |
||
570 | mov [cur_part],0 |
||
571 | m2m [cur_color],dword[color_tbl.text] |
||
572 | mov esi,color_tbl |
||
573 | mov edi,cur_colors |
||
574 | mov ecx,10 |
||
575 | cld |
||
576 | rep movsd |
||
577 | call drawwindow |
||
578 | ret |
||
31 | halyavin | 579 | |
259 | mikedld | 580 | .line_numbers: |
5241 | punk_joker | 581 | xor [line_nums],1 |
582 | ret |
||
259 | mikedld | 583 | .optimal_fill: |
5241 | punk_joker | 584 | xor [optim_save],1 |
585 | ret |
||
259 | mikedld | 586 | .auto_indents: |
5241 | punk_joker | 587 | xor [auto_indent],1 |
588 | ret |
||
259 | mikedld | 589 | .auto_braces: |
5241 | punk_joker | 590 | xor [auto_braces],1 |
591 | ret |
||
259 | mikedld | 592 | .secure_sel: |
5241 | punk_joker | 593 | xor [secure_sel],1 |
594 | ret |
||
31 | halyavin | 595 | |
122 | diamond | 596 | ;----------------------------------------------------------------------------- |
31 | halyavin | 597 | |
617 | mikedld | 598 | include 'data/tp-defines.inc' |
259 | mikedld | 599 | |
122 | diamond | 600 | include 'tp-draw.asm' |
601 | include 'tp-key.asm' |
||
258 | mikedld | 602 | include 'tp-button.asm' |
122 | diamond | 603 | include 'tp-mouse.asm' |
604 | include 'tp-files.asm' |
||
258 | mikedld | 605 | include 'tp-common.asm' |
606 | include 'tp-dialog.asm' |
||
122 | diamond | 607 | include 'tp-popup.asm' |
608 | include 'tp-tbox.asm' |
||
259 | mikedld | 609 | include 'tp-tabctl.asm' |
610 | include 'tp-editor.asm' |
||
258 | mikedld | 611 | include 'tp-recode.asm' |
4487 | mario79 | 612 | include 'tp-clipboard.asm' |
31 | halyavin | 613 | |
3014 | dunkaist | 614 | include '../../../dll.inc' |
178 | heavyiron | 615 | |
31 | halyavin | 616 | ;----------------------------------------------------------------------------- |
7134 | dunkaist | 617 | __section @DATA ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
31 | halyavin | 618 | ;----------------------------------------------------------------------------- |
619 | |||
827 | mikedld | 620 | ;include_debug_strings |
621 | |||
617 | mikedld | 622 | include 'data/tp-idata.inc' |
31 | halyavin | 623 | |
617 | mikedld | 624 | ;----------------------------------------------------------------------------- |
7134 | dunkaist | 625 | __section @IMPORT ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
617 | mikedld | 626 | ;----------------------------------------------------------------------------- |
31 | halyavin | 627 | |
617 | mikedld | 628 | library \ |
5241 | punk_joker | 629 | libini,'libini.obj',\ |
630 | libio,'libio.obj',\ |
||
631 | libgfx,'libgfx.obj',\ |
||
632 | proc_lib,'proc_lib.obj' |
||
31 | halyavin | 633 | |
5241 | punk_joker | 634 | import libini, \ |
635 | ini.get_str ,'ini_get_str',\ |
||
636 | ini.set_str ,'ini_set_str',\ |
||
637 | ini.get_int ,'ini_get_int',\ |
||
638 | ini.set_int ,'ini_set_int',\ |
||
639 | ini.get_color,'ini_get_color',\ |
||
640 | ini.set_color,'ini_set_color' |
||
31 | halyavin | 641 | |
5241 | punk_joker | 642 | import libio, \ |
643 | file.find_first,'file_find_first',\ |
||
644 | file.find_next ,'file_find_next',\ |
||
645 | file.find_close,'file_find_close',\ |
||
646 | file.size ,'file_size',\ |
||
647 | file.open ,'file_open',\ |
||
648 | file.read ,'file_read',\ |
||
649 | file.write ,'file_write',\ |
||
650 | file.seek ,'file_seek',\ |
||
651 | file.tell ,'file_tell',\ |
||
652 | file.eof? ,'file_iseof',\ |
||
653 | file.truncate ,'file_truncate',\ |
||
654 | file.close ,'file_close' |
||
31 | halyavin | 655 | |
5241 | punk_joker | 656 | import libgfx, \ |
657 | gfx.open ,'gfx_open',\ |
||
658 | gfx.close ,'gfx_close',\ |
||
659 | gfx.pen.color ,'gfx_pen_color',\ |
||
660 | gfx.brush.color ,'gfx_brush_color',\ |
||
661 | gfx.pixel ,'gfx_pixel',\ |
||
662 | gfx.move.to ,'gfx_move_to',\ |
||
663 | gfx.line.to ,'gfx_line_to',\ |
||
664 | gfx.line ,'gfx_line',\ |
||
665 | gfx.polyline ,'gfx_polyline',\ |
||
666 | gfx.polyline.to ,'gfx_polyline_to',\ |
||
667 | gfx.fillrect ,'gfx_fillrect',\ |
||
668 | gfx.fillrect.ex ,'gfx_fillrect_ex',\ |
||
669 | gfx.framerect ,'gfx_framerect',\ |
||
670 | gfx.framerect.ex,'gfx_framerect_ex',\ |
||
671 | gfx.rectangle ,'gfx_rectangle',\ |
||
672 | gfx.rectangle.ex,'gfx_rectangle_ex' |
||
31 | halyavin | 673 | |
5241 | punk_joker | 674 | import proc_lib, \ |
675 | OpenDialog_Init ,'OpenDialog_init',\ |
||
676 | OpenDialog_Start ,'OpenDialog_start' |
||
1624 | mario79 | 677 | |
5241 | punk_joker | 678 | TINYPAD_END: ; end of file |
122 | diamond | 679 | |
31 | halyavin | 680 | ;----------------------------------------------------------------------------- |
7134 | dunkaist | 681 | __section @UDATA ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
31 | halyavin | 682 | ;----------------------------------------------------------------------------- |
683 | |||
617 | mikedld | 684 | include 'data/tp-udata.inc' |
297 | mikedld | 685 | |
31 | halyavin | 686 | ;----------------------------------------------------------------------------- |
7134 | dunkaist | 687 | __section @PARAMS ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
31 | halyavin | 688 | ;----------------------------------------------------------------------------- |
689 | |||
690 | fasm_parameters: |
||
6343 | serge | 691 | rb 1024+256 |
5241 | punk_joker | 692 | p_info process_information |
122 | diamond | 693 | p_info2 process_information |
5241 | punk_joker | 694 | sc system_colors |
122 | diamond | 695 | |
5241 | punk_joker | 696 | ini_path rb PATHL |
987 | mikedld | 697 | |
1624 | mario79 | 698 | ;--------------------------------------------------------------------- |
699 | temp_dir_pach: |
||
5241 | punk_joker | 700 | rb 4096 |
1624 | mario79 | 701 | ;--------------------------------------------------------------------- |
702 | fname_Info: |
||
5241 | punk_joker | 703 | rb 4096 ; filename |
1624 | mario79 | 704 | ;--------------------------------------------------------------------- |
705 | filename_area: |
||
5241 | punk_joker | 706 | rb 256 |
1624 | mario79 | 707 | ;--------------------------------------------------------------------- |
259 | mikedld | 708 | rb 1024*4 |
709 | MAIN_STACK: |
||
710 | rb 1024*4 |
||
711 | POPUP_STACK: |
||
712 | |||
713 | STATIC_MEM_END: |
||
714 | |||
715 | diff10 'Main memory size',0,$ |