Compucolor.org – Virtual Media

Listing of file='GRPH.SRC;15' on disk='vmedia/bitmaps-sector.ccvf'

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;	GRAPHICS PROGRAM FOR PAPER TIGER
;
;	COPIES THE SCREEN TO THE PRINTER VERBATIM
;
RATE	EQU	88H	;BAUD RATE CODE = 1200 BAUD
BRATE	EQU	81E2H	;CURRENT BAUD RATE
TXSER	EQU	33C3H	;TRANSMIT TO SERIAL PORT

;
;	SPECIAL ASCII CHARACTER CODES
;
STX	EQU	02	;NORMAL MODE
ETX	EQU	03	;GRAPHICS MODE/ESCAPE
LF	EQU	10	;LINE FEED
VT	EQU	11	;VERTICAL TAB - LINE TERMINATOR
FF	EQU	12	;FORM FEED
CR	EQU	13	;CARRIAGE RETURN
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;	SAVE FCS STACK POINTER FOR RETURN
;
	ORG	0F700H	;ORIGIN FOR 32K MACHINE

START:	LXI	H,0
	DAD	SP
	SHLD	FCSSP
	LXI	SP,STACK
;
;	SET UP CORRECT BAUD RATE - 1200 AS SHOWN ABOVE
;
	MVI	A,RATE
	OUT	5
	STA	BRATE
;
;	OUTPUT 10 LINEFEEDS TO GET STARTED
;
	MVI	B,10
	MVI	A,LF
	MOV	E,A
SKPLIN:	CALL	TXSER
	DCR	B
	JNZ	SKPLIN
;
;	SET PRINTER TO GRAPHICS MODE
;
	MVI	A,ETX
	MOV	E,A
	CALL	TXSER
;
;	LOAD STARTING POINT IN REFRESH RAM - TOP RIGHT CORNER
;
	LXI	H,707EH
	SHLD	POSN
;
;..............................................................
;
;	MAIN LOOP - BEGIN A NEW OUTPUT LINE
;
;	OUTPUT SOME SPACES FIRST
;

NEWLIN:	XRA	A
	MOV	E,A
	MVI	B,64
SPC:	CALL	TXSER
	DCR	B
	JNZ	SPC

NEWBYT:	CALL	CLEAR	;CLEAR THE CHARACTER BUFFER
	LHLD	POSN	;GET POSITION ON SCREEN (IN REFRESH RAM)
	MOV	E,M	;GET CHARACTER
	INX	H
	MOV	D,M	;GET COMPOSITE COLOR CODE
;
;	CHECK THE COMPOSITE COLOR CODE FIRST.
;	SEE IF FOREGROUND AND BACKGROUND ARE THE SAME COLOR
;	AND ALSO IF THE CHARACTER IS A SPACE
;
	MVI	A,0FFH	;SET THE INVERT FLAG FALSE
	STA	INVERT
	MOV	A,D	;GET FGND COLOR CODE
	ANI	7
	STA	FGCOL
	JNZ	SKPINV
	STA	INVERT	;CHARACTER IS INVERTED IF BLACK FGND

SKPINV:	MOV	B,A	;EXTRACT BKGND COLOR CODE
	MOV	A,D
	ANI	38H
	RRC
	RRC
	RRC
	STA	BGCOL	;STORE BGND COLOR CODE
	CMP	B	;SEE IF EQUALS FGND I.E. BLANK SPACE
	JZ	BLANK
	MOV	A,E	;CHECK FOR A SPACE CHARACTER
	ANI	7FH	;  (MAY BE 2X CHARACTER)
	CPI	' '
	JZ	BLANK
	LDA	INVERT
	ORA	A
	JNZ	CHKPLT
	CALL	BKGND
;
;	CHECK FOR PLOT CHARACTERS
;
CHKPLT:	MOV	A,D
	ANI	80H	;SEE IF PLOT BIT SET IN COMPOSITE CODE
	JZ	CHKBIG
	MOV	A,E
	CALL	PLTCHR
	JMP	PRTCHR
;
;	SEE IF IT IS A 2X CHARACTER
;
CHKBIG:	MOV	A,E
	CPI	80H
	JC	PLAIN
	CALL	BIGCHR
	JMP	PRTCHR
;
;	BY NOW, IT CAN ONLY BE A PLAIN CHARACTER
;
PLAIN:	LXI	H,ISCCHR
	CALL	LOAD
	CALL	OUTCHR
	JMP	PRTCHR
;
;	BLANK CHARACTER (BACKGROUND ONLY)
;
BLANK:	CALL	BKGND
;
;	PRINT THE COMPLETED CHARACTER
;
PRTCHR:	MVI	B,8	;8 COLUMNS TO A CHARACTER
	LXI	H,BUFFER
