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