home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
DRI-archive
/
roche
/
NCRGRAF.ASM
< prev
next >
Wrap
Assembly Source File
|
2009-12-11
|
61KB
|
3,019 lines
; NCRGRAF.ASM
; -----------
;
; NCR Decision Mate V - NCRGRAF.REL
;
; Disassembled by:
;
; ROCHE Emmanuel
; 8 rue HERLUISON
; 10000 TROYES
; FRANCE
; ------
;
;--------------------------------
;
; Summary of graphics routines
; ----------------------------
;
; NAME BASIC FORMAT PARAMETERS DESCRIPTION
; ---- ------------ ---------- -----------
;
; GARC GARC (R,S,E) R = 1:255 Arc with radius R,
; S = -360:360 starting angle S,
; E = -360:360 and ending angle E.
;
; GBOX GBOX (H,V,D) H = 1:640 Filled rectangle with
; V = 1:640 sides of length H and V,
; D = 0:7 drawn in direction D.
;
; GCIRCL GCIRCL (R) R = 1:255 Circle with radius R.
;
; GCLEAR GCLEAR Erase screen.
;
; GEXIT GEXIT Leave graphics mode.
;
; GINIT GINIT Initialize graphics mode.
;
; GLINE GLINE (X,Y) X = 0:639 Line from cursor to (X,Y).
; Y = 0:399
;
; GMODE GMODE (M) M = 0:3 Drawing mode.
;
; GPATT GPATT (P) P = 0:15 Pattern to fill box or line.
;
; GPOINT GPOINT (X,Y) X = 0:639 Set cursor at (X,Y).
; Y = 0:399
;
; GPRINT GPRINT (P,L) P = 0,1,2,4,5 Output screen image to printer P
; L = 0:99 with linefeed L.
;
; GRECT GRECT (H,V,D) H = 2:640 Rectangle with sides
; V = 2:640 of length H and V,
; D = 0:7 drawn in direction D.
;
; GTEXT GTEXT (A$,D) A$ = ASCII string Draw A$
; D = 0:7 in direction D.
;
; GZOOM GZOOM (Z) Z = 0:15 Zoom parameter for text and boxes.
;
;--------------------------------
;
; NCRGRAF and assembler programs
; ------------------------------
;
; To program graphics on the NCR DECISION MATE V with an
; assembler program, all graphics routines must be declared as
; externals in your program. The address of the first parameter
; for a routine must be in register pair HL; the address of the
; second parameter must be in register pair DE; and the address
; of the third parameter must be in register pair BC.
;
; The integer parameters are always stored with 2 bytes,
; low-order first. The string parameters are stored with 3
; bytes. The first byte is the length of the string and the
; second and third bytes contain the address of the actual
; text.
;
; The program should be assembled with the MACRO-80
; assembler from MICROSOFT (or any other relocatable assembler)
; and then linked with NCRGRAF.REL.
;
;--------------------------------
;
PAGE 0 ; Listing without page breaks
;
;--------------------------------
;
NAME 'NCR11R' ; REL module name
;
PUBLIC GSTAT ; Error status byte
PUBLIC GINIT ; Erase screen and init graphics memory
PUBLIC GPOINT ; Set cursor at (X,Y) on screen
PUBLIC GZOOM ; Select param for text and boxes
PUBLIC GCIRCL ; Draw a circle with radius R
PUBLIC GLINE ; Draw a line from cur pos to (X,Y)
PUBLIC GBOX ; Draw a filled rectangle (H,V,D)
PUBLIC GRECT ; Draw a rectangle (H,V,D)
PUBLIC GPATT ; Select a pattern for a box/line
PUBLIC GMODE ; Select the drawing mode
PUBLIC GTEXT ; Draw a string in a given direction
PUBLIC GEXIT ; Era screen, leaves graph mode and exit
PUBLIC GPRINT ; Outputs screen image to printer
PUBLIC GARC ; Draw an arc with radius, start/end angle
PUBLIC GCLEAR ; Era screen but don't reset some values
;
;--------------------------------
; CP/M-related equates (used only one time: in GEXIT)
;
conout equ 2 ; Console output
ctrlZ equ 1AH ; = CLS (CLear Screen)
bdos equ 0005H ; Basic Disk Operating System
;
;--------------------------------
; NEC uPD7220 GDC commands (Cf. "Data Sheet", p.3-8-14)
;
status equ 0A0H ; Status register
FIFO equ 0A1H ; FIFO buffer
;
; Video control commands:
;
RESET1 equ 00H ; 0000 0000
RESET2 equ 01H ; 0000 0001
RESET3 equ 09H ; 0000 1001
SYNC equ 0EH ; 0000 111 DE (0EH or 0FH)
VSYNC equ 6EH ; 0110 111 M (6EH or 6FH)
CCHAR equ 4BH ; 0100 1011
;
; Display control commands:
;
START equ 6BH ; 0110 1011
BCTRL1 equ 0CH ; 0000 110 DE (0CH or 0DH)
BCTRL2 equ 05H ; 0000 0101
ZOOM equ 46H ; 0100 0110
CURS equ 49H ; 0100 1001
PRAM equ 70H ; 0111 SA (70H to 7FH)
PITCH equ 47H ; 0100 0111
;
; Drawing control commands:
;
WDAT equ 20H ; 001 TYPE 0 MOD
MASK equ 4AH ; 0100 1010
FIGS equ 4CH ; 0100 1100
FIGD equ 6CH ; 0110 1100
GCHRD equ 68H ; 0110 1000
;
; Data read commands:
;
RDAT equ 0A0H ; 101 TYPE 0 MOD
CURD equ 0E0H ; 1110 0000
LPRD equ 0C0H ; 1100 0000
;
; DMA control commands:
;
DMAR equ 0A4H ; 101 TYPE 1 MOD
DMAW equ 24H ; 001 TYPE 1 MOD
;
; DE bits:
;
DE0 equ 0 ; Display blanked
DE1 equ 1 ; Display enabled
;
; M bits:
;
M0 equ 0 ; Slave Mode
M1 equ 1 ; Master Mode
;
; SA bits: SA means "Starting Address in Parameter RAM"
; 1 to 16 (zero-based) bytes to be loaded into the Parameter
; RAM, starting at the RAM address specified by SA.
;
; TYPE bits:
;
TYPE00 equ 0 ; Word: Low then High Byte
TYPE01 equ 1 ; Invalid
TYPE10 equ 2 ; Low Byte of the Word only
TYPE11 equ 3 ; High Byte of the Word only
;
; MOD bits:
;
MOD00 equ 0 ; REPLACE with pattern
MOD01 equ 1 ; COMPLEMENT
MOD10 equ 2 ; RESET to zero
MOD11 equ 3 ; SET to one
;
;--------------------------------
; Error status byte
;
GSTAT: DB 00H
;
;
; The routine GINIT sets this status byte to 00H and,
; when an error occurs, drawing stops and this byte is changed
; to a number greater than 00H.
;
;
; Error code Routine Description
; ---------- ------- -----------
;
; 1 GPOINT The X coordinate is less than 0.
; 2 GPOINT The X coordinate is greater than 639.
; 3 GPOINT The Y coordinate is less than 0.
; 4 GPOINT The Y coordinate is greater than 399.
; 5 GLINE The X coordinate is less than 0.
; 6 GLINE The X coordinate is greater than 639.
; 7 GLINE The Y coordinate is less than 0.
; 8 GLINE The Y coordinate is greater than 399.
; 10 GZOOM The zomm parameter is out of range.
; 20 GCIRCL The radius parameter is out of range.
; 21 GARC The radius parameter is out of range.
; 22 GARC The starting angle is less than -360.
; 23 GARC The starting angle is greater than 360.
; 24 GARC The ending angle is less than -360.
; 25 GARC The ending angle is greater than 360.
; 30 GBOX The direction parameter is out of range.
; GRECT
; 40 GPATT The pattern parameter is out of range.
; 50 GMODE The mode parameter is out of range.
; 60 GTEXT The direction parameter is out of range.
; 70 GPRINT The printer selector is out of range.
; 71 GPRINT The linefeed parameter is out of range.
; 80 GRECT The H parameter is less than 2.
; GBOX The H parameter is less than 1.
; 81 GRECT The H parameter is greater than 640.
; GBOX The H parameter for a zoomed box is greater than 640.
; 82 GRECT The V parameter is less than 2.
; GBOX The V parameter is less than 1.
; 83 GRECT The V parameter is greater than 640.
; GBOX The V parameter for a zoomed box is greater than 640.
;
; NOTE: If a picture is drawn over the edges of the CRT screen,
; it will extend over the other parts of the screen and no error
; status byte is set.
;
;--------------------------------
;
noerr: LDA GSTAT
CPI 00H ; No error ?
JNZ finis ; Go back to calling routine
RET
;
;--------------------------------
;
noerH: MOV A,H
CPI 00H ; No error ?
JM noerB
CMP D
JNC noerC
DCR D
CMP D
JZ noerL
RET
;
;--------------------------------
;
noerL: MOV A,L
CMP E
JNC noerC
RET
;
;--------------------------------
;
noerB: MOV A,B
STA GSTAT
JMP noerr
;
;--------------------------------
;
noerC: MOV A,C
STA GSTAT
JMP noerr
;
;--------------------------------
;
errH: MOV A,H
CPI 00H ; No error ?
JNZ errD
MOV A,L
CMP E
JNC errD
RET
;
;--------------------------------
;
errD: MOV A,D
STA GSTAT
JMP noerr
;
;--------------------------------
;
param1: DB 00H ; ZOOM param (no zoom)
DB 00H ; CCHAR param (no cursor)
DB 00H ; PRAM params: P1
DB 00H ; P2
DB 00H ; P3
DB 59H ; P4
DB 00H ; P5
DB 00H ; P6
DB 00H ; P7
DB 59H ; P8
DB 0FFH ; P9
DB 0FFH ; P10
DB 0FFH ; P11
DB 0FFH ; P12
DB 0FFH ; P13
DB 0FFH ; P14
DB 0FFH ; P15
DB 0FFH ; P16
DB 00H ; CURS params: P1
Do0154: DB 00H ; P2
DB 00H ; P3
DB 0FFH ; MASK params: P1: 0FFFFH
DB 0FFH ; P2
DB 02H ; FIGS params: P1: 02H: DIR (right)
DB 0FFH ; P2: 7FFFH
DB 7FH ; P3
DB 08H ; P4: 0008H
DB 00H ; P5
DB 08H ; P6: 0008H
DB 00H ; P7
DB 0FFH ; P8: 3FFFH
DB 3FH ; P9
DB 0FFH ; P10: 3FFFH
DB 3FH ; P11
DB 0FFH ; WDAT params: P1
DB 0FFH ; P2
;
param2: DB 8FH ; CHAR param: (display cursor)
DB 00H ; ZOOM param: (no zoom)
DB 00H ; PRAM params: P1
DB 00H ; P2
DB 00H ; P3
DB 19H ; P4
DB 00H ; P5
DB 00H ; P6
DB 00H ; P7
DB 19H ; P8
DB 0FFH ; P9
DB 0FFH ; P10
DB 0FFH ; P11
DB 0FFH ; P12
DB 0FFH ; P13
DB 0FFH ; P14
DB 0FFH ; P15
DB 0FFH ; P16
;
;--------------------------------
; Transfer parameters from memory to register pair HL.
;
loadHL: MOV E,M ; HL = M(HL)
INX H
MOV D,M
XCHG
RET
;
;--------------------------------
; Save area for register pairs HL, DE and BC.
;
saveHL: DW 0000H ; BASIC First parameter
saveDE: DW 0000H ; BASIC Second parameter
saveBC: DW 0000H ; BASIC Third parameter
;
;--------------------------------
; Erase the screen and initialize the graphics memory.
; Sets default values for GPATT (P = 0), GZOOM (Z = 0),
; GMODE (M = 0) and GSTAT (0).
; GINIT (or GCLEAR) must be the first graphics statement
; in a program.
; If a special terminal function, for example: reverse video,
; is set before starting graphics, GINIT will reset this.
;
GINIT: LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
NOP ; ???
SUB A ; Why not XOR A ??? (complement Carry)
STA GSTAT ; GSTAT = 00H
STA valueP ; P = 00H
STA valueZ ; Z = 00H
MVI A,20H ; (WDAT command with MOD: REPLACE)
STA valueM ; M = 20H (WDAT command...)
CALL init ; CLS and init graphics memory
JMP finis ; Go back to calling routine
;
;--------------------------------
; Erase the screen and initialize the graphics memory
; WITHOUT resetting the values for GPATT, GZOOM,
; GMODE and GSTAT.
;
GCLEAR: LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
CALL init ; CLS and init graphics memory
JMP finis ; Go back to calling routine
;
;---------------------------------
; Erase the screen and initialize the graphics memory.
;
init: CALL noerr
MVI A,0CH ; BCTRL1: display blanked
CALL outA
LXI H,param1 ; String of GDC bytes
CALL outzom ; (no zoom)
CALL outCHR ; (no cursor)
CALL outPRM ; (load Parameter RAM)
XRA A
STA Do0154 ; ???
MVI B,03H ; 4 times init2 (4 banks of RAM ?)
init2: CALL outCRS
CALL outMSK
CALL outFGS
MVI A,22H ; WDAT (type: word, mod: reset to zero)
CALL outA
MVI C,02H ; 2 bytes follow
CALL outC
LXI H,Do0154 ; ???
MOV A,M
ADI 40H ; ???
MOV M,A
DCX H
DCR B
JNZ init2
LDA valueM ; Outputs Mode value
CALL outA
CALL gpat2 ; Outputs Pattern bytes
LXI H,valueZ ; Outputs Zoom value
CALL outzom
MVI A,0DH ; BCTRL1: display enabled
CALL outA
LXI H,0001H
SHLD startX ; Position cursor at lower
SHLD startY ; left corner of screen
CALL point2 ; Position cursor at (startX,startY)
RET
;
;--------------------------------
; Erase the screen, leave the graphics mode
; and return to the alpha mode.
; GEXIT should always be used to leave the graphics mode.
; After GEXIT is called, the next graphics routine must
; begin with GINIT.
;
GEXIT: NOP ; ???
LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
LXI H,param2 ; String of GDC bytes
CALL outCHR ; (display cursor)
CALL outzom ; (no zoom)
CALL outPRM ; ???
MVI E,ctrlZ ; = CLS (CLear Screen)
MVI C,conout ; Console output
CALL BDOS
JMP finis ; Go back to calling routine
;
;--------------------------------
; Set the cursor at a specific point (X,Y) on the screen.
; The valid range of values for X is 0:639.
; The valid range of values for Y is 0:399.
; The coordinates (0,0) set the cursor at the lower left
; corner of the screen.
; GPOINT should be used in conjunction with GCIRCL,
; GRECT, GBOX, GLINE and GTEXT to define the starting
; point of these routines.
; Calling GPOINT sets the cursor at a specific point
; on the screen, but the point remains invisible.
; To see the point, call GLINE using the same X and Y
; coordinates as GPOINT.
;
GPOINT: SHLD saveHL ; X value
XCHG
SHLD saveDE ; Y value
LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
CALL noerr
LHLD saveHL ; Load X value
CALL loadHL
LXI D,0380H ; 0280H = 640 (check for 0:639)
LXI B,0102H ; 01H = error 1, 02H = error 2
CALL noerH
INX H
SHLD startX ; X = X + 1 (so 0 = first pixel)
LHLD saveDE ; Load Y value
CALL loadHL
LXI D,0290H ; 0190H = 400 (check for 0:399)
LXI B,0304H ; 03H = error 3, 04H = error 4
CALL noerH
INX H
SHLD startY ; Y = Y + 1 (so 0 = first pixel)
CALL point2 ; Position cursor at (X,Y)
JMP finis ; Go back to calling routine
;
;--------------------------------
; Position cursor at (X,Y) (contained in startX, startY)
;
point2: CALL EADdAD ; Compute EAD and dAD
LXI H,Do0995 ; save a 2 bytes value
CALL outCRS ; CURSor position
RET
;
;--------------------------------
; Select a zoom parameter for text and boxes.
; The valid range of values for Z is 0:15 (default = 0).
; (Refer to GBOX and GTEXT for the specific zoom formulas.)
; Once a specific zoom parameter is set, it remains so
; until another GZOOM or GINIT routine is called.
;
GZOOM: SHLD saveHL ; Zoom value
LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
CALL noerr
LHLD saveHL ; Load zoom value
CALL loadHL
LXI D,0A10H ; Check for 0:15 (0AH = error 10)
gzoom2: CALL errH
XCHG
LXI H,valueZ ; Zoom value
MOV M,E
CALL outzom ; Outputs zoom parameter
JMP finis ; Go back to calling routine
;
;--------------------------------
; Draw a circle with the radius R.
; The valid range of values for R is 1:255.
; The center of the circle is defined with GPOINT.
;
GCIRCL: SHLD saveHL ; Radius R
LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
CALL noerr
LXI H,0000H ; Starting angle = 0 degrees
SHLD angleS
LXI H,0168H ; Ending angle = 360 degrees
SHLD angleE
LXI D,14FFH ; Check for 1:255 (14H = error 20)
JMP garc3 ; End of GARC routine below
;
;--------------------------------
; Draw an arc with radius R, starting angle S
; and ending angle E.
; The valid range of values for R is 1:255.
; The valid range of values for S and E is -360 to +360.
; (A starting angle S of +360 is equal to 0.)
; GPOINT defines the center and the arc is drawn
; starting at angle S and ending at angle E.
; Arcs are always drawn counterclockwise.
;
GARC: SHLD saveHL ; Radius R
XCHG
SHLD saveDE ; Starting angle S
LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
CALL noerr
MOV L,C
MOV H,B
SHLD saveBC ; Ending angle E
LHLD saveDE ; Load starting angle S
CALL loadHL
SHLD angleS
LXI D,0168H ; = 360 degrees ?
DAD D
LXI D,03D1H ; 02D1H = 721 (360+360+1)
LXI B,1617H ; 16H = error 22, 17H = error 23
CALL noerH
LHLD angleS
LXI B,0168H ; = 360 degrees
CALL garc8
SHLD angleS
LHLD saveBC ; Load ending angle E
CALL loadHL
SHLD angleE
garc2: LXI D,0168H ; = 360 degrees ?
DAD D
LXI D,03D1H ; 02D1H = 721 (360+360+1)
LXI B,1819H ; 18H = error 24, 19H = error 25
CALL noerH
LHLD angleE
LXI B,0169H ; = 0169H = 361
CALL garc8
SHLD angleE
LXI D,15FFH ; Check for 1:255 (15H = error 21)
garc3: PUSH D
LHLD saveHL ; Load radius R
CALL loadHL
DCX H ; R = R - 1 (because overflow with 255)
POP D
CALL errH ; (Check for 1:255)
INX H ; R = R + 1
SHLD radius
CALL garc31
CALL garc32
CALL garc33
CALL garc34
CALL garc35
CALL garc36
LDA Do0AEB
STA Do0AE6
LXI H,Io0AEC
SUB M
JNZ garc4
CALL garc37
JMP garc7
;
;--------------------------------
;
garc4: CALL garc41
CALL garc42
garc5: CALL garc51
CALL garc52
LHLD Do0AE7
LXI B,0FFD3H ; 211
DAD B
JNC garc6
CALL garc53
MVI A,2DH ; "-" (2DH = 45)
STA Do0AE9
JMP garc5
;
;--------------------------------
;
garc6: CALL C$0C3F
garc7: JMP finis ; Go back to calling routine
;
;--------------------------------
;
garc8: LXI D,0168H ; = 360 degrees ?
MOV A,H
CPI 00H
JP garc9
DAD D
JMP garcA
;
;--------------------------------
;
garc9: LXI D,0FE98H ; 98H = 152
CMP B
JNZ garcA
MOV A,L
CMP C
JNZ garcA
DAD D
garcA: RET
;
;--------------------------------
; Draw a line from the current cursor position to the point (X,Y).
; The valid range of values for X is 0:639.
; The valid range of values for Y is 0:399.
; Call GPOINT to define the starting point for the GLINE routine.
; Calling subsequent GLINE routines without defining a new
; starting point causes the end point of one line to be
; the starting point of the next line.
; (The cursor is positioned one point ahead of the end point
; after drawing a line. Use GPOINT for exact cursor positioning
; each time GLINE is called.)
; GPATT may be used in conjunction with GLINE to draw different
; line patterns (see GPATT).
;
GLINE: SHLD saveHL ; X value
XCHG
SHLD saveDE ; Y value
LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
CALL noerr
LHLD saveHL ; Load X value
CALL loadHL
LXI D,0380H ; 0280H = 640
LXI B,0506H ; 05H = error 5, 06H = error 6
CALL noerH
INX H ; X = X + 1 (so 0 = first pixel)
SHLD endX
LHLD saveDE ; Load Y value
CALL loadHL
LXI D,0290H ; 0190H = 400
LXI B,0708H ; 07H = error 7, 08H = error 8
CALL noerH
INX H ; Y = Y + 1 (so 0 = first pixel)
SHLD endY
CALL line2 ; Compute everything
LXI H,FIGSP1 ; Specify line to draw
CALL outFG2 ; Outputs line specification
MVI A,6CH ; FIGD: draw the line
CALL outA
JMP finis ; Go back to calling routine
;
;--------------------------------
;
gboxz: DB 00H ; GBOX Zoom value
gboxp: DW 0000H ; GBOX Pattern value
;
;--------------------------------
; Draw a filled rectangle with sides of length H and V
; in direction D. (H is the number of pixels in the
; horizontal line and V is the number of pixels in the
; vertical line.)
; The valid range of values for H and V is 1:640.
; The valid range of values for D is 0:7 (see GRECT).
; GPOINT defines the lower left corner of the box.
; The pattern that fills the box is selected with the
; GPATT routine and the size of the box is affected
; by the GZOOM routine. Assuming the zoom parameter
; is Z, then the actual length of the sides of the
; box are H=H*(Z+1) and V=V*(Z+1). Make sure the
; results of these calculations do not exceed 640 for H and V.
;
GBOX: SHLD saveHL ; H value
LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
MVI A,01H
STA valueD ; Direction = 01H (45 degrees ?)
LXI H,0FFFFH
SHLD gboxp ; GBOX Pattern value = 0FFFFH
LHLD saveHL
PUSH H
LHLD valueZ ; Zoom value
MOV A,L
ADI 01H
STA gboxz ; GBOX Zoom value
POP H
JMP grect2 ; End of GRECT routine below
;
;--------------------------------
; Draw a rectangle with sides of length H and V in direction D.
; (H is the number of pixels in the horizontal line
; and V is the number of pixels in the vertical line.)
; The valid range of values for H is 2:640.
; The valid range of values for V is 2:640.
; The valid range of values for D is 0:7.
; GPOINT defines the lower left corner of the rectangle.
; The direction D rotates the rectangle counterclockwise
; in steps of 45 degrees around the cursor.
;
GRECT: SHLD saveHL ; H value
LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
MVI A,00H
STA valueD ; Direction = 00H (0 degrees)
ADI 01H
STA gboxz ; GBOX Zoom value = 01H
LXI H,0FFFEH
SHLD gboxp ; GBOX Pattern value = 0FFFEH
grect2: CALL noerr
XCHG
SHLD saveDE ; V value
MOV L,C
MOV H,B
SHLD saveBC ; D value
CALL loadHL
LXI D,1E08H ; Check for 0:7 (1EH = error 30)
CALL errH
MOV A,L
STA rectD
LHLD saveHL ; Load H value
CALL loadHL
SHLD rectH
LXI B,5051H ; 50H = error 80, 51H = error 81
CALL grect4
LHLD saveDE ; Load V value
CALL loadHL
SHLD rectV
LXI B,5253H ; 52H = error 82, 53H = error 83
CALL grect4
LHLD rectD ; Load D value
MOV A,H
ANI 0FH ; 15
JNZ grect3
CALL grect9
LXI H,FIGSP1 ; Specify rectangle
CALL outFG2
MVI A,6CH ; FIGD: draw the rectangle
CALL outA
JMP finis ; Go back to calling routine
;
;--------------------------------
;
grect3: CALL grec31
LXI H,FIGSP1 ; Specify rectangle
CALL outFG2
MVI A,68H ; GCHRD: area filling
CALL outA
JMP finis ; Go back to calling routine
;
;--------------------------------
;
grect4: XCHG
MVI H,00H
MVI L,00H
LDA gboxz ; GBOX Zoom value
grect5: DAD D
DCR A
JNZ grect5
XCHG
LHLD gboxp ; GBOX Pattern value
XCHG
DAD D
PUSH H
LXI H,0381H ; 0281H = 641
DAD D
XCHG
POP H
CALL noerH ; (check for 2:640)
RET
;
;--------------------------------
; Select a pattern that fills a box or a line.
; The valid range of values for P is 0:15 (defaut = 0).
; Once a specific pattern is set, it remains so until
; another GPATT or GINIT routine is called.
; NOTE: Arcs, circles, and rectangles are drawn with
; the selected line pattern.
;
GPATT: SHLD saveHL ; Pattern value
LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
CALL noerr
LHLD saveHL ; Load pattern
CALL loadHL
LXI D,2810H ; Check for 0:15 (28H = error 40)
CALL errH
MOV A,L
STA valueP ; Pattern value
CALL gpat2 ; Outputs pattern bytes
JMP finis ; Go back to calling routine
;
;--------------------------------
;
gpat2: LDA valueP ; Pattern value
MVI H,00H
MOV L,A
DAD H
DAD H ; Each pattern is 8 bytes long
DAD H
LXI D,tablin ; Table of line patterns
DAD D
CALL outpat ; Outputs pattern bytes
RET
;
;--------------------------------
; Select the drawing mode.
; The valid range of values for M is 0:3 (default = 0).
; Once the drawing mode is set, it remains so until
; another GMODE or GINIT routine is called.
; The following table explains these 4 modes:
;
; Parameter Name Description
; --------- ---- -----------
;
; 0 Replace Draws white character fields
; on a black background.
; (The black parts of a dashed line
; or box pattern are drawn black.)
;
; 1 Complement Draws white characters on a
; black background and black
; characters on a white background.
;
; 2 Draw Black Draws black characters.
; (Printing is visible only on a
; white background.)
;
; 3 Draw White Draws white characters.
; (Printing is visible only on a
; black background.)
;
GMODE: SHLD saveHL ; Drawing mode value
LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
CALL noerr
LHLD saveHL ; Load drawing mode value
CALL loadHL
LXI D,3204H ; Check for 0:3 (32H = error 50)
CALL errH
MOV A,L
ORI 20H ; 0 (replace) becomes 20H (GINIT)
STA valueM ; Mode value
CALL outA ; WDAT, with MOD = drawing mode ...
JMP finis ; Go back to calling routine
;
;--------------------------------
;
valueM: DB 00H ; Drawing mode value
;
;--------------------------------
;
tablin: ; Table of line patterns in Hex
; and in Symbolic Binary:
; 0 = ".", 1 = "O"
;--------------------------------
;
DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
;
; Line pattern 0:
;
; OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
;
;--------------------------------
;
DB 0AAH,55H,0AAH,55H,0AAH,55H,0AAH,55H
;
; Line pattern 1:
;
; O.O.O.O..O.O.O.OO.O.O.O..O.O.O.OO.O.O.O..O.O.O.OO.O.O.O..O.O.O.O
;
;--------------------------------
;
DB 88H,44H,22H,11H,88H,44H,22H,11H
;
; Line pattern 2:
;
; O...O....O...O....O...O....O...OO...O....O...O....O...O....O...O
;
;--------------------------------
;
DB 11H,22H,44H,88H,11H,22H,44H,88H
;
; Line pattern 3:
;
; ...O...O..O...O..O...O..O...O......O...O..O...O..O...O..O...O...
;
;--------------------------------
;
DB 00H,0AAH,00H,0AAH,00H,0AAH,00H,0AAH
;
; Line pattern 4:
;
; ........O.O.O.O.........O.O.O.O.........O.O.O.O.........O.O.O.O.
;
;--------------------------------
;
DB 00H,0FFH,00H,0FFH,00H,0FFH,00H,0FFH
;
; Line pattern 5:
;
; ........OOOOOOOO........OOOOOOOO........OOOOOOOO........OOOOOOOO
;
;--------------------------------
;
DB 0AAH,0AAH,0AAH,0AAH,0AAH,0AAH,0AAH,0AAH
;
; Line pattern 6:
;
; O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.
;
;--------------------------------
;
DB 81H,42H,24H,18H,18H,24H,42H,81H
;
; Line pattern 7:
;
; O......O.O....O...O..O.....OO......OO.....O..O...O....O.O......O
;
;--------------------------------
;
DB 0F0H,0FH,0F0H,0FH,0F0H,0FH,0F0H,0FH
;
; Line pattern 8:
;
; OOOO........OOOOOOOO........OOOOOOOO........OOOOOOOO........OOOO
;
;--------------------------------
;
DB 55H,55H,55H,55H,0AAH,0AAH,0AAH,0AAH
;
; Line pattern 9:
;
; .O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.OO.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.
;
;--------------------------------
;
DB 33H,0CCH,33H,0CCH,33H,0CCH,33H,0CCH
;
; Line pattern 10:
;
; ..OO..OOOO..OO....OO..OOOO..OO....OO..OOOO..OO....OO..OOOO..OO..
;
;--------------------------------
;
DB 55H,55H,0AAH,0AAH,55H,55H,0AAH,0AAH
;
; Line pattern 11:
;
; .O.O.O.O.O.O.O.OO.O.O.O.O.O.O.O..O.O.O.O.O.O.O.OO.O.O.O.O.O.O.O.
;
;--------------------------------
;
DB 52H,0A5H,4AH,94H,29H,52H,0A5H,4AH
;
; Line pattern 12:
;
; .O.O..O.O.O..O.O.O..O.O.O..O.O....O.O..O.O.O..O.O.O..O.O.O..O.O.
;
;--------------------------------
;
DB 4AH,0A5H,52H,29H,94H,4AH,0A5H,52H
;
; Line pattern 13:
;
; .O..O.O.O.O..O.O.O.O..O...O.O..OO..O.O...O..O.O.O.O..O.O.O.O..O.
;
;--------------------------------
;
DB 73H,0E7H,0CEH,9CH,39H,73H,0E7H,0CEH
;
; Line pattern 14:
;
; .OOO..OOOOO..OOOOO..OOO.O..OOO....OOO..O.OOO..OOOOO..OOOOO..OOO.
;
;--------------------------------
;
DB 0FH,0FH,0FH,0FH,0F0H,0F0H,0F0H,0F0H
;
; Line pattern 15:
;
; ....OOOO....OOOO....OOOO....OOOO....OOOO....OOOO....OOOO....OOOO
;
;--------------------------------
;
; P.S.
; The doc (Appendix J, "NCR Graphics Extension for MS-BASIC")
; shows the following fill patterns for boxes:
;
; tabbox: ; Table of fill patterns for boxes
; ; in Hex and Symbolic Binary:
; ; 0 = ".", 1 = "O"
;
;-------------------------------; Box pattern O:
;
; DB 0FFH ; OOOOOOOO
; DB 0FFH ; OOOOOOOO
; DB 0FFH ; OOOOOOOO
; DB 0FFH ; OOOOOOOO
; DB 0FFH ; OOOOOOOO
; DB 0FFH ; OOOOOOOO
; DB 0FFH ; OOOOOOOO
; DB 0FFH ; OOOOOOOO
;
;-------------------------------; Box pattern 1:
;
; DB 55H ; .O.O.O.O
; DB 0AAH ; O.O.O.O.
; DB 55H ; .O.O.O.O
; DB 0AAH ; O.O.O.O.
; DB 55H ; .O.O.O.O
; DB 0AAH ; O.O.O.O.
; DB 55H ; .O.O.O.O
; DB 0AAH ; O.O.O.O.
;
;-------------------------------; Box pattern 2:
;
; DB 11H ; ...O...O
; DB 22H ; ..O...O.
; DB 44H ; .O...O..
; DB 88H ; O...O...
; DB 11H ; ...O...O
; DB 22H ; ..O...O.
; DB 44H ; .O...O..
; DB 88H ; O...O...
;
;-------------------------------; Box pattern 3:
;
; DB 88H ; O...O...
; DB 44H ; .O...O..
; DB 22H ; ..O...O.
; DB 11H ; ...O...O
; DB 88H ; O...O...
; DB 44H ; .O...O..
; DB 22H ; ..O...O.
; DB 11H ; ...O...O
;
;-------------------------------; Box pattern 4:
;
; DB 00H ; ........
; DB 55H ; .O.O.O.O
; DB 00H ; ........
; DB 55H ; .O.O.O.O
; DB 00H ; ........
; DB 55H ; .O.O.O.O
; DB 00H ; ........
; DB 55H ; .O.O.O.O
;
;-------------------------------; Box pattern 5:
;
; DB 00H ; ........
; DB 0FFH ; OOOOOOOO
; DB 00H ; ........
; DB 0FFH ; OOOOOOOO
; DB 00H ; ........
; DB 0FFH ; OOOOOOOO
; DB 00H ; ........
; DB 0FFH ; OOOOOOOO
;
;-------------------------------; Box pattern 6:
;
; DB 55H ; .O.O.O.O
; DB 55H ; .O.O.O.O
; DB 55H ; .O.O.O.O
; DB 55H ; .O.O.O.O
; DB 55H ; .O.O.O.O
; DB 55H ; .O.O.O.O
; DB 55H ; .O.O.O.O
; DB 55H ; .O.O.O.O
;
;-------------------------------; Box pattern 7:
;
; DB 81H ; O......O
; DB 42H ; .O....O.
; DB 24H ; ..O..O..
; DB 18H ; ...OO...
; DB 18H ; ...OO...
; DB 24H ; ..O..O..
; DB 42H ; .O....O.
; DB 81H ; O......O
;
;-------------------------------; Box pattern 8:
;
; DB 0FH ; ....OOOO
; DB 0F0H ; OOOO....
; DB 0FH ; ....OOOO
; DB 0F0H ; OOOO....
; DB 0FH ; ....OOOO
; DB 0F0H ; OOOO....
; DB 0FH ; ....OOOO
; DB 0F0H ; OOOO....
;
;-------------------------------; Box pattern 9:
;
; DB 0AAH ; O.O.O.O.
; DB 0AAH ; O.O.O.O.
; DB 0AAH ; O.O.O.O.
; DB 0AAH ; O.O.O.O.
; DB 0AAH ; .O.O.O.O
; DB 0AAH ; .O.O.O.O
; DB 0AAH ; .O.O.O.O
; DB 0AAH ; .O.O.O.O
;
;-------------------------------; Box pattern 10:
;
; DB 0CCH ; OO..OO..
; DB 33H ; ..OO..OO
; DB 0CCH ; OO..OO..
; DB 33H ; ..OO..OO
; DB 0CCH ; OO..OO..
; DB 33H ; ..OO..OO
; DB 0CCH ; OO..OO..
; DB 33H ; ..OO..OO
;
;-------------------------------; Box pattern 11:
;
; DB 0AAH ; O.O.O.O.
; DB 0AAH ; O.O.O.O.
; DB 55H ; .O.O.O.O
; DB 55H ; .O.O.O.O
; DB 0AAH ; O.O.O.O.
; DB 0AAH ; O.O.O.O.
; DB 55H ; .O.O.O.O
; DB 55H ; .O.O.O.O
;
;-------------------------------; Box pattern 12:
;
; DB 4AH ; .O..O.O.
; DB 0A5H ; O.O..O.O
; DB 52H ; .O.O..O.
; DB 29H ; ..O.O..O
; DB 94H ; O..O.O..
; DB 4AH ; .O..O.O.
; DB 0A5H ; O.O..O.O
; DB 52H ; .O.O..O.
;
;-------------------------------; Box pattern 13:
;
; DB 52H ; .O.O..O.
; DB 0A5H ; O.O..O.O
; DB 4AH ; .O..O.O.
; DB 94H ; O..O.O..
; DB 29H ; ..O.O..O
; DB 52H ; .O.O..O.
; DB 0A5H ; O.O..O.O
; DB 4AH ; .O..O.O.
;
;-------------------------------; Box pattern 14:
;
; DB 0CEH ; OO..OOO.
; DB 0E7H ; OOO..OOO
; DB 73H ; .OOO..OO
; DB 39H ; ..OOO..O
; DB 9CH ; O..OOO..
; DB 0CEH ; OO..OOO.
; DB 0E7H ; OOO..OOO
; DB 73H ; .OOO..OO
;
;-------------------------------; Box pattern 15:
;
; DB 0F0H ; OOOO....
; DB 0F0H ; OOOO....
; DB 0F0H ; OOOO....
; DB 0F0H ; OOOO....
; DB 0FH ; ....OOOO
; DB 0FH ; ....OOOO
; DB 0FH ; ....OOOO
; DB 0FH ; ....OOOO
;
;--------------------------------
;
valueP: DB 00H ; Pattern value
;
DB 00H,00H ; ???
DB 00H,00H ; ???
DB 00H,00H ; ???
;
startX: DW 0000H ; Starting point X
;
DB 00H,00H ; ???
;
startY: DW 0000H ; Starting point Y
;
DB 00H,00H ; ???
DB 00H,00H ; ???
;
;--------------------------------
; Draw a string A$ in a specific direction D.
; The valid range of values for D is 0:7.
; A$ may be any alphanumeric string defined in the program
; (ASCII characters only).
; GPOINT defines the lower left corner of the text string.
; The direction D rotates the text counterclockwise in
; steps of 45 degrees around the cursor.
; GZOOM affects the size of the text. For a zoom factor of 0,
; the maximum size of the character field is 16 pixels high
; and 8 pixels wide. The maximum size of the character
; itself is 9 pixels high and 6 pixels wide. Assuming the
; zoom parameter is Z, the actual size of a character field
; is height = 16*(Z+1) pixels by width = 8*(Z+1) pixels.
; For example, a text 3 characters long with a zoom parameter
; of 4 is height = 3*(16*(4+1)) by width = 3*(8*(4+1)) pixels.
; There is no error checking done on these calculations,
; so make sure the results do not exceed the height and width
; of the screen.
;
GTEXT: SHLD saveHL ; Length of string A$ (one byte)
XCHG
SHLD saveDE ; Direction D
LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
CALL noerr
LHLD saveDE ; Direction D
SHLD saveBC
CALL loadHL
LXI D,3C08H ; Check for 0:7 (3CH = error 60)
CALL errH
MOV A,L
STA gtextD
ADI 02H ; 2
ANI 07H ; 7
ORI 10H ; 16
STA gtextX ; GTEXT unknown...
LHLD saveHL ; Load length of string A$
MOV C,M
MVI A,00H ; Empty string ?
CMP C
JZ finis ; Go back to calling routine
INX H
CALL loadHL ; Load first char of string A$
gtext2: MOV B,M
INX H
PUSH H
PUSH B
MOV A,B
CALL gtext3
LXI H,I$0F0F ; Pattern ?
CALL gtext5
LXI H,Io0F07 ; Pattern ?
CALL gtext5
CALL gtext6
CALL point2 ; Position cursor at (X,Y)
POP B
POP H
DCR C
JNZ gtext2
CALL gpat2 ; Outputs pattern bytes
JMP finis ; Go back to calling routine
;
;--------------------------------
;
gtextD: DB 00H ; GTEXT direction D
;
gtextX: DB 10H ; FIGS params: P1: Graphics Character (ON)
DB 07H ; P2
DB 40H ; P3
DB 08H ; P4
DB 00H ; P5
DB 08H ; P6
DB 00H ; P7
DB 0FFH ; P8
DB 3FH ; P9
DB 0FFH ; P10
DB 3FH ; P11
;
;--------------------------------
; Output a screen image to a printer.
; GPRINT outputs an entire screen image to a printer.
; All white areas on the screen are output as black
; on the printer, and black areas are output as white.
; When the output is finished, one additional linefeed
; is printed. (Printing a screen can be interrupted
; only by switching off the NCR DECISION MATE V.)
; The valid range of values for a Printer is 0,1,2,4,5.
; The following printers can be used with GPRINT:
; EPSON MX-80
; EPSON MX-82
; EPSON MX-110
; EPSON FX-80
; NCR 6411-8510 (C-ITOH M8510A)
; The Printer parameters are assigned as follows:
; 0 EPSON MX-80, MX-82, MX-100;
; single density, one directional
; 1 EPSON MX-80, MX-82, MX-100;
; Double density, one directional
; 2 EPSON FX-80; single density, one directional
; 4 NCR 6411-8510 (C-ITOH M8510A);
; single density, bi-directional
; 5 NCR 6411-8510 (C-ITOH M8510A);
; single density, one directional
; (When the graphics output is completed,
; bi-directional printing is automatically restored.)
; Some of the above printers are not capable of printing
; the whole screen image horizontally. Below is a list of the
; maximum horizontal width for each printer:
; 480 pixels - EPSON MX-80
; 576 pixels - EPSON MX-82
; 640 pixels - EPSON MX-100
; 640 pixels - EPSON FX-80
; 640 pixels - NCR 6411-8510 (C-ITOH M8510A)
; Using the recommended Linefeeds, the EPSON MX-82 does not
; distort the screen image on paper; the EPSON FX-80, MX-80
; and MX-100 distort horizontally; The NCR (C-ITOH) printer
; distorts vertically.
; The valid range of values for the Linefeed parameter is 0:99.
; The recommended Linefeed for the EPSON MX-80, MX-82, and
; MX-100 printers is 8; EPSON FX-80 is 7; and NCR 6411-8510
; (C-ITOH M8510A) is 16. These recommended values produce
; the best output. Smaller values produce overlapped lines
; and larger values produce lines with a visible distance
; between them. When the graphics output is completed,
; the normal linefeed value is automatically restored.
;
GPRINT: SHLD saveHL ; Printer P
XCHG
SHLD saveDE ; Linefeed L
LXI H,0000H
DAD SP
SHLD oldSP
LXI SP,stack
CALL noerr
LHLD saveHL ; Load printer value
CALL loadHL
LXI D,4606H ; Check for 0:5 (46H = error 70)
CALL errH
MOV A,L
STA printr
LXI H,tabESC ; Table of ESCape codes
RLC
RLC
RLC
MVI D,00H
MOV E,A ; A-reg = printer number
DAD D
SHLD ESCod ; ESCape code to send
LDA printr
CPI 03H ; Not valid ?
JNZ validP
MVI A,46H ; = error 70 (Printer out of range)
STA GSTAT
JMP finis ; Go back to calling routine
;
;--------------------------------
; Valid printer numbers
;
validP: CPI 04H ; 5
JNC J$0674
CPI 01H ; 2
JZ valid2
SUB A
valid2: STA Do0820 ; 1
SUB A
STA Do081F ; 0
CALL chkLF ; Check number of linefeeds L
STA valueL
LXI H,I$083C
SHLD Do0824
LXI H,I$087E
SHLD Do0828
JMP Jo06C3
;
;--------------------------------
;
J$0674: MVI A,01H ; 1
STA Do081F
SUB A
STA D$081E ; 0
STA Do0820
MOV B,A
CALL chkLF ; Check number of linefeeds L
J$0684: CPI 0AH ; 10
JC J$068F
SUI 0AH ; 10
INR B
JMP J$0684
;
;--------------------------------
;
J$068F: ADI 30H ; "0"
STA D$0845
STA D$084B
MOV A,B
ADI 30H ; "0"
STA D$0844
STA D$084A
LDA printr
CPI 04H ; NCR single density bidirect
JZ J$06B7
LXI H,I$0848
SHLD Do0824
LXI H,I$0888
SHLD Do0828
JMP Jo06C3
;
;--------------------------------
;
J$06B7: LXI H,I$0842
SHLD Do0824
LXI H,I$0883
SHLD Do0828
Jo06C3: LHLD Do0824
LXI B,0605H
CALL Co088F
J$06CC: LHLD ESCod ; ESCape code to send
LXI B,0805H
CALL Co088F
J$06D5: LXI H,Io082C
SHLD Do082A
LDA Do0817
ORA A
JNZ J$06F6
LXI H,0000H
SHLD Do0818
SHLD Do081B
MVI A,32H ; "2"
STA Do0817
LDA Do0821
STA Do0816
J$06F6: LXI H,I$07F6
MVI A,78H ; PRAM: 2 bytes follow
CALL outA
MVI C,02H ; 2 bytes follow
CALL outC
LXI H,Do0818
CALL outCRS ; CURS
LXI H,I$07F8
CALL outMSK ; MASK
LXI H,I$07FA
CALL outFGS
MVI A,0A0H ; RDAT
CALL outA
LXI H,0805H
LXI D,Io080D
MVI C,08H ; 8
CALL Co07E2
LHLD Do082A
XCHG
CALL C$0799
XCHG
SHLD Do082A
LHLD Do0818
INX H
SHLD Do0818
LDA Do0820
STA Do0822
LXI H,Io082C
LXI B,1005H
CALL Co088F
MVI A,00H
STA Do0822
LDA Do0816
DCR A
STA Do0816
JNZ J$06D5
LXI B,0205H
LXI H,I$088D
CALL Co088F
LXI H,0028H
DAD H
DAD H
DAD H
XCHG
LHLD Do081B
DAD D
SHLD Do0818
SHLD Do081B
LDA Do0821
STA Do0816
LDA Do0817
DCR A
STA Do0817
JNZ J$06CC
LHLD Do0828
LXI B,0505H
CALL Co088F
JMP finis ; Go back to calling routine
;
;--------------------------------
;
chkLF: LHLD saveDE ; Load Linefeed value
CALL loadHL
LXI D,4764H ; Check for 0:99 (47H = error 71)
CALL errH
MOV A,L
RET
;
;--------------------------------
;
C$0799: MVI A,01H ; 1
STA Do0815
J$079E: LXI B,0808H
;
J$07A1: DB 21H ; ?
;
; LXI H,0805H
;
Do07A2: DW 0805H ; ?
;
J$07A4: LDA Do081F
CPI 00H
JZ J$07B4
MOV A,M
RAR
MOV M,A
LDAX D
RAR
JMP J$07B9
;
;--------------------------------
;
J$07B4: MOV A,M
RAR
MOV M,A
LDAX D
RAL
J$07B9: INX H
STAX D
DCR B
JNZ J$07A4
INX D
MVI B,08H ; 8
DCR C
JNZ J$07A1
LDA Do0815
ANI 01H ; 1
JZ J$07DB
LXI H,Io080D
SHLD Do07A2 ; ?
DCR A
STA Do0815
JMP J$079E
;
;--------------------------------
;
J$07DB: LXI H,0805H
SHLD Do07A2 ; ?
RET
;
;--------------------------------
; Probably outputs screen dump to RAM ?
;
Co07E2: IN status ; Read status register
ANI 00000001B ; Status register flags:
; ::::::::
; :::::::+-> Bit 0: Data Ready
; ::::::+--> Bit 1:
; :::::+---> Bit 2:
; ::::+----> Bit 3:
; :::+-----> Bit 4:
; ::+------> Bit 5:
; :+-------> Bit 6:
; +--------> Bit 7:
JZ Co07E2
IN FIFO ; FIFO write a byte ?
MOV M,A
INX H
IN FIFO ; FIFO write a byte ?
STAX D
INX D
DCR C
JNZ Co07E2
RET
;
;--------------------------------
;
I$07F6: DB 0FFH,0FFH
;
I$07F8: DB 0FFH,0FFH
;
I$07FA: DB 00H ; P1
DB 08H ; P2
DB 40H ; P3
DB 08H ; P4
DB 00H ; P5
DB 08H ; P6
DB 00H ; P7
DB 0FFH ; P8
DB 3FH ; P9
DB 0FFH ; P10
DB 3FH ; P11
;
; Set program counter P070D
;
DB 00H,00H,00H
DB 00H,00H,00H,00H,00H
Io080D: DB 00H
DB 00H,00H,00H,00H,00H,00H,00H
;
; Set program counter P0715
;
Do0815: DB 00H
Do0816: DB 00H
Do0817: DB 00H
Do0818: DB 00H,00H,00H
Do081B: DB 00H,00H,00H
D$081E: DB 00H
Do081F: DB 00H
Do0820: DB 00H
Do0821: DB 28H
Do0822: DB 00H
;
printr: DB 00H ; Printer number
;
Do0824: DB 00H,00H
;
ESCod: DW 0000H ; Address of ESCape code to send
;
Do0828: DB 00H,00H
;
Do082A: DW 2C07H ; ?
;
; 16 octets en trop...
;
Io082C: DB 00H,00H,00H,00H,00H,00H,00H,00H
DB 00H,00H,00H,00H,00H,00H,00H,00H
;
; Set program counter P073C
;
I$083C: DB 1BH,41H
;
valueL: DB 00H,00H,00H,00H
;
I$0842: DB 1BH,54H
D$0844: DB 00H
D$0845: DB 00H,00H,00H
I$0848: DB 1BH,54H
D$084A: DB 00H
D$084B: DB 00H,1BH,3EH
;
tabESC: DB 00H,00H,00H,00H,1BH,4BH,80H,02H ; Printer 0: MX-80
DB 00H,00H,00H,00H,1BH,4CH,00H,05H ; Printer 1: MX-82
DB 00H,00H,00H,1BH,2AH,04H,80H,02H ; Printer 2: MX-100
DB 00H,00H,00H,00H,00H,00H,00H,00H ; Printer 3: (none)
DB 00H,00H,1BH,53H,30H,36H,34H,30H ; Printer 4: FX-80
DB 00H,00H,1BH,53H,30H,36H,34H,30H ; Printer 5: 8510
;
I$087E: DB 1BH,41H,0CH,00H,0AH
I$0883: DB 1BH,41H,00H
DB 00H,0AH
I$0888: DB 1BH,41H,1BH,3CH,0AH
I$088D: DB 0DH,0AH
;
;--------------------------------
;
Co088F: LDA Do0822
MOV D,A
J$0893: MOV E,M
PUSH H
PUSH B
PUSH D
CALL BDOS
POP D
POP B
POP H
DCR D
JZ J$0893
INX H
DCR B
JNZ Co088F
RET
;
;--------------------------------
; Outputs GDC command in A-reg
;
outA: PUSH H ; HL used by following outC
PUSH PSW
outA2: IN status ; Read Status register
ANI 00001010B ; Status register flags:
; ::::::::
; :::::::+-> Bit 0:
; ::::::+--> Bit 1: FIFO Full
; :::::+---> Bit 2:
; ::::+----> Bit 3: Drawing in Progress
; :::+-----> Bit 4:
; ::+------> Bit 5:
; :+-------> Bit 6:
; +--------> Bit 7:
JNZ outA2
POP PSW ; GDC command in A-reg
OUT FIFO ; FIFO read GDC command
POP H
RET
;
;--------------------------------
; Outputs GDC parameters in M(HL) (length in C-reg)
;
outC: IN status ; Read Status register
ANI 00001010B ; Status register flags:
; ::::::::
; :::::::+-> Bit 0:
; ::::::+--> Bit 1: FIFO Full
; :::::+---> Bit 2:
; ::::+----> Bit 3: Drawing in Progress
; :::+-----> Bit 4:
; ::+------> Bit 5:
; :+-------> Bit 6:
; +--------> Bit 7:
JNZ outC
MOV A,M ; Get GDC parameter
OUT status ; Write Parameter into FIFO
INX H ; Next GDC parameter
DCR C ; Decrements Counter
JNZ outC
RET
;
;--------------------------------
; Outputs ZOOM parameter
;
outzom: MVI A,ZOOM ; GDC command
CALL outA
MVI C,01H ; 1 byte follows
CALL outC
RET
;
;--------------------------------
; Outputs CCHAR parameter
;
outCHR: MVI A,CCHAR ; GDC command
CALL outA
MVI C,01H ; 1 byte follows
CALL outC
RET
;
;--------------------------------
; Outputs PRAM parameters
;
outPRM: MVI A,PRAM ; GDC command
CALL outA
MVI C,10H ; 16 byte follow
CALL outC
RET
;
;--------------------------------
; Outputs CURS parameters
;
outCRS: MVI A,CURS ; GDC command
CALL outA
MVI C,03H ; 3 bytes follow
CALL outC
RET
;
;--------------------------------
; Outputs MASK parameters
;
outMSK: MVI A,MASK ; GDC command
CALL outA
MVI C,02H ; 2 bytes follow
CALL outC
RET
;
;--------------------------------
; Outputs FIGS parameters
;
outFGS: MVI A,FIGS ; GDC command
CALL outA
MVI C,0BH ; 11 bytes follow
CALL outC
RET
;
;--------------------------------
; Outputs FIGS command and switch Graphics Drawing flag
;
outFG2: MVI A,FIGS ; GDC command
CALL outA
CALL SGDflg ; Switch Graphics Drawing flag
MVI C,0BH ; 11 bytes follow
CALL outC
RET
;
;--------------------------------
; Outputs PRAM command (8 bytes version)
;
outpat: MVI A,78H ; PRAM GDC command
CALL outA
MVI C,08H ; 8 bytes follow
CALL outC
RET
;
;--------------------------------
; Switch Graphics Drawing flag
;
SGDflg: LDA FIGSP3 ; FIGS P3
ORI 40H ; 0100 0000B: Graphics Drawing flag
STA FIGSP3
RET
;
;--------------------------------
; Compute EAD and dAD for CURS
;
EADdAD: PUSH H
PUSH B
PUSH D
PUSH PSW
LHLD startY ; Starting point Y
SHLD strtY2
CALL Co0977
SHLD startY ; Starting point Y
LXI B,0000H
LHLD startX ; Starting point X
DCX H
MOV A,L
ANI 0FH ; 15
STA Do099A
RLC
RLC
RLC
RLC
STA Do0997
MOV A,L
ANI 0F0H
MOV L,A
LXI D,0FFF0H
CALL Co0A48
MOV A,C
STA Do0998
LHLD startY ; Starting point Y
DCX H
XCHG
LXI H,0000H
LXI B,0028H
CALL Co0982
XCHG
LDA Do0998
MOV L,A
DAD D
SHLD Do0995
POP PSW
POP D
POP B
POP H
RET
;
;--------------------------------
;
Co0977: CALL Co1002
XCHG
MVI H,01H ; 1
MVI L,90H
INX H
DAD D
RET
;
;--------------------------------
;
Co0982: MVI A,00H
CMP E
JZ J$098D
DAD B
DCR E
JMP Co0982
;
;--------------------------------
;
J$098D: CMP D
RZ
DAD B
DCR E
DCR D
JMP Co0982
;
;--------------------------------
;
Do0995: DB 00H,00H
;
Do0997: DB 00H
;
Do0998: DB 00H,00H
;
Do099A: DB 00H,00H
;
;--------------------------------
;
garc31: PUSH H
PUSH B
PUSH D
PUSH PSW
MVI A,20H
STA FIGSP1 ; 20H = Arc
LHLD radius
XCHG
LHLD Do0995
LXI B,0028H
CALL Co0A40
CALL Co0982
SHLD Do0A51
SHLD D$0A60
LHLD radius
XCHG
LHLD Do0995
LXI B,0028H
CALL Co0982
SHLD D$0A54
SHLD D$0A5D
LDA Do0997
STA D$0A53
STA D$0A62
STA D$0A56
STA D$0A5F
LHLD radius
MOV A,L
STA Do0A69
ANI 0F0H
MOV L,A
LXI D,0FFF0H
LXI B,0000H
CALL Co0A48
PUSH B
LDA Do0A69
ANI 0FH ; 15
CALL Co0A2C
STA D$0A5C
STA D$0A65
LHLD Do0995
DAD B
SHLD D$0A5A
SHLD D$0A63
POP B
LDA Do0A69
ANI 0FH ; 15
CMA
INR A
CALL Co0A2C
STA D$0A59
STA D$0A68
CALL Co0A40
LHLD Do0995
DAD B
SHLD D$0A57
SHLD D$0A66
POP PSW
POP D
POP B
POP H
RET
;
;--------------------------------
;
Co0A2C: MOV E,A
LDA Do099A
ADD E
MOV E,A
ANI 0F0H
JZ J$0A38
INX B
J$0A38: MOV A,E
RLC
RLC
RLC
RLC
ANI 0F0H
RET
;
;--------------------------------
;
Co0A40: MOV A,C
CMA
MOV C,A
MOV A,B
CMA
MOV B,A
INX B
RET
;
;--------------------------------
;
Co0A48: DAD D
INR C
JC Co0A48
DCR C
RET
;
;--------------------------------
;
radius: DB 00H,00H
Do0A51: DB 00H,00H
D$0A53: DB 00H
D$0A54: DB 00H,00H
D$0A56: DB 00H
D$0A57: DB 00H,00H
D$0A59: DB 00H
D$0A5A: DB 00H,00H
D$0A5C: DB 00H
D$0A5D: DB 00H,00H
D$0A5F: DB 00H
D$0A60: DB 00H,00H
D$0A62: DB 00H
D$0A63: DB 00H,00H
D$0A65: DB 00H
D$0A66: DB 00H
DB 00H
D$0A68: DB 00H
Do0A69: DB 00H
;
;--------------------------------
;
garc32: LHLD radius
DCX H
SHLD FIGSP4
DAD H
SHLD FIGSP6
LXI H,3FFFH
SHLD FIGSP8
LXI H,0000H
SHLD FIGSPA
RET
;
;--------------------------------
;
garc41: LDA Do0AE6
ANI 01H ; 1
JZ J$0AAA
LDA Do0AE9
CPI 2DH ; "-"
JNZ J$0A95
CALL Co0CAA
J$0A95: LDA Do0AE9
MOV L,A
MVI H,00H
CALL Co0D09
LXI B,0001H
LXI H,FIGSPA
CALL Co0CA6
JMP J$0AC5
;
;--------------------------------
;
J$0AAA: CALL Co0CAA
LDA Do0AED
ANI 01H ; 1
JZ J$0AB9
LXI H,FIGSP2
INR M
J$0AB9: MVI A,2DH ; "-"
LXI H,Do0AE9
SUB M
MOV L,A
MVI H,00H
CALL Co0D13
J$0AC5: RET
;
;--------------------------------
;
garc33: MVI B,0FFH
LHLD angleS
LXI D,0FFD3H
J$0ACE: DAD D
INR B
JC J$0ACE
LXI H,Do0AEB
MOV M,B
MVI B,0FFH
LHLD angleE
J$0ADC: DAD D
INR B
JC J$0ADC
LXI H,Io0AEC
MOV M,B
RET
;
;--------------------------------
;
Do0AE6: DB 00H
Do0AE7: DB 00H,00H
Do0AE9: DB 00H,00H
Do0AEB: DB 00H
Io0AEC: DB 00H
Do0AED: DB 00H
;
;--------------------------------
;
garc35: LHLD angleS
MOV C,L
MOV B,H
CALL Co0A40
LHLD angleE
DAD B
MOV A,H
ANI 80H
JZ J$0B09
LXI H,0168H ; = 360
DAD B
XCHG
LHLD angleE
DAD D
J$0B09: SHLD Do0AE7
RET
;
;--------------------------------
;
garc36: LDA Do0AEB
RLC
MVI D,00H
MOV E,A
LXI H,table1
DAD D
MOV E,M
INX H
MOV D,M
XCHG
PUSH H
LHLD angleS
MOV B,H
MOV C,L
CALL Co0A40
POP H
DAD B
MOV A,L
STA Do0AE9
RET
;
;--------------------------------
; Error: table angleS/octants ? (8 datas)
;
table1: DW 2D00H ; ?
DW 5A00H ; ?
DW 8700H ; ?
DW 0B400H ; ?
DW 0E100H ; ?
DW 0E01H ; ?
DW 3B01H ; ?
DW 6801H ; ?
;
;--------------------------------
;
garc42: LDA Do0AE6
RLC
LXI H,Do0AE6
ADD M
MOV C,A
MVI B,00H
LXI H,table2
DAD B
PUSH H
MOV A,M
MOV E,A
INX H
MOV A,M
MOV D,A
XCHG
CALL outCRS ; CURS: position cursor
POP H
INX H
INX H
MOV A,M
LXI H,FIGSP1 ; Get FIGS P1 (first param)
ORI 20H ; Reset Arc bit
MOV M,A
CALL outFG2 ; FIGS and switch Graphics Drawing flag
MVI A,6CH ; FIGD: Draw the Arc
CALL outA
RET
;
;--------------------------------
;
; Table of addr + byte (between 00H and 07H)
;
table2: DW D$0A5A ; ?
DB 04H ; ?
DW Do0A51 ; ?
DB 01H ; ?
DW Do0A51 ; ?
DB 06H ; ?
DW D$0A57 ; ?
DB 03H ; ?
DW D$0A57 ; ?
DB 00H ; ?
DW D$0A54 ; ?
DB 05H ; ?
DW D$0A54 ; ?
DB 02H ; ?
DW D$0A5A ; ?
DB 07H ; ?
;
;--------------------------------
;
garc51: LDA Do0AE9
MOV C,A
MVI B,00H
CALL Co0A40
LHLD Do0AE7
DAD B
SHLD Do0AE7
RET
;
;--------------------------------
;
garc52: LDA Do0AE6
INR A
ANI 07H ; 7
STA Do0AE6
RET
;
;--------------------------------
;
garc53: CALL Co0CAA
LDA Do0AE6
LXI H,0001H
SHLD FIGSPA
ANI 01H ; 1
JNZ Jo0BBE
LXI H,0000H
SHLD FIGSPA
LDA Do0AED
ANI 01H ; 1
JZ Jo0BBE
LXI H,FIGSP2
INR M
Jo0BBE: CALL garc42
RET
;
;--------------------------------
;
garc37: LDA Do0AEB
ANI 01H ; 1
JZ J$0BE5
LHLD angleS
SHLD Do0D24
CALL Co0C01
CALL Co0D09
LHLD angleE
SHLD Do0D24
CALL Co0C01
CALL Co0D13
JMP J$0BFD
;
;--------------------------------
;
J$0BE5: LHLD angleE
SHLD Do0D24
CALL Co0C1C
CALL Co0D09
LHLD angleS
SHLD Do0D24
CALL Co0C1C
CALL Co0D13
J$0BFD: CALL garc42
RET
;
;--------------------------------
;
Co0C01: LDA Do0AEB
RLC
MVI D,00H
MOV E,A
LXI H,table1
DAD D
MOV E,M
INX H
MOV D,M
XCHG
PUSH H
LHLD Do0D24
MOV B,H
MOV C,L
CALL Co0A40
POP H
DAD B
RET
;
;--------------------------------
;
Co0C1C: LDA Do0AEB
RLC
MVI D,00H
MOV E,A ; DE = 00 + Do0AEB
LXI H,table3 ; HL = 0000
DAD D ; HL = HL + DE
MOV E,M
INX H
MOV D,M ; DE = M(HL)
LHLD Do0D24 ; HL = Do0D24
DAD D ; HL = HL + DE
RET
;
;--------------------------------
;
; Table ?
;
table3: DW 0000H ; ?
DW 0D3FFH ; ?
DW 0A6FFH ; ?
DW 79FFH ; ?
DW 4CFFH ; ?
DW 1FFFH ; ?
DW 0F2FEH ; ?
DW 0C5FEH ; ?
;
;--------------------------------
;
C$0C3F: LDA Do0AE7
STA Do0AE9
CPI 00H
RZ
LDA Do0AE6
ANI 01H ; 1
JZ J$0C62
CALL Co0CAA
MVI A,2DH ; "-"
LXI H,Do0AE9
SUB M
MOV L,A
MVI H,00H
CALL Co0D13
JMP J$0C71
;
;--------------------------------
;
J$0C62: LDA Do0AE9
MOV L,A
MVI H,00H
CALL Co0D09
LXI H,0000H
SHLD FIGSPA
J$0C71: CALL garc42
RET
;
;--------------------------------
;
Co0C75: MOV A,L
ORI 00H
JNZ J$0C81
LXI B,0000H
JMP Jo0CA5
;
;--------------------------------
;
J$0C81: LXI B,table4
DAD B
MOV B,M
LHLD radius
XCHG
LHLD radius
J$0C8D: DAD D
MVI C,00H
JNC J$0C95
MVI C,01H ; 1
J$0C95: DCR B
MVI A,00H
CMP B
JNZ J$0C8D
MOV B,C
MOV C,H
MOV A,L
ANI 80H
JZ Jo0CA5
INR C
Jo0CA5: RET
;
;--------------------------------
;
Co0CA6: MOV M,C
INX H
MOV M,B
RET
;
;--------------------------------
;
Co0CAA: LHLD radius
LXI B,table5
DAD B
MOV C,M
LDA Do0AED
ANI 01H ; 1
JZ J$0CCD
MOV A,C
CMA
INR A
ADI 7FH
MOV C,A
LHLD radius
MVI A,0B5H
CMP L
JNZ Jo0CD1
DCR C
JMP Jo0CD1
;
;--------------------------------
;
J$0CCD: MOV A,C
ADI 7FH
MOV C,A
Jo0CD1: MVI B,00H
LXI H,FIGSP2
CALL Co0CA6
RET
;
;--------------------------------
;
garc34: MVI A,00H
STA Do0AED
LHLD radius
LXI B,table5
DAD B
MOV B,M
LDA radius
CPI 0B4H ; = 180
JNC J$0CFD
MOV A,B
ANI 80H
JNZ Jo0D08
MVI A,01H ; 1
STA Do0AED
JMP Jo0D08
;
;--------------------------------
;
J$0CFD: MOV A,B
ANI 80H
JZ Jo0D08
MVI A,01H ; 1
STA Do0AED
Jo0D08: RET
;
;--------------------------------
;
Co0D09: CALL Co0C75
LXI H,FIGSP2
CALL Co0CA6
RET
;
;--------------------------------
;
Co0D13: CALL Co0C75
LXI H,FIGSPA
CALL Co0CA6
RET
;
;--------------------------------
;
?o0D1D: DB 00H,00H,00H
;
angleS: DW 0000H ; GCIRCL sets this to 0.
;
angleE: DW 0000H ; GCIRCL sets this to 360.
;
Do0D24: DB 00H,00H
;
; Tables ?
;
table4: DB 00H,04H,09H,0DH,11H,16H,1AH,1FH
DB 23H,28H,2CH,30H,35H,39H,3DH
DB 42H,46H,4AH,4FH,53H,57H,5BH,5FH
DB 64H,68H,6CH,70H,74H,78H,7CH,80H
DB 83H,87H,8BH,8FH,92H,96H,9AH,9DH
DB 0A1H,0A4H,0A7H,0ABH,0AEH,0B1H,0B4H
;
table5: DB 81H,82H,82H,7EH,83H,84H,7CH,7BH
DB 86H,87H,79H,88H,89H,77H,76H,8BH
DB 8CH
DB 74H,8DH,8EH,72H,71H,90H,91H,6FH
DB 92H,93H,6DH,6CH,95H,6BH,6AH,97H
DB 98H,68H,99H,9AH,66H,65H,9CH,9DH
DB 63H,9EH,9FH,61H,60H,0A1H,5FH,5EH
DB 0A3H,0A4H,5CH,5BH,0A6H,5AH,59H,0A8H
DB 0A9H,57H,0AAH,0ABH,55H,54H,0ADH,0AEH
DB 52H,0AFH,0B0H,50H,4FH,0B2H,4EH,4DH
DB 0B4H,0B5H,4BH,0B6H,0B7H,49H,48H,0B9H
DB 0BAH,46H,0BBH,0BCH,44H,43H,0BEH,42H
DB 41H,0C0H,0C1H,3FH,3EH,0C3H,3DH,3CH
DB 0C5H,0C6H,3AH,0C7H,0C8H,38H,37H,0CAH
DB 36H,35H,0CCH,0CDH,33H,32H,0CFH,31H
DB 30H,0D1H,0D2H,2EH,0D3H,0D4H,2CH,2BH
DB 0D6H,0D7H,29H,0D8H,0D9H,27H,26H,0DBH
DB 25H,24H,0DDH,0DEH,22H,0DFH,0E0H,20H
DB 1FH,0E2H,0E3H,1DH,0E4H,0E5H,1BH,1AH
DB 0E7H,19H,18H,0E9H,0EAH,16H,15H,0ECH
DB 14H,13H,0EEH,0EFH,11H,0F0H,0F1H,0FH
DB 0EH,0F3H,0F4H,0CH,0F5H,0F6H,0AH,09H
DB 0F8H,08H,07H,0FAH,0FBH,05H,0FCH,0FDH
DB 03H,02H,0FFH,00H,0FFH,01H,02H,0FEH
DB 0FDH,04H,0FCH,0FBH,06H,07H,0F9H,0F8H
DB 09H,0F7H,0F6H,0BH,0CH,0F4H,0DH,0EH
DB 0F2H,0F1H,10H,0F0H,0EFH,12H,13H,0EDH
DB 0ECH,15H,0EBH,0EAH,17H,18H,0E8H,19H
DB 1AH,0E6H,0E5H,1CH,1DH,0E3H,1EH,1FH
DB 0E1H,0E0H,21H,0DFH,0DEH,23H,24H,0DCH
DB 0DBH,26H,0DAH,0D9H,28H,29H,0D7H,2AH
DB 2BH,0D5H,0D4H,2DH,0D3H,0D2H,2FH,30H
DB 0D0H,0CFH,32H,0CEH,0CDH,34H,35H
;
;--------------------------------
; Outputs a char on graphics screen
;
gtext3: PUSH B
PUSH D
PUSH H
ANI 7FH ; ASCII chars only
MOV L,A
MVI H,00H ; HL = ?
DAD H
DAD H
DAD H ; 8 bytes
DAD H
LXI D,1000H ; DE = ?
DAD D
LXI D,Io0F07 ; ?
MVI B,10H ; 16
OUT 11H ; ?
gtext4: MOV A,M
STAX D
INX H
INX D
DCR B
JNZ gtext4
OUT 10H ; ?
POP H
POP D
POP B
RET
;
;--------------------------------
; Initiates the drawing of the graphics character
; (or area filling pattern) stored in Parameter RAM.
;
gtext5: CALL outpat ; Outputs pattern value
LXI H,gtextX ; GTEXT unknown...
CALL outFGS
MVI A,GCHRD ; GDC command
CALL outA
RET
;
;--------------------------------
;
gtext6: LDA valueZ ; Zoom value ?
INR A
MOV B,A
ADD A
ADD A
ADD A
MOV L,A
MVI H,00H
SHLD Do0F19
CALL Co1002
SHLD Do0F1B
LHLD strtY2 ; Temporary startY
SHLD startY ; Starting point Y
LDA gtextD ; Test Direction D of text
CPI 00H ; 0
JZ Co0ED7
CPI 01H ; 1
CZ Co0ED7
JZ Jo0EEF
CPI 02H ; 2
JZ Jo0EEF
CPI 03H ; 3
CZ Co0EE3
JZ Jo0EEF
CPI 04H ; 4
JZ Co0EE3
CPI 05H ; 5
CZ Co0EE3
JZ Jo0EFB
CPI 06H ; 6
JZ Jo0EFB
CALL Co0ED7 ; 7
JMP Jo0EFB
;
;--------------------------------
;
Co0ED7: LHLD startX ; Starting point X
XCHG
LHLD Do0F19 ; ?
DAD D
SHLD startX ; Starting point X
RET
;
;--------------------------------
;
Co0EE3: LHLD startX ; Starting point X
XCHG
LHLD Do0F1B ; ?
DAD D
SHLD startX ; Starting point X
RET
;
;--------------------------------
;
Jo0EEF: LHLD strtY2 ; Temporary startY
XCHG
LHLD Do0F19 ; ?
DAD D
SHLD startY ; Starting point Y
RET
;
;--------------------------------
;
Jo0EFB: LHLD strtY2 ; Temporary startY
XCHG
LHLD Do0F1B ; ?
DAD D
SHLD startY ; Starting point Y
RET
;
;--------------------------------
;
; 16 octets en trop...
;
Io0F07: DB 00H,00H,00H,00H,00H,00H,00H,00H
;
I$0F0F: DB 00H,00H,00H,00H,00H,00H,00H,00H
;
; Set program counter P0E17
;
strtY2: DW 0000H ; Temporary startY
;
Do0F19: DB 00H,00H
;
Do0F1B: DB 00H,00H
;
I$0F1D: DB 0DH,0EH
DB 0AH,09H,0CH,0FH,0BH,08H,0AH,0EH
DB 0CH,08H,0DH,0FH,0BH,09H
;
;--------------------------------
;
line2: PUSH H
PUSH D
PUSH B
PUSH PSW
XRA A
STA Do1020
LHLD endX ; Ending point X
XCHG
LHLD startX ; Starting point X
MOV C,L
MOV B,H
CALL Co0A40
XCHG
DAD B
CNC Co1002
SHLD Do101C
MVI A,02H ; 2
CC Co100C
LHLD endY ; Ending point Y
CALL Co0977
SHLD endY ; Ending point Y
XCHG
LHLD startY ; Starting point Y
MOV C,L
MOV B,H
CALL Co0A40
XCHG
DAD B
CNC Co1002
SHLD Do101E
MVI A,01H ; 1
CC Co100C
XCHG
LHLD Do101C
MOV C,L
MOV B,H
CALL Co0A40
XCHG
DAD B
MVI A,04H ; 4
CC Co100C
MOV A,L
ORA H
MVI A,08H ; 8
CZ Co100C
LHLD Do101E
MOV A,L
ORA H
CZ C$0FDD
MOV A,E
ORA D
CZ C$0FF1
LDA Do1020
ANI 04H ; 4
CZ exHLDE ; Exchange HL with DE...
SHLD FIGSP2
MOV C,L
MOV B,H
CALL Co0A40
MOV L,E
MOV H,D
DAD H
SHLD FIGSP8
DAD B
SHLD FIGSP4
XCHG
DAD B
DAD H
SHLD FIGSP6
LXI H,3FFFH
SHLD FIGSPA ; ?
LXI H,I$0F1D
LXI D,0000H
LDA Do1020
MOV C,A
ANI 10H ; 16
CNZ C$0FF9
MOV E,C
DAD D
MOV A,M
STA FIGSP1 ; ?
LHLD endX ; Ending point X
SHLD startX ; Starting point X
LHLD endY ; Ending point Y
SHLD startY ; Starting point Y
POP PSW
POP B
POP D
POP H
RET
;
;--------------------------------
;
C$0FDD: MVI A,10H ; 16
CALL Co100C
LDA Do1020
ANI 02H ; 2
RZ
LDA Do1020
ANI 0FCH
STA Do1020
RET
;
;--------------------------------
;
C$0FF1: MVI A,14H ; 20
CALL Co100C
RET
;
;--------------------------------
;
exHLDE: XCHG ; Exchange HL with DE...
RET
;
;--------------------------------
;
C$0FF9: LDA Do1020
ANI 03H ; 3
ORI 08H ; 8
MOV C,A
RET
;
;--------------------------------
;
Co1002: PUSH PSW
MOV A,L
CMA
MOV L,A
MOV A,H
CMA
MOV H,A
INX H
POP PSW
RET
;
;--------------------------------
;
Co100C: PUSH H
LXI H,Do1020
ORA M
MOV M,A
POP H
RET
;
;--------------------------------
;
?o1014: DB 00H,00H,00H,00H
;
endX: DW 0000H ; End X coord of line
;
endY: DW 0000H ; End Y coord of line
;
Do101C: DB 00H,00H ; ?
;
Do101E: DB 00H,00H ; ?
;
Do1020: DB 00H ; ?
;
FIGSP1: DB 00H ; FIGS params: P1
FIGSP2: DB 00H ; P2
FIGSP3: DB 00H ; P3
FIGSP4: DB 00H ; P4
DB 00H ; P5
FIGSP6: DB 00H ; P6
DB 00H ; P7
FIGSP8: DB 00H ; P8
DB 00H ; P9
FIGSPA: DB 00H ; P10 (PA in Hex)
DB 00H ; P11
;
valueZ: DB 00H ; Zoom value
;
DB 00H ; ?
;
;--------------------------------
;
grect9: PUSH H
PUSH D
PUSH B
PUSH PSW
CALL Co105E
DCX H
DCX D
SHLD FIGSP4
SHLD FIGSPA
XCHG
SHLD FIGSP6
LXI H,0003H
SHLD FIGSP2 ; ?
LXI H,3FFFH
SHLD FIGSP8 ; ?
LDA rectD
ADI 02H ; 2 ???
ANI 07H ; 7 ???
ORI 40H
STA FIGSP1 ; 40H = rectangle
POP PSW
POP B
POP D
POP H
RET
;
;--------------------------------
;
Co105E: LHLD rectV
XCHG
LHLD rectH
LDA rectD
ANI 07H ; 7
ADI 04H ; 4
RET
;
;--------------------------------
;
grec31: PUSH H
PUSH D
PUSH B
PUSH PSW
CALL Co105E
XCHG
MOV A,H
ANI 3FH ; "?"
MOV H,A
DCX H
SHLD FIGSP2
XCHG
SHLD FIGSP4
SHLD FIGSP6
LXI H,3FFFH
SHLD FIGSP8 ; ?
SHLD FIGSPA ; ?
LDA rectD
ADI 02H ; 2
ANI 07H ; 7
ORI 10H
STA FIGSP1 ; 10H = Graphics Character
POP PSW
POP B
POP D
POP H
RET
;
;--------------------------------
;
rectD: DB 00H ; GRECT direction ?
;
valueD: DB 00H,00H,00H ; GRECT direction ?
;
rectH: DB 00H,00H,00H,00H ; GRECT Horizontal
;
rectV: DB 00H,00H ; GRECT Vertical
;
;--------------------------------
; See CP/M sample file DUMP...
;
finis: LHLD oldSP ; Go back to calling routine
SPHL
RET
; P.S.
; This program is so much similar to those
; published by Digital Research, that I am ready
; to bet that NCR paid DRI to program this driver.
;--------------------------------
;
oldSP: DS 2 ; Entry SP value
DS 32 ; 16 level stack
stack: ; Typical DRI code
;
;--------------------------------
;
the END ; CP/M REL file