TITLE "VIDH - Vlib 4.1" NAME ('VIDH') ;================================================================= ; Copyright (C) 1989 by Harold F. Bower. Permission granted to ; Alpha Systems Corp. to distribute with The Libraries, Version 4 ;----------------------------------------------------------------- ; Author : Harold F. Bower ; Date : 7 Mar 89 ; Version : 1.0 ; Module : VIDH ; Abstract: This module contains the routines DRHORZ and ERAHORZ ; which draw and erase a thin graphics line respectively, ; and DRHBAR which draws a full bar with the block charac- ; ter graphics symbol. Calling parameters for DRHORZ and ; ERAHORZ are: ; CALL DRHORZ ; ..or ERAHORZ ; DEFB 3,5,20,0 ; Row, Col, Count, Dir ; ; where Dir=0 is L->R ; ; ..Dir=1 is R->L ; CALL DRHBAR ; DEFB 1,3,5,10,0 ; Type (1=Full, 2=Hash), ; ; Row, Col, Count, Dir ; Range checking is performed for left border overflow if ; print right-to-left, but no right checking is done. ; ERAHORZ simply prints the bar with space characters. ; Another entry point is also present for each of these ; routines taking parameters from registers. They are GHBAR ; and ERAHBAR. Parameters are: ; A = 0..2 (0=thin line, 1=Full block, 2=Hashed block) ; [A irrelevant in ERAHBAR] ; B = Number of spaces (count) ; C = Direction (0=Left to Right, 1=Right to Left) ; H = Row # (1=Top Row) ; L = Column # (1=Left margin) ; Revision: ; 1.1 19 JAN 90 Joe Wright ; Use @GSET0 rather than VIDOUT for the graphics characters. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC DRHBAR, DRHORZ, ERAHORZ, GHBAR, ERAHBAR ; External References EXT GOTOXY, @GFB, @GHB, @GHL EXT GRXON, GRXOFF, COUT .Z80 CSEG ;=============================================================== ; DRHBAR - Print Heavy horizontal graphics bar ; Entry: - Top of stack has inline data for bar locn, type & size ; Exit : - None, the bar is printed ; Uses : - None ; Special Requirements: None ;=============================================================== DRHBAR: EX (SP),HL ; Swap HL for Stack data ptr PUSH DE ; Save regs PUSH BC PUSH AF LD A,(HL) ; Get Type byte INC HL ; ..and advance PUSH AF CALL SETUP ; Get data POP AF DRHBA0: CALL GHBAR ; ..and to the work DRHBA2: POP AF ; Restore regs POP BC EX DE,HL ; Put return addr in HL POP DE EX (SP),HL ; Swap Ret addr with Entry HL RET ;=============================================================== ; GHBAR - Print graphics horizontal bar from parms in registers ; Entry: - B = Count of spaces ; C = Direction (0=Left to Right, 1=Right to Left) ; A = Type of bar (0=Thin, 1=Full, 2=Hashed) ; H = Starting Row ; L = Starting Column ; Exit : None. AF,BC,HL destroyed ; Uses : AF,BC,HL ; Special Requirements: Needs expanded TCAP ;============================================================== GHBAR: PUSH AF ; Save Bar type CALL SETDIR ; Calculate direction values, Set cursor POP AF ; Retrieve Bar type LD HL,@GHL OR A ; Thin line? JR Z,GHBAR1 ; ..jump if so LD HL,@GFB DEC A ; Full Bar? (1 --> 0) JR Z,GHBAR1 ; ..jump if so LD HL,@GHB ; Else must be hashed GHBAR1: CALL GRXON ; Go to Graphics mode LD A,(HL) ; Get the Graphic character GHBARL: CALL COUT ; ..and 'print' it DJNZ GHBARL ; ..loop til done JP GRXOFF ; Turn graphics Off and return ;=============================================================== ; DRHORZ - Draw thin graphics horizontal line ; Entry: - Top of stack has parameters ; Exit : - None, the line is printed ; Uses : - None ; Special Requirements: None ;=============================================================== DRHORZ: EX (SP),HL ; Get parm addr PUSH DE ; Save regs PUSH BC PUSH AF CALL SETUP ; Load parms & check bounds XOR A ; Set Type byte to thin line JR DRHBA0 ; ..and continue above ;=============================================================== ; ERAHORZ - Write over graphics horizontal line with spaces ; Entry: - Top of stack has parameters ; Exit : - None, the line is printed ; Uses : - None ; Special Requirements: None ;=============================================================== ERAHORZ: EX (SP),HL ; Get parm addr PUSH DE ; Save regs PUSH BC PUSH AF CALL SETUP ; Load parms & check bounds CALL ERAHBAR ; Do the work JR DRHBA2 ; ..and exit above ;=============================================================== ; ERAHBAR - Write over graphics horizontal line with spaces ; Entry: - B = Count of spaces ; C = Direction (0=L to R, 1=R to L) ; H = Row # to start ; L = Col # to start ; Exit : - None, the line is printed ; Uses : - AF,BC,HL ; Special Requirements: None ;=============================================================== ERAHBAR: CALL SETDIR ; Set direction values, position cursor LD A,' ' ; Overwrite with spaces ERA0: CALL COUT ; ..w/syslib routine DJNZ ERA0 ; Loop til done RET ;..... ; Load parameters from the address in HL. Check for exceeding of left ; margin (<1) and correct starting point and length to fix. ; Return: D=Starting Row, E=Starting Column, B=Number of positions, ; C=Direction (0 for Left-to-right, 1 for Right-to-left) SETUP: LD D,(HL) ; Row INC HL LD E,(HL) ; Col INC HL LD B,(HL) ; # of spaces INC HL LD C,(HL) ; Direction INC HL EX DE,HL ; Put return addr in DE RET ;..... ; Set direction and correct count. Set Cursor start at end SETDIR: LD A,C OR A ; L to R? JR Z,SETDI3 ; ..jump to end if so LD A,L INC A ; Get count, not difference SUB B ; Else subtract length from L margin JR C,SETDI1 ; ..jump if too much LD L,A ; Else set new Col # JR NZ,SETDI3 ; ..and return if >= 1 DEC B ; Shorten length by one JR SETDI2 SETDI1: ADD A,B ; Else add amount of ovfl to count LD B,A DEC B ; ..compensate for previous inc SETDI2: LD L,1 ; Set Start column to 1 SETDI3: JP GOTOXY ; Set cursor location and return to caller END