?login_element?

Subversion Repositories NedoOS

Rev

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

  1. prwindow_edit
  2. ;hl=window DE=texteditaddr c=texteditsize
  3. ;out: CY=OK, de=filename
  4.         push de
  5.         push bc
  6.         call prwindow_text ;de=YX of last line
  7.         pop bc
  8.         pop hl
  9.         push hl
  10.         ld a,c ;a=maxsz
  11.         call editline
  12.         pop de ;de=filename
  13.         cp key_esc
  14.         ret z ;cancel
  15.         scf
  16.         ret
  17.  
  18. prwindow_waitkey
  19. ;hl=window
  20. ;out: CY=OK
  21. ;        ld (prwindow_waitkey_addr),hl; commented by demige 190511
  22.         call prwindow_text; insert by demige 190511
  23. ; comment by demige 190511: for why reprinting window after each keypress? On second print getmarkedfiles returns wrong value.
  24. prwindow_waitkey0
  25. ;prwindow_waitkey_addr=$+1 ; comment by demige 190511
  26. ;        ld hl,0 ; comment by demige 190511
  27. ;        call prwindow_text ; comment by demige 190511
  28.        if PRSTDIO
  29.         call yieldgetkeyloop
  30.        else
  31.         YIELDGETKEYLOOP
  32.        endif
  33.         ld a,c
  34.         cp key_esc
  35.         ret z
  36.         cp 'n'
  37.         ret z
  38.         ;cp 'N'
  39.         ;ret z
  40.         cp key_redraw
  41.         ret z
  42.         cp 'y'
  43.         jr z, prwindow_waitkey_keyyes
  44.         ;cp 'Y'
  45.         ;jr z, prwindow_waitkey_keyyes
  46.         cp key_enter
  47.         jr nz,prwindow_waitkey0
  48. prwindow_waitkey_keyyes
  49.         scf
  50.         ret
  51.  
  52. upwindow_text
  53.         ld a,0
  54.         jr prwindow_text0
  55.  
  56. prwindow_text
  57.         ld a,1
  58. prwindow_text0
  59. ;hl = window text
  60. ;out: ;de=YX of last line
  61.         ld e,(hl) ;x
  62.         inc hl
  63.         ld d,(hl) ;y
  64.         inc hl
  65.         ld c,(hl) ;wid
  66.         inc hl
  67.         ld b,(hl) ;hgt
  68.         inc hl
  69.  
  70.         push hl ;text
  71.  
  72.         push de
  73.         or a
  74.         call nz,prwin
  75.         pop de
  76.         inc d
  77.         inc e
  78.         inc e
  79.         call nv_setxy ;keeps de,hl,ix
  80.        
  81.         pop hl ;text
  82. prwindow_waitkey_text0
  83.         ld a,(hl)
  84.         or a
  85.         ret z
  86.         dec a;cp 1
  87.         jr z,prwindow_waitkey_textnfiles
  88.         dec a;cp 2
  89.         jr z,prwindow_waitkey_textoutertext
  90.         dec a;cp 3
  91.         jr z,prwindow_waitkey_textnextline
  92.         push de
  93.          ld c,0
  94.         call prtext
  95.         pop de
  96.         jr prwindow_waitkey_text0
  97. prwindow_waitkey_textnfiles
  98.         inc hl
  99.         push de
  100.         push hl
  101.         call getmarkedfiles;countmarkedfiles
  102.         call prdword
  103.         pop hl
  104.         pop de
  105.         jr prwindow_waitkey_text0
  106. prwindow_waitkey_textoutertext
  107.         inc hl
  108.         push de
  109.         ld e,(hl)
  110.         inc hl
  111.         ld d,(hl)
  112.         inc hl
  113.         push hl
  114.         ex de,hl
  115.          ld c,0
  116.         call prtext
  117.         pop hl
  118.         pop de
  119.         jr prwindow_waitkey_text0
  120. prwindow_waitkey_textnextline
  121.         inc hl
  122.         inc d
  123.         call nv_setxy ;keeps de,hl,ix
  124.         jr prwindow_waitkey_text0
  125.  
  126. getmarkedfiles
  127. ;ix = panel
  128. ;out: hl'hl = files
  129.         ld hl,0
  130.         exx
  131.         ld l,(ix+PANEL.markedfiles)
  132.         ld h,(ix+PANEL.markedfiles+1)
  133.         ret
  134.  
  135. changemark_hl
  136.         push hl
  137.         ld a,(hl)
  138.         xor 1
  139.         ld (hl),a
  140.         ld bc,FCB_FSIZE
  141.         add hl,bc
  142.         ld e,(hl)
  143.         inc hl
  144.         ld d,(hl)
  145.         inc hl
  146.         ld c,(hl)
  147.         inc hl
  148.         ld b,(hl)
  149. ;bcde = file size
  150.         ld l,(ix+PANEL.markedfiles)
  151.         ld h,(ix+PANEL.markedfiles+1)
  152.         inc hl
  153.         jr nz,changemark_hlq ;set mark
  154. ;remove mark
  155.         dec hl
  156.         dec hl
  157.         xor a
  158.         sub e
  159.         ld e,a
  160.         ld a,0
  161.         sbc a,d
  162.         ld d,a
  163.         ld a,0
  164.         sbc a,c
  165.         ld c,a
  166.         sbc a,b
  167.         sub c
  168.         ld b,a ;bcde= -bcde
  169. changemark_hlq
  170.         ld a,(ix+PANEL.markedsize)
  171.         add a,e
  172.         ld (ix+PANEL.markedsize),a
  173.         ld a,(ix+PANEL.markedsize+1)
  174.         adc a,d
  175.         ld (ix+PANEL.markedsize+1),a
  176.         ld a,(ix+PANEL.markedsize+2)
  177.         adc a,c
  178.         ld (ix+PANEL.markedsize+2),a
  179.         ld a,(ix+PANEL.markedsize+3)
  180.         adc a,b
  181.         ld (ix+PANEL.markedsize+3),a
  182.         ld (ix+PANEL.markedfiles),l
  183.         ld (ix+PANEL.markedfiles+1),h
  184.         pop hl
  185.         ret
  186.  
  187. getmarkedfilessize
  188. ;ix = panel
  189. ;out: hl'hl = files
  190.         ld l,(ix+PANEL.markedsize+2)
  191.         ld h,(ix+PANEL.markedsize+3)
  192.         exx
  193.         ld l,(ix+PANEL.markedsize)
  194.         ld h,(ix+PANEL.markedsize+1)
  195.         ret
  196.        
  197. getfiles
  198. ;ix = panel
  199. ;out: hl'hl=files (without ".", "..")
  200.         ld hl,0
  201.         exx
  202.         ld l,(ix+PANEL.filesdirs)
  203.         ld h,(ix+PANEL.filesdirs+1)
  204.         ret
  205.  
  206. countfiles
  207.         ld hl,proc_count
  208.         jp processfiles ;hl'hl=files (without ".", "..")
  209. proc_count
  210.         inc iy
  211.         ret
  212.  
  213. getfilessize
  214. ;ix = panel
  215.         ;exx
  216.         ld l,(ix+PANEL.totalsize+2)
  217.         ld h,(ix+PANEL.totalsize+3)
  218.         exx
  219.         ld l,(ix+PANEL.totalsize)
  220.         ld h,(ix+PANEL.totalsize+1)
  221.         ret ;hl'hl=size
  222.  
  223. processfiles
  224. ;ix = panel address (kept)
  225. ;hl = procedure address (uses hl=fcb, hl'iy = accumulator)
  226. ;out: hl'hl = result
  227.         ld (processfiles_proc),hl
  228.  
  229.         call nv_getpanelfiles_bc
  230.  
  231.         ld l,(ix+PANEL.pointers)
  232.         ld h,(ix+PANEL.pointers+1)
  233.         exx
  234.         ld hl,0
  235.         exx
  236.         ld iy,0
  237. processfiles0
  238.         ld a,b
  239.         or c
  240.         jr z,processfilesq
  241.         push bc
  242.         call getfilepointer_de_fromhl
  243.         push hl
  244.         push ix
  245.         ex de,hl
  246.         call isthisdotdir_hl
  247.         display "processfiles_proc ",$
  248. processfiles_proc=$+1
  249.         call nz,0 ;copy может переключать страницу (сейчас не переключает)
  250.         pop ix
  251.         pop hl
  252.         pop bc
  253.         dec bc
  254.         jp processfiles0
  255. processfilesq
  256.         push iy
  257.        push ix
  258.         call nv_batch ;исполнить всё, что запомнили в nv_batch_pushrecord?
  259.        pop ix
  260.         pop hl
  261.         ret
  262.  
  263. gotofilepointer_numberde
  264.         ld l,(ix+PANEL.pointers)
  265.         ld h,(ix+PANEL.pointers+1)
  266.         add hl,de
  267.         add hl,de
  268.         ret
  269.  
  270. getfilepointer_de_fromhl
  271. ;out: hl=next pointer
  272.         ld a,(ix+PANEL.poipg)
  273.         SETPG32KHIGH
  274.         ld a,(hl)
  275.         and 0xe0
  276.         ld e,a
  277.         xor (hl)
  278.         inc hl
  279.         ld d,(hl)
  280.         inc hl
  281.         ;ld a,e
  282.         ;and 31
  283.         add a,(ix+PANEL.pgadd)
  284.         PGW3strpg
  285.         ;push af
  286.         ;ld a,e
  287.         ;and 0xe0
  288.         ;ld e,a
  289.         ;pop af
  290.         ret
  291.  
  292. putfilepointer_de_tohl
  293. ;out: hl=next pointer
  294.         ld a,(ix+PANEL.poipg)
  295.         SETPG32KHIGH
  296.         ld (hl),e
  297.         inc hl
  298.         ld (hl),d
  299.         inc hl
  300.         ret
  301.  
  302. swapfilepointers_hl_de
  303. ;out: hl=next pointer
  304.         ld a,(ix+PANEL.poipg)
  305.         SETPG32KHIGH
  306.         ld a,(de)
  307.         ldi
  308.         dec hl
  309.         ld (hl),a
  310.         inc hl
  311.         ld a,(de)
  312.         ldi
  313.         dec hl
  314.         ld (hl),a
  315.         inc hl
  316.         ret
  317.  
  318. isthisdotdir_hl
  319. ;out: z="." or ".."
  320.         inc hl
  321.         ld a,(hl)
  322.         cp '.'
  323.         dec hl
  324.         ret
  325.  
  326. drawpanelfilesandsize
  327. ;ix=panel
  328.         call nv_getpanelxy_de
  329.         ld a,d
  330.         add a,CONST_HGT_TABLE+1
  331.         ld d,a
  332.         inc e
  333.         inc e
  334.         call nv_setxy ;keeps de,hl,ix
  335.         ld de,_PANELDIRCOLOR;_PANELFILECOLOR
  336.         call nv_setcolor
  337.         call getmarkedfiles
  338.         ld a,h
  339.         or l
  340.         push af ;z = no marked
  341.         call z,getfiles
  342.         pop af
  343.         push af
  344.         ld de,_PANELSELECTCOLOR
  345.         call nz,nv_setcolor
  346.         ;push ix
  347.         ld de,wordfiles
  348.         call prdword_de_withspaces
  349.         ;ld hl,wordfiles
  350.         ; ld c,0
  351.         ;call prtext
  352.         ;pop ix
  353.         pop af ;z = no marked
  354.         jr nz,drawpanelfilesandsize_markedsize
  355.         call getfilessize
  356.         jr drawpanelfilesandsize_markedsizeq
  357. drawpanelfilesandsize_markedsize
  358.         call getmarkedfilessize
  359. drawpanelfilesandsize_markedsizeq
  360.         ld de,wordbytes
  361.         call prdword_de_withspaces
  362.         push ix
  363.         ld hl,wordfiles;bytes
  364.          ld c,0
  365.         call prtext
  366.         pop ix
  367.         ret
  368.  
  369. nv_setxy
  370. ;de=yx (kept)
  371. ;keeps de,hl,ix
  372.         push de
  373.         push hl
  374.         push ix
  375.         MYSETXY
  376.         pop ix
  377.         pop hl
  378.         pop de
  379.         ret
  380.  
  381. setpanelcolor
  382.         ld de,_PANELCOLOR
  383. nv_setcolor
  384. ;d=paper, e=ink
  385.         push hl
  386.         push ix
  387.        if PRSTDIO
  388.         SETCOLOR_
  389.        else
  390.         ;ld a,d
  391.         ;add a,a
  392.         ;add a,a
  393.         ;add a,a
  394.         ;add a,e
  395.         ;ld e,a
  396.         OS_SETCOLOR
  397.        endif
  398.         pop ix
  399.         pop hl
  400.         ret
  401.  
  402. getfcbaddrundercursor
  403.         call nv_getdirpos_hl
  404. getfcbaddrunderhl
  405.         ld ix,(curpanel)
  406.         ;ld a,(ix+PANEL.pg)
  407.         ;SETPG32KHIGH
  408.         ex de,hl
  409.         call gotofilepointer_numberde ;hl=file pointer
  410.         ;ld a,(hl)
  411.         ;inc hl
  412.         ;ld h,(hl)
  413.         ;ld l,a ;hl=FCB
  414.         call getfilepointer_de_fromhl
  415.         ex de,hl ;hl=FCB
  416.         ret
  417.  
  418. getfcbundercursor
  419.         call getfcbaddrundercursor
  420. getfcbfromhl
  421.         ld de,fcb
  422.         ld bc,FCB_sz
  423.         ldir
  424.         ret
  425.  
  426. panelprtext
  427. ;print max 37 chars (dir)
  428. ;hl = text
  429. ;keeps ix
  430.         push ix
  431. panelprtext0
  432.         ld a,(hl)
  433.         or a
  434.         jr z,panelprtextq
  435.         push bc
  436.         push hl
  437.         MYPRCHAR
  438.         pop hl
  439.         pop bc
  440.         inc c
  441.         inc hl
  442.         ld a,c
  443.         cp PANELDIRCHARS37
  444.         jp nz,panelprtext0
  445. panelprtextq
  446.         pop ix
  447.         ret
  448.  
  449. changedir_fromfcb
  450.         call setcurpaneldir
  451.         ld hl,fcb_filename
  452.         ld de,filenametext
  453.         push de
  454.         call cpmname_to_dotname
  455.         pop de
  456.         OS_CHDIR
  457.         ret
  458.  
  459.         if 1==0
  460. readfile_pages_dehl
  461.         ld a,d
  462.         SETPG32KHIGH
  463.         ld a,+(0xc000+PROGSTART)/256
  464.         call cmd_loadpage
  465.         or a
  466.         ret nz
  467.        
  468.         ld a,e
  469.         SETPG32KHIGH
  470.         ld a,0xc000/256
  471.         call cmd_loadpage
  472.         or a
  473.         ret nz
  474.        
  475.         ld a,h
  476.         SETPG32KHIGH
  477.         ld a,0xc000/256
  478.         call cmd_loadpage
  479.         or a
  480.         ret nz
  481.        
  482.         ld a,l
  483.         SETPG32KHIGH
  484.         ld a,0xc000/256
  485.         jp cmd_loadpage
  486.         endif
  487.  
  488. readfile_pages_dehl
  489.         ld a,d
  490.         SETPG32KHIGH
  491.         ld a,0xc100/256
  492.         call cmd_loadpage
  493.         ret nz
  494.         ld a,e
  495.         call cmd_loadfullpage
  496.         ret nz
  497.         ld a,h
  498.         call cmd_loadfullpage
  499.         ret nz
  500.         ld a,l
  501. cmd_loadfullpage
  502.         SETPG32KHIGH
  503.         ld a,0xc000/256
  504. cmd_loadpage
  505. ;out: a=error, bc=bytes read
  506. ;keeps hl,de
  507.         push de
  508.         push hl
  509.         ld d,a
  510.         xor a
  511.         ld l,a
  512.         ld e,a
  513.         sub d
  514.         ld h,a ;de=buffer, hl=size
  515.         call readcurhandle
  516.         ld b,h
  517.         ld c,l
  518.         pop hl
  519.         pop de
  520.         or a
  521.         ret
  522.  
  523. readcurhandle
  524. curhandle=$+1
  525.         ld b,0
  526.         OS_READHANDLE
  527.         ret
  528.  
  529. cmd_savepage
  530. ;hl=size
  531. ;out: a=error
  532.         ;push hl
  533.         ld de,0x8000
  534.         ;OS_SETDTA
  535.         ;pop hl
  536.         ;ld de,fcb2
  537.         ;OS_FWRITE_NBYTES
  538.         ld a,(curhandle)
  539.         ld b,a
  540.         OS_WRITEHANDLE
  541.         ret
  542.  
  543. setdrawtablesneeded
  544.         ld ix,leftpanel
  545.         res 0,(ix+PANEL.drawtableunneeded)
  546.         ld ix,rightpanel
  547.         res 0,(ix+PANEL.drawtableunneeded)
  548.         ret
  549.  
  550. prwin
  551. ;de=yx
  552. ;bc=hgt,wid
  553.         call setdrawtablesneeded
  554.         ld a,c
  555.         sub 2
  556.         ld (winbeginstroka_wid),a
  557.         ld (winmidstroka_wid),a
  558.         ld (winendstroka_wid),a
  559.         ld hl,winbeginstroka
  560.         call prtableline
  561.         dec b
  562.         dec b
  563. winlineN_0
  564.         inc d
  565.         ld hl,winmidstroka
  566.         call prtableline
  567.         djnz winlineN_0
  568.         inc d
  569.         ld hl,winendstroka
  570.         jr prtableline
  571.  
  572. prtable
  573. ;de=yx
  574.         ld hl,prbeginstroka
  575.         call prtableline
  576.         push ix
  577.         ld b,CONST_HGT_TABLE
  578. prtable0
  579.         inc d
  580.         ;ld hl,prmidstroka
  581.         ;call prtableline
  582.         push bc
  583.         push de
  584.         call nv_setxy ;keeps de,hl,ix
  585.         ld de,tmidstroka
  586.         ld hl,tmidstroka_sz
  587.         call sendchars
  588.         pop de
  589.         pop bc
  590.         djnz prtable0
  591.         pop ix
  592.         inc d
  593.         ld hl,prendstroka
  594. prtableline
  595. ;hl=tableline data
  596. ;de=yx
  597. ;b=hgt
  598. ;keeps bc,de,ix
  599.         push bc
  600.         call nv_setxy ;keeps de,hl
  601. prtableline0
  602.         ld a,(hl)
  603.         or a
  604.         jr z,prtablelineq
  605.         inc hl
  606.         ld b,(hl)
  607.         inc hl
  608.         call prNsymbol
  609.         jr prtableline0
  610. prtablelineq
  611.         pop bc
  612.         ret
  613.  
  614. prNsymbol
  615. ;a=symbol
  616. ;b=count
  617.         push de
  618.         push hl
  619.         push ix
  620.         ld c,a
  621. prNsymbol0
  622.         push bc
  623.         ld a,c
  624.         MYPRCHAR
  625.         pop bc
  626.         djnz prNsymbol0
  627.         pop ix
  628.         pop hl
  629.         pop de
  630.         ret
  631.  
  632. ;;;;;;;;;;;;;;;;;;
  633.  
  634. cmdprchar
  635.         push hl
  636.         push ix
  637.         MYPRCHAR
  638.         pop ix
  639.         pop hl
  640.         ret
  641.  
  642. nv_getpanelxy_de
  643.         ld e,(ix+PANEL.xy)
  644.         ld d,(ix+PANEL.xy+1)
  645.         ret
  646.  
  647. nv_getdirscroll_bc
  648.         ld c,(ix+PANEL.dirscroll)
  649.         ld b,(ix+PANEL.dirscroll+1)
  650.         ret
  651. nv_setdirscroll_bc
  652.         ld (ix+PANEL.dirscroll),c
  653.         ld (ix+PANEL.dirscroll+1),b
  654.         ret
  655.  
  656. nv_getpanelfiles_bc
  657.         ld c,(ix+PANEL.files)
  658.         ld b,(ix+PANEL.files+1)
  659.         ret
  660. nv_getdirpos_hl
  661.         ld l,(ix+PANEL.dirpos)
  662.         ld h,(ix+PANEL.dirpos+1)
  663.         ret
  664.  
  665. cpfiles_setdirpos
  666. ;hl=suggested dirpos (might be >= files)
  667. ;out: hl=dirpos
  668.         call nv_getpanelfiles_bc
  669.         dec bc
  670.         call minhl_bc_tobc
  671.         ld h,b
  672.         ld l,c
  673. nv_setdirpos_hl
  674.         ld (ix+PANEL.dirpos),l
  675.         ld (ix+PANEL.dirpos+1),h
  676.         ret
  677. nv_setdirpos_zero
  678.         ld hl,0
  679.         jr nv_setdirpos_hl
  680.  
  681. count_filecursor_y
  682. ;out: a=y, de=PANEL.xy
  683.         call nv_getpanelxy_de
  684.         ld a,(ix+PANEL.dirpos)
  685.         sub (ix+PANEL.dirscroll)
  686.         add a,d;(ix+PANEL.xy+1) ;y
  687.         ret
  688.  
  689. setfilecursorxy
  690.         ;push af
  691.         ld ix,(curpanel)
  692.         call count_filecursor_y
  693.         ld d,a
  694.         ;ld e,(ix+PANEL.xy)
  695.         inc d
  696.         inc e
  697.         ;pop af
  698.         ;push af
  699.         call nv_setxy
  700.         ;pop af ;color
  701.         ret
  702.  
  703. prfilecursor_reprintfile
  704. ;hl=color
  705.         push hl
  706.         ;ex de,hl
  707.         ;SETCOLOR_
  708.         call setfilecursorxy
  709.         ld ix,(curpanel)
  710.         ;call getfcbaddrundercursor
  711.         ;jp prdirfile
  712.         call getfcbundercursor
  713.         ld ix,fcb
  714.         pop de
  715.         jp prdirfile_ix_decolor
  716.         ;push hl
  717.         ;pop ix
  718.         ;call prdirfile_copyfilename
  719.         ;;ld ix,(curpanel)
  720.         ;ld de,filelinebuf
  721.         ;ld hl,8+1+3
  722.         ;jp sendchars
  723.  
  724. prfilecursor
  725. ;hl=color
  726.         push hl
  727.         call setfilecursorxy
  728.         pop hl
  729.         ld b,12
  730.         call drawfilecursor_sizeb_colorhl ;hl=old color
  731.         ld ix,(curpanel)
  732.         ret
  733.  
  734. editcmd_readprompt_setendcmdx
  735.         ld ix,(curpanel)
  736.         call setpaneldir_makeprompt ;->prompt
  737.         ld hl,cmdbuf
  738.         call strlen
  739.         ld a,l
  740.         ld (curcmdx),a
  741.         ret
  742.  
  743. getanotherpanel_hl
  744. getanotherpanel_ix
  745. curpanel=$+1
  746.         ld bc,leftpanel
  747.         ld hl,0xffff&(leftpanel+rightpanel)
  748.         or a
  749.         sbc hl,bc
  750.         push hl
  751.         pop ix
  752.         ret
  753.  
  754. setanotherpaneldir
  755.         call getanotherpanel_ix
  756.         jr setpaneldir
  757.  
  758. setcurpaneldir
  759.         ld ix,(curpanel)
  760. setpaneldir
  761. ;ix=panel
  762.         push ix
  763.         pop hl
  764.         ld de,PANEL.dir
  765.         add hl,de
  766.         ex de,hl ;de=path
  767.         OS_CHDIR
  768.         ret
  769.  
  770. getcurpaneldir_hl
  771.         ld hl,(curpanel)
  772.         ld de,PANEL.dir
  773.         add hl,de
  774.         ret
  775.  
  776. drawfilecursor_sizeb_colorhl
  777. ;de=yx
  778. ;hl=color
  779. ;b=size
  780.        if PRSTDIO
  781.         push bc
  782.         push hl
  783.         call nv_setxy
  784.         pop de
  785.         SETCOLOR_
  786.         call setcolor_invisible
  787.         pop bc
  788.         ld de,tspaces
  789.         ld h,0
  790.         ld l,b
  791.         call sendchars
  792.         jp setcolor_visible
  793.        else
  794.         ;ld a,d
  795.         ;add a,a
  796.         ;add a,a
  797.         ;add a,a
  798.         ;add a,e
  799.         ;ld e,a
  800.         ;OS_SETCOLOR
  801. drawfilecursor_sizeb0
  802.         push bc
  803.         push de
  804.         push hl ;color
  805.         MYSETXY
  806.         pop de ;color
  807.         push de ;color
  808.         OS_PRATTR
  809.         pop hl ;color
  810.         pop de
  811.         pop bc
  812.         inc e ;x
  813.         djnz drawfilecursor_sizeb0
  814.         ret
  815.        endif
  816.  
  817.         if 1==0
  818. nv_openfcb
  819. ;if success, autopush nv_closefcb
  820. ;out: nz=error
  821.         push ix
  822.         ld de,fcb
  823.         OS_FOPEN
  824.         pop ix
  825.         or a
  826.         ret nz ;error
  827.         ld hl,nv_closefcb
  828.         ex (sp),hl
  829.         jp (hl)
  830.  
  831. nv_createfcb2
  832. ;if success, autopush nv_closefcb2
  833. ;out: nz=error
  834.         ld de,fcb2
  835.         push ix
  836.         OS_FCREATE
  837.         pop ix
  838.         or a
  839.         ret nz ;error
  840.         ld hl,nv_closefcb2
  841.         ex (sp),hl
  842.         jp (hl)
  843.  
  844. nv_closefcb2
  845. ;keep de and flags!!!
  846.         push de
  847.         ld de,fcb2
  848.         jr nv_closefcb_de_
  849. nv_closefcb
  850. ;keep de and flags!!!
  851.         push de
  852.         ld de,fcb
  853. nv_closefcb_de_
  854. ;out: keep flags!!!
  855.         push af
  856.         push ix
  857.         OS_FCLOSE
  858.         pop ix
  859.         pop af
  860.         pop de
  861.         ;or a
  862.         ret
  863.         endif
  864.  
  865. copy_to_fcb_filename
  866.         ld de,fcb_filename
  867. ;copy_to_defcb_filename
  868.         ld bc,11
  869.         ldir
  870.         ret
  871.  
  872. nv_closehandle
  873. ;keep de and flags!!!
  874.         push af
  875.         push de
  876.         ld a,(curhandle)
  877.         ld b,a
  878.         OS_CLOSEHANDLE
  879.         pop de
  880.         pop af
  881.         ret
  882.  
  883. tdoublehoriz
  884.         ds PANELDIRCHARS37,0xcd
  885.  
  886. winbeginstroka
  887.         db 0xc9;'г'
  888.         db 1
  889.         db 0xcd;'='
  890. winbeginstroka_wid=$
  891.         db 12;wdtcolumn1
  892.         db 0xbb;'┐'
  893.         db 1
  894.         db 0
  895.        
  896. winmidstroka
  897.         db 0xba;'│'
  898.         db 1
  899.         db ' '
  900. winmidstroka_wid=$
  901.         db 12;wdtcolumn1
  902.         db 0xba;'│'
  903.         db 1
  904.         db 0
  905.  
  906. winendstroka
  907.         db 0xc8;'L'
  908.         db 1
  909.         db 0xcd;'='
  910. winendstroka_wid=$
  911.         db 12;wdtcolumn1
  912.         db 0xbc;'-'
  913.         db 1
  914.         db 0
  915.  
  916. prbeginstroka
  917.         db 0xc9;'г'
  918.         db 1
  919.         db 0xcd;'='
  920.         db 14;wdtcolumn1
  921.         db 0xcd;0xd1;'T'
  922.         db 1
  923.         db 0xcd;'='
  924.         db 10;wdtcolumn2
  925.         db 0xd1;'T'
  926.         db 1
  927.         db 0xcd;'='
  928.         db 12;wdtcolumn3
  929.         db 0xbb;'┐'
  930.         db 1
  931.         db 0
  932.  
  933. tmidstroka
  934.         db 0xba;'│'
  935.        if PRSTDIO
  936.         db 0x1b,"[25C"
  937.         db 0xb3;'│'
  938.         db 0x1b,"[12C"
  939.        else
  940.         ds 25,' '
  941.         db 0xb3;'│'
  942.         ds 12,' '
  943.        endif
  944.         db 0xba;'│'
  945. tmidstroka_sz=$-tmidstroka
  946.         if 1==0
  947. prmidstroka
  948.         db 0xba;'│'
  949.         db 1
  950.         db ' '
  951.         db 14;wdtcolumn1
  952.         db ' ';0xb3;'│'
  953.         db 1
  954.         db ' '
  955.         db 10;wdtcolumn2
  956.         db 0xb3;'│'
  957.         db 1
  958.         db ' '
  959.         db 12;wdtcolumn3
  960.         db 0xba;'│'
  961.         db 1
  962.         db 0
  963.         endif
  964.  
  965. prendstroka
  966.         db 0xc8;'L'
  967.         db 1
  968.         db 0xcd;;'='
  969.         db 14;wdtcolumn1
  970.         db 0xcd;0xcf;'│'
  971.         db 1
  972.         db 0xcd;'='
  973.         db 10;wdtcolumn2
  974.         db 0xcf;'│'
  975.         db 1
  976.         db 0xcd;'='
  977.         db 12;wdtcolumn3
  978.         db 0xbc;'-'
  979.         db 1
  980.         db 0
  981.        
  982. prcrlf
  983.         ld de,tcrlf
  984.         ld hl,2
  985.         jp sendchars
  986. tcrlf
  987.         db 0x0d,0x0a
  988.  
  989.         if PRSTDIO==0
  990. nv_copyscreen0to1
  991.         OS_GETMAINPAGES
  992.         push hl
  993.         ;OS_GETSCREENPAGES
  994.         ld a,(user_scr1_low) ;ok
  995.         ld l,a
  996.         ld a,(user_scr1_high) ;ok
  997.         ld h,a
  998.         ld a,(user_scr0_low) ;ok
  999.         ld e,a
  1000.         ld a,(user_scr0_high) ;ok
  1001.         ld d,a
  1002.         push hl ;1 screen
  1003.         push de ;0 screen
  1004.         ld a,l
  1005.         SETPG32KHIGH
  1006.         pop de
  1007.         push de
  1008.         ld a,e
  1009.         SETPG32KLOW
  1010.         ld bc,0x4000
  1011.         ld hl,0x8000
  1012.         ld de,0xC000
  1013.         ldir
  1014.         pop de
  1015.         pop hl
  1016.         push de
  1017.         ld a,h
  1018.         SETPG32KHIGH
  1019.         pop de
  1020.         ld a,d
  1021.         SETPG32KLOW
  1022.         ld bc,0x4000
  1023.         ld hl,0x8000
  1024.         ld de,0xC000
  1025.         ldir
  1026.         pop hl
  1027.         push hl
  1028.         ld a,l
  1029.         SETPG32KHIGH
  1030.         pop hl
  1031.         ld a,h
  1032.         SETPG32KLOW
  1033.         ret
  1034.  
  1035. nv_copyscreen1to0
  1036.         OS_GETMAINPAGES
  1037.         push hl
  1038.         ;OS_GETSCREENPAGES
  1039.         ld a,(user_scr1_low) ;ok
  1040.         ld l,a
  1041.         ld a,(user_scr1_high) ;ok
  1042.         ld h,a
  1043.         ld a,(user_scr0_low) ;ok
  1044.         ld e,a
  1045.         ld a,(user_scr0_high) ;ok
  1046.         ld d,a
  1047.         push hl ;1 screen
  1048.         push de ;0 screen
  1049.         ld a,l
  1050.         SETPG32KHIGH
  1051.         pop de
  1052.         push de
  1053.         ld a,e
  1054.         SETPG32KLOW
  1055.         ld bc,0x4000
  1056.         ld hl,0xc000
  1057.         ld de,0x8000
  1058.         ldir
  1059.         pop de
  1060.         pop hl
  1061.         push de
  1062.         ld a,h
  1063.         SETPG32KHIGH
  1064.         pop de
  1065.         ld a,d
  1066.         SETPG32KLOW
  1067.         ld bc,0x4000
  1068.         ld hl,0xc000
  1069.         ld de,0x8000
  1070.         ldir
  1071.         pop hl
  1072.         push hl
  1073.         ld a,l
  1074.         SETPG32KHIGH
  1075.         pop hl
  1076.         ld a,h
  1077.         SETPG32KLOW
  1078.         ret
  1079.        
  1080. ;sendchar
  1081. ;        PRCHAR
  1082. ;        ret
  1083.        
  1084. sendchars
  1085. ;de=buf, hl=size, c=x
  1086. ;out: A=error, c=x
  1087. sendchars0
  1088.         push bc
  1089.         push de
  1090.         push hl
  1091.         ld a,(de)
  1092.         PRCHAR
  1093.         pop hl
  1094.         pop de
  1095.         pop bc
  1096.         inc de
  1097.         inc c ;x
  1098.         dec l
  1099.         jr nz,sendchars0
  1100.         xor a ;no error
  1101.         ret
  1102.        
  1103. clearrestofline_crlf
  1104.         ;call clearrestofline
  1105.         ;ld a,0x0d
  1106.         ;PRCHAR
  1107.         ;ld a,0x0a
  1108.         ;PRCHAR
  1109.         ;ret
  1110. clearrestofline
  1111. ;c=x
  1112. clearrestofline0
  1113.         push bc
  1114.         ld a,' '
  1115.         PRCHAR
  1116.         pop bc
  1117.         inc c
  1118.         ld a,c
  1119.         cp 80
  1120.         jr nz,clearrestofline0
  1121.         ret
  1122.        
  1123.         endif