TITLE "VIDAB - Vlib 4.1" NAME ('VIDAB') ;======================================================================= ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;----------------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from VIDA.Z80 & VIDB.Z80 Ver 1.1 by Richard Conn ; Date : 12 Jan 89 ; Version : 1.2 ; Module : VIDAB ; Abstract: This module contains the routines Z3VINIT and VIDINIT which ; set both the Environment and video pointers, and just the video ; pointer respectively. The routine also contains the storage ; location for the pointer VIDPTR which points to the Termcap ; storage area, video delay times, and video string address table ; for remainder of modules. ; The module also contains the routine VIDSKP which skips ; entries in the raw string TERMCAP. It should not be needed by ; application programs since table-driven routines have been made. ; Revision: ; 1.3 15 Dec 89 Joe Wright ; Added @B14, @B15, @SA and @AT, Set Attributes. ; 1.4 19 Jan 90 ; Added @RC and @RL to Read Cursor and Read Line. ; Compacted the 13 graphics characters into a table. ; 1.5 2 Feb 90 Joe Wright ; Put @CD string back where it was, after @LI. Establish ; @B13 as offset to GOELD. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC Z3VINIT, VIDINIT, VIDPTR, VIDSKP PUBLIC @B13, @B14, @B15, @CL, @CM, @CE, @SO, @SE, @TI, @TO PUBLIC @LD, @LI, @SA, @AT, @CMD, @CLSD, @EOLD PUBLIC @CD, @GOELD, @GO, @GE, @CDO, @CDE, @RC, @RL PUBLIC @GULC, @GURC, @GLLC, @GLRC, @GHL, @GVL PUBLIC @GFB, @GHB, @GUI, @GLI, @GIS, @GRTI, @GLTI ; ..from Z3LIB Get.. EXT ENVPTR .Z80 CSEG ;=============================================================== ; Z3VINIT - Initialize Z3Env, VidPtr, and Video tables ; Entry: HL = Address of the Z3 Environment Descriptor ; Exit : - Nothing returned ; Uses : - None ; Special Requirements: None ;=============================================================== Z3VINIT:PUSH HL ; Save HL PUSH DE PUSH AF LD (ENVPTR),HL ; Set Z3 Environment pointer LD A,H ; ..and check it for Null OR L JR Z,Z3V0 ; Bypass offset if Null LD DE,80H ; 80H bytes later ... ADD HL,DE Z3V0: LD (VIDPTR),HL ; Set Z3TCAP pointer PUSH BC ; Save rest of regs LD A,H ; Is it a valid address? OR L JR Z,NOTERM ; ..jump if not valid LD A,(HL) ; Get first char of TERMCAP name CP ' '+1 ; Is a definition there? JR C,NOTERM ; ..jump if none installed PUSH HL ; Save NZTCAP address LD DE,13 ADD HL,DE ; Offset to GOELD LD A,(HL) LD (@B13),A INC HL LD A,(HL) LD (@B14),A ; Save it locally INC HL LD A,(HL) LD (@B15),A LD DE,5 ; Offset to CL Delay value ADD HL,DE LD DE,@CLSD ; Point to Clear String Delay in Table LD BC,3 ; Move the three constant values LDIR LD B,TABENT ; Set number of elements for rest of table SAVLP: CALL SAVPTR ; Save addr of string start & scan next DJNZ SAVLP ; ..and loop til done POP HL ; Get NZTCAP address LD A,(@B13) ; Offset to GOELD LD C,A ; To C (B=0) ADD HL,BC ; Point HL to GOELD LDI ; Move Graphics On/Off Delay LD B,TABEN1 ; Set length for second block SAVLP0: CALL SAVPTR ; Save addr of string start & scan next DJNZ SAVLP0 ; ..and loop til done LD BC,TABEN2 LDIR ; Move the graphics characters to us Z3EXIT: POP BC ; Restore all registers POP AF POP DE POP HL RET NOTERM: LD B,3 ; Set number of constants LD DE,NULSTR ; Point to null string LD HL,@CLSD ; ..and to table start (constants) NOTER1: LD (HL),0 ; Set null delay INC HL DJNZ NOTER1 ; ..and loop til done (HL = @CL) LD B,TABENT ; Set # of vectors in rest of table NOTER0: LD (HL),E ; Fill invalid string to each entry INC HL LD (HL),D INC HL DJNZ NOTER0 ; ..and loop til done LD (HL),0 INC HL LD B,TABEN1 NOTER2: LD (HL),E ; Fill more pointers INC HL LD (HL),D INC HL DJNZ NOTER2 ; ..loop til done LD B,TABEN2 NOTER3: LD (HL),0 INC HL DJNZ NOTER3 JR Z3EXIT ; Then exit NULSTR: DEFB 0 ; Dummy string target of pointer ;=============================================================== ; NAME - VIDINIT ; Entry: HL - Points to the Z3 Termcap Definition ; Exit : - Nothing returned ; HL,DE,BC,AF - Not affected ; Special Requirements: None ;=============================================================== VIDINIT: PUSH HL ; Save registers PUSH DE PUSH AF JR Z3V0 ; ..store it above ;..... ; Save pointer to string start SAVPTR: EX DE,HL ; Reverse pointers LD (HL),E ; Save address of string start INC HL LD (HL),D INC HL EX DE,HL ; Swap pointers back ;..fall thru.. ;=============================================================== ; VIDSKP - Skip to char after null-terminated string ; Entry: HL - Addr of first character in a string ; Exit : HL - Addr of 1st character after terminating Null ; Uses : HL ; Special Requirements: None ;=============================================================== VIDSKP: LD A,(HL) ; Get a Character INC HL ; ..and advance to next OR A ; Is it the Ending Null? RET Z ; ..quit if so CP '\' ; Is it a literal value? JR NZ,VIDSKP ; ..jump to continue if not INC HL ; Else advance to after literal value JR VIDSKP ;..... ; Data area for TERMCAP Pointer and String Table DSEG ; Put this in the Data Segment VIDPTR: DEFS 2 ; First byte of termcap entry @B13: DEFS 1 ; Offset to GOELD in TCAP @B14: DEFS 1 ; High Type (not defined) @B15: DEFS 1 ; Low Type (Terminal characteristics) @CLSD: DEFS 1 ; Millisecs delay after CLS @CMD: DEFS 1 ; Millisecs delay after CM @EOLD: DEFS 1 ; Millisecs delay after EOL @CL: DEFS 2 ; Clear screen string addr @CM: DEFS 2 ; Cursor Motion string addr @CE: DEFS 2 ; Clear to End-Of-Line string addr @SO: DEFS 2 ; Begin Highlight string addr @SE: DEFS 2 ; End Highlight string addr @TI: DEFS 2 ; Initialize Terminal string addr @TO: DEFS 2 ; De-initialize Term string addr @LD: DEFS 2 ; Line Delete string addr @LI: DEFS 2 ; Line Insert string addr @CD: DEFS 2 ; Clear to EOS string addr @SA: DEFS 2 ; Set Attributes (jww) @AT: DEFS 2 ; Attributes (jww) @RC: DEFS 2 ; Read Cursor position @RL: DEFS 2 ; Read Line to cursor TABENT EQU ($-@CL)/2 ; Number of entries in table @GOELD: DEFS 1 ; GO/GE - Graphics On/Off Delay @GO: DEFS 2 ; Graphics On string addr @GE: DEFS 2 ; Graphics Off string addr @CDO: DEFS 2 ; Cursor Off string addr @CDE: DEFS 2 ; Cursor On string addr TABEN1 EQU ($-@GO)/2 @GULC: DEFS 1 ; Upper Left Corner string addr @GURC: DEFS 1 ; Upper Right Corner string addr @GLLC: DEFS 1 ; Lower Left Corner string addr @GLRC: DEFS 1 ; Lower Right Corner string addr @GHL: DEFS 1 ; Horiz Line string addr @GVL: DEFS 1 ; Vert Line string addr @GFB: DEFS 1 ; Graphics Full Block string addr @GHB: DEFS 1 ; Graphics Hashed Block string addr @GUI: DEFS 1 ; Graphics Upper Intersect string addr @GLI: DEFS 1 ; Graphics Lower Intersect string addr @GIS: DEFS 1 ; Graphics Intersect string addr @GRTI: DEFS 1 ; Graphics Right Intersect string addr @GLTI: DEFS 1 ; Graphics Left Intersect string addr TABEN2 EQU $-@GULC END