Subversion Repositories Kolibri OS

Rev

Rev 122 | Rev 242 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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