; ZCPR3 TCAP Facility (Z3TCAP) ; Program Name: TCVIEW ; Original Author: Jay S. Rouman ; Original Version: 1.0 ; Original version Date: 27 Dec 86 ; ; TCVIEW allows the user to view the contents of a Z3T file ; or the termcap presently in memory. ; ; VERS EQU 11 ; FG ; ; Changes: Converted to use ZAS and run through PPAL pretty printer. ; Frank Gaude' (FG) ; ; VERS EQU 12 ; RAH ; ; Changes: Fixed memory mode that used incorrect Z3ENV pointer. v12. ; Changed to assemble with M80, and link with L80. ; Al Heynneman (RAH) ; ; VERS EQU 20 ; EFB ; ; Changes: Major rewrite to use with new V4LIBS and extended TCAP. ; Eliminated internal enviroment. Used Z80ASM & SLRNK. ; Ernie Barnhart, N8DVE (EFB) ; On ZNODE CENTRAL 312-649-1730 ; 9 May 1989 ; ; VERS EQU 21 ; EFB 14 Nov 89 ; ; Changes: Corrected PRGRAF routine to not strip high bit as pointed ; out by Michael Broschat. Only prints graphics characters ; if GRAPHICS ON/OFF sequence present to be compatible with ; other programs. If reading a file the alpha representations ; of the graphic characters are printed. ; Ernie Barnhart, N8DVE ; ; VERS EQU 22 ; GP ; ; Changes: Made compatible with Joe Wright's NZTCAPD. Now prints ; graphic characters, even if no "graphics on" string is ; included, and even if some graphic characters are missing. ; In file mode, now strips high bit from graphic characters ; before printing to screen. Display adjusted to make ; room for additional strings required by new TCAP. ; Gene Pizzetta, June 11, 1990 ; ;VERS EQU 23 ; GP ; ; Changes: Added display of terminal characteristics byte, labeled ; 'Features:'. Now properly handles display of graphic ; characters in file mode when terminal uses control ; characters with high bit set (such as Televideo 965). ; Gene Pizzetta, June 15, 1990 (GP) ; VERS EQU 24 ; AEH, 15 July, 1990 ; ; Changes: Now reports the VLIB version for which the TCAP is ; intended and adjusts the display accordingly. ; Al Hawley (AEH), Z-Node #2, (213) 670-9465 ; ; Equates . . . ; FCB EQU 5CH TBUFF EQU 80H BELL EQU 7 CR EQU 13 LF EQU 10 ; ; Library routines . . . ; ;if assembling with ZMAC, Z80ASM, SLR180, or M80, then the ;following .request statements make it unneccessary to include ;the names of the libraries during linking. .REQUEST VLIB ;use VLIB4D EXT AT,CLS,DINIT,GRXOFF,GRXON,GXYMSG,GZ3INIT,TINIT EXT VPRINT .REQUEST Z3LIB ;use Latest Version EXT GETCRT,GETEFCB,GETVID,Z3LOG .REQUEST SYSLIB ;VERSION 4 PREFERRED EXT CCOUT,COUT,COUT7,F$CLOSE,F$EXIST,F$OPEN,F$READ EXT MOVEB,PADC,PFN2,PSTR,PRINT ; ; Code begins . . . ; BEGIN: JP START DB 'Z3ENV' 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 PRINT DB CR,LF,' Z3 TCAP not initialized',CR,LF,BELL,0 JP FINISH CHKCRT: CALL TCAPID ; Identify TCAP in memory LD (TCPVSN),A ; and save as default current TCAP version CALL GETCRT ; Check CRT size LD A,(HL) CP 80 ; Requires 80 columns JP NC,CHKLNS ; Continue if enough columns CALL PRINT 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 PRINT 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 PRINT DB '>>>>>>>>> TCVIEW Version ' DB (VERS/10)+'0','.',(VERS MOD 10)+'0' DB ' <<<<<<<<<',CR,LF DB ' Displays contents of a ZCPR3 TCAP and',CR,LF DB ' its associated VLIB version number.',cr,lf DB 'Usage:',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 PRINT DB 'TCVIEW',0 ; Original name GOTNAM: CALL PRINT DB ' {{dir:}fn{.ft}}',CR,LF DB 'If no filename is given, TCAP in memory is used.',CR,LF DB 'If no filetype is given, Z3T is assumed.',CR,LF DB 'File mode graphics are printed as characters.',0 JP FINISH ; ; Resume processing ; STARTM: ; Memory mode CALL CLS ; Clear screen ; CALL TINIT ; Initialize terminal because of 'CLS' CALL GXYMSG ; Print filename DB 1,53 DB 'SOURCE: ',0 CALL VPRINT DB 1,' MEMORY ',2,0 JP START2 ; STARTF: ; File mode ; ; Set default filetype if none ; LD DE,FCB+9 ; Pt to filetype LD HL,DEFTYP ; Pt to default filetype LD B,3 ; 3 bytes LD A,(DE) ; Get first char CP ' ' ; None if space CALL Z,MOVEB ; Set default filetype LD DE,FCB ; Pt to filename 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 OR 00FFH ; Prepare file flag LD (FILE),A ; Store flag CALL CLS ; Clear screen ; CALL TINIT ; Initialize terminal because of 'CLS' CALL GXYMSG ; Print filename DB 1,53 DB 'SOURCE: ',1,' ',0 ; and start highlighting LD DE,FCB+1 CALL PFN2 CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 ; and turn off highlighting LD HL,TBUFF ; Pt to buffer LD (BUFSAV),HL ; Save buffer address CALL TCAPID LD (TCPVSN),A ; TCAP version ID ; START2: CALL GXYMSG DB 1,2 DB 'TERMINAL: ',1,' ',0 LD HL,(BUFSAV) ; Point to TCAP CALL PRTTNM ; Print terminal name CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 LD BC,(TCPVSN) ;identify current tcap CALL TELLVLIB ;Put appropriate VLIB version on screen LD A,C ;Recover current tcap ID OR A ;original definition (VLIB1..3x)? JR Z,ARROWS ;This byte has no meaning for VLIB1 ;so don't print bit mapped info LD DE,15 ; get terminal characteristics byte ADD HL,DE CALL GXYMSG DB 2,2 DB 'Features: ',1,' ',0 LD A,(HL) BIT 0,A ; check standout mode CALL Z,ISDIM CALL NZ,ISREV BIT 1,A ; check delay CALL Z,NODLY CALL NZ,ISDLY BIT 2,A ; check wrap CALL Z,ISWRP CALL NZ,NOWRP BIT 3,A ; check scroll CALL Z,ISSCL CALL NZ,NOSCL BIT 4,A ; check ANSI CALL Z,ISASC CALL NZ,ISANS CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 ARROWS: LD HL,(BUFSAV) ; Restore pointer LD DE,10H ; Get ready for add ADD HL,DE ; Hl now contains buffer + 16 CALL GXYMSG DB 3,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 ; -> next parameter CALL GXYMSG DB 4,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 ; -> next parameter CALL GXYMSG DB 5,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 ; -> next parameter CALL GXYMSG DB 6,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 ; -> next parameter CALL GXYMSG DB 3,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 ; -> next parameter CALL GXYMSG DB 4,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 ; -> next parameter CALL GXYMSG DB 5,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 ; -> next parameter CALL GXYMSG DB 8,5 DB 'Clear Screen: ',0 CALL PRSEQ CALL GXYMSG DB 9,5 DB 'Cursor Motion: ',0 CALL PRSEQ CALL GXYMSG DB 10,5 DB 'Clear to EOL: ',0 CALL PRSEQ CALL GXYMSG DB 11,5 DB 'Begin standout: ',0 CALL PRSEQ CALL GXYMSG DB 12,5 DB 'End standout: ',0 CALL PRSEQ CALL GXYMSG DB 13,5 DB 'Init terminal: ',0 CALL PRSEQ CALL GXYMSG DB 14,5 DB 'Deinit terminal: ',0 CALL PRSEQ ;end of parameters in original unextended TCAP LD A,(TCPVSN) ; get TCAP version ID OR A JP Z,FINISH ;show extended TCAP parameters for TCAPs ;compatible with VLIB4 and VLIB4D CALL GXYMSG DB 15,5 DB 'Delete line: ',0 CALL PRSEQ CALL GXYMSG DB 16,5 DB 'Insert Line: ',0 CALL PRSEQ CALL GXYMSG DB 17,5 DB 'Clear to EOS: ',0 CALL PRSEQ ;the next 4 terminal strings are not present in ;the TCAP for BLIB4 LD A,(TCPVSN) CP 2 ;for VLIB4? JR Z,GRAFIC ;skip over if so CALL GXYMSG DB 18,5 DB 'Set Attributes: ',0 CALL PRSEQ CALL GXYMSG DB 19,5 DB 'Attributes: ',0 CALL PRSEQ CALL GXYMSG DB 20,5 DB 'Read Cursor: ',0 CALL PRSEQ CALL GXYMSG DB 21,5 DB 'Read Line: ',0 CALL PRSEQ GRAFIC: CALL GXYMSG DB 6,45 DB 'Graphics delay: ',1,' ',0 LD A,(HL) CALL PADC CALL VPRINT ; Print trailing blank for reverse video DB ' ',2,0 INC HL ; -> next parameter CALL GXYMSG DB 8,45 DB 'Graphics On: ',0 CALL PRSEQ CALL GXYMSG DB 9,45 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 ;set up the fixed titles for graphics character list CALL GXYMSG DB 10,45 DB 'Graphics Characters',0 CALL GXYMSG DB 11,47 DB 'Upper left corner: ',0 CALL GXYMSG DB 12,47 DB 'Upper right corner: ',0 CALL GXYMSG DB 13,47 DB 'Lower left corner: ',0 CALL GXYMSG DB 14,47 DB 'Lower right corner: ',0 CALL GXYMSG DB 15,47 DB 'Horizontal line: ',0 CALL GXYMSG DB 16,47 DB 'Vertical line: ',0 CALL GXYMSG DB 17,47 DB 'Solid block: ',0 CALL GXYMSG DB 18,47 DB 'Hashed block: ',0 CALL GXYMSG DB 19,47 DB 'Upper intersect: ',0 CALL GXYMSG DB 20,47 DB 'Lower intersect: ',0 CALL GXYMSG DB 21,47 DB 'Intersection: ',0 CALL GXYMSG DB 22,47 DB 'Right intersection: ',0 CALL GXYMSG DB 23,47 DB 'Left intersection: ',0 LD A,(FILE) ; Check if file OR A JR NZ,PRTGRF ; Print alpha characters if file ;fill in the actual characters from the TCAP. Display ;Graphic characters literally only if the source is memory ;and the TCAP in memory is for VLIB4D. Others get the ;characters displayed with conversion. CALL GRXON ; Graphics mode on PRTGRF: CALL AT DB 11,68 CALL PRGRAF ; Upper left corner CALL AT DB 12,68 CALL PRGRAF ; Upper right corner CALL AT DB 13,68 CALL PRGRAF ; Lower left corner CALL AT DB 14,68 CALL PRGRAF ; Lower right corner CALL AT DB 15,68 CALL PRGRAF ; Horizontal line CALL AT DB 16,68 CALL PRGRAF ; Vertical line CALL AT DB 17,68 CALL PRGRAF ; Solid block CALL AT DB 18,68 CALL PRGRAF ; Hashed block CALL AT DB 19,68 CALL PRGRAF ; Upper intersect CALL AT DB 20,68 CALL PRGRAF ; Lower intersect CALL AT DB 21,68 CALL PRGRAF ; Intersection CALL AT DB 22,68 CALL PRGRAF ; Right intersection CALL AT DB 23,68 CALL PRGRAF ; Left intersection CALL GRXOFF ; ; End of program . . . ; FINISH: LD SP,(STACK) CALL DINIT RET ; return to CPR ; ; PRBYT -- print character in A, with some conversions ; PRBYT: CP 0 ; Null? JP Z,PNULL CP 7 ; Bell? JP Z,PBELL CP 8 ; Backspace? JP Z,PBS CP 10 ; Linefeed? JP Z,PLF CP 13 ; Carriage return? JP Z,PCR CALL CCOUT ; Or 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 ; ; PRSEQ -- print character sequence terminated with a null ; Inputs: HL points to first character ; Outputs: characters, including control characters are printed on CRT ; Side effects: 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 ; ; PRGRAF -- print graphics character or string ; String for VLIB4 tcap, Character for VLIB4D tcap ; Inputs: HL points to graphics character ; Outputs: graphics character printed on console ; Side effects: HL points to address after character, uses A ; PRGRAF: LD A,(TCPVSN) ; get ID byte for target TCAP CP 2 ; for VLIB4? JR Z,PRSEQ ; Do a string if so LD A,(FILE) ; See if we're in file mode OR A JR NZ,PRGRF1 ; jump if we are ;if the characters being printed are for a terminal ;other than the current console, this could produce ;garbage! But then, you wouldn't have loaded it into ;your Environment, ....would you?? LD A,(HL) INC HL OR A ; Null entry? If not, ... CALL NZ,COUT ; print it as a graphic character RET ; PRGRF1: LD A,(HL) INC HL OR A ; Null entry? RET Z ; done if so AND 7Fh ; reset high bit JP PRBYT ; and print it with conversion ; PRTTNM -- print terminal name ; Inputs: HL points to name ; Outputs: string printed on console with MSB cleared ; Side effects: none ; PRTTNM: PUSH HL ; Save pointer LD B,13 ; Maximum characters DEC HL ; Back up from first character NXTCHR: INC HL ; Point to next character LD A,(HL) ; Get character CP ' ' ; Space? JR Z,LSTCHR ; (Yes, we're done) CALL COUT7 ; Print with MSB cleared DJNZ NXTCHR ; Repeat until done LSTCHR: POP HL ; Recall pointer RET ; ; PRTCUR -- print current program name ; Inputs: HL points to external FCB ; Outputs: filename printed without trailing spaces on console ; Side effects: 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 ; ; Routines to print status to terminal status byte (B15) ; ISDIM: call vprint db 'Dim Video',0 ret ISREV: call vprint db 'Reverse Video',0 ret ISDLY: call vprint db ', Power-up Delay',0 ret NODLY: call vprint db ', No Power-up Delay',0 ret ISWRP: call vprint db ', Wraps',0 ret NOWRP: call vprint db ', No Wrap',0 ret ISSCL: call vprint db ', Scrolls',0 ret NOSCL: call vprint db ', No Scroll',0 ret ISASC: call vprint db ', ASCII',0 ret ISANS: call vprint db ', ANSI',0 ret ; TCAPID: ; Inputs: HL contains address of a TCAP data structure ; Outputs: A contains the TCAP identification value ; Side effects: BC is used ;TCAP identification ; 0 the original TCAP as defined in ZCPR3 THE MANUAL ; 2 Extended TCAP for VLIB4 initial release ; 4 Extended TCAP for VLIB4D (release D) TCAPID: push hl ld bc,15 ;distance to terminal byte add hl,bc ; ->byte 15 ld a,(hl) and 01100000b ;check value of bits 5,6 ld a,0 ;original release TCAP identifier jr nz,tcapx ;valid if bit 5 or 6 is set dec hl ; ->byte 14 ld a,4 ;assume VLIB4D bit 7,(hl) ;true if bit 7 = 1 jr nz,tcapx ld a,2 ;else must be VLIB4 initial release TCAPX: pop hl ret TELLVLIB: PUSH HL PUSH BC LD HL,VLBVSN ADD HL,BC ;index into address list LD A,(HL) ;get the address INC HL LD H,(HL) LD L,A ;HL = address of message CALL GXYMSG DB 1,28 DB 'TCAP for ',1,0 CALL PSTR ;proper vlib version # CALL VPRINT DB 2,0 ;release highlight POP BC POP HL RET ; ; Data buffers . . . ; FILE: DB 0 ; File flag EXTGRF: DB 0 ; Extended graphics byte DEFTYP: DB 'Z3T' ; Default file type BUFSAV: DW 0 ; Pointer to TCAP in memory mode ; or to TBUFF in file mode. ;TCAP identification ; 0 original TCAP as defined in ZCPR3 THE MANUAL ; 2 Extended TCAP for VLIB4 (initial release) ; 4 Extended TCAP for VLIB4D (release D) TCPVSN: DW 0 ; Identifies target TCAP (file or memory) VLBVSN: DW vlib1,vlib4,vlib4d ; index for next 3 strings VLIB1: DB 'VLIB 1-3 ',0 VLIB4: DB 'VLIB 4 ',0 VLIB4D: DB 'VLIB 4D ',0 DS 64 STACK: DW 0 ; END