home *** CD-ROM | disk | FTP | other *** search
- ;===========================================================================
- ;
- ; VFSUBS4.Z80 - General Screen Output Routines
- ;
- ;===========================================================================
-
- ; PRTSPAC - Print spaces - Reg B had number of spaces
-
- prtspac:
- inc b ; Test for B = 0
- dec b
- ret z
- push af ; Save AF just in case
- ld a,' '
- prtspac1:
- call cout
- djnz prtspac1
- pop af
- ret
-
- ;---------------------------------------------------------------------------
-
- ; Video Routines
-
- ; VCLS - Clear Screen
-
- vcls:
- call cls ; Try to clear the screen
- ret nz ; Ok if done
- push hl ; Save regs
- push bc
- call getcrt ; Get crt data
- inc hl ; Get number of lines on screen
- ld b,(hl) ; B=number of lines
- vcls1:
- call crlf ; New line
- djnz vcls1
- pop bc ; Restore regs
- pop hl
- ret
-
-
- ; VEREOL - Erase To End-of-Line
-
- vereol:
- call ereol ; Try to erase to eol
- ret nz ; Ok if done
- push bc ; Save count
- ld a,' ' ; Space out
- call vereol1 ; Send b spaces
- pop bc ; Get count
- ld a,bs ; Backspace in
- vereol1:
- call cout ; Send char
- djnz vereol1 ; Count down
- ret
-
- ;---------------------------------------------------------------------------
-
- ; PRDU - Print DU in HL
-
- prdu:
- push hl ; Save regs
- push bc
-
- if revvideo
- call stndout ; Dim
- endif
-
- ld a,h ; Get drive
- add a,'A' ; Convert to letter
- call cout
- ld a,l ; Get user
- ld b,h ; Get du in bc
- ld c,l
- call pafdc ; Print user as floating
- ld a,':' ; Print colon
- call cout
- call dutdir ; Scan named directory table
- jr z,prdu2 ; No name?
- ld b,8 ; Print name
- prdu1:
- ld a,(hl) ; Get char
- cp ' ' ; Done if space encountered
- jr z,prdu3
- call cout
- inc hl
- djnz prdu1
- jr prdu3
-
- prdu2:
- call vprint
- db 'Noname',0
- prdu3:
- if revvideo
- call stndend ; Bright
- endif
-
- pop bc ; Restore regs
- pop hl
- ret
-
- ;---------------------------------------------------------------------------
-
- ; File Name Printing Routines
-
-
- ; DISPCFN - Display file name of current file
-
- dispcfn:
- call ringempt ; Check ring empty
- ret z ; Don't bother
-
- if fcols eq 5
- ld hl,fnadr ; Position cursor for file name print
- else ; four columns
- ld hl,fnadr-1 ; One position more to left
- endif
-
- call gotoxy
- ld hl,(ringpos) ; Pt to current file name
- inc hl ; Pt to first char
-
- if revvideo
-
- call stndout
- call prfn
- jp stndend
-
- else
-
- jr prfn ; Print file name
-
- endif ; revvideo
-
-
- ; PRFNS - Print File Name Pointed to by HL (saving HL)
-
- prfnsx:
- push hl ; Save hl
- jr prfns0
-
- ; PRFNSX - Print file name in S$FCB (saving HL)
-
- prfns:
- push hl ; Affect only psw
- ld hl,s$fcb+1
-
- prfns0:
- push bc ; Save bc
- call prfnskip ; Print file name with no spaces
- pop bc ; Restore
- pop hl
- ret
-
-
- ; PRFN - Print file name pted to by HL
-
- prfn:
- xor a ; Preset for no char skipping
- jr prfnsk
-
- prfnskip:
- ld a,' ' ; Preset for skipping spaces
-
- prfnsk:
- ld c,a ; Save char to skip in C
- ld b,8 ; 8 chars
- call prfns1
- ld a,'.'
- call cout
- ld b,3 ; File type and fall thru
-
- prfns1:
- ld a,(hl) ; Get char
- and 7fh
- cp c ; Is it char to skip?
- call nz,cout
- inc hl ; Pt to next
- djnz prfns1
- ret
-
- ;---------------------------------------------------------------------------
-
- ; PRINT$FRE - Print free space on disk
-
- print$fre:
- call erclr ; Position and set flags
- ld hl,(disksp)
- call shlfdc ; # of free k-bytes in hl
- call vprint
- db 'K Bytes free on Disk '
- free$drv:
- db 'X:',0
- ret
-
- ;---------------------------------------------------------------------------
-
- ; File Screen Display Routines
-
-
- ; REBUILD - Build Entire Screen
-
- rebuild:
- ld hl,(curat) ; Save cursor and ring positions
- ld (scurat),hl
- ld hl,(ringpos)
- ld (sringpos),hl
- call banner ; Print banner
- call dirmore ; Print current du:dir (and '[more files]' msg).
-
- if bihelp ; Built-in help?
- ld a,(helpdisp) ; Display help?
- or a ; 0=no
- jr z,reb1
- call helpmsg ; Print help message
- jr reb2
- reb1:
- endif ; Bihelp
-
- call cur$first ; Position cursor at first position
- ld hl,(locbeg) ; Pt to first file name
- call dispfiles ; Display files
- call cur$first ; Re-position cursor at first position
- reb2:
- ld hl,cpmadr ; Command prompt message
- call gotoxy
- call vprint ; Prompt with drive prefix
-
- if not revvideo
- db dim
- endif
-
- db 'Command? ('
- db bright
- db '/'
-
- if not revvideo
- db dim
- endif
-
- db '=',0
-
- ld a,(helpdisp) ; In help now?
- or a ; 0=no
- jr z,reb3
- call vprint
- db 'Files,',0
- jr reb4
-
- reb3:
- call vprint
- db 'Help,',0
-
- reb4:
- call vprint
- db bright,' X'
-
- if not revvideo
- db dim
- endif
-
- db '=Quit): ',bright,0
-
- reb5:
- ld hl,(scurat) ; Restore cursor and ring positions
- ld (curat),hl
- ld hl,(sringpos)
- ld (ringpos),hl
- call ringempt ; Ring empty?
- ret z ; No cursor
- jp setcur ; Restore cursor on screen and return
-
- ;------------------------------
-
- ; REFRESH - Refresh Files Portion of Screen
-
- refresh:
- ld hl,(curat) ; Save cursor and ring positions
- ld (scurat),hl
- ld hl,(ringpos)
- ld (sringpos),hl
- ld hl,(ring)
- ld (ringpos),hl ; Beginning of file display
- call dirmore ; Print current du:dir (and '[more files]' msg).
-
- if bihelp ; Built-in help?
- ld a,(helpdisp) ; Display help?
- or a ; 1=yes
- jr nz,ref1
- endif ; Bihelp
-
- call cur$first ; Set cursor top left
- ld hl,(locbeg) ; Beginning of current screen
- call dispfiles ; Display files
- ref1:
- ld hl,(scurat) ; Restore cursor and ring positions
- ld (curat),hl
- ld hl,(sringpos)
- ld (ringpos),hl
- ret
-
- ;------------------------------
-
- ; BANNER - Print VFILER Banner
-
- banner:
- call vcls ; Clear screen
-
- if fcols eq 5
- ld hl,banadr
- else ; four columns
- ld hl,banadr-2 ; Two spaces to left
- endif
-
- call gotoxy
- call vprint ; Print banner
- db 'VFILER ',vers/10+'0','.',vers mod 10+'0'
-
- if subvers eq ' '
-
- db ' '
-
- else
-
- db subvers
- if usestk
- db 's'
- else
- db 'f'
- endif ; usestk
-
- endif ; subvers eq ' '
-
- db ' '
-
- if not revvideo
- db dim
- endif
-
- db 'Current File:',bright,0
- ret
-
- ;------------------------------
-
- ; DIRMORE - Print Current Directory (and Possibly '[More Files]') messages
-
- dirmore:
- if fcols eq 5
- ld hl,duadr ; Du screen address
- else ; four columns
- ld hl,duadr+2 ; Two columns to right
- endif
-
- call gotoxy
- ld hl,(du$req) ; Get current du
- call prdu ; Print du:dir>
-
- call public
- jr z,dirmr0 ; Not public
- call vprint
- db ' [PUBLIC]',0
-
- dirmr0:
- if fcols eq 5
- ld hl,moreadr ; More screen address
- else ; four columns
- ld hl,moreadr-1 ; One column more to left
- endif
-
- call gotoxy
- ld hl,(ringcnt) ; Get # files in ring.
- ld de,eps ; And maximum number that can be displayed.
- call cmpdehl
- jr nc,dirmr1 ; Br if all files will be displayed.
- call vprint
-
- if revvideo
- db '[More Files]',0
- else ; dimvideo
- db dim,'[More Files]',bright,0
- endif
-
- ret
-
- dirmr1:
- call vprint
- db bright,0
- ld b,12 ; Print 12 spaces
- jp prtspac ; And return
-
- ;------------------------------
-
- ; DISPFILES - Refresh File Display
-
- dispfiles:
- ld (locpos),hl ; Save local position
- dspf1:
- ld hl,(locend) ; At end?
- ex de,hl
- ld hl,(locpos)
- call cmpdehl
- ret z ; Return if done.
-
- call vprint
- if fcols eq 4
- db ' ',0 ; 4 spaces
- else
- db ' ',0 ; 2 spaces
- endif
-
- push hl ; Save current local position in ring
- call reffnt ; Print file name, tag.
- pop hl ; Get current local position
- ld de,eltsiz
- add hl,de
- ld (locpos),hl
- call cur$next ; Advance cursor
- jr dspf1
-
- ;---------------------------------------------------------------------------
-
- ; FINDSCR - Find screen containing file at RINGPOS
- ; Set the screen accordingly and position cursor
-
- findscr:
- ld hl,(ring) ; Begin at the beginning
- fndscr1:
- push hl ; Maybe this is it, save it
- ld de,eps*eltsiz ; One screen
- add hl,de ; Next screen
- ld de,(ringpos)
- call cmpdehl
- jr c,fndscr2 ; Found it
- pop de ; Adjust the stack
- jr fndscr1 ; Try again
- fndscr2:
- pop hl ; Beginning of this screen
- call setscr2 ; Set LOCBEG and LOCEND
-
- ; Position cursor at RINGPOS
-
- ld hl,curhome
- ld (curat),hl ; First position
- ld hl,(locbeg)
- fndnxt:
- ld de,(ringpos)
- call cmpdehl
- ret z ; We are there
- ld de,eltsiz ; One element length
- add hl,de
- push hl
- call psn$next ; Advance cursor
- pop hl
- jr fndnxt ; Try again..
-
-
- ; SETSCR - Setup Screen Display Variables
-
- setscr:
- ld hl,curhome ; Set cursor home
- ld (curat),hl
- ld hl,(ring) ; Set ring position
-
- ; Entry to Reset Ring Position at HL
-
- setscr1:
- ld (ringpos),hl
-
- ; Entry to Reset Local Ring Position at HL
-
- setscr2:
- ld (locbeg),hl ; Front of ring
- ld de,eps*eltsiz ; New end?
- add hl,de
- ld de,(ringend) ; End of ring
- call cmpdehl
- jr nc,setscr3
- ex de,hl
- setscr3:
- ld (locend),hl
- ret
-
- ;---------------------------------------------------------------------------
-
- ; CUR Subroutines to position the cursor
-
-
- ; CUR$FIRST - Home the Cursor
-
- cur$first:
- ld hl,curhome ; Home address
- ld (curat),hl ; Set cursor position
- jp gotoxy
-
-
- ; CUR$LAST - Move Cursor to Last File Position
-
- cur$last:
- call psn$last ; Position cursor
- cur$new:
- ld hl,(curat) ; Set new cursor position
- jp gotoxy
-
-
- ; CUR$NEXT - Move Cursor to Next File Position
-
- cur$next:
- call psn$next ; Position cursor
- jr cur$new ; Set new cursor position
-
-
- ; CUR$BACK - Move Cursor to Previous File Position
-
- cur$back:
- call psn$back ; Position cursor
- jr cur$new ; Set new cursor position
-
-
- ; CUR$DOW - Move Cursor Down a File Position
-
- cur$down:
- call psn$down ; Position cursor
- jr cur$new ; Set new cursor position
-
-
- ; PSN Subroutines manipulate the CURAT value without moving cursor
-
-
- ; PSN$LAST - Set Last File Position
-
- psn$last:
- ld hl,(ringpos) ; Advance
- pl0:
- ld de,eltsiz
- add hl,de
- ex de,hl
- ld hl,(locend) ; End of local ring?
- call cmpdehl
- ret z
- call psn$next ; Advance cursor position.
- ex de,hl ; Get position
- jr pl0
-
-
- ; PSN$NEXT - Advance the Cursor Position
-
- psn$next:
- ld hl,(curat) ; Compute new position
- ld a,l ; Check for new line
- add a,entsiz ; Size of each entry
- cp entsiz*[fcols-1]+2 ; Last column?
- jr nc,pn1 ; Advance to next line
- ld l,a ; New position
- ld (curat),hl
- ret
-
- pn1:
- ld a,h ; Get line
- ld hl,curhome ; Get col
- ld h,a ; Set line and continue with psn$down
- ld (curat),hl
-
- ; PSN$DOWN - Move Cursor Position Down One Line
-
- psn$down:
- ld hl,curhome ; Get home address
- ld b,h ; Line in b
- ld hl,(curat) ; Get current address
- inc h ; Move down
- ld a,h ; Check for too far
- sub b
- cp eps/fcols
- jr c,pd1 ; Ok, so save position
- ld a,l ; Get col
- ld hl,curhome
- ld l,a
- pd1:
- ld (curat),hl
- ret
-
- ; PSN$BACK - Back Up the Cursor Position
-
- psn$back:
- ld de,curhome ; Get home address
- ld hl,(curat)
- call cmpdehl ; Compare
- jr z,psn$last ; Goto end if last
- ld a,l ; Check for first col
- cp e
- jr z,pb1
- sub entsiz ; Back up one col
- ld l,a
- ld (curat),hl ; New pos
- ret
-
- pb1:
- ld a,e ; Get home col
- add a,entsiz*[fcols-1] ; Get last col
- ld l,a
- dec h ; Prev line
- ld (curat),hl
- ret
-
- ; SETCUR - Position Cursor at CURAT
-
- setcur:
- ld a,(helpdisp) ; Nogo if help display is active.
- or a
- ret nz
- ld hl,(curat)
- call gotoxy
- call vprint
-
- if revvideo
-
- db dim
- if fcols eq 4
- db '-->',bright,' '
- else ; not fcols eq 4
- db '->',bright
- endif ; fcols eq 4
-
- else ; not revvideo
-
- if fcols eq 4
- db '--> '
- else ; not fcols eq 4
- db '->'
- endif ; fcols eq 4
-
- endif ; revvideo
-
- db 0
-
- ret
-
- ; CLRCUR - Clear Cursor
-
- clrcur:
- ld a,(helpdisp) ; Nogo if help display is active.
- or a
- ret nz
- ld hl,(curat)
- call gotoxy
- call vprint
- if fcols eq 4
- db ' ',0
- else
- db ' ',0
- endif
- ret
-
- ;---------------------------------------------------------------------------
-
- ; Command Prompts and Messages
-
-
- ; CPRMPT - Command Prompt
-
- cprmpt:
- ld hl,cpadr ; Get command line cursor address
- push bc
- ld a,(cpecnt) ; Get # chars to erase.
- mprint:
- ld b,a ; In b.
- push hl ; Save cursor address
- call gotoxy ; Set cursor.
- call vereol ; Erase to eol
- pop hl ; Restore address
- pop bc
- call gotoxy ; Position cursor
- jp vprint ; Print message and return
-
-
- ; ERMSG - Error Message
-
- ermsg:
- ld hl,eradr ; Get error line cursor address
- push bc
- ld a,(erecnt) ; Get # chars to erase.
- jr mprint ; Print message.
-
-
- ; WORKMSG - Working Message
-
- workmsg:
- call ermsg
- db dim,'Working ...',bright,' ',0
- ret
-
-
- ; ERCLR - Clear Error Message
-
- erclr:
- ld hl,eradr ; Position cursor
- call gotoxy
- push bc
- ld a,(erecnt) ; Get # chars to erase.
- ld b,a ; In b.
- call vereol ; Erase to eol
- pop bc
- ret
-
- ; ATCMD - Position at Command Prompt and Clear It
-
- atcmd:
- ld hl,cpadr ; Position cursor
- call gotoxy
- push bc
- ld a,(cpecnt) ; Get # chars to erase.
- ld b,a ; In b.
- call vereol ; Clear message
- pop bc
- ret
-