Subversion Repositories Kolibri OS

Rev

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