; ; ZCPR3 TCAP Facility (Z3TCAP) ; Program Name: TCVIEW ; Author: Jay S. Rouman ; Version: 1.0 Original ; Date: 27 Dec 86 ; ; Changes: Fixed memory mode that used incorrect Z3ENV pointer. v12. ; Changed to assemble with M80, and link with L80. ; Al Heynneman ; ; Changes: Converted to use ZAS and run through PPAL pretty printer. v11. fg ; ; VERSION EQU 12 ; RAH ; ; Changes: Major rewrite to use with new V4LIBS and extended TCAP. ; Eliminated internal enviroment. Used Z80ASM & SLRNK. ; Ernie Barnhart, N8DVE ; On ZNODE CENTRAL 312-649-1730 ; 9 May 1989 ; VERSION EQU 20 ; EFB ; ; TCVIEW allows the user to view the contents of a Z3T file ; or the termcap presently in memory. ; ; Basic Equates ; FCB EQU 5CH TBUFF EQU 80H BELL EQU 7 CR EQU 13 LF EQU 10 ; ; ZCPR3 and SYSLIB References ; EXT AT,CLS,DINIT,GRXOFF,GRXON,GXYMSG,GZ3INIT,TINIT ; VLIB EXT VPRINT ; VLIB EXT GETCRT,GETEFCB,GETVID,Z3LOG ; Z3LIB EXT CCOUT,COUT7,F$CLOSE,F$EXIST,F$OPEN,F$READ,MOVEB ; SYSLIB EXT PADC,PFN2,PSTR ; SYSLIB ; ; Environment Definition ; BEGIN: JP START DB 'Z3ENV' ; This is a ZCPR3 Utility DB 1 ; Type 1 program Z3EADR: DW 0 START: LD (STACK),SP ; Save stack pointer LD SP,STACK ; Point to internal stack LD HL,(Z3EADR) ; Point to ZCPR3 environment CALL GZ3INIT ; Initialize the ZCPR3 Env and the VLIB Env LD (EXTGRF),A ; Store extended graphics byte CALL GETVID ; Check TCAP LD (BUFSAV),HL ; Save buffer address JR NZ,CHKCRT ; Continue if good TCAP CALL VPRINT DB CR,LF,' Z3 TCAP not initialized',CR,LF,BELL,0 JP FINISH CHKCRT: CALL GETCRT ; Check CRT size LD A,(HL) CP 80 ; Requires 80 columns JP NC,CHKLNS ; Continue if enough columns CALL VPRINT DB CR,LF,' Requires an 80 column screen',CR,LF,BELL,0 JP FINISH CHKLNS: INC HL LD A,(HL) CP 24 ; Requires 24 lines JP NC,GUDCRT ; Continue if enough lines CALL VPRINT DB CR,LF,' Requires a 24 line screen',CR,LF,BELL,0 JP FINISH GUDCRT: CALL TINIT ; Initialize terminal ; ; Check for Entry in FCB ; CHKFCB: LD A,(FCB+1) ; Get first char CP ' ' ; None if space JP Z,STARTM ; Memory mode CP '/' ; None if slash JP NZ,STARTF ; File mode ; ; Print Help Info ; HELP: CALL CLS CALL TINIT ; Because of deinitialization in CLS CALL VPRINT DB CR,LF,LF DB 'TCVIEW, Version ' DB (VERSION/10)+'0','.',(VERSION MOD 10)+'0',CR,LF,LF ; RAH DB ' Displays ZCPR TCAP entries',CR,LF,LF DB ' Syntax:',CR,LF DB ' ',0 CALL GETEFCB ; Get name of program JR Z,ORGNAM ; Print original name if no external FCB CALL PRTCUR ; Print current program name JR GOTNAM ORGNAM: CALL VPRINT DB 'TCVIEW',0 ; Original name GOTNAM: CALL VPRINT DB ' [[dir:]Filename[.typ]]',CR,LF,LF DB ' Note:',CR,LF DB ' Not specifying a file name uses memory',CR,LF DB ' Not specifying a file type uses ''.Z3T''',CR,LF,LF,0 JP FINISH ; ; Resume Processing ; STARTM: ; Memory mode CALL CLS ; Clear screen CALL TINIT ; Initialize terminal because of 'CLS' CALL GXYMSG ; Print file name DB 3,43 DB 'Termcap source:',0 CALL VPRINT DB 1,' MEMORY ',2,0 JP START2 ; STARTF: ; File mode ; ; Set Default File Type if None ; LD DE,FCB+9 ; Pt to file type LD HL,DEFTYP ; Pt to default file type LD B,3 ; 3 bytes LD A,(DE) ; Get first char CP ' ' ; None if space CALL Z,MOVEB ; Set default file type LD DE,FCB ; Pt to file name CALL Z3LOG ; Log in proper directory CALL F$EXIST ; Check for file existence JP NZ,OPNFIL CALL VPRINT DB CR,LF,' File not found',CR,LF,BELL,0 JP FINISH OPNFIL: CALL F$OPEN ; Open file CALL F$READ ; Read file CALL F$CLOSE ; Close file CALL CLS ; Clear screen CALL TINIT ; Initialize terminal because of 'CLS' CALL GXYMSG ; Print file name DB 3,43 DB 'File Name:',1,' ',0 LD DE,FCB+1 CALL PFN2 CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 LD HL,TBUFF ; Pt to buffer LD (BUFSAV),HL ; Save buffer address ; START2: CALL GXYMSG DB 1,23 DB '>>>>>',1,' TCVIEW Version ' DB (VERSION/10)+'0','.',(VERSION MOD 10)+'0',' ',2 ; RAH DB '<<<<<',0 CALL GXYMSG DB 3,7 DB 'Terminal name:',1,' ',0 LD HL,(BUFSAV) ; Point to TCAP LD B,15 ; Print 15 characters CALL PRTCHR ; Print terminal name CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 LD DE,10H ; Get ready for add ADD HL,DE ; Hl now contains buffer + 16 CALL GXYMSG DB 5,10 DB 'Up arrow: ',1,' ',0 LD A,(HL) CALL PRBYT ; Up CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 INC HL CALL GXYMSG DB 6,10 DB 'Down arrow: ',1,' ',0 LD A,(HL) CALL PRBYT ; Down CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 INC HL CALL GXYMSG DB 7,10 DB 'Right arrow:',1,' ',0 LD A,(HL) CALL PRBYT ; Right CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 INC HL CALL GXYMSG DB 8,10 DB 'Left arrow: ',1,' ',0 LD A,(HL) CALL PRBYT ; Left CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 INC HL CALL GXYMSG DB 5,45 DB 'Clear Screen delay: ',1,' ',0 LD A,(HL) CALL PADC CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 INC HL CALL GXYMSG DB 6,45 DB 'Cursor Motion delay:',1,' ',0 LD A,(HL) CALL PADC CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 INC HL CALL GXYMSG DB 7,45 DB 'Clear to EOL delay: ',1,' ',0 LD A,(HL) CALL PADC CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 INC HL CALL GXYMSG DB 10,5 DB 'Clear Screen: ',0 CALL PRSEQ CALL GXYMSG DB 11,5 DB 'Cursor Motion: ',0 CALL PRSEQ CALL GXYMSG DB 12,5 DB 'Clear to EOL: ',0 CALL PRSEQ CALL GXYMSG DB 13,5 DB 'Begin standout: ',0 CALL PRSEQ CALL GXYMSG DB 14,5 DB 'End standout: ',0 CALL PRSEQ CALL GXYMSG DB 15,5 DB 'Init terminal: ',0 CALL PRSEQ CALL GXYMSG DB 16,5 DB 'Deinit terminal: ',0 CALL PRSEQ CALL GXYMSG DB 17,5 DB 'Delete line: ',0 CALL PRSEQ CALL GXYMSG DB 18,5 DB 'Insert Line: ',0 CALL PRSEQ CALL GXYMSG DB 19,5 DB 'Clear to EOS: ',0 CALL PRSEQ CALL GXYMSG DB 8,45 DB 'Graphics delay: ',1,' ',0 LD A,(HL) CALL PADC CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 INC HL CALL GXYMSG DB 20,5 DB 'Graphics On: ',0 CALL PRSEQ CALL GXYMSG DB 21,5 DB 'Graphics Off: ',0 CALL PRSEQ CALL GXYMSG DB 22,5 DB 'Cursor Off: ',0 CALL PRSEQ CALL GXYMSG DB 23,5 DB 'Cursor On: ',0 CALL PRSEQ CALL GXYMSG DB 10,45 DB 'Graphics Characters:',0 CALL GXYMSG DB 11,49 DB 'Upper left corner: ',0 CALL GXYMSG DB 12,49 DB 'Upper right corner: ',0 CALL GXYMSG DB 13,49 DB 'Lower left corner: ',0 CALL GXYMSG DB 14,49 DB 'Lower right corner: ',0 CALL GXYMSG DB 15,49 DB 'Horizontal line: ',0 CALL GXYMSG DB 16,49 DB 'Veritical line: ',0 CALL GXYMSG DB 17,49 DB 'Solid block: ',0 CALL GXYMSG DB 18,49 DB 'Hashed block: ',0 CALL GXYMSG DB 19,49 DB 'Upper intersect: ',0 CALL GXYMSG DB 20,49 DB 'Lower intersect: ',0 CALL GXYMSG DB 21,49 DB 'Intersection: ',0 CALL GXYMSG DB 22,49 DB 'Right intersection: ',0 CALL GXYMSG DB 23,49 DB 'Left intersection: ',0 LD A,(EXTGRF) ; Get extended graphics byte BIT 3,A ; Check bit 3 JP Z,FINISH ; Done if no graphics characters CALL GRXON ; Graphics mode on CALL AT DB 11,70 CALL PRGRAF CALL AT DB 12,70 CALL PRGRAF CALL AT DB 13,70 CALL PRGRAF CALL AT DB 14,70 CALL PRGRAF CALL AT DB 15,70 CALL PRGRAF CALL AT DB 16,70 CALL PRGRAF CALL AT DB 17,70 CALL PRGRAF CALL AT DB 18,70 CALL PRGRAF CALL AT DB 19,70 CALL PRGRAF CALL AT DB 20,70 CALL PRGRAF CALL AT DB 21,70 CALL PRGRAF CALL AT DB 22,70 CALL PRGRAF CALL AT DB 23,70 CALL PRGRAF CALL GRXOFF FINISH: LD SP,(STACK) CALL DINIT RET ; End of program ; ; ; PRINT CHARACTER ; ; PRBYT: CP 0 ; Null? JP Z,PNULL CP 7 ; Bell? JP Z,PBELL CP 8 ; Bs? JP Z,PBS CP 10 ; Lf? JP Z,PLF CP 13 ; Cr? JP Z,PCR CALL CCOUT ; Print byte RET PNULL: CALL VPRINT DB '^@',0 RET PBELL: CALL VPRINT DB '^G',0 RET PBS: CALL VPRINT DB '^H',0 RET PLF: CALL VPRINT DB '^J',0 RET PCR: CALL VPRINT DB '^M',0 RET ; ; ; PRINT CHARACTER SEQUENCE TERMINATED WITH A NULL ; ; INPUTS: HL points to first character ; OUTPUTS: Characters, including control characters are printed on CRT ; SIDE AFFECTS: HL points to address after terminating null ; PRSEQ: CALL VPRINT ; Print terminal sequence DB '->',1,0 PRSEQ2: LD A,(HL) OR A JP Z,PRDONE CALL PRBYT INC HL JP PRSEQ2 PRDONE: INC HL CALL VPRINT DB 2,'<-',0 RET ; ; ; PRINT GRAPHICS CHARACTER ; ; INPUTS: HL points to null terminated graphics character ; OUTPUTS: Graphics character printed on console ; SIDE AFFECTS: HL points to address after terminating null ; PRGRAF: LD A,(HL) CALL PSTR RET ; ; ; PRINT CHARACTER STRING ; ; INPUTS: HL points to string ; B contains count of characters to print ; OUTPUTS: String printed on console with MSB cleared ; SIDE AFFECTS: None ; PRTCHR: PUSH HL ; Save pointer PUSH BC ; Save character count PUSH AF ; Save flags DEC HL ; Back up from first character NXTCHR: INC HL ; Point to next character LD A,(HL) ; Get character CALL COUT7 ; Print with MSB cleared DJNZ NXTCHR ; Repeat until done LSTCHR: POP AF ; Recall flags POP BC ; Recall character count POP HL ; Recall pointer RET ; ; ; PRINT CURRENT PROGRAM NAME ; ; INPUTS: HL points to external FCB ; OUTPUTS: File name printed without trailing spaces on console ; SIDE AFFECTS: None ; PRTCUR: PUSH HL ; Save pointer PUSH AF ; Save flags LD B,8 ; Print 8 characters NXTCH: INC HL ; Point to next character LD A,(HL) ; Get character CP ' ' ; Check if a space JP Z,LSTCH ; Do not print spaces CALL COUT7 ; Print with MSB cleared DJNZ NXTCH ; Repeat until done LSTCH: POP AF ; Recall flags POP HL ; Recall pointer RET ; ; ; DATA BUFFERS ; ; EXTGRF: DB 0 ; Extended graphics byte DEFTYP: DB 'Z3T' ; Default file type BUFSAV: DW 0 ; Place to save buffer address DS 64 STACK: DW 0 ; END