Rev 109 | Rev 178 | 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 |
122 | diamond | 3 | ; compiler: flat assembler 1.64 |
4 | ; memory to compile: 3.0/11.5 MBytes (without/with size optimizations) |
||
5 | ; version: 4.0 |
||
6 | ; last update: 2006-04-13 (Apr 13, 2006) |
||
7 | ;----------------------------------------------------------------------------- |
||
8 | ; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi |
||
9 | ; maintained by: Ivan Poddubny >> ivan-yar@bk.ru |
||
10 | ; Mike Semenyako >> mike.dld@gmail.com |
||
11 | ;----------------------------------------------------------------------------- |
||
12 | ; TODO: |
||
13 | ; optimize drawing (reduce flickering); |
||
14 | ; optimize memory usage (allocate only needed amount, not static 3 Mbytes); |
||
15 | ; add block selection ability, undo action; |
||
16 | ; working with multiple files (add tabs); |
||
17 | ; other bugfixes and speed/size optimizations |
||
18 | ; |
||
31 | halyavin | 19 | ; HISTORY: |
122 | diamond | 20 | ; 4.0.2 (mike.dld) |
21 | ; bug-fixes: |
||
22 | ; - program terminates if started with parameters (fine for DOCPAK) |
||
23 | ; 4.0.1 (mike.dld) |
||
24 | ; bug-fixes: |
||
25 | ; - unable to run program after exiting from main menu (Alt+X) |
||
26 | ; new features: |
||
27 | ; - integration with DOCPAK |
||
28 | ; 4.0 (mike.dld) |
||
29 | ; bug-fixes: |
||
30 | ; - main menu popups' "on show" was called only for first shown popup |
||
31 | ; - clear selection on left/right arrow keys |
||
32 | ; new features: |
||
33 | ; - "replace" dialog (w/o "skip", "replace all") |
||
34 | ; - line numbers display |
||
35 | ; - options (except "appearance" and "smart tabulation") |
||
36 | ; - options saving (colors, window position, "Options" popup triggers) |
||
37 | ; 4.0 beta 2 (mike.dld) |
||
38 | ; bug-fixes: |
||
39 | ; - unable to start if /rd/1/example.asm is missing (from Halyavin) |
||
40 | ; - clicking on menu items draws main window in popup (from Rohan) |
||
41 | ; - passed parameters aren't taken into account (from Mario79) |
||
42 | ; - background isn't erased if text lines < screen lines after |
||
43 | ; selection deletion (from Rohan) |
||
44 | ; 4.0 beta 1 (mike.dld) |
||
45 | ; menu bar and popup menu; |
||
46 | ; removed buttons from the top and input fields from the bottom since |
||
47 | ; now they're accesible through main/popup menu; |
||
48 | ; improved keyboard handling (using 66th function); |
||
49 | ; support for almost all FASMW keyboard shourtcuts; |
||
50 | ; added text selection ability, standard selection operations |
||
51 | ; (copy,cut,paste); |
||
52 | ; new integrated dialogs (open, save, find) |
||
53 | ; fix to collapse SPACEs into TABs only for *.asm and *.inc files |
||
31 | halyavin | 54 | ; 3.78a (mike.dld) |
122 | diamond | 55 | ; fixed termination while typing in x positions higher than (line_length+10); |
31 | halyavin | 56 | ; improved drawing on small heights |
122 | diamond | 57 | ; don't draw window while its height = 0 (Kolibri "minimize" support) |
31 | halyavin | 58 | ; 3.78 (mike.dld) |
59 | ; now lines may be of ANY length; |
||
60 | ; optimized memory usage (less memory for internal file representation) |
||
61 | ; after loading file, it's internal size equals to its real size |
||
62 | ; plus 14 bytes for each line (4 bytes for line length |
||
122 | diamond | 63 | ; and 10 spaced to the end - to reduce data relocations count); |
31 | halyavin | 64 | ; completely rewritten keyboard handling; |
65 | ; added horizontal scrollbar; |
||
66 | ; all line feed formats are supported: WIN(CRLF),*NIX(LF),MAC(CR); |
||
67 | ; etc. |
||
68 | ; 3.77 (mike.dld) |
||
69 | ; changed save_string to collapse SPACEs into TABs; |
||
70 | ; rewrote drawfile from scratch (speed++) |
||
71 | ; through some drawing improvements still needed |
||
72 | ; (some checkups to reduce flickering); |
||
73 | ; writepos (size--); |
||
74 | ; fixed drawing window while height < 100px, and for non-asm files; |
||
75 | ; several small fixes; speed/size optimizations |
||
76 | ; 3.76 (mike.dld) |
||
77 | ; changed loadfile/loadhdfile to expand TABs into SPACEs; |
||
78 | ; changed TAB,ENTER,DELETE,BSPACE keys behaviour (rewritten from scratch); |
||
79 | ; vertical scrollbar; |
||
80 | ; extra window resizing capabilities (added a couple of constants); |
||
81 | ; completely new text cursor management & moving text cursor with mouse; |
||
82 | ; improved search function, moving cursor to beginning of text found; |
||
122 | diamond | 83 | ; adjustable max line width (change LINE_WIDTH & recompile) // (obsolet) |
31 | halyavin | 84 | ; 3.75a |
85 | ; fixed converting char to upper case in read_string |
||
86 | ; 3.75 |
||
87 | ; rewrote save_file from scratch; bugfix in loadfile; |
||
88 | ; 3.74 |
||
89 | ; optimisation |
||
90 | ; 3.73 |
||
91 | ; completly new load_file function |
||
92 | ; 3.72 |
||
93 | ; speed++ |
||
94 | ; 3.71 |
||
95 | ; error beep |
||
96 | ; 3.6,3.7: |
||
97 | ; many bugs fixed |
||
98 | ; simple toolbar |
||
99 | ; compile, run applications from TINYPAD, all fasm output is in debug board |
||
100 | ; TAB button |
||
101 | ; auto-indent |
||
102 | ; Ctrl+L - insert comment string |
||
122 | diamond | 103 | ;----------------------------------------------------------------------------- |
31 | halyavin | 104 | ; Memory 0x300000: |
122 | diamond | 105 | ; stack for popup 0x00dff0 - |
106 | ; stack for help 0x00eff0 - |
||
107 | ; stack 0x00fff0 - |
||
108 | ; load position 0x010000 + |
||
109 | ; edit area 0x080000 + |
||
110 | ; copy/paste area 0x2f0000 + |
||
111 | ;----------------------------------------------------------------------------- |
||
31 | halyavin | 112 | |
113 | include 'macros.inc' ; useful stuff |
||
122 | diamond | 114 | include 'tinypad.inc' |
115 | purge mov,add,sub ; SPEED |
||
31 | halyavin | 116 | |
122 | diamond | 117 | header '01',1,@CODE,TINYPAD_END,AREA_ENDMEM,MAIN_STACK,@PARAMS,self_path |
31 | halyavin | 118 | |
122 | diamond | 119 | ;include 'debug.inc' |
31 | halyavin | 120 | |
122 | diamond | 121 | ASEPC = '-' ; separator character (char) |
122 | ATOPH = POP_IHEIGHT+2 ; menu bar height (pixels) |
||
123 | ;OLEFT = 50+1 ; left offset (pixels) !!! don't change !!! |
||
124 | SCRLW = 16 ; scrollbar widht/height (pixels) |
||
125 | ATABW = 8 ; tab width (chars) |
||
126 | LINEH = 10 ; line height (pixels) |
||
127 | PATHL = 255 ; maximum path length (chars) !!! don't change !!! |
||
128 | AMINS = 8 ; minimal scroll thumb size (pixels) |
||
31 | halyavin | 129 | |
122 | diamond | 130 | STATH = 14 ; status bar height |
31 | halyavin | 131 | |
122 | diamond | 132 | MEV_LDOWN = 1 |
133 | MEV_LUP = 2 |
||
134 | MEV_RDOWN = 3 |
||
135 | MEV_RUP = 4 |
||
136 | MEV_MOVE = 5 |
||
137 | |||
31 | halyavin | 138 | ;----------------------------------------------------------------------------- |
122 | diamond | 139 | section @OPTIONS ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
31 | halyavin | 140 | ;----------------------------------------------------------------------------- |
141 | |||
122 | diamond | 142 | label color_tbl dword |
143 | RGB( 0, 0, 0) ; RGB( 0, 0, 0) ; RGB( 0, 0, 0) ; text |
||
144 | RGB( 0,144, 0) ; RGB( 0,144, 0) ; RGB( 0,160, 0) ; numbers |
||
145 | RGB(176, 0, 0) ; RGB(160, 0, 0) ; RGB( 0,128,255) ; strings |
||
146 | RGB(128,128,128) ; RGB(144,144,144) ; RGB(160,160,160) ; comments |
||
147 | RGB( 48, 48,240) ; RGB( 48, 48,240) ; RGB(255, 0, 0) ; symbols |
||
148 | RGB(255,255,255) ; RGB(224,224,224) ; RGB(255,255,255) ; background |
||
149 | RGB(255,255,255) ; RGB(255,255,255) ; RGB(255,255,255) ; selection text |
||
150 | RGB( 10, 36,106) ; RGB( 0, 0,128) ; RGB( 0, 64,128) ; selection background |
||
31 | halyavin | 151 | |
122 | diamond | 152 | ins_mode db 1 |
31 | halyavin | 153 | |
122 | diamond | 154 | options db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB |
31 | halyavin | 155 | |
122 | diamond | 156 | mainwnd_pos: |
157 | .x dd 100 |
||
158 | .y dd 75 |
||
159 | .w dd 6*80+6+SCRLW+5 |
||
160 | .h dd 402 |
||
31 | halyavin | 161 | |
122 | diamond | 162 | ;----------------------------------------------------------------------------- |
163 | section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
||
164 | ;----------------------------------------------------------------------------- |
||
31 | halyavin | 165 | |
122 | diamond | 166 | ; fninit |
31 | halyavin | 167 | |
122 | diamond | 168 | cld |
169 | mov edi,@UDATA |
||
170 | mov ecx,@PARAMS-@UDATA |
||
171 | mov al,0 |
||
172 | rep stosb |
||
31 | halyavin | 173 | |
122 | diamond | 174 | mov [left_ofs],40+1 |
175 | mov [f_info+4],0 |
||
176 | mov [f_info+12],AREA_TEMP |
||
177 | mov [f_info+16],AREA_EDIT-AREA_TEMP |
||
31 | halyavin | 178 | |
122 | diamond | 179 | ; mov esi,s_example |
180 | ; mov edi,s_fname |
||
181 | ; mov ecx,s_example.size |
||
182 | ; mov [s_fname.size],ecx |
||
183 | ; rep movsb |
||
184 | mov esi,s_example |
||
185 | mov edi,tb_opensave.text |
||
186 | mov ecx,s_example.size |
||
187 | mov [tb_opensave.length],cl |
||
188 | rep movsb |
||
31 | halyavin | 189 | |
122 | diamond | 190 | mov esi,s_still |
191 | mov edi,s_search |
||
192 | mov ecx,s_still.size |
||
193 | mov [s_search.size],ecx |
||
194 | rep movsb |
||
31 | halyavin | 195 | |
122 | diamond | 196 | cmp byte[@PARAMS],0 |
197 | jz no_params |
||
31 | halyavin | 198 | |
122 | diamond | 199 | ;// Willow's code to support DOCPAK [ |
31 | halyavin | 200 | |
122 | diamond | 201 | cmp byte[@PARAMS],'*' |
202 | jne .noipc |
||
203 | ; convert size from decimal representation to dword |
||
204 | mov esi, @PARAMS+1 |
||
205 | xor edx, edx |
||
206 | xor eax, eax |
||
207 | @@: |
||
208 | lodsb |
||
209 | test al, al |
||
210 | jz @f |
||
211 | lea edx, [edx*4+edx] |
||
212 | lea edx, [edx*2+eax] |
||
213 | jmp @b |
||
214 | @@: |
||
215 | add edx,20 |
||
216 | mcall 60,1,AREA_TEMP-16 ; 0x10000-16 |
||
217 | mov dword[AREA_TEMP-16+4],8 ; [0x10000-16+4],8 |
||
218 | mcall 40,1000000b |
||
219 | mcall 23,200 |
||
220 | cmp eax,7 |
||
221 | jne key.alt_x.close ; ¤Єю эр mcall -1 ьхЄър |
||
222 | mov esi,AREA_TEMP-16 ; 0x10000-16 |
||
223 | mov byte[esi],1 |
||
224 | mov eax,[esi+12] |
||
225 | inc eax |
||
226 | call load_file.file_found |
||
227 | jmp @f |
||
228 | ; call file_found ; чруЁєчър Їрщыр |
||
229 | ; jmp do_load_file.restorecursor ; юЄюсЁрцхэшх |
||
230 | .noipc: |
||
31 | halyavin | 231 | |
122 | diamond | 232 | ;// Willow's code to support DOCPAK ] |
31 | halyavin | 233 | |
122 | diamond | 234 | ; parameters are at @PARAMS |
235 | mov esi,@PARAMS |
||
236 | mov edi,tb_opensave.text |
||
237 | mov ecx,PATHL |
||
238 | rep movsb |
||
239 | mov edi,tb_opensave.text |
||
240 | mov ecx,PATHL |
||
241 | xor al,al |
||
242 | repne scasb |
||
243 | jne key.alt_x.close |
||
244 | lea eax,[edi-tb_opensave.text-1] |
||
245 | mov [tb_opensave.length],al |
||
31 | halyavin | 246 | |
122 | diamond | 247 | no_params: |
248 | call btn.load_file;do_load_file |
||
249 | jnc @f |
||
250 | call new_file |
||
31 | halyavin | 251 | |
252 | @@: |
||
122 | diamond | 253 | call drawwindow |
254 | mcall 66,1,1 |
||
255 | mcall 40,00100111b |
||
31 | halyavin | 256 | |
122 | diamond | 257 | ;----------------------------------------------------------------------------- |
31 | halyavin | 258 | |
122 | diamond | 259 | still: |
260 | call writepos ; write current position & number of strings |
||
31 | halyavin | 261 | |
122 | diamond | 262 | .skip_write: |
263 | mcall 10;23,50; wait here until event |
||
264 | cmp [main_closed],0 |
||
265 | jne key.alt_x |
||
266 | dec eax ; redraw ? |
||
267 | jz red |
||
268 | dec eax ; key ? |
||
269 | jz key |
||
270 | dec eax ; button ? |
||
271 | jz button |
||
272 | sub eax,3 ; mouse ? |
||
273 | jz mouse |
||
31 | halyavin | 274 | |
122 | diamond | 275 | jmp still.skip_write |
31 | halyavin | 276 | |
122 | diamond | 277 | ;----------------------------------------------------------------------------- |
278 | func red ;///// window redraw //////////////////////////////////////////////// |
||
279 | ;----------------------------------------------------------------------------- |
||
280 | call drawwindow |
||
281 | call check_inv_all.skip_check |
||
282 | jmp still |
||
31 | halyavin | 283 | endf |
284 | |||
122 | diamond | 285 | ;----------------------------------------------------------------------------- |
286 | func start_fasm ;///////////////////////////////////////////////////////////// |
||
287 | ;----------------------------------------------------------------------------- |
||
31 | halyavin | 288 | ; BL = run after compile |
122 | diamond | 289 | ;----------------------------------------------------------------------------- |
290 | cmp [asm_mode],0 |
||
291 | jne @f |
||
292 | ret |
||
293 | @@: mov esi,f_info.path ; s_fname |
||
294 | mov edi,fasm_parameters |
||
31 | halyavin | 295 | |
122 | diamond | 296 | cmp byte[esi],'/' |
297 | je .yes_systree |
||
31 | halyavin | 298 | |
122 | diamond | 299 | mov ecx,[f_info.length] ; [s_fname.size] |
300 | rep movsb |
||
31 | halyavin | 301 | |
122 | diamond | 302 | mov al,',' |
303 | stosb |
||
31 | halyavin | 304 | |
122 | diamond | 305 | mov ecx,[f_info.length] ; [s_fname.size] |
306 | add ecx,-4 |
||
307 | mov esi,f_info.path ; s_fname |
||
308 | rep movsb |
||
31 | halyavin | 309 | |
122 | diamond | 310 | mov al,',' |
311 | stosb |
||
31 | halyavin | 312 | |
122 | diamond | 313 | mov dword[edi],'/RD/' |
314 | mov word[edi+4],'1/' |
||
315 | add edi,6 |
||
31 | halyavin | 316 | |
122 | diamond | 317 | mov al,0 |
318 | stosb |
||
31 | halyavin | 319 | |
122 | diamond | 320 | jmp .run |
31 | halyavin | 321 | |
322 | .yes_systree: |
||
122 | diamond | 323 | mov eax,[f_info.length] |
324 | add esi,eax ; [s_fname.size] |
||
325 | dec esi |
||
31 | halyavin | 326 | |
122 | diamond | 327 | xor ecx,ecx |
328 | mov al,'/' |
||
329 | @@: cmp [esi],al |
||
330 | je @f |
||
331 | dec esi |
||
332 | inc ecx |
||
333 | jmp @b |
||
334 | @@: inc esi |
||
31 | halyavin | 335 | |
122 | diamond | 336 | push esi esi ecx |
31 | halyavin | 337 | |
122 | diamond | 338 | rep movsb |
31 | halyavin | 339 | |
122 | diamond | 340 | mov al,',' |
341 | stosb |
||
31 | halyavin | 342 | |
122 | diamond | 343 | pop ecx esi |
31 | halyavin | 344 | |
122 | diamond | 345 | add ecx,-4 |
346 | rep movsb |
||
31 | halyavin | 347 | |
122 | diamond | 348 | mov al,',' |
349 | stosb |
||
31 | halyavin | 350 | |
122 | diamond | 351 | pop ecx |
352 | sub ecx,f_info.path ; s_fname |
||
353 | mov esi,f_info.path ; s_fname |
||
31 | halyavin | 354 | |
122 | diamond | 355 | rep movsb |
31 | halyavin | 356 | |
122 | diamond | 357 | mov al,0 |
358 | stosb |
||
31 | halyavin | 359 | |
360 | .run: |
||
122 | diamond | 361 | cmp bl,0 ; run outfile ? |
362 | je @f |
||
363 | mov dword[edi-1],',run' |
||
364 | mov byte[edi+3],0 |
||
365 | @@: mcall 19,fasm_filename,fasm_parameters |
||
366 | ret |
||
31 | halyavin | 367 | endf |
368 | |||
122 | diamond | 369 | ;----------------------------------------------------------------------------- |
370 | func open_debug_board ;/////////////////////////////////////////////////////// |
||
371 | ;----------------------------------------------------------------------------- |
||
372 | mcall 19,debug_filename,0 |
||
373 | ret |
||
31 | halyavin | 374 | endf |
375 | |||
122 | diamond | 376 | ;----------------------------------------------------------------------------- |
377 | func open_sysfuncs_txt ;////////////////////////////////////////////////////// |
||
378 | ;----------------------------------------------------------------------------- |
||
379 | mcall 19,docpak_filename,sysfuncs_param |
||
380 | cmp eax,0xfffffff0 |
||
381 | jb @f |
||
382 | mcall 19,tinypad_filename,sysfuncs_filename |
||
383 | @@: ret |
||
31 | halyavin | 384 | endf |
385 | |||
122 | diamond | 386 | ;----------------------------------------------------------------------------- |
387 | func layout ;///// change keyboard layout /////////////////////////////////// |
||
388 | ;----------------------------------------------------------------------------- |
||
389 | mcall 19,setup,param_setup |
||
390 | mcall 5,eax |
||
31 | halyavin | 391 | ; call activate_me |
392 | ; ret |
||
393 | ;endf |
||
394 | |||
395 | ;func activate_me |
||
122 | diamond | 396 | mcall 9,p_info,-1 |
397 | inc eax |
||
398 | inc eax |
||
399 | mov ecx,eax |
||
400 | mov edi,[p_info.PID] |
||
401 | mov ebx,p_info |
||
402 | @@: dec ecx |
||
403 | jz @f ; counter=0 => not found? => return |
||
404 | mcall 9 |
||
405 | cmp edi,[p_info.PID] |
||
406 | jne @b |
||
407 | mcall 18,3 |
||
408 | mcall 5,eax |
||
31 | halyavin | 409 | @@: ret |
410 | endf |
||
411 | |||
122 | diamond | 412 | func set_opt |
413 | test [options],al |
||
414 | je @f |
||
415 | not al |
||
416 | and [options],al |
||
417 | ret |
||
418 | @@: or [options],al |
||
419 | ret |
||
31 | halyavin | 420 | endf |
421 | |||
122 | diamond | 422 | func set_line_numbers |
423 | mov al,OPTS_LINENUMS |
||
424 | call set_opt |
||
425 | ret |
||
31 | halyavin | 426 | endf |
427 | |||
122 | diamond | 428 | func set_optimal_fill |
429 | mov al,OPTS_OPTIMSAVE |
||
430 | call set_opt |
||
431 | ret |
||
31 | halyavin | 432 | endf |
433 | |||
122 | diamond | 434 | func set_auto_indents |
435 | mov al,OPTS_AUTOINDENT |
||
436 | call set_opt |
||
437 | ret |
||
31 | halyavin | 438 | endf |
439 | |||
122 | diamond | 440 | func set_auto_braces |
441 | mov al,OPTS_AUTOBRACES |
||
442 | call set_opt |
||
443 | ret |
||
31 | halyavin | 444 | endf |
445 | |||
122 | diamond | 446 | func set_secure_sel |
447 | mov al,OPTS_SECURESEL |
||
448 | call set_opt |
||
449 | ret |
||
31 | halyavin | 450 | endf |
451 | |||
122 | diamond | 452 | ;----------------------------------------------------------------------------- |
31 | halyavin | 453 | |
122 | diamond | 454 | include 'tp-draw.asm' |
455 | include 'tp-key.asm' |
||
456 | ;include 'tp-key2.asm' |
||
457 | include 'tp-butto.asm' |
||
458 | include 'tp-mouse.asm' |
||
459 | include 'tp-files.asm' |
||
460 | include 'tp-commo.asm' |
||
461 | include 'tp-dialo.asm' |
||
462 | ;include 'tp-find.asm' |
||
463 | include 'tp-popup.asm' |
||
464 | include 'tp-tbox.asm' |
||
31 | halyavin | 465 | |
466 | ;----------------------------------------------------------------------------- |
||
122 | diamond | 467 | section @DATA ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
31 | halyavin | 468 | ;----------------------------------------------------------------------------- |
469 | |||
122 | diamond | 470 | ;addr dd s_fname ; address of input string |
471 | ;temp dd 0xABCD ; used in read_string |
||
472 | vscrl_capt dd -1 |
||
473 | hscrl_capt dd -1 |
||
474 | body_capt dd -1 |
||
31 | halyavin | 475 | |
122 | diamond | 476 | key0 db \ |
477 | 0x00,0x00,0x02,0x03,0x04,0x05,0x06,0x07,\ |
||
478 | 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x00,0x00,\ |
||
479 | 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,\ |
||
480 | 0x18,0x19,0x1A,0x1B,0x00,0x00,0x1E,0x1F,\ |
||
481 | 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,\ |
||
482 | 0x28,0x29,0x00,0x2B,0x2C,0x2D,0x2E,0x2F,\ |
||
483 | 0x30,0x31,0x32,0x33,0x34,0x35,0x00,0x00,\ |
||
484 | 0x00,0x39,0x00,0x00,0x00,0x00,0x00,0x00 |
||
485 | times 12*16 db 0x00 |
||
31 | halyavin | 486 | |
122 | diamond | 487 | accel_table dd \ |
488 | 0x0000000E,key.bkspace ,\ ; BackSpace |
||
489 | 0x0000000F,key.tab ,\ ; Tab |
||
490 | 0x0000001C,key.return ,\ ; Return |
||
491 | 0x0000003D,key.f3 ,\ ; F3 |
||
492 | 0x00000043,key.f9 ,\ ; F9 |
||
493 | 0x00000147,key.home ,\ ; Home |
||
494 | 0x00000148,key.up ,\ ; Up |
||
495 | 0x00000149,key.pgup ,\ ; PageUp |
||
496 | 0x0000014B,key.left ,\ ; Left |
||
497 | 0x0000014D,key.right ,\ ; Right |
||
498 | 0x0000014F,key.end ,\ ; End |
||
499 | 0x00000150,key.down ,\ ; Down |
||
500 | 0x00000151,key.pgdn ,\ ; PageDown |
||
501 | 0x00000152,key.ins ,\ ; Insert |
||
502 | 0x00000153,key.del ,\ ; Delete |
||
503 | 0x00010147,key.shift_home ,\ ; Shift+Home |
||
504 | 0x00010148,key.shift_up ,\ ; Shift+Up |
||
505 | 0x00010149,key.shift_pgup ,\ ; Shift+PageUp |
||
506 | 0x0001014B,key.shift_left ,\ ; Shift+Left |
||
507 | 0x0001014D,key.shift_right ,\ ; Shift+Right |
||
508 | 0x0001014F,key.shift_end ,\ ; Shift+End |
||
509 | 0x00010150,key.shift_down ,\ ; Shift+Down |
||
510 | 0x00010151,key.shift_pgdn ,\ ; Shift+PageDown |
||
511 | 0x00010153,key.del ,\ ; Shift+Delete |
||
512 | 0x00020015,key.ctrl_y ,\ ; Ctrl+Y |
||
513 | 0x00020018,key.ctrl_o ,\ ; Ctrl+O |
||
514 | 0x0002001E,key.ctrl_a ,\ ; Ctrl+A |
||
515 | 0x0002001F,key.ctrl_s ,\ ; Ctrl+S |
||
516 | 0x00020020,key.ctrl_d ,\ ; Ctrl+D |
||
517 | 0x00020021,key.ctrl_f ,\ ; Ctrl+F |
||
518 | 0x00020022,key.ctrl_g ,\ ; Ctrl+G |
||
519 | 0x00020023,key.ctrl_h ,\ ; Ctrl+H |
||
520 | \;0x00020026,key.ctrl_l ,\ ; Ctrl+L |
||
521 | 0x0002002D,key.ctrl_x ,\ ; Ctrl+X |
||
522 | 0x0002002E,key.ctrl_c ,\ ; Ctrl+C |
||
523 | 0x0002002F,key.ctrl_v ,\ ; Ctrl+V |
||
524 | 0x00020031,key.ctrl_n ,\ ; Ctrl+N |
||
525 | 0x00020043,key.ctrl_f9 ,\ ; Ctrl+F9 |
||
526 | 0x00020147,key.ctrl_home ,\ ; Ctrl+Home |
||
527 | \;0x00020148,key.ctrl_up ,\ ; Ctrl+Up |
||
528 | 0x00020149,key.ctrl_pgup ,\ ; Ctrl+PageUp |
||
529 | 0x0002014B,key.ctrl_left ,\ ; Ctrl+Left |
||
530 | 0x0002014D,key.ctrl_right ,\ ; Ctrl+Right |
||
531 | 0x0002014F,key.ctrl_end ,\ ; Ctrl+End |
||
532 | \;0x00020150,key.ctrl_down ,\ ; Ctrl+Down |
||
533 | 0x00020151,key.ctrl_pgdn ,\ ; Ctrl+PageDown |
||
534 | 0x00020153,key.del ,\ ; Ctrl+Del |
||
535 | 0x0003001F,key.shift_ctrl_s ,\ ; Shift+Ctrl+S |
||
536 | 0x00030147,key.shift_ctrl_home ,\ ; Shift+Ctrl+Home |
||
537 | \;0x00030148,key.shift_ctrl_up ,\ ; Shift+Ctrl+Up |
||
538 | 0x00030149,key.shift_ctrl_pgup ,\ ; Shift+Ctrl+PageUp |
||
539 | 0x0003014B,key.shift_ctrl_left ,\ ; Shift+Ctrl+Left |
||
540 | 0x0003014D,key.shift_ctrl_right ,\ ; Shift+Ctrl+Right |
||
541 | 0x0003014F,key.shift_ctrl_end ,\ ; Shift+Ctrl+End |
||
542 | \;0x00030150,key.shift_ctrl_down ,\ ; Shift+Ctrl+Down |
||
543 | 0x00030151,key.shift_ctrl_pgdn ,\ ; Shift+Ctrl+PageDown |
||
544 | 0x0004002D,key.alt_x ,\ ; Alt+X |
||
545 | |||
31 | halyavin | 546 | |
122 | diamond | 547 | accel_table_textbox dd \ |
548 | \;0x00000001,key.tb.escape ,\ ; Escape |
||
549 | 0x0000000E,key.tb.bkspace ,\ ; BackSpace |
||
550 | \;0x0000000F,key.tb.tab ,\ ; Tab |
||
551 | \;0x0000001C,key.tb.return ,\ ; Return |
||
552 | 0x00000147,key.tb.home ,\ ; Home |
||
553 | 0x0000014B,key.tb.left ,\ ; Left |
||
554 | 0x0000014D,key.tb.right ,\ ; Right |
||
555 | 0x0000014F,key.tb.end ,\ ; End |
||
556 | 0x00000153,key.tb.del ,\ ; Delete |
||
557 | 0x00010147,key.tb.shift_home ,\ ; Shift+Home |
||
558 | 0x0001014B,key.tb.shift_left ,\ ; Shift+Left |
||
559 | 0x0001014D,key.tb.shift_right ,\ ; Shift+Right |
||
560 | 0x0001014F,key.tb.shift_end ,\ ; Shift+End |
||
561 | 0x00010153,key.tb.del ,\ ; Shift+Del |
||
562 | |||
31 | halyavin | 563 | |
122 | diamond | 564 | accel_table2 dd \ |
565 | 1,btn.close_main_window ,\ |
||
566 | \;10000,btn.compile ,\ |
||
567 | \;10001,btn.compile_run ,\ |
||
568 | \;10002,btn.debug_board ,\ |
||
569 | \;10003,btn.sysfuncs_txt ,\ |
||
570 | 'UP',btn.scroll_up ,\ |
||
571 | 'DN',btn.scroll_down ,\ |
||
572 | 'LT',btn.scroll_left ,\ |
||
573 | 'RT',btn.scroll_right ,\ |
||
574 | \;5,key.ctrl_o ,\ |
||
575 | |||
31 | halyavin | 576 | |
122 | diamond | 577 | accel_table2_botdlg dd \ |
578 | 1,btn.close_main_window ,\ |
||
579 | 20001,btn.bot.cancel ,\ |
||
580 | 20002,btn.bot.opensave ,\ |
||
581 | 20003,btn.bot.find ,\ |
||
582 | |||
31 | halyavin | 583 | |
584 | add_table: |
||
585 | ; times $61 db -$00 |
||
586 | times $1A db -$20 |
||
587 | times $25 db -$00 |
||
588 | times $10 db -$20 |
||
589 | times $30 db -$00 |
||
590 | times $10 db -$50 |
||
591 | times $04 db -$00,-$01 |
||
592 | times $08 db -$00 |
||
593 | |||
122 | diamond | 594 | ;error_beep db 0xA0,0x30,0 |
31 | halyavin | 595 | |
122 | diamond | 596 | sz s_example,'EXAMPLE.ASM' |
31 | halyavin | 597 | sz s_still ,'still' |
598 | |||
122 | diamond | 599 | ;sz param_setup,'LANG',0 ; parameter for SETUP |
31 | halyavin | 600 | |
601 | sz fasm_filename ,'FASM ' |
||
602 | sz debug_filename ,'BOARD ' |
||
603 | sz tinypad_filename,'TINYPAD ' |
||
122 | diamond | 604 | sz docpak_filename ,'DOCPAK ' |
605 | ;sz setup ,'SETUP ' ; to change keyboard layout |
||
31 | halyavin | 606 | |
122 | diamond | 607 | sz sysfuncs_param,'g',0 |
608 | |||
31 | halyavin | 609 | lsz sysfuncs_filename,\ |
610 | ru,<'SYSFUNCR.TXT',0>,\ |
||
611 | en,<'SYSFUNCS.TXT',0> |
||
612 | |||
613 | sz htext,'TINYPAD' |
||
614 | |||
615 | lszc help_text,b,\ |
||
616 | ru,'КОМАНДЫ:',\ |
||
617 | ru,' ',\ |
||
618 | ru,' CTRL+F1 : Это окно',\ |
||
619 | ru,' CTRL+S : Первая строка для копирования',\ |
||
620 | ru,' CTRL+E : Последняя строка для копирования',\ |
||
621 | ru,' CTRL+P : Вставить выбранное на текущую позицию',\ |
||
622 | ru,' CTRL+D : Удалить строку',\ |
||
623 | ru,' CTRL+L : Вставить строку-разделитель',\ |
||
624 | ru,' CTRL+[ : Перейти в начало файла',\ |
||
625 | ru,' CTRL+] : Перейти в конец файла',\ |
||
626 | ru,' CTRL+F2 : Загрузить файл',\ |
||
627 | ru,' CTRL+F3 : Поиск',\ |
||
628 | ru,' CTRL+F4 : Сохранить файл',\ |
||
629 | ru,' CTRL+F5 : Ввести имя файла',\ |
||
630 | ru,' CTRL+F6 : Ввести строку для поиска',\ |
||
631 | ru,' CTRL+F8 : Сменить раскладку клавиатуры',\ |
||
122 | diamond | 632 | \ |
31 | halyavin | 633 | en,'COMMANDS:',\ |
634 | en,' ',\ |
||
635 | en,' CTRL+F1 : SHOW THIS WINDOW',\ |
||
636 | en,' CTRL+S : SELECT FIRST STRING TO COPY',\ |
||
637 | en,' CTRL+E : SELECT LAST STRING TO COPY',\ |
||
638 | en,' CTRL+P : PASTE SELECTED TO CURRENT POSITION',\ |
||
639 | en,' CTRL+D : DELETE CURRENT LINE',\ |
||
640 | en,' CTRL+L : INSERT SEPARATOR LINE',\ |
||
641 | en,' CTRL+[ : GO TO THE BEGINNING OF FILE',\ |
||
642 | en,' CTRL+] : GO TO THE END OF FILE',\ |
||
643 | en,' CTRL+F2 : LOAD FILE',\ |
||
644 | en,' CTRL+F3 : SEARCH',\ |
||
645 | en,' CTRL+F4 : SAVE FILE',\ |
||
646 | en,' CTRL+F5 : ENTER FILENAME',\ |
||
647 | en,' CTRL+F6 : ENTER SEARCH STRING',\ |
||
122 | diamond | 648 | en,' CTRL+F8 : CHANGE KEYBOARD LAYOUT' |
649 | db 0 |
||
31 | halyavin | 650 | |
122 | diamond | 651 | menubar_res main_menu,\ |
652 | ru,'Файл' ,popup_file ,onshow.file ,\ |
||
653 | ru,'Правка',popup_edit ,onshow.edit ,\ |
||
654 | ru,'Поиск' ,popup_search ,onshow.search ,\ |
||
655 | ru,'Запуск',popup_run ,onshow.run ,\ |
||
656 | ru,'Опции' ,popup_options,onshow.options,\ |
||
657 | \ |
||
658 | en,'File' ,popup_file ,onshow.file ,\ |
||
659 | en,'Edit' ,popup_edit ,onshow.edit ,\ |
||
660 | en,'Search' ,popup_search ,onshow.search,\ |
||
661 | en,'Run' ,popup_run ,onshow.run ,\ |
||
662 | en,'Options',popup_options,onshow.options |
||
31 | halyavin | 663 | |
122 | diamond | 664 | popup_res popup_file,\ |
665 | ru,'Новый' ,'Ctrl+N',key.ctrl_n ,\ |
||
666 | ru,'Открыть...' ,'Ctrl+O',key.ctrl_o ,\ |
||
667 | ru,'Сохранить' ,'Ctrl+S',key.ctrl_s ,\ |
||
668 | ru,'Сохранить как...','' ,key.shift_ctrl_s,\ |
||
669 | ru,'-' ,'' ,0 ,\ |
||
670 | ru,'Выход' ,'Alt+X' ,key.alt_x ,\ |
||
671 | \ |
||
672 | en,'New' ,'Ctrl+N',key.ctrl_n ,\ |
||
673 | en,'Open...' ,'Ctrl+O',key.ctrl_o ,\ |
||
674 | en,'Save' ,'Ctrl+S',key.ctrl_s ,\ |
||
675 | en,'Save as...','' ,key.shift_ctrl_s,\ |
||
676 | en,'-' ,'' ,0 ,\ |
||
677 | en,'Exit' ,'Alt+X' ,key.alt_x |
||
31 | halyavin | 678 | |
122 | diamond | 679 | popup_res popup_edit,\ |
680 | ru,'Вырезать' ,'Ctrl+X',key.ctrl_x,\ |
||
681 | ru,'Копировать' ,'Ctrl+C',key.ctrl_c,\ |
||
682 | ru,'Вставить' ,'Ctrl+V',key.ctrl_v,\ |
||
683 | ru,'Удалить' ,'' ,key.del ,\ |
||
684 | ru,'-' ,'' ,0 ,\ |
||
685 | ru,'Выделить всё','Ctrl+A',key.ctrl_a,\ |
||
686 | \ |
||
687 | en,'Cut' ,'Ctrl+X',key.ctrl_x,\ |
||
688 | en,'Copy' ,'Ctrl+C',key.ctrl_c,\ |
||
689 | en,'Paste' ,'Ctrl+V',key.ctrl_v,\ |
||
690 | en,'Delete' ,'' ,key.del ,\ |
||
691 | en,'-' ,'' ,0 ,\ |
||
692 | en,'Select all','Ctrl+A',key.ctrl_a |
||
31 | halyavin | 693 | |
122 | diamond | 694 | popup_res popup_search,\ |
695 | ru,'Перейти...' ,'Ctrl+G',key.ctrl_g,\ |
||
696 | ru,'-' ,'' ,0 ,\ |
||
697 | ru,'Найти...' ,'Ctrl+F',key.ctrl_f,\ |
||
698 | ru,'Найти далее','F3' ,key.f3 ,\ |
||
699 | ru,'Заменить...','Ctrl+H',key.ctrl_h,\ |
||
700 | \ |
||
701 | en,'Position...','Ctrl+G',key.ctrl_g,\ |
||
702 | en,'-' ,'' ,0 ,\ |
||
703 | en,'Find...' ,'Ctrl+F',key.ctrl_f,\ |
||
704 | en,'Find next' ,'F3' ,key.f3 ,\ |
||
705 | en,'Replace...' ,'Ctrl+H',key.ctrl_h |
||
31 | halyavin | 706 | |
122 | diamond | 707 | popup_res popup_run,\ |
708 | ru,'Запустить' ,'F9' ,key.f9 ,\ |
||
709 | ru,'Компилировать' ,'Ctrl+F9',key.ctrl_f9 ,\ |
||
710 | ru,'-' ,'' ,0 ,\ |
||
711 | ru,'Доска отладки' ,'' ,open_debug_board ,\ |
||
712 | ru,'Системные функции','' ,open_sysfuncs_txt,\ |
||
713 | \ |
||
714 | en,'Run' ,'F9' ,key.f9 ,\ |
||
715 | en,'Compile' ,'Ctrl+F9',key.ctrl_f9 ,\ |
||
716 | en,'-' ,'' ,0 ,\ |
||
717 | en,'Debug board' ,'' ,open_debug_board ,\ |
||
718 | en,'System functions' ,'' ,open_sysfuncs_txt |
||
719 | |||
720 | popup_res popup_options,\ |
||
721 | ru,'Внешний вид...' ,'',0,\ |
||
722 | ru,'-' ,'',0,\ |
||
723 | ru,'Безопасное выделение' ,'',set_secure_sel,\ |
||
724 | ru,'Автоматические скобки' ,'',set_auto_braces,\ |
||
725 | ru,'Автоматический отступ' ,'',set_auto_indents,\ |
||
726 | ru,'Умная табуляция' ,'',0,\ |
||
727 | ru,'Оптимальное сохранение','',set_optimal_fill,\ |
||
728 | ru,'-' ,'',0,\ |
||
729 | ru,'Номера строк' ,'',set_line_numbers,\ |
||
730 | \ |
||
731 | en,'Appearance...' ,'',0,\ |
||
732 | en,'-' ,'',0,\ |
||
733 | en,'Secure selection' ,'',set_secure_sel,\ |
||
734 | en,'Automatic brackets' ,'',set_auto_braces,\ |
||
735 | en,'Automatic indents' ,'',set_auto_indents,\ |
||
736 | en,'Smart tabulation' ,'',0,\ |
||
737 | en,'Optimal fill on saving','',set_optimal_fill,\ |
||
738 | en,'-' ,'',0,\ |
||
739 | en,'Line numbers' ,'',set_line_numbers |
||
740 | |||
741 | lsz s_modified,\ |
||
742 | ru,'Изменено',\ |
||
743 | en,'Modified' |
||
744 | |||
745 | lsz s_2filename,\ |
||
746 | ru,'Имя файла:',\ |
||
747 | en,'Filename:' |
||
748 | lsz s_2open,\ |
||
749 | ru,'Открыть',\ |
||
750 | en,'Open' |
||
751 | lsz s_2save,\ |
||
752 | ru,'Сохранить',\ |
||
753 | en,'Save' |
||
754 | lsz s_2find,\ |
||
755 | ru,'Найти',\ |
||
756 | en,'Find' |
||
757 | db ':' |
||
758 | lsz s_2replace,\ |
||
759 | ru,'Заменить',\ |
||
760 | en,'Replace' |
||
761 | db ':' |
||
762 | lsz s_2cancel,\ |
||
763 | ru,'Отмена',\ |
||
764 | en,'Cancel' |
||
765 | |||
766 | sz symbols_ex,';?.%"',"'" |
||
767 | sz symbols ,'#&*\:/<>|{}()[]=+-, ' |
||
768 | |||
769 | TINYPAD_END: ; end of file |
||
770 | |||
771 | self_path rb PATHL |
||
772 | |||
31 | halyavin | 773 | ;----------------------------------------------------------------------------- |
122 | diamond | 774 | section @UDATA ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
31 | halyavin | 775 | ;----------------------------------------------------------------------------- |
776 | |||
122 | diamond | 777 | f_info.length dd ? |
778 | f_info dd ?,?,?,?,?;?,0,?,AREA_TEMP,AREA_EDIT-AREA_TEMP |
||
779 | |||
780 | f_info.path: |
||
781 | times PATHL+1 db ? |
||
782 | |||
783 | pos.x dd ? ; global X position (cursor) |
||
784 | pos.y dd ? ; global Y position (cursor) |
||
785 | sel.x dd ? ; global X position (selection start) |
||
786 | sel.y dd ? ; global Y position (selection start) |
||
787 | lines dd ? ; number of lines in file |
||
788 | lines.scr dd ? ; number of lines on the screen |
||
31 | halyavin | 789 | columns dd ? ; number of columns in file |
122 | diamond | 790 | columns.scr dd ? ; number of columns on the screen |
31 | halyavin | 791 | top_ofs dd ? ; height occupied by top buttons |
792 | bot_ofs dd ? ; height occupied by bottom buttons |
||
122 | diamond | 793 | dw ? |
794 | left_ofs dd ? ; |
||
31 | halyavin | 795 | top_line dd ? ; topmost visible line on screen |
796 | left_col dd ? ; leftmost visible char on line |
||
797 | vscrl_top dd ? |
||
798 | vscrl_size dd ? |
||
799 | hscrl_top dd ? |
||
800 | hscrl_size dd ? |
||
122 | diamond | 801 | skinh dd ? ; skin height |
802 | __rc dd ?,?,?,? |
||
31 | halyavin | 803 | ;filelen dd ? ; file size (on save) ??? |
804 | filesize dd ? ; file size (on load) ??? |
||
122 | diamond | 805 | ya dd ? ; for read_string |
806 | ;copy_start dd ? ; first line for copying (Ctrl+S) |
||
31 | halyavin | 807 | copy_count dd ? ; number of lines for copying (Ctrl+E) |
808 | copy_size dd ? ; size of data to copy |
||
809 | s_title.size dd ? ; caption length |
||
810 | |||
122 | diamond | 811 | draw_blines dd ? ; last line to draw |
812 | |||
31 | halyavin | 813 | cur_line_len dd ? |
122 | diamond | 814 | h_popup dd ? |
815 | bot_dlg_handler dd ? |
||
31 | halyavin | 816 | |
122 | diamond | 817 | sel.begin.x dd ? |
818 | sel.begin.y dd ? |
||
819 | sel.end.x dd ? |
||
820 | sel.end.y dd ? |
||
821 | sel.selected db ? |
||
822 | |||
823 | in_sel db ? |
||
824 | |||
31 | halyavin | 825 | asm_mode db ? ; ASM highlight? |
826 | do_not_draw db ? ; draw top and bottom buttons? |
||
122 | diamond | 827 | main_closed db ? ; main window closed? |
828 | tb_casesen db ? ; focused textbox is case-sensitive? |
||
31 | halyavin | 829 | |
830 | align 4 |
||
831 | s_fname.size dd ? |
||
832 | s_fname rb PATHL+1 |
||
833 | align 4 |
||
834 | s_search.size dd ? |
||
835 | s_search rb PATHL+1 |
||
836 | |||
122 | diamond | 837 | s_title rb PATHL+11 ; window caption |
31 | halyavin | 838 | |
122 | diamond | 839 | chr db ? |
840 | ext db ? |
||
841 | shi dd ? |
||
842 | |||
843 | align 4 |
||
844 | cl_3d_normal dd ? |
||
845 | cl_3d_pushed dd ? |
||
846 | cl_3d_outset dd ? |
||
847 | cl_3d_inset dd ? |
||
848 | cl_3d_grayed dd ? |
||
849 | |||
850 | tb_opensave TBOX |
||
851 | tb_find TBOX |
||
852 | tb_replace TBOX |
||
853 | tb_gotorow TBOX |
||
854 | tb_gotocol TBOX |
||
855 | |||
856 | focused_tb dd ? |
||
857 | |||
858 | key1 rb 256 |
||
859 | |||
860 | mst db ? |
||
861 | mst2 db ? |
||
862 | mev db ? |
||
863 | mouse_captured db ? |
||
864 | just_from_popup db ? |
||
865 | |||
866 | bot_mode db ? |
||
867 | |||
868 | modified db ? |
||
869 | |||
870 | align 4 |
||
871 | |||
872 | bot_dlg_height dd ? |
||
873 | bot_dlg_mode2 db ? |
||
874 | |||
31 | halyavin | 875 | ;----------------------------------------------------------------------------- |
122 | diamond | 876 | section @PARAMS ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
31 | halyavin | 877 | ;----------------------------------------------------------------------------- |
878 | |||
879 | fasm_parameters: |
||
880 | |||
122 | diamond | 881 | p_info process_information |
882 | p_info2 process_information |
||
883 | sc system_colors |
||
884 | |||
885 | diff16 'Main memory size',0,$ |
||
886 | |||
887 | MAIN_STACK = 0x0000FFF0 |
||
888 | POPUP_STACK = 0x0000EFF0 |
||
889 | |||
890 | AREA_TEMP = 0x00010000 ; 0x00010000 |
||
891 | AREA_EDIT = 0x000C0000 ; 0x00080000 |
||
892 | AREA_TEMP2 = 0x00190000 ; 0x002E0000 |
||
893 | AREA_CBUF = 0x001A0000 ; 0x002F0000 |
||
894 | AREA_ENDMEM = 0x001B0000 ; 0x00300000 |
||
895 | |||
896 | diff10 'Header+options size',0,@CODE |
||
897 | diff10 'Load area size',AREA_TEMP,AREA_EDIT |
||
898 | diff10 'Edit area size',AREA_EDIT,AREA_TEMP2 |
||
899 | diff10 'Total memory usage',0,AREA_ENDMEM |
||
900 | |||
901 | ;store dword '/hd/' at tb_opensave.text+4*0 |
||
902 | ;store dword '1/tp' at tb_opensave.text+4*1 |
||
903 | ;store dword 'ad4/' at tb_opensave.text+4*2 |
||
904 | ;store dword 'tiny' at tb_opensave.text+4*3 |
||
905 | ;store dword 'pad.' at tb_opensave.text+4*4 |
||
906 | ;store dword 'asm' at tb_opensave.text+4*5 |
||
907 | ;store byte 23 at tb_opensave.length>'SYSFUNCS.TXT',0>'SYSFUNCR.TXT',0>>> |