NEXT:	MOV	A,M
	INX	H
	MOV	E,A
	CALL	TXSER
	CPI	ETX	;ETX IS GRAPHICS ESCAPE - SEND TWICE
	JNZ	SKPETX
	CALL	TXSER
SKPETX:	DCR	B
	JNZ	NEXT
;
;	CALCULATE ADDRESS OF NEXT CHARACTER
;
NXTCHR:	LHLD	POSN
	LXI	B,0080H
	DAD	B
	SHLD	POSN
	MOV	A,H
	CPI	80H
	JC	NEWBYT
;
;	END OF COLUMN ON SCREEN
;	OUTPUT ESCAPE AND VERTICAL TAB TO END PRINTER LINE
;
	MVI	A,ETX
	MOV	E,A
	CALL	TXSER
	MVI	A,VT
	MOV	E,A
	CALL	TXSER
;
;	RESET ADDRESS TO TOP OF SCREEN
;
	LHLD	POSN
	MVI	H,70H
	DCX	H
	DCX	H
	SHLD	POSN
	MOV	A,H
	CPI	70H
	JNC	NEWLIN
;
;	END OF REFRESH RAM - FINISH UP
;	OUTPUT END OF GRAPHICS CODE AND FORM FEED
;
	MVI	A,ETX
	MOV	E,A
	CALL	TXSER
	MVI	A,STX
	MOV	E,A
	CALL	TXSER
	MVI	A,FF
	MOV	E,A
	CALL	TXSER
;
;	RESTORE FCS STACK POINTER AND RETURN NO ERROR
;
EXIT:	MVI	B,0
	LHLD	FCSSP
	SPHL
	RET
;
;..............................................................
;
;	SAVE THE REGISTERS
;
SAVE:	XTHL
	PUSH	D
	PUSH	B
	PUSH	PSW
	CALL	RETURN
	POP	PSW
	POP	B
	POP	D
	POP	H
	RET
RETURN:	PCHL
;
;..............................................................
;
;
;	INDEX INTO A DOT MATRIX TABLE
;
LOAD:	MOV	C,A
	XRA	A
	MOV	B,A
	DAD	B
	DAD	B
	DAD	B
	DAD	B
	DAD	B
	DAD	B
	DAD	B
	DAD	B
	LXI	D,BUFFER
	RET
;..............................................................
;
;	GET A NEW ROW IN THE MATRIX AND OUTPUT IT
;
NEWROW:	MOV	A,M	;GET COLUMN FROM CHARACTER TABLE
	RRC		;MUST ROTATE - DESIGNED FOR SCREEN USE
	RRC
OUTROW:	PUSH	PSW
	XCH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CALL	OUTROW
	INX	H
	INX	D
	POP	PSW
	PUSH	PSW
	CMA
	XCHG
	ANA	M
	MOV	M,A
	XCHG
	POP	PSW
	ANA	M
	CALL	OUTROW
	INX	H
	INX	D
	XTHL
	MOV	A,H
	RRC
	MOV	H,A
	DCR	C
	JNZ	LOOP
	POP	H
	RET
;
;.................................................
;
;	DATA AREA
;
FCSSP:	DS	2
	DS	100
STACK:	DS	2
BUFFER:	DS	8
INVERT:	DB	0FFH
BGCOL:	DB	0
FGCOL:	DB	0
POSN:	DS	2
;
;	DOT MATRIX TABLE FOR "COLOR" SHADES
;
COLOR:	DB	00H,00H,00H,00H,00H,00H,00H,00H
	DB	3FH,00H,3FH,00H,3FH,00H,3FH,00H
	DB	2AH,2AH,15H,15H,2AH,2AH,15H,15H
	DB	33H,0CH,33H,0CH,33H,0CH,33H,0CH
	DB	3FH,3FH,3FH,3FH,3FH,3FH,3FH,3FH
	DB	12H,3FH,12H,3FH,12H,3FH,12H,3FH
	DB	15H,15H,15H,15H,15H,15H,15H,15H
	DB	00H,12H,00H,12H,12H,00H,12H,00H
