;'TIMES SQUARE' VDM SIGN GENERATOR
;BY ROBERT VAN VALZAH, 1976
;TRANSLATED FROM CONTROL LOGIC ASSEMBLER
;TO PROCESSOR TECHNOLOGY ASSEMBLER
;BY WARD CHRISTENSEN, 10/10/76
;THEN TO CP/M 9/16/78, WARD CHRISTENSEN
;MODIFIED FOR SOL 11/13/01, JIM BATTLE
;
SPVR	EQU	0	;EXIT TO SUPERVISOR
;
;DEFINE THE CHARACTER TO BE SHOWN ON THE SCREEN.
;ALL CHARACTERS ARE MADE OF BLOCKS OF THIS CHAR.
;
;FOR VDM, 0A0H (REV VIDEO BLOCK) WORKS WELL.
;FOR VTI, 0FFH (REV VIDEO BLOCK) WORKS WELL
;
;IF YOUR SCREEN "TEARS" BADLY WITH ALL THIS REVERSE
;VIDEO, YOU MIGHT TRY A CHARACTER SUCH AS "O" OR "X".
;
SCRNCHR	EQU	0A0H
DELAY	EQU	20H	;DEFINES SCROLLING DELAY
VDM	EQU	0CC00H	;jtb SOL-specific value
;
;THIS IS A SIMPLE ROUTINE, WHICH ASKS FOR A CHARACTER,
;THEN DISPLAYS IT ON THE VDM IN TIME-SQUARE
;FORMAT.  A MORE TYPICAL USE WOULD BE TO CALL THE
;"SIGN" SUBROUTINE FROM ANOTHER PROGRAM WHICH HAS
;PRE-DEFINED LINES OF DATA.
;
;NOTE THAT CALLS TO CP/M WERE NOT USED, AS
;THEY ECHO THE CHARACER TYPED, SO MAKE
;CHANGES TO THE FOLLOWING FOR YOUR KEYBOARD INPUT
;
	ORG	100H
	XRA	A
	OUT	0FEH	;jtb scrollbase=0
	CALL	ERASE	;ERASE SCREEN
LOOP	IN	0FAH	;jtb SOL-specific
	ANI	1	;jtb SOL-specific
	JNZ	LOOP
	IN	0FCH	;jtb SOL-specific
	CPI	80H	;jtb SOL-specific: mode key
	JZ	SPVR	;jtb done
	CALL	SIGN	;PRINT IT
	JMP	LOOP
;
;THE FOLLOWING IS A SUBROUTINE TO PRINT LARGE
;CHARACTERS SIDEWAY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TL-CHAR, JUST DO LONG DELAY
CTLCH	LXI	H,8000H
CTLDL	DCR	L
	JNZ	CTLDL
	DCR	H
	JNZ	CTLDL
	XRA	A
	JMP	NOTCL
ERASE	LXI	H,VDM
	MVI	A,' '
	MVI	B,4
CLRLP	MOV	M,A
	INR	L
	JNZ	CLRLP
	INR	H
	DCR	B
	JNZ	CLRLP
	RET
;

;THIS IS A TABLE OF 5X7 BIT PATTERNS FOR THE
;UPPER CASE ASCII CHARACTERS AND PUNCTUATION.
;
;EACH 5 CHARACTERS ARE CODED AS A COLUMN OF THE
;CHARACTER.  THUS 7FH IS A SOLID COLUMN OF 7 BITS.
;
;FOR EXAMPLE, THE DOLLAR SIGN IS CODED AS:
;	DB	3AH,2AH,7FH,2AH,2EH
;
;WHICH IS THUS:
;
;	3 2 7 2 2
;	A A F A E
;	- - - - -
;	    X
;	X X X X X
;	X   X
;	X X X X X
;	    X   X
;	X X X X X
;	    X
;
;' '
ROMT	DB	0,0,0,0,0
;EXCLAMATION MARK
	DB	0,0,7DH,0,0
;'"'
	DB	0,70H,0,70H,0
;'#'
	DB	14H,7FH,14H,7FH,14H
;'$'
	DB	3AH,2AH,7FH,2AH,2EH
;'%'
	DB	62H,64H,8,13H,23H
;'&'
	DB	36H,49H,35H,2,5
;''''
	DB	0,0,70H,0,0
;'('
	DB	1CH,22H,41H,0,0
;')'
	DB	0,0,41H,22H,1CH
;'*'
	DB	22H,14H,7FH,14H,22H
;'+'
	DB	8,8,3EH,8,8
;','
	DB	0,1,6,0,0
;'-'
	DB	8,8,8,8,8
;'.'
	DB	0,0,1,0,0
;'/'
	DB	2,4,8,10H,20H
;'0'
	DB	7FH,45H,49H,51H,7FH
;'1'
	DB	0,21H,7FH,1,0
;'2'
	DB	23H,45H,49H,49H,31H
;'3'
	DB	41H,41H,49H,49H,7FH
;'4'
	DB	78H,8,8,8,7FH
;'5'
	DB	72H,51H,51H,51H,4EH
;'6'
	DB	7FH,49H,49H,49H,4FH
;'7'
	DB	40H,40H,40H,40H,7FH
;'8'
	DB	7FH,49H,49H,49H,7FH
;'9'
	DB	79H,49H,49H,49H,7FH
;':'
	DB	0,0,14H,0,0
;';'
	DB	0,1,16H,0,0
;'<'
	DB	8,14H,22H,41H,0
;'='
	DB	14H,14H,14H,14H,14H
;'>'
	DB	0,41H,22H,14H,8
;'?'
	DB	20H,40H,4DH,50H,20H
;'@'
	DB	3EH,41H,5DH,4DH,39H
;'A'
	DB	7FH,44H,44H,44H,7FH
;'B'
	DB	7FH,49H,49H,49H,36H
;'C'
	DB	7FH,41H,41H,41H,41H
;'D'
	DB	7FH,41H,41H,63H,3EH
;'E'
	DB	7FH,49H,49H,49H,41H
;'F'
	DB	7FH,48H,48H,48H,40H
;'G'
	DB	7FH,41H,41H,45H,47H
;'H'
	DB	7FH,8,8,8,7FH
;'I'
	DB	0,41H,7FH,41H,0
;'J'
	DB	3,1,1,1,7FH
;'K'
	DB	7FH,8,14H,22H,41H
;'L'
	DB	7FH,1,1,1,1
;'M'
	DB	7FH,20H,10H,20H,7FH
;'N'
	DB	7FH,10H,8,4,7FH
;'O'
	DB	7FH,41H,41H,41H,7FH
;'P'
	DB	7FH,48H,48H,48H,78H
;'Q'
	DB	7FH,41H,45H,42H,7FH
;'R'
	DB	7FH,48H,4CH,4AH,79H
;'S'
	DB	79H,49H,49H,49H,4FH
;'T'
	DB	40H,40H,7FH,40H,40H
;'U'
	DB	7FH,1,1,1,7FH
;'V'
	DB	7CH,2,1,2,7CH
;'W'
	DB	7FH,2,0CH,2,7FH
;'X'
	DB	63H,14H,8,14H,63H
;'Y'
	DB	60H,10H,1FH,10H,60H
;'Z'
	DB	43H,45H,49H,51H,61H
;LEFT BRACKET
	DB	7FH,7FH,41H,41H,41H
;BACK SLASH
	DB	20H,10H,8,4,2
;RIGHT BRACKET
	DB	41H,41H,41H,7FH,7FH
;UP ARROW
	DB	4,8,10H,8,4
;'_'
	DB	1,1,1,1,1
SBUF	EQU	$

