?login_element?

Subversion Repositories NedoOS

Rev

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

  1. ;TODO в режиме wrap:
  2. ;- при стирании перерисовывать последнюю строку и всё за ней, если она уничтожена
  3. ;- при добавлении перерисовывать строки ниже, если изменилось число строк
  4. ;a) отслеживать последнюю позицию при печати (не годится для word wrap)
  5. ;б) отслеживать длину строки до и после (не годится для word wrap)
  6. ;в) отслеживать число подстрок до и после
  7. ;г) отслеживать список адресов всех подстрок на экране
  8.  
  9. texted_XYTOP=0x0000
  10. ;texted_HGT=24
  11. texted_WID=80
  12. _texted_PANELCOLOR=0x0700;0x38
  13.  
  14. textview
  15.         ;xor a
  16.         ;ld h,a
  17.         ;ld l,a
  18.         ;call texted_settop
  19.         ;ld (curlineaddr),hl
  20.         ;ld (curlineaddrHSB),a
  21.         ;ld hl,1
  22.         ;ld (texted_ncurline),hl
  23.         ;ld hl,0
  24.         ;ld (curxy),hl
  25.         call texted_gotobof
  26.        
  27.         call texted_panel        
  28.        
  29.         call texted_calclines
  30.  
  31. texted_redrawloop
  32.         call setredrawflag
  33. texted_mainloop
  34. texted_lineredrawflag=$
  35.         scf ;/or a
  36.         call c,texted_prcurline ;might set redrawflag
  37. texted_redrawflag=$
  38.         scf ;/or a
  39.         call c,texted_prcurpage
  40.  
  41. ;texted_waitkey_nokey
  42.         ld de,(curxy)
  43.         call nv_setxy
  44.        if 0
  45.         ld a,2
  46. mainloop_yieldkeep
  47.         ld (wasnokey),a
  48.         YIELDKEEP
  49.         ld a,55+128 ;"or a"
  50.         ld (texted_wasyield),a
  51.        endif
  52. texted_waitkey_nokey
  53.       if 0
  54.       else
  55.         YIELD
  56.       endif
  57.         GETKEY_ ;OS_GETKEYNOLANG
  58.         ;or a ;cp NOKEY ;keylang==0?
  59.         ;jr nz,texted_mainloop_keyq
  60.         ;cp c ;keynolang==0?
  61.         ;ld a,c ;keynolang
  62.         ;cp NOKEY ;TODO отличить от отсутствия фокуса nz? (не в фокусе клавиши не отдаются)
  63.         jr nz,texted_mainloop_keyq ;event
  64.         ;GETKEY_
  65.         ;jr nz,texted_mainloop_keyq ;event
  66.         ;GETKEY_
  67.         ;jr nz,texted_mainloop_keyq ;event бывает 3-символьный
  68.       if 0
  69.        ld a,(stdindatacount)
  70.        or a
  71.        jr nz,texted_mainloop
  72. ;если два раза подряд нет события, то делаем YIELD, иначе YIELDKEEP
  73. ;рисовать панельку только при отсутствии события после YIELD
  74. wasnokey=$+1
  75.         ld a,1
  76.         dec a
  77.         jr nz,mainloop_yieldkeep
  78. texted_wasyield=$
  79.         scf
  80.         jr nc,nopanel
  81.       endif
  82. texted_panelredrawflag=$
  83.         scf ;/or a
  84.         call c,texted_panel ;call c
  85.       if 0
  86.         ld de,(curxy)
  87.         call nv_setxy
  88. nopanel
  89.         YIELD
  90.         ld a,55 ;"scf"
  91.         ld (texted_wasyield),a
  92.         jr texted_waitkey_nokey
  93.       else
  94.         jr texted_mainloop
  95.       endif        
  96. texted_mainloop_keyq      
  97.  
  98.         cp key_redraw
  99.         jr z,texted_redrawloop
  100.         cp key_esc
  101.         ret z
  102.        
  103.         ld hl,texted_mainloop
  104.         push hl
  105.         cp key_up
  106.         jp z,texted_up
  107.         cp key_down
  108.         jp z,texted_down
  109.         cp key_pgup
  110.         jp z,texted_pgup
  111.         cp key_pgdown
  112.         jp z,texted_pgdown
  113.          cp key_F10;extS
  114.          jp z,texted_changeencoding
  115.         cp key_home
  116.         jp z,texted_home
  117.         cp key_end
  118.         jp z,texted_end
  119.         cp key_left
  120.         jp z,texted_left
  121.         cp key_right
  122.         jp z,texted_right
  123.         cp key_sspgup;ext3
  124.         jp z,texted_gotobof;home
  125.         cp key_sspgdown;ext4
  126.         jp z,texted_gotoeof;end
  127.         ;cp extW
  128.         ;jp z,texted_wrap
  129.          cp key_ins
  130.          jp z,texted_wrap
  131.         cp key_backspace
  132.         jp z,texted_backspace
  133.         cp key_del
  134.         jp z,texted_del
  135.         cp key_enter
  136.         jp z,texted_enter
  137.         cp key_csenter
  138.         jp z,texted_save
  139.         cp key_F1
  140.         jp z,texted_help
  141.         cp key_F2
  142.         jp z,texted_save
  143.         cp key_F9
  144.         jp z,texted_build
  145.         cp 0x20
  146.         ret c ;прочие системные кнопки не нужны
  147. typein
  148.         ld c,a
  149.         ld a,(texted_prline_recodepatch)
  150.         or a
  151.         jr z,typein_nowin
  152.        ld h,t866towin/256
  153.        ld l,c
  154.        ld c,(hl)
  155. typein_nowin
  156.         call linesize_minus_x ;sz<x = error
  157.         call c,insert_minushl_spaces
  158.         call calccursoraddr
  159.         call insertbyte
  160. ;TODO wrap (reprint screen if needed)        
  161.         call setlineredrawflag;texted_prcurpage
  162.         jp texted_right
  163.  
  164. linesize_minus_x
  165. ;sz<x = CY
  166.         call calccurlinesz ;hl=sz
  167.         ex de,hl
  168.         call calccurlinex
  169.         ex de,hl
  170.         or a
  171.         sbc hl,de ;sz<x = error
  172.         ret
  173.  
  174. insert_minushl_spaces
  175.         push bc
  176. textinsertsymbol_pseudospace0
  177.         push hl ;sz-x < 0
  178.         call texted_end
  179.         call calccursoraddr
  180.         ld c,' '
  181.         call insertbyte
  182.         pop hl ;sz-x < 0
  183.         inc hl
  184.         inc h
  185.         dec h
  186.         jr nz,textinsertsymbol_pseudospace0
  187.         call texted_end
  188.         pop bc
  189.         ret
  190.  
  191. texted_enter
  192.         call linesize_minus_x ;sz<x = error
  193.         ;jr nc,texted_enter_nopseudospaces
  194.         call c,texted_end
  195. ;texted_enter_nopseudospaces
  196.         call calccursoraddr
  197.         ld c,0x0d
  198.         call insertbyte
  199.         ld c,0x0a
  200.         call insertbyte
  201.         xor a
  202.         ld (curx),a
  203.         ld hl,0
  204.         ld (texted_prline_shift),hl
  205.  
  206.         call setredrawflag;texted_prcurpage
  207.  
  208.         call incnlines
  209.         jp texted_down
  210.        
  211. texted_save
  212. texted_filenameaddr=$+1
  213.         ld de,defaultfilename
  214.         OS_CREATEHANDLE
  215.         or a
  216.         ret nz
  217. ;b=new file handle
  218.         push bc
  219.         ld a,b
  220.         ld (cmd_savepage_handle),a
  221.  
  222.         ;ld de,(fcb+FCB_FSIZE)
  223.         ;ld hl,(fcb+FCB_FSIZE+2)
  224.         call getsize
  225.         ex de,hl
  226.         ld l,a
  227.         ld h,0
  228.         ld a,0 ;page number
  229. texted_save0
  230. ;a=page number in table (0..)
  231. ;hlde=remaining size
  232.         push af ;pg
  233.         push de ;remaining LSW
  234.         push hl ;remaining HSW
  235.         call setpg32k
  236.         ld a,d
  237.         and 0xc0
  238.         or h
  239.         or l
  240.         jr z,$+5 ;de=size
  241.         ld de,#4000
  242.         ex de,hl ;hl=pg size
  243.          push hl ;hl=pg size
  244.         call cmd_savepage
  245.          pop bc ;bc=pg size
  246.         pop hl ;remaining HSW
  247.         pop de ;remaining LSW
  248.         ex de,hl
  249.         or a
  250.         sbc hl,bc
  251.         ex de,hl
  252.         jr nc,$+3
  253.         dec hl ;size = size-pgsize
  254.         ld a,h
  255.         or l
  256.         or d
  257.         or e
  258.         jr z,texted_save_popq
  259.         pop af ;pg
  260.         inc a
  261.         jr texted_save0
  262. texted_save_popq
  263.         pop af
  264.         pop bc
  265.         OS_CLOSEHANDLE
  266.         call setunchanged
  267.         jp setpanelredrawflag
  268.  
  269. cmd_savepage
  270. ;hl=size
  271. ;out: a=error
  272. cmd_savepage_handle=$+1
  273.         ld b,0
  274.         ld de,#8000
  275. ;B = file handle, DE = Buffer address, HL = Number of bytes to write
  276.         OS_WRITEHANDLE
  277. ;HL = Number of bytes actually written, A=error
  278.         ret
  279.        
  280. setredrawflag
  281.         ld a,55 ;scf
  282.         ld (texted_redrawflag),a
  283.         ;ret
  284. setpanelredrawflag
  285.         ld a,55 ;scf
  286.         ld (texted_panelredrawflag),a
  287.         ret
  288. setlineredrawflag
  289.         ld a,55 ;scf
  290.         ld (texted_lineredrawflag),a
  291.         jr setpanelredrawflag;ret
  292.  
  293. calccurlinex
  294.         ld hl,(texted_prline_shift)
  295.         ld a,(curx)
  296.         add a,l
  297.         ld l,a
  298.         ret nc
  299.         inc h
  300.         ret
  301.        
  302. calccursoraddr
  303. ;TODO учитывать ширину строки (правее строки простое сложение бессмысленно)
  304.         call calccurlinex
  305.         ex de,hl
  306.         ld hl,(curlineaddr)
  307.         ld a,(curlineaddrHSB)
  308.         add hl,de
  309.         adc a,0
  310.         ret
  311.        
  312. texted_backspace
  313. ;TODO wrap (set y, reprint screen if needed)
  314.         call calccurlinex
  315.         ld a,h
  316.         or l
  317.         jr z,texted_backspace_startline
  318.  
  319.         call linesize_minus_x ;sz<x = error
  320.         jp c,texted_left
  321.  
  322.         call calccursoraddr
  323.         call prevbyte
  324.         ;call isbof
  325.         ;ret z
  326.         call deletebyte        
  327.         call setlineredrawflag
  328.         jp texted_left
  329. texted_backspace_startline
  330.         call calccursoraddr
  331.         call isbof
  332.         ret z
  333.         call prevbyte
  334.         call getbyte
  335.         push bc
  336.         call deletebyte
  337.         pop bc
  338.         ld b,a
  339.          ld a,c ;deleted byte
  340.          cp 0x0d
  341.          ld a,b
  342.          jr z,texted_backspace_startline_onlycr ;for CR texts
  343.         ld a,c
  344.         cp 0x0a
  345.         ld a,b
  346.         jr nz,texted_backspace_startline_onlycr
  347.         call isbof
  348.         jr z,texted_backspace_startline_onlycr
  349.         call prevbyte
  350.         call getbyte
  351.         ld b,a
  352.         ld a,c
  353.         cp 0x0d
  354.         ld a,b
  355.         ;jr nz,texted_backspace_startline_onlycr
  356.         call z,deletebyte ;0x0d
  357. texted_backspace_startline_onlycr
  358. ;ahl=at deleted CR/LF
  359. ;if not CR/LF before, go to "previous line" (after earlier CR/LF) and count difference
  360. ;else x=0
  361.          push af
  362.          push hl
  363.         call prevbyte
  364.         call getbyte ;c
  365.          pop hl
  366.          pop af
  367.          ld d,h
  368.          ld e,l
  369.         ld b,a
  370.         ld a,c
  371.         cp 0x0d
  372.         jr z,texted_backspace_startline_setxshift_hlminusde
  373.         cp 0x0a
  374.         jr z,texted_backspace_startline_setxshift_hlminusde
  375.         ld a,b
  376.  
  377.         ;push af
  378.         push hl
  379.         call texted_prevline ;CY=error (impossible?)
  380.         ex de,hl
  381.         ;ld c,a
  382.         pop hl ;hl=at deleted CR?,de=prevline
  383.         ;pop af
  384. texted_backspace_startline_setxshift_hlminusde
  385.         or a
  386.         sbc hl,de
  387.         ;sbc a,c
  388.         call setxshift_hl
  389.        
  390.         call setredrawflag
  391.  
  392.         call decnlines
  393.         jp texted_up
  394.  
  395. decnlines
  396.         push hl
  397.         ld hl,(nlines)
  398.         dec hl
  399.         ld (nlines),hl
  400.         pop hl
  401.         ret
  402. incnlines
  403.         push hl
  404.         ld hl,(nlines)
  405.         inc hl
  406.         ld (nlines),hl
  407.         pop hl
  408.         ret
  409.  
  410. texted_home
  411. ;TODO wrap (set y)
  412.         ld hl,0
  413.         call setxshift_hl
  414.         jp setredrawflag
  415.  
  416. texted_end
  417. ;TODO wrap (set y)
  418.         ;call calccursoraddr
  419.         call calccurlinesz ;hl=sz
  420.         call setxshift_hl
  421.         jp setredrawflag
  422.  
  423. calccurlinesz_nowrap
  424. ;out: hl=sz (keeps bc)
  425.         ld hl,(curlineaddr)
  426.         ld a,(curlineaddrHSB)
  427. ;ahl=line addr
  428.         push bc
  429.         call texted_nextline_nowrap ;CY=error
  430.         jr calccurlinesz_go
  431. calccurlinesz
  432. ;out: hl=sz (keeps bc)
  433.         ld hl,(curlineaddr)
  434.         ld a,(curlineaddrHSB)
  435. ;ahl=line addr
  436.         push bc
  437.         call texted_nextline ;CY=error
  438. calccurlinesz_go
  439.         call c,getsize
  440.         call nc,skipbackcrlf
  441.         ld bc,(curlineaddr)
  442.         or a
  443.         sbc hl,bc
  444.         pop bc
  445.         ret
  446.  
  447. skipbackcrlf
  448. ;out: ahl=eof or endline+1 (at cr/lf)
  449.         call isbof
  450.         ret z
  451.         call prevbyte
  452.         call getbyte
  453.         ld b,a
  454.          ld a,c
  455.          cp 0x0d
  456.          ld a,b
  457.          ret z ;for CR texts
  458.         ld a,c
  459.         cp 0x0a
  460.         ld a,b
  461.         jp nz,nextbyte
  462.         call isbof
  463.         ret z
  464.         call prevbyte
  465.         call getbyte
  466.         ld b,a
  467.         ld a,c
  468.         cp 0x0d
  469.         ld a,b
  470.         jp nz,nextbyte
  471.         ret
  472.        
  473. setxshift_hl
  474. ;X=hl=ahl-startline
  475. ;x+shift = X:
  476. ;x = min(X,texted_WID-1), но под mod8 должен совпадать с X
  477. ;shift = X-x
  478.         ld bc,texted_WID-1
  479.         call minhl_bc_tobc
  480.         ld a,c
  481.         xor l
  482.         and %11111000
  483.         xor l
  484.         ld c,a
  485.         ld (curx),a
  486.         or a
  487.         sbc hl,bc
  488.         ld (texted_prline_shift),hl
  489.         ret
  490.        
  491. texted_del
  492. ;TODO wrap (set y, reprint screen if needed)
  493.         call linesize_minus_x ;sz<x = error
  494.         jr c,texted_del_newline
  495.         jr z,texted_del_newline
  496.         call texted_right
  497.         jp texted_backspace
  498. texted_del_newline
  499. ;удаление ентера справа (backspace не умеет)
  500. ;hl=sz-x
  501.         call c,insert_minushl_spaces
  502.         call setredrawflag
  503.         call calccursoraddr
  504.         call iseof
  505.         ret z
  506.         call decnlines
  507.         call getbyte
  508.         push af
  509.         call deletebyte
  510.         pop bc ;b=deleted byte
  511.         ld c,a
  512.         ld a,b
  513.         cp 0x0a
  514.         ld a,c
  515.         ret z ;endline = 0x0a
  516.         call iseof
  517.         ret z
  518.         call getbyte
  519.         ld b,a
  520.         ld a,c
  521.         cp 0x0a
  522.         ld a,b
  523.         ret nz
  524.         call deletebyte        
  525.         ret
  526.        
  527. texted_wrap
  528.         ld a,(wrapflag)
  529.         xor 128
  530.         ld (wrapflag),a
  531.         ld hl,0
  532.         ld (texted_prline_shift),hl
  533.         ld (curxy),hl
  534.         call texted_calclines
  535.         ld hl,(curtoptextaddr)
  536.         ld a,(curtoptextHSB)
  537.         ld (curlineaddr),hl
  538.         ld (curlineaddrHSB),a
  539.         call texted_calccurline
  540.         jp setredrawflag;texted_prcurpage
  541.        
  542. texted_right
  543. ;TODO X<16384
  544.         call setpanelredrawflag
  545.         ld de,(curxy)
  546.         inc e
  547.         ld a,e
  548.         cp texted_WID
  549.         ld (curx),a
  550.         ret c
  551.          call iswrapon ;CY=on
  552.          jr c,texted_right_wrap
  553.         ld hl,(texted_prline_shift)
  554.         ld bc,8
  555.         add hl,bc
  556.         ld (texted_prline_shift),hl
  557.         ld a,e
  558.         sub c;8
  559.         ld (curx),a
  560.         jp setredrawflag;texted_prcurpage
  561.        
  562. texted_right_wrap
  563.         xor a
  564.         ld (curx),a
  565.         jp texted_down
  566.        
  567. texted_left
  568.         call setpanelredrawflag
  569.         ld de,(curxy)
  570.         ld a,e
  571.         sub 1
  572.         ld e,a
  573.         ld (curx),a
  574.         ret nc
  575.         xor a
  576.         ld (curx),a
  577.         ld hl,(texted_prline_shift)
  578.         ld bc,8
  579.         or a
  580.         sbc hl,bc
  581.         ret c
  582.         ld (texted_prline_shift),hl
  583.         ld a,e
  584.         add a,c;8
  585.         ld (curx),a
  586.         jp setredrawflag;texted_prcurpage
  587.        
  588. texted_prcurline
  589.         ld a,55+0x80 ;or a
  590.         ld (texted_lineredrawflag),a
  591.         ld de,(curxy)
  592.         ld e,0
  593.         ;push de
  594.         call nv_setxy ;keeps de
  595.         ;pop de
  596. ;print lines until CR or EOF
  597. ;TODO если изменилось число подстрок, то печатаем всё ниже
  598. ;костыль: печатаем всё ниже, если у текущей строки последняя позиция печати=0 (бывает при стирании) или 1 (бывает при добавлении). можно сделать делением длины строки на 80
  599.       push de
  600.        call calccurlinesz_nowrap ;out: hl=sz (keeps bc)
  601.       pop de
  602.        ld bc,-80
  603.        add hl,bc
  604.        jr c,$-1
  605. ;hl=-80..-1 for line remainder = 0..79
  606.        ld a,l
  607.        sub c
  608.        cp 2
  609.         ld hl,(curlineaddr)
  610.         ld a,(curlineaddrHSB)
  611.        jr c,texted_prcurline_allbelow
  612. texted_prcurline_continue0
  613.         call texted_prline_nextline_nooverflow    
  614.         call texted_prcurline_continue ;z=no continue
  615.        ret z
  616.         inc d
  617.        ld b,a
  618.         ;ld a,texted_HGT
  619.         ld a,(textedhgt)
  620.         cp d
  621.        ld a,b
  622.         jr nz,texted_prcurline_continue0
  623.         ret
  624. texted_prcurline_allbelow
  625. texted_prcurline_allbelow0
  626.         call texted_prline_nextline_nooverflow    
  627.         call texted_prcurline_continue ;z=no continue
  628.         inc d
  629.        ld b,a
  630.         ;ld a,texted_HGT
  631.         ld a,(textedhgt)
  632.         cp d
  633.        ld a,b
  634.         jr nz,texted_prcurline_allbelow0
  635.         ret
  636.  
  637. texted_prline_nextline_nooverflow
  638.         push de
  639.         call texted_prline_nextline
  640.         pop de
  641.         call c,getsize ;при переполнении ahl=filesize
  642.         ret
  643.  
  644. texted_prcurline_continue
  645. ;out: z=no continue
  646.         call iseof
  647.         ret z
  648.         call prevbyte
  649.         call getbyte ;to c
  650.        push bc
  651.         call nextbyte
  652.        pop bc
  653.         ld b,a
  654.         ld a,c
  655.         cp 0x0d
  656.         jr z,texted_prcurline_continue_ab_z
  657.         cp 0x0a
  658. texted_prcurline_continue_ab_z
  659.         ld a,b
  660.         ;ret z
  661.         ret
  662.  
  663. texted_prcurpage
  664.          ;ld e,0
  665.          ;OS_CLS
  666.         ld a,55+0x80 ;or a
  667.         ld (texted_redrawflag),a
  668.         ld hl,(curtoptextaddr)
  669.         ld a,(curtoptextHSB)
  670.         jp texted_prpage
  671.        
  672. texted_gotobof
  673.         xor a
  674.         ld h,a
  675.         ld l,a
  676. ;texted_gotobof_ok
  677.         call texted_settop
  678.         ld (curlineaddr),hl
  679.         ld (curlineaddrHSB),a
  680.         ;ld hl,1
  681.         ;ld (texted_ncurline),hl
  682. ;ahl=curtextline (kept)
  683.         call texted_calccurline
  684.         ld hl,0
  685.         ld (curxy),hl
  686.         jp setredrawflag;texted_prcurpage
  687.  
  688. getsize
  689.         ld hl,(filesize)
  690.         ld a,(filesizeHSW)
  691.         ret
  692.        
  693. texted_gotoeof
  694.         call getsize
  695.         ;ld b,texted_HGT
  696.         ld bc,(textedhgt-1) ;b
  697. texted_end0
  698.         push bc
  699.         call texted_prevline
  700.         pop bc
  701.         djnz texted_end0
  702. ;ahl=curtextline (kept)
  703.         call texted_calccurline
  704.         jp texted_pgdown_bottom
  705.  
  706.  
  707. deccurline
  708.         push hl
  709.         ld hl,(texted_ncurline)
  710.         dec hl
  711.         ld (texted_ncurline),hl
  712.         pop hl
  713.         ret
  714. deccury
  715.         push hl
  716.         ld hl,cury
  717.         dec (hl)
  718.         pop hl
  719.         ret
  720.        
  721. inccurline
  722.         push hl
  723.         ld hl,(texted_ncurline)
  724.         inc hl
  725.         ld (texted_ncurline),hl
  726.         pop hl
  727.         ret
  728. inccury
  729.         push hl
  730.         ld hl,cury
  731.         inc (hl)
  732.         pop hl
  733.         ret
  734.  
  735. texted_up
  736.         ld hl,(curlineaddr)
  737.         ld a,(curlineaddrHSB)
  738.         call texted_prevline
  739.         ret c
  740.         ld (curlineaddr),hl
  741.         ld (curlineaddrHSB),a
  742.         push af
  743.         push hl
  744.         call deccurline
  745.         call setpanelredrawflag
  746.         pop hl
  747.         pop af
  748.         ld c,a
  749.         ld a,(cury)
  750.         sub 1
  751.         ld (cury),a
  752.         ret nc
  753.         inc a
  754.         ld (cury),a
  755.         ld a,c
  756.         call texted_settop
  757.         push af
  758.         push hl
  759.         ld de,texted_XYTOP
  760.         ;ld hl,256*texted_HGT + texted_WID
  761.         ld hl,(textedhgt-1) ;h
  762.         ld l,texted_WID
  763.         call scrolldown ;OS_SCROLLDOWN
  764.         ld de,texted_XYTOP
  765.         call nv_setxy
  766.         pop hl
  767.         pop af
  768.         call texted_prline
  769.         ret
  770.  
  771. texted_down
  772.         ld hl,(curlineaddr)
  773.         ld a,(curlineaddrHSB)
  774.         call texted_nextline
  775.         ret c
  776.         ld (curlineaddr),hl
  777.         ld (curlineaddrHSB),a
  778.         push af
  779.         push hl
  780.         call inccurline
  781.         call setpanelredrawflag
  782.         pop hl
  783.         pop af
  784.         ld c,a
  785.         ld de,(curxy)
  786.         inc d
  787.         ;ld a,texted_HGT
  788.         ld a,(textedhgt)
  789.         cp d
  790.         ld (curxy),de
  791.         ret nz;c
  792.         dec d
  793.         ld (curxy),de
  794.         ld a,c
  795.         push af
  796.         push hl
  797.         ld de,texted_XYTOP
  798.         ;ld hl,256*texted_HGT + texted_WID
  799.         ld hl,(textedhgt-1) ;h
  800.         ld l,texted_WID
  801.        push de
  802.        push hl
  803.         call scrollup ;OS_SCROLLUP
  804.        pop hl
  805.        pop de
  806.        dec h
  807.        ld l,0
  808.        add hl,de
  809.        ex de,hl ;de=texted_XYTOP+((texted_HGT-1)*256)
  810.         call nv_setxy
  811.         pop hl
  812.         pop af
  813.         call texted_prline;_nextline
  814. curtoptextaddr=$+1
  815.         ld hl,0
  816. curtoptextHSB=$+1
  817.         ld a,0
  818.         call texted_nextline
  819. texted_settop        
  820.         ld (curtoptextaddr),hl
  821.         ld (curtoptextHSB),a
  822.         ret
  823.  
  824. texted_pgup
  825.         call setpanelredrawflag
  826.         ld a,(cury)
  827.         or a
  828.         ld b,a
  829.         ld hl,(curlineaddr)
  830.         ld a,(curlineaddrHSB)
  831.         jr z,texted_pgup_top
  832. texted_pgup_gotop0
  833.         push bc
  834.         call texted_prevline
  835.          call nc,deccurline
  836.          call nc,deccury
  837.         pop bc
  838.         djnz texted_pgup_gotop0
  839.         ld (curlineaddr),hl
  840.         ld (curlineaddrHSB),a
  841.         ret
  842. texted_pgup_top
  843.         ;ld b,texted_HGT-1
  844.         ld bc,(textedhgt-1) ;b
  845.         dec b
  846. texted_pgup0
  847.         push bc
  848.         call texted_prevline
  849.          call nc,deccurline
  850.         pop bc
  851.         djnz texted_pgup0
  852.         call texted_settop
  853.         ld (curlineaddr),hl
  854.         ld (curlineaddrHSB),a
  855.         call setredrawflag
  856.         ret
  857.        
  858. texted_pgdown
  859.         call setpanelredrawflag
  860.         ;ld a,(cury)
  861.         ;sub texted_HGT-1
  862.         ;neg
  863.         ;ld b,a
  864.         ld a,(textedhgt)
  865.         dec a
  866.         ld hl,cury
  867.         sub (hl)
  868.         ld b,a
  869.         ld hl,(curlineaddr)
  870.         ld a,(curlineaddrHSB)
  871.         jr z,texted_pgdown_bottom
  872. texted_pgdown_gobottom0
  873.         push bc
  874.         call texted_nextline
  875.          call nc,inccurline
  876.          call nc,inccury
  877.         pop bc
  878.         djnz texted_pgdown_gobottom0
  879.         ld (curlineaddr),hl
  880.         ld (curlineaddrHSB),a
  881.         ret
  882. texted_pgdown_bottom
  883.         push af
  884.         xor a
  885.         ld (cury),a
  886.         pop af
  887.         call texted_settop
  888.         ;ld b,texted_HGT-1
  889.         ld bc,(textedhgt-1) ;b
  890.         dec b
  891. texted_pgdown0
  892.         push bc
  893.         call texted_nextline
  894.          call nc,inccurline
  895.          call nc,inccury
  896.         pop bc
  897.         djnz texted_pgdown0
  898.         ld (curlineaddr),hl
  899.         ld (curlineaddrHSB),a
  900.         jp setredrawflag
  901.        
  902. texted_calccurline
  903. ;ahl=curtextline (kept)
  904.         push af
  905.         push hl
  906.         ld (texted_calccurline_old),hl
  907.         ld (texted_calccurline_oldHSB),a
  908.         ld ix,1;0
  909.          or h
  910.          or l
  911.          jr z,texted_calccurline_countq
  912.         xor a
  913.         ld h,a
  914.         ld l,a
  915. texted_calccurline_count0
  916.         call texted_nextline ;texted_pseudoprline
  917.  
  918.         if 1==0
  919.         jr c,texted_calccurline_countq ;не помогает
  920.         ex de,hl
  921. texted_calccurline_old=$+1
  922.         ld hl,0
  923.         or a
  924.         sbc hl,de ;nc: hl<=old
  925.         ld l,a
  926. texted_calccurline_oldHSB=$+1
  927.         ld a,0
  928.         sbc a,l
  929.         ld a,l
  930.         inc ix
  931.         jr nc,texted_calccurline_count0 ;nc: ahl<=old
  932.         else
  933.        
  934.         push hl
  935. texted_calccurline_old=$+1
  936.         ld bc,0
  937.         or a
  938.         sbc hl,bc ;nc: hl>=old
  939.         ld l,a
  940. texted_calccurline_oldHSB=$+1
  941.         sbc a,0
  942.         ld a,l
  943.         pop hl
  944.         inc ix
  945.         jr c,texted_calccurline_count0 ;cy: ahl<old
  946.         endif
  947. texted_calccurline_countq
  948.         ;push ix
  949.         ;pop hl
  950.         ld (texted_ncurline),ix;hl
  951.         pop hl
  952.         pop af
  953.         ret
  954.        
  955. texted_calclines
  956. ;sets nlines
  957.         xor a
  958.         ld h,a
  959.         ld l,a
  960.         ld (nlines),hl
  961. texted_calclines0
  962.         call incnlines
  963.         call texted_nextline
  964.         jr nc,texted_calclines0
  965.         ret
  966.        
  967. clear_keyboardbuffer
  968.         push bc
  969.         ld b,50;5
  970. clear_keyboardbuffer0
  971.         push bc
  972.         GETKEY_
  973.         pop bc
  974.         djnz clear_keyboardbuffer0
  975.         pop bc
  976.         ret
  977.        
  978. texted_changeencoding
  979.         ld hl,texted_prline_recodepatch
  980.         ld a,(hl)
  981.         xor 0x7e ;"ld a,(hl)"
  982.         ld (hl),a
  983.         call setredrawflag;texted_prcurpage
  984.         ;call texted_prcurpage
  985.         ;ret
  986. texted_panel
  987.         ld a,55+0x80 ;or a
  988.         ld (texted_panelredrawflag),a
  989.         ;ld de,0x1800
  990.         ld a,(stdiohgt)
  991.         dec a
  992.         ld d,a
  993.         ld e,0
  994.         call nv_setxy
  995.         ld de,_texted_PANELCOLOR
  996.         SETCOLOR_
  997.        
  998.         ld a,(texted_prline_recodepatch)
  999.         or a
  1000.         ld hl,t866
  1001.         jr z,$+5
  1002.         ld hl,twin
  1003.         call prtext
  1004.        
  1005. fchanged=$+1
  1006.         ld a,' '
  1007.         PRCHAR_
  1008.         call calccurlinex
  1009.         inc hl
  1010.         call prword
  1011.         ld a,','
  1012.         PRCHAR_
  1013. texted_ncurline=$+1
  1014.         ld hl,0
  1015.         call prword
  1016.         ld a,'/'
  1017.         PRCHAR_
  1018.         ld hl,(nlines)
  1019.         exx
  1020.         ld hl,0
  1021.         exx
  1022.         call prdword
  1023.         ld a,' '
  1024.         PRCHAR_
  1025.         call getsize
  1026.         exx
  1027.         ;ld hl,(fcb+FCB_FSIZE+2)
  1028.         ld l,a
  1029.         ld h,0
  1030.         exx
  1031.         ;ld hl,(fcb+FCB_FSIZE)
  1032.         call prdword
  1033.         ld de,tspaces_filename
  1034.         ld hl,TSPACES_FILENAME_SZ
  1035.         call sendchars
  1036.         ;ld de,_texted_PANELCOLOR;#38
  1037.         ;OS_PRATTR
  1038.         ld de,_COLOR
  1039.         SETCOLOR_
  1040.         ret
  1041.  
  1042. tspaces_filename
  1043.         db ' '
  1044. tshown_filename
  1045.         ds TSPACES_FILENAME_SZ,' '
  1046.        
  1047. twin
  1048.         db "WIN",0
  1049. t866
  1050.         db "866",0
  1051.  
  1052.      
  1053. isbof
  1054. ;out: z=bof
  1055.         push bc
  1056.         ld c,a
  1057.         or h
  1058.         or l
  1059.         ld a,c
  1060.         pop bc
  1061.         ret
  1062. iseof
  1063. ;out: z=eof
  1064.         push bc
  1065.         push de
  1066.         push hl
  1067.         ;ld de,(fcb+FCB_FSIZE)
  1068.         ;ld bc,(fcb+FCB_FSIZE+2)
  1069.         ;ld b,a
  1070.         ;or a
  1071.         ;sbc hl,de
  1072.         ;sbc a,c
  1073.         ;ld a,b
  1074.         ex de,hl
  1075.         ld c,a
  1076.         call getsize
  1077.         or a
  1078.         sbc hl,de
  1079.         sbc a,c
  1080.         or h
  1081.         or l
  1082.         ld a,c
  1083.         pop hl
  1084.         pop de
  1085.         pop bc
  1086.         ret
  1087.      
  1088. texted_prpage
  1089. ;ahl=addr
  1090.         ld (curtoptextaddr),hl
  1091.         ld (curtoptextHSB),a
  1092.         push af
  1093.         ld de,texted_XYTOP
  1094.         call nv_setxy
  1095.         pop af
  1096.         ;ld b,texted_HGT
  1097.         ld bc,(textedhgt-1) ;b
  1098. texted_prpage0
  1099.         push bc
  1100.         ;push de
  1101.         call texted_prline_nextline
  1102.         call c,getsize
  1103.         ;pop de
  1104.         pop bc
  1105.         ;inc d
  1106.         djnz texted_prpage0
  1107.         ;call clear_keyboardbuffer
  1108.         ret
  1109.        
  1110. texted_prevline
  1111. ;ahl=addr
  1112. ;line < 16K
  1113. ;out: ahl, CY=error
  1114.         call isbof
  1115.          scf
  1116.         ret z
  1117. ;перед нами может быть #0d или #0d,#0a или ничего
  1118.         ld (findprevline_old),hl
  1119.         ld (findprevline_oldHSB),a
  1120.        
  1121.         or a
  1122.         ld bc,0xffff
  1123.         jr nz,$+4
  1124.          ld b,h
  1125.          ld c,l
  1126.          
  1127.         ;push de
  1128.         ld de,0x4000
  1129.         or a
  1130.         sbc hl,de
  1131.         sbc a,e;0
  1132.         ;pop de
  1133.        
  1134.         push af
  1135.         push hl
  1136.         call ahl_to_pgaddr
  1137.         set 6,h
  1138. ;hl=c000+, можно уменьшать
  1139. ;bc=number of chars to go != 0
  1140.  
  1141. ;перед нами может быть #0d или #0d,#0a или ничего
  1142.         dec hl
  1143.         dec bc
  1144.         ld a,b
  1145.         or c
  1146.         jr z,texted_prevlineq
  1147.         ld a,0x0a
  1148.         cp (hl)
  1149.         jr nz,texted_prevline_nolf
  1150.         dec hl
  1151.         dec bc
  1152.         ld a,b
  1153.         or c
  1154.         jr z,texted_prevlineq
  1155. texted_prevline_nolf
  1156.         ld a,0x0d
  1157.         cp (hl)
  1158.         jr nz,texted_prevline_nocr
  1159.         dec hl
  1160.         dec bc
  1161.         ld a,b
  1162.         or c
  1163.         jr z,texted_prevlineq
  1164. texted_prevline_nocr
  1165. ;сейчас мы находимся перед символом конца предыдущей строки (не на нём)
  1166. texted_prevline0
  1167.         ld a,(hl)
  1168.         cp 0x0d
  1169.         jr z,texted_prevline_cr
  1170.         cp 0x0a
  1171.         jr z,texted_prevline_lf
  1172.         dec hl
  1173.         dec bc
  1174.         ld a,b
  1175.         or c
  1176.         jr nz,texted_prevline0
  1177. ;beginning of file
  1178.         jr texted_prevlineq
  1179. texted_prevline_cr
  1180. texted_prevline_lf
  1181. ;сейчас мы находимся на конце символа конца строки перед предыдущей
  1182.         inc hl
  1183. texted_prevlineq
  1184.         ex de,hl ;new addr (bits 13..0), bit 14 = overflow
  1185.         pop hl ;old addr
  1186.         pop af
  1187.         call pgaddr_to_ahl
  1188.         call iswrapon ;CY=on
  1189.         ret nc ;no wrap
  1190.  
  1191. findprevline_linewrap
  1192. ;ahl = в начале строки
  1193. ;перед ней может быть #0d или #0d,#0a
  1194. ;надо псевдонапечатать несколько псевдострок, пока не дойдём до текущей
  1195. findprevline_linewrap_count0
  1196.          push af
  1197.          push hl
  1198.         call texted_pseudoprline
  1199.         push hl
  1200. findprevline_old=$+1
  1201.         ld bc,0
  1202.         or a
  1203.         sbc hl,bc ;nc: hl>=old
  1204.         ld l,a
  1205. findprevline_oldHSB=$+1
  1206.         sbc a,0
  1207.         ld a,l
  1208.         pop hl
  1209.          pop de ;old addr
  1210.          pop bc ;b=old HSB
  1211.         jr c,findprevline_linewrap_count0
  1212.         ex de,hl
  1213.         ld a,b
  1214. ;ahl=на псевдострочку раньше
  1215.         ret ;nc
  1216.  
  1217. getmaxlinesize
  1218. ;ahl = addr
  1219. ;out: bc=max line size before eof, z=(bc==0) (keeps ahl)
  1220.          ;push de
  1221.         push af
  1222.         push hl
  1223.         ex de,hl
  1224.         ld c,a
  1225.         call getsize
  1226.         or a
  1227.         sbc hl,de
  1228.         sbc a,c
  1229.         ld bc,0
  1230.         jr c,getmaxlinesize_aftereof
  1231.         dec bc
  1232.         or a
  1233.         jr nz,$+4 ;filesize-addr >= 0x10000, will be 0xffff
  1234.          ld b,h
  1235.          ld c,l ;filesize-addr
  1236. getmaxlinesize_aftereof
  1237.         pop hl
  1238.         pop af
  1239.         ld e,a
  1240.         ld a,b
  1241.         or c
  1242.         ld a,e
  1243.          ;pop de
  1244.         ret
  1245.  
  1246. texted_prline_nextline
  1247.         push af
  1248.         push hl
  1249.         call texted_prline
  1250.         pop hl
  1251.         pop af
  1252. texted_nextline
  1253. ;if eof, returns CY and old addr (use call c,getsize) [eof addr]
  1254. ;ahl=addr
  1255. ;line < 16K
  1256. ;out: ahl, CY=error
  1257.         call iswrapon ;CY=on
  1258.         jp c,texted_pseudoprline
  1259. texted_nextline_nowrap ;для вычисления длины строки
  1260.         call getmaxlinesize ;bc=max line size before eof, z=(bc==0)
  1261.          scf
  1262.         ret z
  1263.         push af
  1264.         push hl
  1265.         call ahl_to_pgaddr
  1266. ;bc=number of chars to go != 0
  1267. texted_nextline0
  1268.         ld a,(hl)
  1269.         inc hl
  1270.         dec bc
  1271.         cp 0x0d
  1272.         jr z,texted_nextline_cr
  1273.         cp 0x0a
  1274.         jr z,texted_nextline_lf
  1275.         ld a,b
  1276.         or c
  1277.         jr nz,texted_nextline0
  1278. ;texted_nextline_eof
  1279.         pop hl ;old addr
  1280.         pop af
  1281.         scf ;error
  1282.         ret
  1283. texted_nextlineq
  1284.         ex de,hl ;new addr (bits 13..0), bit 14 = overflow
  1285.         pop hl ;old addr
  1286.         pop af
  1287.         jp pgaddr_to_ahl
  1288. texted_nextline_cr
  1289.         ld a,b
  1290.         or c
  1291.         jr z,texted_nextlineq
  1292.         ld a,(hl)
  1293.         cp 0x0a
  1294.         jr nz,texted_nextline_lf
  1295.         inc hl
  1296. texted_nextline_lf
  1297.         jr texted_nextlineq
  1298.        
  1299. texted_prline
  1300. ;ahl=addr
  1301. ;check for last line (vs. file size)
  1302. ;if filesize-addr < 80, then b=filesize-addr, else b=80
  1303.         call getmaxlinesize ;bc=max line size before eof, z=(bc==0)
  1304.         jr z,texted_prlinespc_all;ret z
  1305.         call ahl_to_pgaddr
  1306. ;hl=#8000+0..#3fff
  1307. ;bc=max line size before eof != 0
  1308. texted_prline_shift=$+1
  1309.         ld de,0
  1310.         call istherecr_or_lf ;add hl,de
  1311.         ;jr nz,$+3
  1312.         ;dec hl ;hl=cr/lf address
  1313.  
  1314.         push hl
  1315.         ld h,b
  1316.         ld l,c
  1317.         or a
  1318.         sbc hl,de
  1319.         ld b,h
  1320.         ld c,l ;bc=bc-lineshift
  1321.         pop hl
  1322.         ;ld a,texted_WID
  1323.         jr c,texted_prlinespc_all
  1324.         jr z,texted_prlinespc_all ;maxlinesize<=lineshift
  1325.  
  1326.         push hl
  1327.         ld hl,texted_WID
  1328.         call minhl_bc_tobc
  1329.         ld b,c
  1330.         pop hl
  1331. ;b=number of chars to print != 0
  1332.         ld de,prlinebuf
  1333.         ld c,texted_WID
  1334. texted_prline0
  1335.         ld a,(hl)
  1336.         inc hl
  1337.         cp 0x0d
  1338.         jr z,texted_prline_cr
  1339.         cp 0x0a
  1340.         jr z,texted_prline_cr;lf
  1341.         ;push bc
  1342.         push hl
  1343.         ld h,twinto866/256
  1344.         ld l,a
  1345. texted_prline_recodepatch=$
  1346.         nop ;/ld a,(hl)
  1347.         ld (de),a ;PRCHAR_
  1348.         inc de
  1349.         pop hl
  1350.         ;pop bc
  1351.         dec c
  1352.         djnz texted_prline0
  1353.         ;call print_prlinebuf
  1354.         ;jr nz,texted_prline_lf
  1355.         ;ret
  1356. texted_prline_cr
  1357.         call print_prlinebuf
  1358. ;texted_prline_lf
  1359. ;допечатать пробелы до конца строки
  1360.         jr texted_prlinespc
  1361. texted_prlinespc_all
  1362.         ld c,texted_WID
  1363. texted_prlinespc
  1364.         push af
  1365.         push hl
  1366.         ;ld l,b
  1367.         ;ld h,0
  1368.         ;ld de,tspaces
  1369.         ;call sendchars
  1370.          ld a,c
  1371.          or a
  1372.         call nz,clearrestofline_crlf
  1373.         pop hl
  1374.         pop af
  1375.         ret
  1376.  
  1377. print_prlinebuf
  1378.         push af
  1379.         push bc
  1380.         push hl
  1381. ;c=texted_WID-число символов
  1382.         ld de,prlinebuf
  1383.         ld a,texted_WID
  1384.         sub c
  1385.         ld l,a
  1386.         ld h,0
  1387.         call sendchars
  1388.         pop hl
  1389.         pop bc
  1390.         pop af
  1391.         ret
  1392.  
  1393. prlinebuf
  1394.         ds texted_WID
  1395.  
  1396. texted_pseudoprline
  1397. ;ahl=addr
  1398. ;out: ahl, CY=error
  1399. ;check for last line (vs. file size)
  1400. ;if filesize-addr < 80, then b=filesize-addr, else b=80
  1401.         call getmaxlinesize ;bc=max line size before eof, z=(bc==0)
  1402.          scf
  1403.         ret z
  1404.         push af
  1405.         push hl
  1406.         call ahl_to_pgaddr
  1407. ;hl=#8000+0..#3fff
  1408. ;bc=max line size before eof != 0
  1409.         push hl
  1410.         ld hl,texted_WID
  1411.         call minhl_bc_tobc
  1412.         ld b,c
  1413.         pop hl
  1414. ;b=number of chars to print != 0
  1415.         ld c,texted_WID
  1416. texted_pseudoprline0
  1417.         ld a,(hl)
  1418.         inc hl
  1419.         cp 0x0d
  1420.         jr z,texted_pseudoprline_cr
  1421.         cp 0x0a
  1422.         jr z,texted_pseudoprline_lf
  1423.         dec c
  1424.         djnz texted_pseudoprline0
  1425.          ld a,(hl)
  1426.          inc hl
  1427.          cp 0x0d
  1428.          jr z,texted_pseudoprline_crok
  1429.          cp 0x0a
  1430.          jr z,texted_pseudoprline_lf
  1431.          dec hl
  1432.         jp texted_nextlineq
  1433. texted_pseudoprline_cr
  1434.         dec b
  1435.         jp z,texted_nextlineq
  1436. texted_pseudoprline_crok
  1437.         ld a,(hl)
  1438.         cp 0x0a
  1439.         jr nz,texted_pseudoprline_lf
  1440.         inc hl
  1441. texted_pseudoprline_lf
  1442.         jp texted_nextlineq
  1443.        
  1444. ;по идее это псевдопечать N экранных позиций (там могут быть цветовые коды и т.п.)
  1445. istherecr_or_lf
  1446. ;hl=addr ;TODO ahl
  1447. ;de=length to search
  1448. ;out: z=found, hl=at match or after area (TODO ahl)
  1449.         ld a,d
  1450.         or e
  1451.         jr z,istherecr_or_lf_fail
  1452.          push hl
  1453.         ld a,0x0d
  1454.         call istherecrlfgo
  1455.         jr z,istherecr_or_lf_popafZret;ret z
  1456.          pop hl
  1457.         ld a,0x0a
  1458. istherecrlfgo
  1459.         push bc
  1460.         ld b,d
  1461.         ld c,e
  1462.         cpir ;TODO несколько раз через все блоки, если заканчиваются блоки, то их переключать
  1463.         pop bc
  1464.         ret nz ;nz=not found
  1465.          dec hl
  1466.         ret ;z=found
  1467. istherecr_or_lf_fail
  1468.         dec a
  1469.         ret ;nz=not found
  1470.        
  1471. istherecr_or_lf_popafZret
  1472.         pop af
  1473.         cp a ;Z
  1474.         ret
  1475.        
  1476. ;texted_closefcb
  1477. ;        ld de,fcb
  1478. ;        OS_FCLOSE
  1479. ;        ret
  1480.  
  1481. texted_help
  1482.         call clearterm
  1483.         ld hl,thelp
  1484.         call prtext
  1485.         call yieldgetkeyloop
  1486.         jp setredrawflag
  1487.  
  1488. thelp
  1489.         db "Keys in texted:\r\n"
  1490.         db "\r\n"
  1491.         db "стрелки, PageUp (Caps Shift+3), PageDown (Caps Shift+4) - движение курсора\r\n"
  1492.         db "Home (Symbol Shift+Q) - переход к началу строки\r\n"
  1493.         db "End (Symbol Shift+E) - переход к концу строки\r\n"
  1494.         db "Symbol Shift+PageUp - переход к началу текста\r\n"
  1495.         db "Symbol Shift+PageDown - переход к концу текста\r\n"
  1496.         db "BackSpace (Caps Shift+0) - удаление символа слева от курсора\r\n"
  1497.         db "Del (Caps Shift+9) - удаление символа справа от курсора\r\n"
  1498.         db "Break (Esc, Caps Shift+Space) - выход\r\n"
  1499.         db "Ins (Symbol Shift+W) - wrap on/off\r\n"
  1500.         db "F1 - help\r\n"
  1501.         db "F2 или Caps Shift+Enter - сохранение\r\n"
  1502.         db "F9 - запустить build.bat из директории с текстом\r\n"
  1503.         db "F10 - сменить кодировку (866/1251)"
  1504.         db 0
  1505.  
  1506.  
  1507. setunchanged
  1508.         ld a,' '
  1509.         jr setchanged_a
  1510. setchanged
  1511.         ld a,'*'
  1512. setchanged_a
  1513.         ld (fchanged),a
  1514.         ret
  1515.  
  1516. iswrapon
  1517. ;CY = on
  1518. wrapflag=$
  1519.         or a ;/scf
  1520.         ret
  1521.  
  1522. curlineaddr
  1523.         ds 3
  1524. curlineaddrHSB=$-1
  1525.  
  1526. nlines
  1527.         dw 0
  1528.  
  1529. curxy
  1530. curx
  1531.         db 0
  1532. cury
  1533.         db 0
  1534.        
  1535.         align 256
  1536. twinto866
  1537.         incbin "../_sdk/codepage/winto866"
  1538. t866towin
  1539.         ds 256,' ' ;incbin "../_sdk/codepage/866towin"
  1540.