;
;	DOT MATRIX TABLE FOR ASCII CODES
;
ISCCHR:	DB	8CH,70H,40H,0A0H,90H,90H,88H,84H
	DB	80H,80H,80H,80H,80H,80H,80H,80H
	DB	04H,04H,04H,04H,04H,04H,04H,04H
	DB	1CH,60H,80H,80H,80H,80H,60H,1CH
	DB	0E0H,18H,4H,04H,04H,04H,18H,0F0H
	DB	0FCH,0H,00H,00H,00H,00H,00H,00H
	DB	0C0H,20H,18H,4H,00H,00H,00H,00H
	DB	00H,00H,00H,00H,80H,60H,10H,0CH
	DB	0CH,10H,60H,80H,00H,00H,00H,00H
	DB	00H,00H,00H,00H,04H,18H,20H,0C0H
	DB	80H,80H,80H,40H,40H,20H,20H,20H
	DB	10H,10H,10H,08H,08H,04H,04H,04H
	DB	80H,80H,80H,80H,80H,80H,80H,0FCH
	DB	04H,04H,04H,04H,04H,04H,04H,0FCH
	DB	0FCH,80H,80H,80H,80H,80H,80H,80H
	DB	0FCH,4H,04H,04H,04H,04H,04H,04H
CHR10:	DB	80H,0C0H,0C0H,0A0H,90H,88H,88H,84H
	DB	04H,0CH,0CH,14H,24H,44H,44H,84H
	DB	84H,88H,88H,90H,0A0H,0C0H,0C0H,80H
	DB	84H,44H,44H,24H,14H,0CH,0CH,04H
	DB	0CH,30H,40H,40H,80H,80H,80H,80H
	DB	0C0H,30H,8H,08H,04H,04H,04H,04H
	DB	80H,80H,80H,80H,40H,40H,30H,0CH
	DB	04H,04H,04H,04H,08H,08H,30H,0C0H
	DB	84H,44H,24H,24H,14H,08H,38H,0C4H
	DB	04H,08H,08H,10H,20H,40H,40H,0FCH
	DB	0FCH,8H,08H,10H,20H,40H,40H,80H
	DB	0FCH,80H,80H,80H,80H,80H,80H,0FCH
	DB	80H,40H,40H,20H,10H,08H,08H,04H
	DB	0FCH,04H,04H,04H,04H,04H,04H,0FCH
	DB	04H,08H,08H,10H,20H,40H,40H,80H
	DB	00H,00H,00H,00H,00H,00H,00H,0FCH
CHR20:	DB	00H,00H,00H,00H,00H,00H,00H,00H
	DB	10H,10H,10H,10H,00H,00H,10H,00H
	DB	28H,28H,28H,00H,00H,00H,00H,00H
	DB	28H,28H,7CH,28H,7CH,28H,28H,00H
	DB	10H,3CH,50H,38H,14H,78H,10H,00H
	DB	60H,64H,08H,10H,20H,4CH,0CH,00H
	DB	20H,50H,50H,20H,54H,48H,34H,00H
	DB	04H,08H,10H,00H,00H,00H,00H,00H
	DB	04H,08H,10H,10H,10H,08H,04H,00H
	DB	40H,20H,10H,10H,10H,20H,40H,00H
	DB	10H,54H,38H,10H,38H,54H,10H,00H
	DB	00H,10H,10H,7CH,10H,10H,00H,00H
	DB	00H,00H,00H,00H,00H,10H,10H,20H
	DB	00H,00H,00H,7CH,00H,00H,00H,00H
	DB	00H,00H,00H,00H,00H,00H,10H,00H
	DB	00H,04H,08H,10H,20H,40H,00H,00H
CHR30:	DB	38H,44H,4CH,54H,64H,44H,38H,00H
	DB	10H,30H,10H,10H,10H,10H,38H,00H
	DB	38H,44H,04H,38H,40H,40H,7CH,00H
	DB	7CH,04H,08H,18H,04H,44H,38H,00H
	DB	08H,18H,28H,48H,7CH,08H,08H,00H
	DB	7CH,40H,78H,04H,04H,44H,38H,00H
	DB	1CH,20H,40H,78H,44H,44H,38H,00H
	DB	7CH,04H,04H,08H,10H,20H,40H,00H
	DB	38H,44H,44H,38H,44H,44H,38H,00H
	DB	38H,44H,44H,3CH,04H,08H,70H,00H
	DB	00H,00H,00H,10H,00H,10H,00H,00H
	DB	00H,00H,00H,10H,00H,10H,10H,20H
	DB	00H,04H,18H,20H,18H,04H,00H,00H
	DB	00H,00H,7CH,00H,7CH,00H,00H,00H
	DB	00H,20H,18H,04H,18H,20H,00H,00H
	DB	38H,44H,04H,08H,10H,00H,10H,00H
