Rev 258 | Rev 267 | 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 |
259 | mikedld | 3 | ; compiler: flat assembler 1.67.15 |
178 | heavyiron | 4 | ; memory to compile: 2.0/7.0 MBytes (without/with size optimizations) |
258 | mikedld | 5 | ; version: 4.0.4 pre |
259 | mikedld | 6 | ; last update: 2007-01-03 (Jan 3, 2007) |
178 | heavyiron | 7 | ; minimal kernel: revision #138 (svn://kolibrios.org/kernel) |
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 |
||
122 | diamond | 12 | ;----------------------------------------------------------------------------- |
259 | mikedld | 13 | ; TODO (FOR 4.1.0): |
178 | heavyiron | 14 | ; - optimize drawing (reduce flickering) |
259 | mikedld | 15 | ; - add vertical selection, undo, goto position, overwrite mode |
178 | heavyiron | 16 | ; - improve window drawing with small dimensions |
259 | mikedld | 17 | ; - other bug-fixes and speed/size optimizations |
122 | diamond | 18 | ; |
259 | mikedld | 19 | ; TODO (FOR 4.0.4, PLANNED FOR 2007-01-21): |
20 | ; - finish tabbed interface [critical] |
||
21 | ; - add memory reallocation to keys handler [critical] |
||
22 | ; - rework save_file (memory manager) [critical] |
||
23 | ; - reduce flickering (changes checker) [average] |
||
24 | ; - incorrect saved/modified lines flags on copy/paste [normal] |
||
25 | ; - case-insensitive file extensions comparison (.asm/.inc) [normal] |
||
26 | ; - prompt to save file before closing/opening [low] |
||
27 | ; |
||
31 | halyavin | 28 | ; HISTORY: |
258 | mikedld | 29 | ; 4.0.4 pre (mike.dld) |
30 | ; bug-fixes: |
||
259 | mikedld | 31 | ; - statusbar contained hint after dialog operation cancelled |
32 | ; - small drawing fix for gutter and line saved/modified markers |
||
258 | mikedld | 33 | ; changes: |
34 | ; - modified/saved colors now match those in MSVS |
||
259 | mikedld | 35 | ; - function 70 for *all* file operations (including diamond's fixes) |
36 | ; - use memory manager instead of statically allocated region |
||
258 | mikedld | 37 | ; new features: |
38 | ; - recode tables between CP866, CP1251 and KOI8-R (suggested by Victor) |
||
259 | mikedld | 39 | ; - tabbed interface, ability to open several files in one app instance |
178 | heavyiron | 40 | ; 4.0.3 (mike.dld) |
41 | ; bug-fixes: |
||
42 | ; - 1-char selection if pressing |
||
43 | ; - fault in `writepos`, added call to function 9 |
||
44 | ; - main menu items weren't highlighted if popup opened and cursor |
||
258 | mikedld | 45 | ; isn't in main menu item's area |
178 | heavyiron | 46 | ; - statusbar and textboxes drawing fixes (wrong colors) |
47 | ; - perform no redraw while pressing Shift, Ctrl, Alt keys |
||
258 | mikedld | 48 | ; - data length from DOCPAK in string representation (fixed by diamond) |
178 | heavyiron | 49 | ; changes: |
50 | ; - function 70 instead of 58 for files loading/saving |
||
51 | ; - clientarea-relative drawing (less code) |
||
52 | ; - every line's dword is now splitted into 2 words; |
||
53 | ; low word - line block length, so max line length is 65535 now |
||
54 | ; high word - various flags. for now, only 2 of 16 bits are used: |
||
55 | ; if bit #0 is set, line was modified since file open |
||
56 | ; if bit #1 is set, line was saved after last modification |
||
57 | ; high word could also be further used for code collapsing and different |
||
58 | ; line marking features (breakpoints, errors, bookmarks, etc.) |
||
59 | ; new features: |
||
60 | ; - line markers for modified and saved lines |
||
61 | ; - status messages for various actions |
||
122 | diamond | 62 | ; 4.0.2 (mike.dld) |
63 | ; bug-fixes: |
||
64 | ; - program terminates if started with parameters (fine for DOCPAK) |
||
65 | ; 4.0.1 (mike.dld) |
||
66 | ; bug-fixes: |
||
67 | ; - unable to run program after exiting from main menu (Alt+X) |
||
68 | ; new features: |
||
69 | ; - integration with DOCPAK |
||
70 | ; 4.0 (mike.dld) |
||
71 | ; bug-fixes: |
||
72 | ; - main menu popups' "on show" was called only for first shown popup |
||
73 | ; - clear selection on left/right arrow keys |
||
74 | ; new features: |
||
75 | ; - "replace" dialog (w/o "skip", "replace all") |
||
76 | ; - line numbers display |
||
77 | ; - options (except "appearance" and "smart tabulation") |
||
78 | ; - options saving (colors, window position, "Options" popup triggers) |
||
79 | ; 4.0 beta 2 (mike.dld) |
||
80 | ; bug-fixes: |
||
81 | ; - unable to start if /rd/1/example.asm is missing (from Halyavin) |
||
82 | ; - clicking on menu items draws main window in popup (from Rohan) |
||
83 | ; - passed parameters aren't taken into account (from Mario79) |
||
84 | ; - background isn't erased if text lines < screen lines after |
||
85 | ; selection deletion (from Rohan) |
||
86 | ; 4.0 beta 1 (mike.dld) |
||
87 | ; menu bar and popup menu; |
||
88 | ; removed buttons from the top and input fields from the bottom since |
||
89 | ; now they're accesible through main/popup menu; |
||
90 | ; improved keyboard handling (using 66th function); |
||
91 | ; support for almost all FASMW keyboard shourtcuts; |
||
92 | ; added text selection ability, standard selection operations |
||
93 | ; (copy,cut,paste); |
||
94 | ; new integrated dialogs (open, save, find) |
||
95 | ; fix to collapse SPACEs into TABs only for *.asm and *.inc files |
||
31 | halyavin | 96 | ; 3.78a (mike.dld) |
122 | diamond | 97 | ; fixed termination while typing in x positions higher than (line_length+10); |
31 | halyavin | 98 | ; improved drawing on small heights |
122 | diamond | 99 | ; don't draw window while its height = 0 (Kolibri "minimize" support) |
31 | halyavin | 100 | ; 3.78 (mike.dld) |
101 | ; now lines may be of ANY length; |
||
102 | ; optimized memory usage (less memory for internal file representation) |
||
103 | ; after loading file, it's internal size equals to its real size |
||
104 | ; plus 14 bytes for each line (4 bytes for line length |
||
122 | diamond | 105 | ; and 10 spaced to the end - to reduce data relocations count); |
31 | halyavin | 106 | ; completely rewritten keyboard handling; |
107 | ; added horizontal scrollbar; |
||
108 | ; all line feed formats are supported: WIN(CRLF),*NIX(LF),MAC(CR); |
||
109 | ; etc. |
||
110 | ; 3.77 (mike.dld) |
||
111 | ; changed save_string to collapse SPACEs into TABs; |
||
112 | ; rewrote drawfile from scratch (speed++) |
||
178 | heavyiron | 113 | ; through some drawing improvements needed |
31 | halyavin | 114 | ; (some checkups to reduce flickering); |
115 | ; writepos (size--); |
||
116 | ; fixed drawing window while height < 100px, and for non-asm files; |
||
117 | ; several small fixes; speed/size optimizations |
||
118 | ; 3.76 (mike.dld) |
||
119 | ; changed loadfile/loadhdfile to expand TABs into SPACEs; |
||
120 | ; changed TAB,ENTER,DELETE,BSPACE keys behaviour (rewritten from scratch); |
||
121 | ; vertical scrollbar; |
||
122 | ; extra window resizing capabilities (added a couple of constants); |
||
123 | ; completely new text cursor management & moving text cursor with mouse; |
||
124 | ; improved search function, moving cursor to beginning of text found; |
||
122 | diamond | 125 | ; adjustable max line width (change LINE_WIDTH & recompile) // (obsolet) |
31 | halyavin | 126 | ; 3.75a |
127 | ; fixed converting char to upper case in read_string |
||
128 | ; 3.75 |
||
129 | ; rewrote save_file from scratch; bugfix in loadfile; |
||
130 | ; 3.74 |
||
131 | ; optimisation |
||
132 | ; 3.73 |
||
133 | ; completly new load_file function |
||
134 | ; 3.72 |
||
135 | ; speed++ |
||
136 | ; 3.71 |
||
137 | ; error beep |
||
138 | ; 3.6,3.7: |
||
139 | ; many bugs fixed |
||
140 | ; simple toolbar |
||
141 | ; compile, run applications from TINYPAD, all fasm output is in debug board |
||
142 | ; TAB button |
||
143 | ; auto-indent |
||
144 | ; Ctrl+L - insert comment string |
||
122 | diamond | 145 | ;----------------------------------------------------------------------------- |
31 | halyavin | 146 | |
178 | heavyiron | 147 | include 'lang.inc' |
31 | halyavin | 148 | include 'macros.inc' ; useful stuff |
178 | heavyiron | 149 | ;include 'proc32.inc' |
122 | diamond | 150 | include 'tinypad.inc' |
259 | mikedld | 151 | purge mov,add,sub ; SPEED |
31 | halyavin | 152 | |
259 | mikedld | 153 | header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path |
31 | halyavin | 154 | |
258 | mikedld | 155 | APP_VERSION equ '4.0.4 pre' |
156 | |||
122 | diamond | 157 | ;include 'debug.inc' |
31 | halyavin | 158 | |
258 | mikedld | 159 | ASEPC = '-' ; separator character (char) |
160 | ATOPH = POP_IHEIGHT+2 ; menu bar height (pixels) |
||
161 | SCRLW = 16 ; scrollbar widht/height (pixels) |
||
162 | ATABW = 8 ; tab width (chars) |
||
163 | LINEH = 10 ; line height (pixels) |
||
259 | mikedld | 164 | PATHL = 256 ; maximum path length (chars) !!! don't change !!! |
258 | mikedld | 165 | AMINS = 8 ; minimal scroll thumb size (pixels) |
259 | mikedld | 166 | LCHGW = 3 ; changed/saved marker width |
31 | halyavin | 167 | |
259 | mikedld | 168 | STATH = 16 ; status bar height |
169 | TBARH = 18 ; tab bar height |
||
31 | halyavin | 170 | |
122 | diamond | 171 | MEV_LDOWN = 1 |
172 | MEV_LUP = 2 |
||
173 | MEV_RDOWN = 3 |
||
174 | MEV_RUP = 4 |
||
175 | MEV_MOVE = 5 |
||
176 | |||
31 | halyavin | 177 | ;----------------------------------------------------------------------------- |
122 | diamond | 178 | section @OPTIONS ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
31 | halyavin | 179 | ;----------------------------------------------------------------------------- |
180 | |||
122 | diamond | 181 | label color_tbl dword |
258 | mikedld | 182 | RGB( 0, 0, 0) ; RGB( 0, 0, 0) ; RGB( 0, 0, 0) ; text |
183 | RGB( 0,144, 0) ; RGB( 0,144, 0) ; RGB( 0,160, 0) ; numbers |
||
184 | RGB(176, 0, 0) ; RGB(160, 0, 0) ; RGB( 0,128,255) ; strings |
||
122 | diamond | 185 | RGB(128,128,128) ; RGB(144,144,144) ; RGB(160,160,160) ; comments |
186 | RGB( 48, 48,240) ; RGB( 48, 48,240) ; RGB(255, 0, 0) ; symbols |
||
187 | RGB(255,255,255) ; RGB(224,224,224) ; RGB(255,255,255) ; background |
||
188 | RGB(255,255,255) ; RGB(255,255,255) ; RGB(255,255,255) ; selection text |
||
189 | RGB( 10, 36,106) ; RGB( 0, 0,128) ; RGB( 0, 64,128) ; selection background |
||
259 | mikedld | 190 | RGB(255,238, 98) ; modified line marker |
191 | RGB(108,226,108) ; saved line marker |
||
31 | halyavin | 192 | |
122 | diamond | 193 | ins_mode db 1 |
31 | halyavin | 194 | |
122 | diamond | 195 | options db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB |
31 | halyavin | 196 | |
122 | diamond | 197 | mainwnd_pos: |
198 | .x dd 100 |
||
199 | .y dd 75 |
||
200 | .w dd 6*80+6+SCRLW+5 |
||
201 | .h dd 402 |
||
31 | halyavin | 202 | |
122 | diamond | 203 | ;----------------------------------------------------------------------------- |
204 | section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
||
205 | ;----------------------------------------------------------------------------- |
||
31 | halyavin | 206 | |
122 | diamond | 207 | ; fninit |
31 | halyavin | 208 | |
178 | heavyiron | 209 | ; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_left,50 |
210 | ; mov [mainwnd_pos.x],eax |
||
211 | ; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_top,50 |
||
212 | ; mov [mainwnd_pos.y],eax |
||
213 | ; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_right,350 |
||
214 | ; sub eax,[mainwnd_pos.x] |
||
215 | ; mov [mainwnd_pos.w],eax |
||
216 | ; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_bottom,450 |
||
217 | ; sub eax,[mainwnd_pos.y] |
||
218 | ; mov [mainwnd_pos.h],eax |
||
219 | |||
258 | mikedld | 220 | cld |
221 | mov edi,@UDATA |
||
222 | mov ecx,@PARAMS-@UDATA |
||
223 | mov al,0 |
||
224 | rep stosb |
||
31 | halyavin | 225 | |
259 | mikedld | 226 | mov [tab_bar.Style],2 |
227 | |||
228 | mcall 68,11 |
||
229 | or eax,eax |
||
230 | jz key.alt_x.close |
||
231 | |||
232 | mov eax,65536 |
||
233 | call mem.Alloc |
||
234 | mov [temp_buf],eax |
||
235 | |||
236 | mov eax,65536 |
||
237 | call mem.Alloc |
||
238 | mov [cur_tab.Editor.Data],eax |
||
239 | |||
178 | heavyiron | 240 | inc [do_not_draw] |
241 | |||
258 | mikedld | 242 | mov [left_ofs],40+1 |
259 | mikedld | 243 | ; mov [f_info+4],0 |
244 | ; mov [f_info+12],AREA_TEMP |
||
245 | ; mov [f_info+16],AREA_EDIT-AREA_TEMP |
||
31 | halyavin | 246 | |
258 | mikedld | 247 | mov esi,s_example |
248 | mov edi,tb_opensave.text |
||
249 | mov ecx,s_example.size |
||
250 | mov [tb_opensave.length],cl |
||
251 | rep movsb |
||
31 | halyavin | 252 | |
258 | mikedld | 253 | mov esi,s_still |
254 | mov edi,s_search |
||
255 | mov ecx,s_still.size |
||
256 | mov [s_search.size],ecx |
||
257 | rep movsb |
||
31 | halyavin | 258 | |
258 | mikedld | 259 | cmp byte[@PARAMS],0 |
260 | jz no_params |
||
31 | halyavin | 261 | |
122 | diamond | 262 | ;// Willow's code to support DOCPAK [ |
31 | halyavin | 263 | |
258 | mikedld | 264 | cmp byte[@PARAMS],'*' |
265 | jne .noipc |
||
178 | heavyiron | 266 | |
267 | ;// diamond [ (convert size from decimal representation to dword) |
||
268 | ;-- mov edx,dword[@PARAMS+1] |
||
258 | mikedld | 269 | mov esi,@PARAMS+1 |
270 | xor edx,edx |
||
271 | xor eax,eax |
||
178 | heavyiron | 272 | @@: lodsb |
258 | mikedld | 273 | test al,al |
274 | jz @f |
||
275 | lea edx,[edx*4+edx] |
||
276 | lea edx,[edx*2+eax-'0'] |
||
277 | jmp @b |
||
178 | heavyiron | 278 | @@: |
279 | ;// diamond ] |
||
280 | |||
258 | mikedld | 281 | add edx,20 |
259 | mikedld | 282 | |
283 | mov eax,edx |
||
284 | call mem.Alloc |
||
285 | mov ebp,eax |
||
286 | |||
287 | ;! mcall 60,1,AREA_TEMP-16 ; 0x10000-16 |
||
288 | ;! mov dword[AREA_TEMP-16+4],8 ; [0x10000-16+4],8 |
||
289 | mcall 60,1,ebp |
||
290 | mov dword[ebp+4],8 |
||
258 | mikedld | 291 | mcall 40,1000000b |
292 | mcall 23,200 |
||
293 | cmp eax,7 |
||
259 | mikedld | 294 | jne key.alt_x.close |
295 | ;! mov esi,AREA_TEMP-16 ; 0x10000-16 |
||
296 | ;! mov byte[esi],1 |
||
297 | ;! mov eax,[esi+12] |
||
298 | mov byte[ebp],1 |
||
299 | ;! mov eax,[ebp+12] |
||
300 | ;! inc eax |
||
301 | ;! call load_file.file_found |
||
302 | |||
303 | mov ecx,[ebp+12] |
||
304 | mov esi,ebp |
||
305 | call create_tab |
||
306 | call load_from_memory |
||
307 | |||
308 | mov eax,ebp |
||
309 | call mem.Free |
||
310 | |||
258 | mikedld | 311 | jmp @f |
122 | diamond | 312 | .noipc: |
31 | halyavin | 313 | |
122 | diamond | 314 | ;// Willow's code to support DOCPAK ] |
31 | halyavin | 315 | |
122 | diamond | 316 | ; parameters are at @PARAMS |
258 | mikedld | 317 | mov esi,@PARAMS |
318 | mov edi,tb_opensave.text |
||
319 | mov ecx,PATHL |
||
320 | rep movsb |
||
321 | mov edi,tb_opensave.text |
||
322 | mov ecx,PATHL |
||
323 | xor al,al |
||
324 | repne scasb |
||
325 | jne key.alt_x.close |
||
326 | lea eax,[edi-tb_opensave.text-1] |
||
327 | mov [tb_opensave.length],al |
||
31 | halyavin | 328 | |
122 | diamond | 329 | no_params: |
259 | mikedld | 330 | ;call btn.load_file;do_load_file |
331 | ;jnc @f |
||
332 | call create_tab |
||
31 | halyavin | 333 | |
334 | @@: |
||
178 | heavyiron | 335 | dec [do_not_draw] |
258 | mikedld | 336 | mcall 66,1,1 |
337 | mcall 40,00100111b |
||
178 | heavyiron | 338 | red: |
258 | mikedld | 339 | call drawwindow |
178 | heavyiron | 340 | call check_inv_all.skip_check |
31 | halyavin | 341 | |
122 | diamond | 342 | ;----------------------------------------------------------------------------- |
31 | halyavin | 343 | |
122 | diamond | 344 | still: |
259 | mikedld | 345 | call draw_statusbar ; write current position & number of strings |
31 | halyavin | 346 | |
122 | diamond | 347 | .skip_write: |
258 | mikedld | 348 | mcall 10;23,50; wait here until event |
349 | cmp [main_closed],0 |
||
350 | jne key.alt_x |
||
351 | dec eax ; redraw ? |
||
352 | jz red |
||
353 | dec eax ; key ? |
||
354 | jz key |
||
355 | dec eax ; button ? |
||
356 | jz button |
||
357 | sub eax,3 ; mouse ? |
||
358 | jz mouse |
||
31 | halyavin | 359 | |
258 | mikedld | 360 | jmp still.skip_write |
31 | halyavin | 361 | |
122 | diamond | 362 | ;----------------------------------------------------------------------------- |
363 | func start_fasm ;///////////////////////////////////////////////////////////// |
||
364 | ;----------------------------------------------------------------------------- |
||
31 | halyavin | 365 | ; BL = run after compile |
122 | diamond | 366 | ;----------------------------------------------------------------------------- |
259 | mikedld | 367 | cmp [cur_tab.Editor.AsmMode],0 ;! [asm_mode],0 |
258 | mikedld | 368 | jne @f |
369 | ret |
||
370 | @@: mov esi,f_info.path ; s_fname |
||
371 | mov edi,fasm_parameters |
||
31 | halyavin | 372 | |
258 | mikedld | 373 | cmp byte[esi],'/' |
374 | je .yes_systree |
||
31 | halyavin | 375 | |
258 | mikedld | 376 | mov ecx,[f_info.length] ; [s_fname.size] |
377 | rep movsb |
||
31 | halyavin | 378 | |
258 | mikedld | 379 | mov al,',' |
380 | stosb |
||
31 | halyavin | 381 | |
258 | mikedld | 382 | mov ecx,[f_info.length] ; [s_fname.size] |
383 | add ecx,-4 |
||
384 | mov esi,f_info.path ; s_fname |
||
385 | rep movsb |
||
31 | halyavin | 386 | |
258 | mikedld | 387 | mov al,',' |
388 | stosb |
||
31 | halyavin | 389 | |
258 | mikedld | 390 | mov dword[edi],'/RD/' |
391 | mov word[edi+4],'1/' |
||
392 | add edi,6 |
||
31 | halyavin | 393 | |
258 | mikedld | 394 | mov al,0 |
395 | stosb |
||
31 | halyavin | 396 | |
258 | mikedld | 397 | jmp .run |
31 | halyavin | 398 | |
399 | .yes_systree: |
||
258 | mikedld | 400 | mov eax,[f_info.length] |
401 | add esi,eax ; [s_fname.size] |
||
402 | dec esi |
||
31 | halyavin | 403 | |
258 | mikedld | 404 | xor ecx,ecx |
405 | mov al,'/' |
||
406 | @@: cmp [esi],al |
||
407 | je @f |
||
408 | dec esi |
||
409 | inc ecx |
||
410 | jmp @b |
||
411 | @@: inc esi |
||
31 | halyavin | 412 | |
258 | mikedld | 413 | push esi esi ecx |
31 | halyavin | 414 | |
258 | mikedld | 415 | rep movsb |
31 | halyavin | 416 | |
258 | mikedld | 417 | mov al,',' |
418 | stosb |
||
31 | halyavin | 419 | |
258 | mikedld | 420 | pop ecx esi |
31 | halyavin | 421 | |
258 | mikedld | 422 | add ecx,-4 |
423 | rep movsb |
||
31 | halyavin | 424 | |
258 | mikedld | 425 | mov al,',' |
426 | stosb |
||
31 | halyavin | 427 | |
258 | mikedld | 428 | pop ecx |
429 | sub ecx,f_info.path ; s_fname |
||
430 | mov esi,f_info.path ; s_fname |
||
31 | halyavin | 431 | |
258 | mikedld | 432 | rep movsb |
31 | halyavin | 433 | |
258 | mikedld | 434 | mov al,0 |
435 | stosb |
||
31 | halyavin | 436 | |
437 | .run: |
||
258 | mikedld | 438 | cmp bl,0 ; run outfile ? |
439 | je @f |
||
440 | mov dword[edi-1],',run' |
||
441 | mov byte[edi+3],0 |
||
178 | heavyiron | 442 | @@: |
258 | mikedld | 443 | mov ebx, fasm_start |
178 | heavyiron | 444 | start_ret: |
258 | mikedld | 445 | mov eax, 70 |
446 | int 0x40 |
||
447 | ret |
||
31 | halyavin | 448 | endf |
449 | |||
122 | diamond | 450 | ;----------------------------------------------------------------------------- |
451 | func open_debug_board ;/////////////////////////////////////////////////////// |
||
452 | ;----------------------------------------------------------------------------- |
||
258 | mikedld | 453 | mov ebx, board_start |
454 | jmp start_ret |
||
31 | halyavin | 455 | endf |
456 | |||
122 | diamond | 457 | ;----------------------------------------------------------------------------- |
458 | func open_sysfuncs_txt ;////////////////////////////////////////////////////// |
||
459 | ;----------------------------------------------------------------------------- |
||
258 | mikedld | 460 | mov ebx, docpak_start |
461 | call start_ret |
||
462 | cmp eax,0xfffffff0 |
||
463 | jb @f |
||
464 | mov ebx, tinypad_start |
||
465 | mov dword [ebx+8], sysfuncs_filename |
||
466 | call start_ret |
||
122 | diamond | 467 | @@: ret |
31 | halyavin | 468 | endf |
469 | |||
122 | diamond | 470 | ;----------------------------------------------------------------------------- |
178 | heavyiron | 471 | ;func layout ;///// change keyboard layout /////////////////////////////////// |
122 | diamond | 472 | ;----------------------------------------------------------------------------- |
178 | heavyiron | 473 | ; mcall 19,setup,param_setup |
474 | ; mcall 5,eax |
||
475 | ;; call activate_me |
||
476 | ;; ret |
||
477 | ;;endf |
||
478 | |||
479 | ;;func activate_me |
||
480 | ; mcall 9,p_info,-1 |
||
481 | ; inc eax |
||
482 | ; inc eax |
||
483 | ; mov ecx,eax |
||
484 | ; mov edi,[p_info.PID] |
||
485 | ; mov ebx,p_info |
||
486 | ; @@: dec ecx |
||
487 | ; jz @f ; counter=0 => not found? => return |
||
488 | ; mcall 9 |
||
489 | ; cmp edi,[p_info.PID] |
||
490 | ; jne @b |
||
491 | ; mcall 18,3 |
||
492 | ; mcall 5,eax |
||
493 | ; @@: ret |
||
31 | halyavin | 494 | ;endf |
495 | |||
259 | mikedld | 496 | set_opt: |
31 | halyavin | 497 | |
259 | mikedld | 498 | .line_numbers: |
258 | mikedld | 499 | mov al,OPTS_LINENUMS |
259 | mikedld | 500 | jmp .main |
501 | .optimal_fill: |
||
258 | mikedld | 502 | mov al,OPTS_OPTIMSAVE |
259 | mikedld | 503 | jmp .main |
504 | .auto_indents: |
||
258 | mikedld | 505 | mov al,OPTS_AUTOINDENT |
259 | mikedld | 506 | jmp .main |
507 | .auto_braces: |
||
258 | mikedld | 508 | mov al,OPTS_AUTOBRACES |
259 | mikedld | 509 | jmp .main |
510 | .secure_sel: |
||
511 | mov al,OPTS_SECURESEL |
||
31 | halyavin | 512 | |
259 | mikedld | 513 | .main: |
514 | xor [options],al |
||
515 | ; test [options],al |
||
516 | ; je @f |
||
517 | ; not al |
||
518 | ; and [options],al |
||
519 | ; ret |
||
520 | ; @@: or [options],al |
||
258 | mikedld | 521 | ret |
31 | halyavin | 522 | |
122 | diamond | 523 | ;----------------------------------------------------------------------------- |
31 | halyavin | 524 | |
259 | mikedld | 525 | include 'tp-defines.inc' |
526 | |||
122 | diamond | 527 | include 'tp-draw.asm' |
528 | include 'tp-key.asm' |
||
258 | mikedld | 529 | include 'tp-button.asm' |
122 | diamond | 530 | include 'tp-mouse.asm' |
531 | include 'tp-files.asm' |
||
258 | mikedld | 532 | include 'tp-common.asm' |
533 | include 'tp-dialog.asm' |
||
122 | diamond | 534 | include 'tp-popup.asm' |
535 | include 'tp-tbox.asm' |
||
259 | mikedld | 536 | include 'tp-tabctl.asm' |
537 | include 'tp-editor.asm' |
||
258 | mikedld | 538 | include 'tp-recode.asm' |
31 | halyavin | 539 | |
178 | heavyiron | 540 | ;include 'lib-ini.asm' |
541 | |||
31 | halyavin | 542 | ;----------------------------------------------------------------------------- |
122 | diamond | 543 | section @DATA ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
31 | halyavin | 544 | ;----------------------------------------------------------------------------- |
545 | |||
122 | diamond | 546 | ;addr dd s_fname ; address of input string |
547 | ;temp dd 0xABCD ; used in read_string |
||
548 | vscrl_capt dd -1 |
||
549 | hscrl_capt dd -1 |
||
550 | body_capt dd -1 |
||
31 | halyavin | 551 | |
122 | diamond | 552 | key0 db \ |
553 | 0x00,0x00,0x02,0x03,0x04,0x05,0x06,0x07,\ |
||
554 | 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x00,0x00,\ |
||
555 | 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,\ |
||
556 | 0x18,0x19,0x1A,0x1B,0x00,0x00,0x1E,0x1F,\ |
||
557 | 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,\ |
||
558 | 0x28,0x29,0x00,0x2B,0x2C,0x2D,0x2E,0x2F,\ |
||
559 | 0x30,0x31,0x32,0x33,0x34,0x35,0x00,0x00,\ |
||
560 | 0x00,0x39,0x00,0x00,0x00,0x00,0x00,0x00 |
||
561 | times 12*16 db 0x00 |
||
31 | halyavin | 562 | |
258 | mikedld | 563 | accel_table dd \ |
564 | 0x0000000E,key.bkspace ,\ ; BackSpace |
||
565 | 0x0000000F,key.tab ,\ ; Tab |
||
566 | 0x0000001C,key.return ,\ ; Return |
||
567 | 0x0000003D,key.f3 ,\ ; F3 |
||
568 | 0x00000043,key.f9 ,\ ; F9 |
||
569 | 0x00000147,key.home ,\ ; Home |
||
570 | 0x00000148,key.up ,\ ; Up |
||
571 | 0x00000149,key.pgup ,\ ; PageUp |
||
572 | 0x0000014B,key.left ,\ ; Left |
||
573 | 0x0000014D,key.right ,\ ; Right |
||
574 | 0x0000014F,key.end ,\ ; End |
||
575 | 0x00000150,key.down ,\ ; Down |
||
576 | 0x00000151,key.pgdn ,\ ; PageDown |
||
577 | 0x00000152,key.ins ,\ ; Insert |
||
578 | 0x00000153,key.del ,\ ; Delete |
||
579 | 0x00010147,key.shift_home ,\ ; Shift+Home |
||
580 | 0x00010148,key.shift_up ,\ ; Shift+Up |
||
581 | 0x00010149,key.shift_pgup ,\ ; Shift+PageUp |
||
582 | 0x0001014B,key.shift_left ,\ ; Shift+Left |
||
583 | 0x0001014D,key.shift_right ,\ ; Shift+Right |
||
584 | 0x0001014F,key.shift_end ,\ ; Shift+End |
||
585 | 0x00010150,key.shift_down ,\ ; Shift+Down |
||
586 | 0x00010151,key.shift_pgdn ,\ ; Shift+PageDown |
||
587 | 0x00010153,key.del ,\ ; Shift+Delete |
||
259 | mikedld | 588 | 0x0002000F,key.ctrl_tab ,\ ; Ctrl+Tab |
258 | mikedld | 589 | 0x00020015,key.ctrl_y ,\ ; Ctrl+Y |
590 | 0x00020018,key.ctrl_o ,\ ; Ctrl+O |
||
591 | 0x0002001E,key.ctrl_a ,\ ; Ctrl+A |
||
592 | 0x0002001F,key.ctrl_s ,\ ; Ctrl+S |
||
593 | 0x00020020,key.ctrl_d ,\ ; Ctrl+D |
||
594 | 0x00020021,key.ctrl_f ,\ ; Ctrl+F |
||
595 | 0x00020022,key.ctrl_g ,\ ; Ctrl+G |
||
596 | 0x00020023,key.ctrl_h ,\ ; Ctrl+H |
||
122 | diamond | 597 | \;0x00020026,key.ctrl_l ,\ ; Ctrl+L |
258 | mikedld | 598 | 0x0002002D,key.ctrl_x ,\ ; Ctrl+X |
599 | 0x0002002E,key.ctrl_c ,\ ; Ctrl+C |
||
600 | 0x0002002F,key.ctrl_v ,\ ; Ctrl+V |
||
601 | 0x00020031,key.ctrl_n ,\ ; Ctrl+N |
||
602 | 0x00020043,key.ctrl_f9 ,\ ; Ctrl+F9 |
||
603 | 0x00020147,key.ctrl_home ,\ ; Ctrl+Home |
||
122 | diamond | 604 | \;0x00020148,key.ctrl_up ,\ ; Ctrl+Up |
258 | mikedld | 605 | 0x00020149,key.ctrl_pgup ,\ ; Ctrl+PageUp |
606 | 0x0002014B,key.ctrl_left ,\ ; Ctrl+Left |
||
607 | 0x0002014D,key.ctrl_right ,\ ; Ctrl+Right |
||
608 | 0x0002014F,key.ctrl_end ,\ ; Ctrl+End |
||
122 | diamond | 609 | \;0x00020150,key.ctrl_down ,\ ; Ctrl+Down |
258 | mikedld | 610 | 0x00020151,key.ctrl_pgdn ,\ ; Ctrl+PageDown |
611 | 0x00020153,key.del ,\ ; Ctrl+Del |
||
259 | mikedld | 612 | 0x0003000F,key.shift_ctrl_tab ,\ ; Shift+Ctrl+Tab |
258 | mikedld | 613 | 0x0003001F,key.shift_ctrl_s ,\ ; Shift+Ctrl+S |
122 | diamond | 614 | 0x00030147,key.shift_ctrl_home ,\ ; Shift+Ctrl+Home |
615 | \;0x00030148,key.shift_ctrl_up ,\ ; Shift+Ctrl+Up |
||
616 | 0x00030149,key.shift_ctrl_pgup ,\ ; Shift+Ctrl+PageUp |
||
617 | 0x0003014B,key.shift_ctrl_left ,\ ; Shift+Ctrl+Left |
||
618 | 0x0003014D,key.shift_ctrl_right ,\ ; Shift+Ctrl+Right |
||
619 | 0x0003014F,key.shift_ctrl_end ,\ ; Shift+Ctrl+End |
||
620 | \;0x00030150,key.shift_ctrl_down ,\ ; Shift+Ctrl+Down |
||
621 | 0x00030151,key.shift_ctrl_pgdn ,\ ; Shift+Ctrl+PageDown |
||
258 | mikedld | 622 | 0x0004002D,key.alt_x ,\ ; Alt+X |
122 | diamond | 623 | |
31 | halyavin | 624 | |
258 | mikedld | 625 | accel_table_textbox dd \ |
122 | diamond | 626 | \;0x00000001,key.tb.escape ,\ ; Escape |
258 | mikedld | 627 | 0x0000000E,key.tb.bkspace ,\ ; BackSpace |
122 | diamond | 628 | \;0x0000000F,key.tb.tab ,\ ; Tab |
629 | \;0x0000001C,key.tb.return ,\ ; Return |
||
258 | mikedld | 630 | 0x00000147,key.tb.home ,\ ; Home |
631 | 0x0000014B,key.tb.left ,\ ; Left |
||
632 | 0x0000014D,key.tb.right ,\ ; Right |
||
633 | 0x0000014F,key.tb.end ,\ ; End |
||
634 | 0x00000153,key.tb.del ,\ ; Delete |
||
635 | 0x00010147,key.tb.shift_home ,\ ; Shift+Home |
||
636 | 0x0001014B,key.tb.shift_left ,\ ; Shift+Left |
||
122 | diamond | 637 | 0x0001014D,key.tb.shift_right ,\ ; Shift+Right |
258 | mikedld | 638 | 0x0001014F,key.tb.shift_end ,\ ; Shift+End |
639 | 0x00010153,key.tb.del ,\ ; Shift+Del |
||
122 | diamond | 640 | |
31 | halyavin | 641 | |
258 | mikedld | 642 | accel_table2 dd \ |
122 | diamond | 643 | 1,btn.close_main_window ,\ |
258 | mikedld | 644 | 'UP',btn.scroll_up ,\ |
645 | 'DN',btn.scroll_down ,\ |
||
646 | 'LT',btn.scroll_left ,\ |
||
122 | diamond | 647 | 'RT',btn.scroll_right ,\ |
648 | |||
31 | halyavin | 649 | |
258 | mikedld | 650 | accel_table2_botdlg dd \ |
122 | diamond | 651 | 1,btn.close_main_window ,\ |
258 | mikedld | 652 | 20001,btn.bot.cancel ,\ |
122 | diamond | 653 | 20002,btn.bot.opensave ,\ |
258 | mikedld | 654 | 20003,btn.bot.find ,\ |
122 | diamond | 655 | |
31 | halyavin | 656 | |
657 | add_table: |
||
658 | times $1A db -$20 |
||
659 | times $25 db -$00 |
||
660 | times $10 db -$20 |
||
661 | times $30 db -$00 |
||
662 | times $10 db -$50 |
||
663 | times $04 db -$00,-$01 |
||
664 | times $08 db -$00 |
||
665 | |||
178 | heavyiron | 666 | s_status dd 0 |
667 | |||
668 | fasm_start: |
||
258 | mikedld | 669 | dd 7 |
670 | dd 0 |
||
671 | dd fasm_parameters |
||
672 | dd 0 |
||
673 | dd 0 |
||
674 | db '/RD/1/DEVELOP/FASM',0 |
||
178 | heavyiron | 675 | board_start: |
258 | mikedld | 676 | dd 7 |
677 | dd 0 |
||
678 | dd 0 |
||
679 | dd 0 |
||
680 | dd 0 |
||
681 | db '/RD/1/BOARD',0 |
||
178 | heavyiron | 682 | tinypad_start: |
258 | mikedld | 683 | dd 7 |
684 | dd 0 |
||
685 | dd ? |
||
686 | dd 0 |
||
687 | dd 0 |
||
688 | db '/RD/1/TINYPAD',0 |
||
178 | heavyiron | 689 | docpak_start: |
258 | mikedld | 690 | dd 7 |
691 | dd 0 |
||
692 | dd sysfuncs_param |
||
693 | dd 0 |
||
694 | dd 0 |
||
695 | db '/RD/1/DOCPAK',0 |
||
178 | heavyiron | 696 | |
122 | diamond | 697 | sz sysfuncs_param,'g',0 |
698 | |||
259 | mikedld | 699 | include 'tp-locale.inc' |
31 | halyavin | 700 | |
122 | diamond | 701 | sz symbols_ex,';?.%"',"'" |
702 | sz symbols ,'#&*\:/<>|{}()[]=+-, ' |
||
703 | |||
259 | mikedld | 704 | sz ini_sec_window ,'Window',0 |
705 | sz ini_window_top ,'Top',0 |
||
706 | sz ini_window_left ,'Left',0 |
||
707 | sz ini_window_right ,'Right',0 |
||
708 | sz ini_window_bottom,'Bottom',0 |
||
178 | heavyiron | 709 | |
258 | mikedld | 710 | TINYPAD_END: ; end of file |
122 | diamond | 711 | |
712 | self_path rb PATHL |
||
713 | |||
31 | halyavin | 714 | ;----------------------------------------------------------------------------- |
122 | diamond | 715 | section @UDATA ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
31 | halyavin | 716 | ;----------------------------------------------------------------------------- |
717 | |||
122 | diamond | 718 | f_info.length dd ? |
719 | f_info.path: |
||
720 | times PATHL+1 db ? |
||
259 | mikedld | 721 | f_info70 rd 7 |
122 | diamond | 722 | |
259 | mikedld | 723 | file_info FILEINFO |
724 | |||
725 | tab_bar TABCTL |
||
726 | virtual at tab_bar.Current |
||
727 | cur_tab TABITEM |
||
728 | ;cur_tab_addr dd ? |
||
729 | end virtual |
||
730 | |||
122 | diamond | 731 | lines.scr dd ? ; number of lines on the screen |
732 | columns.scr dd ? ; number of columns on the screen |
||
31 | halyavin | 733 | top_ofs dd ? ; height occupied by top buttons |
734 | bot_ofs dd ? ; height occupied by bottom buttons |
||
258 | mikedld | 735 | dw ? |
122 | diamond | 736 | left_ofs dd ? ; |
258 | mikedld | 737 | __rc dd ?,?,?,? |
31 | halyavin | 738 | copy_count dd ? ; number of lines for copying (Ctrl+E) |
739 | copy_size dd ? ; size of data to copy |
||
740 | s_title.size dd ? ; caption length |
||
741 | |||
122 | diamond | 742 | draw_blines dd ? ; last line to draw |
743 | |||
31 | halyavin | 744 | cur_line_len dd ? |
122 | diamond | 745 | h_popup dd ? |
746 | bot_dlg_handler dd ? |
||
31 | halyavin | 747 | |
122 | diamond | 748 | sel.begin.x dd ? |
749 | sel.begin.y dd ? |
||
750 | sel.end.x dd ? |
||
751 | sel.end.y dd ? |
||
752 | sel.selected db ? |
||
753 | |||
258 | mikedld | 754 | in_sel db ? |
122 | diamond | 755 | |
31 | halyavin | 756 | do_not_draw db ? ; draw top and bottom buttons? |
122 | diamond | 757 | main_closed db ? ; main window closed? |
758 | tb_casesen db ? ; focused textbox is case-sensitive? |
||
31 | halyavin | 759 | |
760 | align 4 |
||
761 | s_fname.size dd ? |
||
762 | s_fname rb PATHL+1 |
||
763 | align 4 |
||
764 | s_search.size dd ? |
||
765 | s_search rb PATHL+1 |
||
766 | |||
122 | diamond | 767 | s_title rb PATHL+11 ; window caption |
31 | halyavin | 768 | |
122 | diamond | 769 | chr db ? |
770 | ext db ? |
||
771 | shi dd ? |
||
772 | |||
773 | align 4 |
||
774 | cl_3d_normal dd ? |
||
775 | cl_3d_pushed dd ? |
||
776 | cl_3d_outset dd ? |
||
777 | cl_3d_inset dd ? |
||
778 | cl_3d_grayed dd ? |
||
779 | |||
780 | tb_opensave TBOX |
||
781 | tb_find TBOX |
||
782 | tb_replace TBOX |
||
783 | tb_gotorow TBOX |
||
784 | tb_gotocol TBOX |
||
785 | |||
786 | focused_tb dd ? |
||
787 | |||
788 | key1 rb 256 |
||
789 | |||
790 | mst db ? |
||
791 | mst2 db ? |
||
792 | mev db ? |
||
258 | mikedld | 793 | mouse_captured db ? |
122 | diamond | 794 | just_from_popup db ? |
795 | |||
796 | bot_mode db ? |
||
797 | |||
798 | align 4 |
||
799 | |||
800 | bot_dlg_height dd ? |
||
801 | bot_dlg_mode2 db ? |
||
802 | |||
259 | mikedld | 803 | temp_buf dd ? |
804 | copy_buf dd ? |
||
805 | |||
31 | halyavin | 806 | ;----------------------------------------------------------------------------- |
122 | diamond | 807 | section @PARAMS ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
31 | halyavin | 808 | ;----------------------------------------------------------------------------- |
809 | |||
810 | fasm_parameters: |
||
811 | |||
258 | mikedld | 812 | p_info process_information |
122 | diamond | 813 | p_info2 process_information |
258 | mikedld | 814 | sc system_colors |
122 | diamond | 815 | |
816 | ;store dword '/hd/' at tb_opensave.text+4*0 |
||
817 | ;store dword '1/tp' at tb_opensave.text+4*1 |
||
818 | ;store dword 'ad4/' at tb_opensave.text+4*2 |
||
819 | ;store dword 'tiny' at tb_opensave.text+4*3 |
||
820 | ;store dword 'pad.' at tb_opensave.text+4*4 |
||
821 | ;store dword 'asm' at tb_opensave.text+4*5 |
||
822 | ;store byte 23 at tb_opensave.length |
||
259 | mikedld | 823 | |
824 | ;rb 1024*36 |
||
825 | rb 1024*4 |
||
826 | MAIN_STACK: |
||
827 | rb 1024*4 |
||
828 | POPUP_STACK: |
||
829 | |||
830 | STATIC_MEM_END: |
||
831 | |||
832 | diff10 'Main memory size',0,$>>> |