home *** CD-ROM | disk | FTP | other *** search
- page
-
- ; RCP-LT.Z80
-
- ;=============================================================================
- ;
- ; L I S T A N D T Y P E C O M M A N D S
- ;
- ;=============================================================================
-
- ;Command: LIST
- ;Function: Print out specified file on the LST: Device
- ;Forms:
- ; LIST <afn> Print file (NO Paging)
- ;Notes:
- ; The flags which apply to TYPE do not take effect with LIST
-
- if liston
- list:
- ;
- ; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED
-
-
- call retsave
- ld a,0ffh ; Turn on printer flag
- jr type0
- endif ;liston
-
- ;Command: TYPE
- ;Function: Print out specified file on the CON: Device
- ;Forms:
- ; TYPE <afn> Print file
- ; TYPE <afn> P Print file with paging flag
- ;Notes:
- ; The flag PGDFLG defines the letter which toggles the paging
- ; facility (P in the forms section above)
- ; The flag PGDFLT determines if TYPE is to page by default
- ; (PGDFLT=TRUE if TYPE pages by default); combined with
- ; PGDFLG, the following events occur --
- ; If PGDFLT = TRUE, PGDFLG turns OFF paging
- ; If PGDFLT = FALSE, PGDFLG turns ON paging
- ;
- type:
- ;
- ; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED
- ;
- ;
- call retsave
- xor a ; Turn off printer flag
- ;
- ; ENTRY POINT FOR CPR LIST FUNCTION (LIST)
- ;
- type0:
- if liston
- ld (prflg),a ; Set flag
- endif ; Liston
-
- ld a,(fcb2+1) ; Get page flag
- ld (pgflg),a ; Save it as a flag
- ld a,1 ; Select dir files
- call getdir ; Allow ambiguous files (HL points to buffer)
- jp z,prfnf ; No files
- jr typex2
-
- ; Entry point for successive files
- typex:
- ld hl,(nxtfile) ; Get ptr to next file
- ld a,(hl) ; Any files?
- or a
- jp z,exit
-
- if liston
- ld a,(prflg) ; Check for list output
- or a ; 0=type
- jr z,typex1
- ld a,cr ; Bol on printer
- call lcout
- ld a,ff ; Form feed the printer
- call lcout
- jr typex2
- endif ; Liston
-
- typex1:
- ; LDA PAGCNT ; If we've just done so,
- push hl
- ld hl,(pagcnt)
- ld a,(hl)
- pop hl
- cp nlines-2 ; Don't type another
- call nz,pagebreak ; Page break message
- typex2:
- ld de,fcb1+1 ; Copy into fcb1
- ld b,11 ; 11 bytes
- call blkmov
- ld (nxtfile),hl ; Set ptr to next file
- call initfcb1 ; Init fcb1
- ld c,15 ; Open file
- call bdos
- inc a ; Set error flag
- jp z,prfnf ; Abort if error
- ; MVI A,NLINES-2 ; Set line count
- ; STA PAGCNT
- ld hl,(pagcnt)
- ld (hl),nlines-2
- ld a,cr ; New line
- call lcout
- ld a,lf
- call lcout
- ld bc,080h ; Set char position and tab count
- ; (b=0=tab, c=080h=char position)
- ;
- ; MAIN LOOP FOR LOADING NEXT BLOCK
- ;
- type2:
- ld a,c ; Get char count
- cp 80h
- jr c,type3
- ; PUSH H ; Read next block
- push bc
- ld de,fcb1 ; Pt to fcb
- ld c,20 ; Read record
- call bdos
- or a ; Set flags
- pop bc
- ; POP H
- jr nz,typex ; End of file?
- ld c,0 ; Set char count
- ld hl,tbuff ; Pt to first char
- ;
- ; MAIN LOOP FOR PRINTING CHARS IN TBUFF
- ;
- type3:
- ld a,(hl) ; Get next char
- and 7fh ; Mask out msb
- cp 1ah ; End of file (^z)?
- jr z,typex ; Next file if so
- ;
- ; OUTPUT CHAR TO CON: OR LST: DEVICE WITH TABULATION
- ;
- cp cr ; Reset tab count?
- jr z,type4
- cp lf ; Reset tab count?
- jr z,type4
- cp tab ; Tab?
- jr z,type5
- ;
- ; OUTPUT CHAR AND INCREMENT CHAR COUNT
- ;
- call lcout ; Output char
- inc b ; Increment tab count
- jr type6
- ;
- ; OUTPUT <CR> OR <LF> AND RESET TAB COUNT
- ;
- type4:
- call lcout ; Output <cr> or <lf>
- ld b,0 ; Reset tab counter
- jr type6
- ;
- ; TABULATE
- ;
- type5:
- ld a,' ' ; <sp>
- call lcout
- inc b ; Incr pos count
- ld a,b
- and 7
- jr nz,type5
- ;
- ; CONTINUE PROCESSING
- ;
- type6:
- inc c ; Increment char count
- inc hl ; Pt to next char
- call break ; Check for abort
- jp z,typex ; Skip
- jr type2
- ;
- ; SEND OUTPUT TO LST: OR CON:, AS PER THE FLAG
- ; RETURN WITH Z IF ABORT
- ;
- lcout:
- push hl ; Save regs
- push bc
- ld e,a ; Char in e
- ld c,2 ; Output to con:
- if liston
- prflg equ $+1 ; Pointer for in-the-code modification
- ld a,0 ; 2nd byte is the print flag
- or a ; 0=type
- jr z,lc1
- ld c,5 ; Output to lst:
- endif ; Liston
-
- lc1:
- push de ; Save char
- call bdos ; Output char in e
- pop de ; Get char
- ld a,e
- cp lf
- jr nz,lc2
- if liston
- ld a,(prflg) ; Output to lst:?
- or a ; Nz = yes
- jr nz,lc2
- endif ; Liston
- ;
- ; CHECK FOR PAGING
- ;
- ; LXI H,PAGCNT ; Count down
- ld hl,(pagcnt)
- dec (hl)
- jr nz,lc2 ; Jump if not end of page
- ld (hl),nlines-2 ; Refill counter
- pgflg equ $+1 ; Pointer to in-the-code buffer
- ld a,0 ; 2nd byte is the paging flag
- cp pgdflg ; Page default override option wanted?
- ;
- if pgdflt ; If paging is default
- ;
- jr z,lc2 ; Pgdflg means no paging
- ;
- else
- ;
- jr nz,lc2 ; Pgdflg means page
- ;
- endif ; Pgdflt
- ;
- call pagebreak ; Print page break message
- jp z,typex ; Z to skip
- lc2:
- pop bc ; Restore regs
- pop hl
- ret
- ;
- ; PRINT PAGE BREAK MESSAGE AND GET USER INPUT
- ; ABORT IF ^C, RZ IF ^X
- ;
- pagebreak:
- push hl ; Save hl
- call print
- db cr,lf,' Typing',' '+80h
- ld hl,fcb1+1 ; Print file name
- call prfn
- call dash ; Print dash
- call conin ; Get input
- pop hl ; Restore hl
- push af
- call crlf ; New line
- pop af
- jp break1
- ;
- ; End RCP-LT.Z80
-
- .