home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
BEEHIVE
/
ZCAT
/
GRDEMO.LBR
/
GRDEMO.Z80
< prev
next >
Wrap
Text File
|
2000-06-30
|
19KB
|
732 lines
;program grdemo
;version 1.0
;author dennis l. wright
;echelon, inc.
;date 1-23-86
;
;assembly and link with ei zas and zlink using
; syslib, z3lib, vlib, grxlib, grwlib, and pdmlib rel libraries
;
z3env equ 0fe00h
;
CR EQU 0DH
LF EQU 0AH
DIM EQU 1
BRT EQU 2
;
;
; external routines used by demo program
;
EXT TINIT,GXYMSG,CLS,EREOL,CRLF,CIN,COUT,AT,VPRINT,PRINT
EXT DRBOX,ATW,WXYMSG,DRHBAR,DRVBAR
EXT DRVERT,DRHORZ,GRXINIT,OPENW,CLOSEW,CLREOS
EXT LTISEC,RTISEC,UISEC,LISEC,ISEC,DRFULL,DRHASH
EXT ULEFT,URIGHT,LRIGHT,LLEFT,CLEARW,OPENFW
EXT PDMINIT,SETPDM,SELPDM,CLRPDM
;
; program to test graphics and window lib functions
;
JP START
DB 'Z3ENV'
DB 1
Z3EADR: DW Z3ENV
;
START: LD HL,(Z3EADR)
CALL GRXINIT ; Initialize the graphic and Z3 environment
JR NZ,START1
CALL PRINT
DB CR,LF,'*** Extended Z3TCAP not available ***',CR,LF,0
RET
START1: CALL TINIT ; Initialize users terminal
CALL PDMINIT
JR Z,START2
LD A,-1 ; Pull Down Menus and Windows are supported
LD (PDMFLG),A ; Set Pull Down Menu Window flag
START2: LD HL,0
ADD HL,SP
LD (OLDSTK),HL
LD HL,STACK
LD SP,HL
CALL CLS
LD A,(PDMFLG)
OR A ; Pull Down Menus supported?
JP Z,LOGON
CALL SETPDM ; Yes setup GRXLIB pull down menu
DB 1,'GRAPHICS',1
DB 'GRAPHIC PRIMATIVES',2
DB 'Graphic Characters',3
DB 'LINE AND BAR DRAWING',2
DB 'Vertical Routines',3
DB 'Horizontal Routines',3
DB 'ADVANCED GRAPHICS',2
DB 'Box Routine',3
DB 'Graph Demo',3
DB 0
CALL SETPDM ; Setup GRWLIB pull down menu
DB 2,'WINDOWS',1
DB 'WINDOW HANDLING',2
DB 'Introduction',3
DB 'Window Demo',3
DB 0
CALL SETPDM ; Setup PDMLIB pull down menu
DB 3,'PULL-DOWN-MENUS',1
DB 'PULL DOWN MENU ROUTINES',2
DB 'SETPDM Routine',3
DB 'SELPDM Routine',3
DB 'CLRPDM Routine',3
DB 0
CALL SETPDM ; Setup a dummy pull down menu
DB 4,'DUMMY MENU 1',1
DB 'SUBHEADER 1',2
DB 'ITEM 1',3
DB 'ITEM 2',3
DB 'ITEM 3',3
DB 'SUBHEADER 2',2
DB 'ITEM 4',3
DB 'ITEM 5',3
DB 0
LOGON: CALL GXYMSG
DB 3,1
DB ' GRXLIB, GRWLIB AND PDMLIB DEMO'
DB ' PROGRAM',CR,LF
DB CR,LF
DB ' This program demonstrates the use of Graphic,'
DB ' Windowing and Pull ',CR,LF
DB ' Down Menu routines in the GRXLIB.REL,'
DB ' GRWLIB.REL and PDMLIB ',CR,LF
DB ' libraries. GRXLIB, GRWLIB and PDMLIB use'
DB ' the new Z-System extended ',CR,LF
DB ' Z3TCAP information to make them terminal'
DB ' independent. ',CR,LF,LF,0
LD A,(PDMFLG)
OR A
JP NZ,PDMOK
CALL GXYMSG
DB 17,7
DB 'Sorry your Terminal does not support Windows'
DB ' or Pull Down Menus',0
JP MENU ; Can't use pull down menus
;
PDMOK: CALL VPRINT
DB ' Since your terminal has the needed'
DB ' capabilities for Pull Down ',CR,LF
DB ' Menus you will be able to select the demonstrations'
DB ' you want to ',CR,LF
DB ' see by using the pull down selections you'
DB ' see on the top line.',CR,LF
DB CR,LF
DB ' If you look at the top line of your'
DB ' screen you will see a ',CR,LF
DB ' line of Pull Down Menu selections the'
DB ' left most selection is ',CR,LF
DB ' printed in hi-intensity. To move to the'
DB ' other selections use your ',CR,LF
DB ' left and right cursor keys or Control-S'
DB ' (move left), Control-D ',CR,LF
DB ' (move right). Once you reach the desired'
DB ' selection press Return ',CR,LF
DB ' and a Pull Down Menu will appear. You can'
DB ' escape from this menu by ',CR,LF
DB ' pressing the escape key or you can move'
DB ' to a desired menu ',CR,LF
DB ' selection with the up and down cursor keys'
DB ' or Control-R (move up), ',CR,LF
DB ' Control-C (move down). Press Return when'
DB ' at desired selection. ',0
JP PDMENU
;
MENU: CALL WAIT
CALL CLR9
CALL GXYMSG ; Display a conventional menu
DB 12,1
DB ' PLEASE SELECT ONE OF THE FOLLOWING'
DB ' OPTIONS',CR,LF
DB CR,LF
DB ' 1. Graphic Characters',CR,LF
DB ' 2. Vertical Routines',CR,LF
DB ' 3. Horizontal Routines',CR,LF
DB ' 4. Box Routine',CR,LF
DB ' 5. Graph Demo',CR,LF
DB ' 6. Exit Demo Program',0
MENU1: CALL CHOICE
MENU2: LD (OPT),A
CP '1'
JP Z,GCHAR
CP '2'
JP Z,DRV
CP '3'
JP Z,GRAPHIC
CP '4'
JP Z,DRBX
CP '5'
JP Z,GRAF
CP '6'
JP Z,DONE
JR MENU1
;
PDMENU: LD A,(PDMFLG)
OR A ; Pull down menus available?
JP Z,MENU
CALL PDMC
CALL SELPDM ; Enter Pull down Menu mode
JP Z,DONE ; Done if no selection made
LD A,H ; Else get menu number from (H) reg
CP 1 ; Menu 1?
JP Z,DEMO2
CP 2 ; Menu 2?
JP Z,DEMO3
CP 3 ; Menu 3?
JP Z,DEMO4
JP PDMENU
;
DEMO2: LD A,L
CP 1 ; Menu item 1?
JP Z,GCHAR
CP 2
JP Z,DRV
CP 3
JP Z,GRAPHIC
CP 4
JP Z,DRBX
JP GRAF
;
DEMO3 LD A,L
CP 1
JP Z,WINDOW1
JP WINDOW2
;
DEMO4: LD A,L
CP 1
JP Z,SETDMO
CP 3
JP Z,CLRDMO
CALL CLR9
CALL GXYMSG
DB 10,1
DB ' PDMLIB routine SELPDM is used to enter Pull'
DB ' Down Menu Mode. The ',CR,LF
DB ' first Pull Down Selection on the menu'
DB ' line at the top of the ',CR,LF
DB ' screen is printed in hi-intensity and user'
DB ' input to select a menu ',CR,LF
DB ' or move to another selection is awaited.'
DB ' The following code will ',CR,LF
DB ' now be used to enter Pull Down Menu Mode.'
DB ' The return from SELPDM ',CR,LF
DB ' either contains Zero Status, in which case'
DB ' user exited Pull Down ',CR,LF
DB ' Mode without making a selection or Non-Zero'
DB ' Status in which case ',CR,LF
DB ' the register pair (HL) contain the Menu'
DB ' number (H) and the Item ',CR,LF
DB ' number (L) selected.',CR,LF
DB CR,LF
DB ' CALL SELPDM ; Enter'
DB ' Pull Down Menu Mode',CR,LF
DB ' ...',CR,LF
DB ' < Code to interrogate the return status'
DB ' and user selection >',0
JP PDMENU
;
CLRDMO: CALL CLR9
CALL GXYMSG
DB 12,1
DB ' PDMLIB routine CLRPDM is used to clear'
DB ' a Pull Down Menu. The ',CR,LF
DB ' following code will now be used to clear'
DB ' DUMMY MENU 1.',CR,LF
DB CR,LF
DB CR,LF
DB ' LD A,4 ; Menu'
DB ' number in register (A)',CR,LF
DB ' CALL CLRPDM ; Clear'
DB ' the menu',CR,LF
DB 0
CALL WAIT
LD A,4
CALL CLRPDM
JP PDMENU
;
SETDMO: CALL CLR9
CALL GXYMSG
DB 10,1
DB ' PDMLIB routine SETPDM is used to setup a'
DB ' Pull Down Menu. Up to 10 ',CR,LF
DB ' Pull Down Menus can be present at one time'
DB ' as long as the top of ',CR,LF
DB ' screen headers can all fit on the screen.'
DB ' The following code will ',CR,LF
DB ' now be used to setup a new menu.',CR,LF
DB CR,LF
DB ' CALL SETPDM ; Setup the'
DB ' following menu',CR,LF
DB ' DB 5,''DUMMY MENU 2'',1 '
DB '; Menu Number, Header String',cr,lf
DB ' DB ''SUBHEADER'',2 '
DB '; Subheader String (optional)',cr,lf
DB ' DB ''ITEM 1'',3 ; Item String',cr,lf
DB ' DB ''ITEM 2'',3 ; " "',cr,lf
DB ' DB 0 ; End of menu',cr,lf
DB 0
CALL WAIT
CALL SETPDM
DB 5,'DUMMY MENU 2',1
DB 'SUBHEADER',2
DB 'ITEM 1',3
DB 'ITEM 2',3
DB 0
JP PDMENU
;
GRAPHIC:CALL CLR9
CALL GXYMSG
DB 12,1
DB ' The following is a demonstration of GRXLIB'
DB ' graphics routines. The ',CR,LF
DB ' following routine will draw a horizontal'
DB ' line starting at row 17, ',CR,LF
DB ' column 10 The line will be 60 columns long'
DB ' and will be drawn from ',CR,LF
DB ' left to right. ',CR,LF
DB CR,LF
DB ' CALL DRHORZ',CR,LF
DB ' DB 17,10,60,0 ; row,col,length,direction',0
CALL WAIT
CALL CLR9
CALL GXYMSG
DB 14,16
DB 'Horizontal line created by GRXLIB routine DRHORZ',0
CALL DRHORZ
DB 17,10,60,0 ; Row 22, Col 10, 60 columns long, rt to lt
CALL WAIT
DRHB: CALL CLR9
CALL GXYMSG
DB 12,1
DB ' Horizontal bars can also be created using'
DB ' the GRXLIB routine ',CR,LF
DB ' DRHBAR. The following are examples of'
DB ' the GRXLIB horizontal bar ',CR,LF
DB ' routine:',CR,LF,LF
DB ' CALL DRHBAR',CR,LF
DB ' DB 1,16,10,60,0 '
DB '; type, row,col,length,left to right',cr,lf
DB ' CALL DRHBAR',CR,LF
DB ' DB 2,18,69,60,1 '
DB '; type, row,col,length,right to left',0
CALL WAIT
CALL CLR9
CALL GXYMSG
DB 13,16
DB 'Horizontal bars created by GRXLIB routine DRHBAR',0
CALL GXYMSG
DB 16,2
DB 'Type 1',0
CALL DRHBAR ; Draw dark horizontal bar
DB 1,16,10,60,0 ; Row 16, Col 10, 60 columns long, lt to rt
CALL GXYMSG
DB 18,2
DB 'Type 2',0
CALL DRHBAR ; Draw light horizontal bar
DB 2,18,69,60,1 ; Row 18, Col 69, 60 columns long, rt to lt
JP PDMENU
;
DRV: CALL CLR9
CALL GXYMSG
DB 12,1
DB ' The following routine will draw a vertical'
DB ' line starting at row ',CR,LF
DB ' 16, column 38 The line will be 5 rows long'
DB ' and will be drawn from ',CR,LF
DB ' top to bottom.',CR,LF
DB CR,LF
DB ' CALL DRVERT',CR,LF
DB ' DB 16,38,5,0 ; row,col,length,direction',0
CALL WAIT
CALL CLR9
CALL GXYMSG
DB 13,17
DB 'Vertical line created by GRXLIB routine DRVERT',0
CALL DRVERT ; Draw vertical line
DB 16,38,5,0 ; Row 16, Col 40, 5 rows deep, Top down
CALL WAIT
DRVB: CALL CLR9
CALL GXYMSG
DB 12,1
DB ' Vertical bars can also be created using'
DB ' the GRXLIB routine ',CR,LF
DB ' DRVBAR as follows:',CR,LF,LF
DB ' CALL DRVBAR',CR,LF
DB ' DB 1,16,25,5,0'
DB ' ; type,row,col,height,direction',cr,lf
DB ' CALL DRVBAR',CR,LF
DB ' DB 2,16,35,5,0'
DB ' ; type,row,col,height,direction',cr,lf
DB ' CALL DRVBAR',CR,LF
DB ' DB 3,16,45,5,0'
DB ' ; type,row,col,height,direction',cr,lf
DB ' CALL DRVBAR',CR,LF
DB ' DB 4,16,55,5,0'
DB ' ; type,row,col,height,direction',0
CALL WAIT
CALL CLR9
CALL GXYMSG
DB 12,17
DB 'Vertical bars created by GRXLIB routine DRVBAR',0
CALL GXYMSG
DB 14,22
DB 'Type 1',0
CALL GXYMSG
DB 14,32
DB 'Type 2',0
CALL GXYMSG
DB 14,42
DB 'Type 3',0
CALL GXYMSG
DB 14,52
DB 'Type 4',0
CALL DRVBAR
DB 1,16,25,5,0
CALL DRVBAR
DB 2,16,35,5,0
CALL DRVBAR
DB 3,16,45,5,0
CALL DRVBAR
DB 4,16,55,5,0
JP PDMENU
;
GCHAR: CALL CLR9
CALL GXYMSG
DB 12,1
DB ' GRXLIB contains routines to draw individual'
DB ' graphics characters. ',CR,LF
DB ' The routines LTISEC (draw left intersect),'
DB ' RTISEC (draw right ',CR,LF
DB ' intersect), UISEC (draw upper intersect),'
DB ' LISEC (draw lower ',CR,LF
DB ' intersect), ISEC (draw intersection), DRFULL'
DB ' (draw full block), ',CR,LF
DB ' DRHASH (draw hashed block), and ULEFT,'
DB ' URIGHT, LRIGHT, LLEFT ',CR,LF
DB ' (corner drawing routines) are demonstrated.',0
CALL WAIT
CALL CLR9
CALL GXYMSG
DB 13,13
DB 'Individual graphics characters supported by GRXLIB',0
CALL AT
DB 16,18
CALL ULEFT ; Draw upper left corner
CALL AT
DB 16,38
CALL UISEC ; Draw upper intersect
CALL AT
DB 16,58
CALL URIGHT ; Draw upper right corner
CALL AT
DB 18,18
CALL LTISEC ; Draw left intersect
CALL AT
DB 18,38
CALL ISEC ; Draw intersection
CALL AT
DB 18,58
CALL RTISEC ; Draw right intersect
CALL AT
DB 20,18
CALL LLEFT ; Draw lower left corner
CALL AT
DB 20,38
CALL LISEC ; Draw lower intersect
CALL AT
DB 20,58
CALL LRIGHT ; Draw lower right corner
CALL AT
DB 18,28
CALL DRFULL ; Draw full block
CALL AT
DB 18,48
CALL DRHASH ; Draw hashed block
JP PDMENU
;
DRBX: CALL CLR9
CALL GXYMSG
DB 12,1
DB ' The following is an example of the GRXLIB'
DB ' DRBOX routine. this ',CR,LF
DB ' example will draw a box starting at row'
DB ' 16, column 10 The box ',CR,LF
DB ' will be 5 rows high and 20 columns wide.',CR,LF
DB CR,LF
DB ' CALL DRBOX',CR,LF
DB ' DB 16,10,5,20 ; row,col,height,width',0
CALL WAIT
CALL CLR9
CALL GXYMSG
DB 13,3
DB 'Box drawn with GRXLIB routine DRBOX',0
CALL DRBOX ; Draw a box
DB 16,10,5,20 ; Row 16, col 10, 5 X 20
JP PDMENU
;
GRAF: CALL CLR9
CALL GXYMSG
DB 12,1
DB ' The next demonstration will show how by'
DB ' combining the GRXLIB ',CR,LF
DB ' routines DRBOX, and DRVBAR a bar graph'
DB ' chart can be created.',0
CALL WAIT
CALL CLR9
CALL DRBOX ; Draw a box
DB 11,10,11,60 ; Row 12, col 10, 11 X 60
CALL GXYMSG
DB 12,3 ; Vertical descriptors
DB '100% - ',0
CALL GXYMSG
DB 16,4
DB '50% - ',0
CALL GXYMSG
DB 20,5
DB '0% _ ',0
CALL GXYMSG
DB 22,18 ; Horizontal descriptors
DB '1976',0
CALL GXYMSG
DB 22,26
DB '1977',0
CALL GXYMSG
DB 22,34
DB '1978',0
CALL GXYMSG
DB 22,42
DB '1979',0
CALL GXYMSG
DB 22,50
DB '1980',0
CALL GXYMSG
DB 22,58
DB '1981',0
CALL DRVBAR ; Draw dark vertical bar
DB 2,20,18,5,1 ; Row 19, col 18, 5 rows deep, bottom up
CALL DRVBAR ; Draw light vertical bar
DB 4,20,20,3,1 ; Row 19, col 20, 3 rows deep, bottom up
CALL DRVBAR ; Draw dark vertical bar
DB 2,20,26,6,1 ; Row 19, col 26, 6 rows deep, bottom up
CALL DRVBAR ; Draw light vertical bar
DB 4,20,28,4,1 ; Row 19, col 28, 4 rows deep, bottom up
CALL DRVBAR
DB 2,20,34,7,1
CALL DRVBAR
DB 4,20,36,6,1
CALL DRVBAR
DB 2,20,42,8,1
CALL DRVBAR
DB 4,20,44,8,1
CALL DRVBAR
DB 2,20,50,8,1
CALL DRVBAR
DB 4,20,52,9,1
CALL DRVBAR
DB 2,20,58,7,1
CALL DRVBAR
DB 4,20,60,9,1
JP PDMENU
;
WINDOW1:CALL CLR9
CALL GXYMSG
DB 12,1
DB ' INTRODUCTION TO GRWLIB WINDOW'
DB ' ROUTINES',CR,LF
DB CR,LF
DB ' GRWLIB contains routines to create and maintain'
DB ' up to 16 separate ',CR,LF
DB ' on screen windows. GRWLIB supports two types'
DB ' of windows, framed ',CR,LF
DB ' windows (those which are surrounded by'
DB ' a bold boarder) and ',CR,LF
DB ' standard windows (those which are surrounded'
DB ' by a thin line). ',CR,LF
DB ' Routines are provided to create (OPENW, '
DB ' OPENFW), clear (CLEARW), ',CR,LF
DB ' position cursor and print in (ATW, WXYMSG),'
DB ' interrogate (GETCUR, ',CR,LF
DB ' GETLEV), and close (CLOSEW), windows.',0
JP PDMENU
;
WINDOW2:CALL CLR9
CALL GXYMSG
DB 12,1
DB ' The following demonstrations will demonstrate'
DB ' the use of some of ',CR,LF
DB ' the routines in the GRWLIB window library.'
DB ' GRWLIB contains ',CR,LF
DB ' routines to create and maintain up to 16'
DB ' separate windows the ',CR,LF
DB ' following routine will open window number'
DB ' 1 starting at row 2, ',CR,LF
DB ' column 33 The window will be framed 15'
DB ' rows high and 42 columns ',CR,LF
DB ' wide.',CR,LF
DB CR,LF
DB ' LD DE,SAVBUF ; Address of buffer'
DB ' to save current screen',CR,LF
DB ' CALL OPENFW ; Open a framed window',cr,lf
DB ' DB 1,2,33,15,42 '
DB '; window number,row,col,height,width',0
CALL WAIT
LD DE,SBUFF1
CALL OPENFW
DB 1,2,33,15,42
LD A,1
CALL CLEARW
CALL WXYMSG
DB 1,2,5
DB 'THIS IS A GRWLIB FRAMED WINDOW',0
CALL WXYMSG
DB 1,4,2
DB 'Data was printed in this window using',0
CALL WXYMSG
DB 1,5,2
DB 'calls to GRWLIB routines CLEARW and',0
CALL WXYMSG
DB 1,6,2
DB 'WXYMSG as follows:',0
CALL WXYMSG
DB 1,8,4
DB 'LD A,WINDOW ; Window # in (A)',0
CALL WXYMSG
DB 1,9,4
DB 'CALL CLEARW ; Clear the window',0
CALL WXYMSG
DB 1,10,4
DB 'CALL WXYMSG ; Send the message',0
CALL WXYMSG
DB 1,11,4
DB 'DB WINDOW,ROW,COL',0
CALL WXYMSG
DB 1,12,4
DB 'DB ''MESSAGE'',0',0
CALL WAIT
LD DE,SBUFF2
CALL OPENW
DB 2,9,14,10,36
LD A,2
CALL CLEARW
CALL WXYMSG
DB 2,2,2
DB 'THIS IS A GRWLIB STANDARD WINDOW',0
CALL WXYMSG
DB 2,4,2
DB 'This window was created with the',0
CALL WXYMSG
DB 2,5,2
DB 'GRWLIB routine OPENW.',0
CALL WXYMSG
DB 2,7,2
DB 'As can be seen windows can be',0
CALL WXYMSG
DB 2,8,2
DB 'overlayed.',0
CALL WAIT
LD DE,SBUFF3
CALL OPENFW
DB 3,4,3,11,56
LD A,3
CALL CLEARW
CALL WXYMSG
DB 3,2,4
DB DIM,'To insure that the ',BRT,'original screen',DIM
DB ' is properly',0
CALL WXYMSG
DB 3,3,4
DB 'restored, windows should be closed in the reverse',0
CALL WXYMSG
DB 3,4,4
DB 'order from which they were opened. The GRXLIB',0
CALL WXYMSG
DB 3,5,4
DB 'routine ',BRT,'CLOSEW',DIM,' is used as follows:',BRT,0
CALL WXYMSG
DB 3,7,4
DB ' LD A,WINDOW NUMBER',0
CALL WXYMSG
DB 3,8,4
DB ' CALL CLOSEW',0
CALL WAIT1
LD A,3
CALL CLOSEW
CALL WAIT2
LD A,2
CALL CLOSEW
CALL WAIT3
LD A,1
CALL CLOSEW
JP PDMENU
;
DONE: CALL CLR9
XOR A ; Clear all pull down menus
CALL CLRPDM
CALL GXYMSG
DB 17,12
DB ' This concludes the GRXLIB/GRWLIB/PDMLIB demonstration. ',0
CALL AT
DB 23,1
LD HL,(OLDSTK)
LD SP,HL
RET
;
CHOICE: CALL GXYMSG
DB 24,1
DB DIM,' Enter your choice: ',BRT,0
JP WCIN
;
PDMC: CALL GXYMSG
DB 24,1
DB DIM,' Select Pull Down Menu or Press <ESC> '
DB 'to quit: ',BRT,0
RET
;
WAIT: CALL GXYMSG
DB 24,1
DB DIM,' Press any key to continue: ',BRT,0
JP WCIN
;
WAIT1: CALL GXYMSG
DB 24,1
DB DIM,' Press any key to close window 3: ',BRT,0
JP WCIN
;
WAIT2: CALL GXYMSG
DB 24,1
DB DIM,' Press any key to close window 2: ',BRT,0
JP WCIN
;
WAIT3: CALL GXYMSG
DB 24,1
DB DIM,' Press any key to close window 1: ',BRT,0
;
WCIN: CALL CIN
PUSH AF
LD A,CR
CALL COUT
CALL EREOL
POP AF
RET
;
CLR9: CALL AT
DB 9,1
CALL CLREOS
RET
;
PDMFLG: DB 0
OPT: DB 0
SBUFF1: DS 2000
SBUFF2: DS 2000
SBUFF3: DS 2000
OLDSTK: DW 0
DS 128
STACK EQU $
;
; end test program
;