CHR40:	DB	18H,24H,5CH,54H,5CH,20H,1CH,00H
	DB	38H,44H,44H,44H,7CH,44H,44H,00H
	DB	78H,44H,44H,78H,44H,44H,78H,00H
	DB	38H,44H,40H,40H,40H,44H,38H,00H
	DB	78H,44H,44H,44H,44H,44H,78H,00H
	DB	7CH,40H,40H,78H,40H,40H,7CH,00H
	DB	7CH,40H,40H,78H,40H,40H,40H,00H
	DB	3CH,40H,40H,40H,4CH,44H,3CH,00H
	DB	44H,44H,44H,7CH,44H,44H,44H,00H
	DB	38H,10H,10H,10H,10H,10H,38H,00H
	DB	04H,04H,04H,04H,04H,44H,38H,00H
	DB	44H,48H,50H,60H,50H,48H,44H,00H
	DB	40H,40H,40H,40H,40H,40H,7CH,00H
	DB	44H,6CH,54H,54H,44H,44H,44H,00H
	DB	44H,44H,64H,54H,4CH,44H,44H,00H
	DB	38H,44H,44H,44H,44H,44H,38H,00H

CHR50:	DB	78H,44H,44H,78H,40H,40H,40H,00H
	DB	38H,44H,44H,44H,54H,48H,34H,00H
	DB	78H,44H,44H,78H,50H,48H,44H,00H
	DB	38H,44H,40H,38H,04H,44H,38H,00H
	DB	7CH,10H,10H,10H,10H,10H,10H,00H
	DB	44H,44H,44H,44H,44H,44H,38H,00H
	DB	44H,44H,44H,44H,28H,28H,10H,00H
	DB	44H,44H,44H,54H,54H,6CH,44H,00H
	DB	44H,44H,28H,10H,28H,44H,44H,00H
	DB	44H,44H,28H,10H,10H,10H,10H,00H
	DB	7CH,04H,08H,10H,20H,40H,7CH,00H
	DB	1CH,10H,10H,10H,10H,10H,1CH,00H
	DB	00H,40H,20H,10H,08H,04H,00H,00H
	DB	70H,10H,10H,10H,10H,10H,70H,00H
	DB	10H,28H,44H,00H,00H,00H,00H,00H
	DB	00H,00H,00H,00H,00H,00H,0FCH,0H

CHR60:	DB	0A8H,54H,0A8H,54H,0A8H,54H,0A8H,54H
	DB	18H,3CH,7CH,0F8H,18H,38H,7CH,0H
	DB	80H,80H,80H,80H,84H,98H,0A8H,0C4H
	DB	38H,38H,10H,7CH,6CH,10H,38H,00H
	DB	10H,38H,7CH,7CH,7CH,38H,10H,00H
	DB	00H,0FCH,0H,00H,00H,00H,00H,00H
	DB	00H,00H,0FCH,0H,00H,00H,00H,00H
	DB	00H,00H,00H,0FCH,0H,00H,00H,00H
	DB	6CH,6CH,7CH,38H,38H,10H,10H,00H
	DB	00H,00H,00H,00H,0FCH,0H,00H,00H
	DB	0FCH,0H,00H,00H,00H,00H,0H,0FCH
	DB	30H,0FCH,30H,30H,30H,78H,78H,0FCH
	DB	40H,40H,40H,40H,40H,40H,40H,40H
	DB	20H,20H,20H,20H,20H,20H,20H,20H
	DB	10H,10H,10H,10H,10H,10H,10H,10H
	DB	08H,08H,08H,08H,08H,08H,08H,08H

CHR70:	DB	00H,00H,10H,38H,10H,10H,38H,00H
	DB	0B4H,0FCH,30H,30H,30H,78H,78H,0FCH
	DB	54H,38H,38H,38H,38H,38H,7CH,00H
	DB	10H,10H,38H,7CH,7CH,10H,38H,03H
	DB	0CH,3CH,7CH,7CH,0FCH,0FCH,0FCH,0FCH
	DB	0C0H,0F0H,0F8H,0F8H,0FCH,0FCH,0FCH,0FCH
	DB	0FCH,0FCH,0FCH,0FCH,7CH,7CH,3CH,0CH
	DB	0FCH,0FCH,0FCH,0FCH,0F8H,0F8H,0F0H,0C0H
	DB	84H,48H,48H,30H,30H,48H,48H,84H
	DB	20H,20H,20H,40H,40H,80H,80H,80H
	DB	04H,04H,04H,08H,08H,10H,10H,10H
	DB	9CH,0E0H,80H,80H,80H,80H,60H,1CH
	DB	80H,0C0H,0C0H,0E0H,0F0H,0F0H,0F8H,0FCH
	DB	0E0H,18H,4H,04H,04H,4H,1CH,0E4H
	DB	04H,0CH,0CH,1CH,3CH,3CH,7CH,0FCH
	DB	00H,00H,00H,00H,00H,0FCH,0H,00H

	END	START