Compucolor.org – Virtual Media

Listing of file='TERMNL.SRC;01' on disk='vmedia/terminal-sector.ccvf'

;*******************************************************
;*						       *
;* TERMNL - This is an interrupt driven standalone     *
;* machine language program which makes the CC II      *
;* into a standard terminal.                           *
;*                                                     *
;*   It will only recognise the standard printable     *
;* ASCII character set plus the following control      *
;* codes:-                                             *
;*       a) Line Feed          Hex 0A                  *
;*       b) Carriage Return    Hex 0D                  *
;*						       *
;*******************************************************
;;
		ORG	9000H
;
;
;*****  EXTERNAL CALLS  ******
;
;
	BEGIN	EQU	01B6H	;wait loop..int enabled
	IPFLAG	EQU	81E3H	;address of Input Flag
	USRJMP	EQU	81C5H	;input table user jump
	OSTR	EQU	182AH	;print string
	DUPLX	EQU	81DDH	;local, full/half duplex flag
;
;
;*****  START OF MAIN PROGRAM  *****
;
;
	TERMNL:	LXI	SP,STACK;initialize SP
		DI
		LXI	H,INTRO	;pointer to intro message
		CALL	OSTR	;go print it
	IOINIT:	MVI	A,90H	;set up for 1200 baud
		OUT	5	;send it
		MVI	A,0FFH	;minus 1 equals full duplex
		STA	DUPLX	;into flag
		MVI	A,1FH	;offset into INPUT TABLE
		STA	IPFLAG	;
		LXI	H,USRJMP;input table user jump
		MVI	A,0C3H	;vector
		MOV	M,A
		LXI	H,ÍѕɁinput routine
		SHLD	USRJMP+1;iU;Zhnto user input table jump
		EI
	EXIT:	JMP	BEGIN	;jmp to CRTMO
;
;
	INTRO:	DB	06H	;CCI
		DB	02H	;yellow on black
		DB	0CH	;erase page
		DB	0EH	;large characters
		DB	'TERMINAL'
		DB	0AH	;return
		DB	0DH	;line feed
		DB	0FH	;small chars
		DB	06H
		DB	02H	;green on black
		DB	0EFH	;end of string terminator
;
;

	SPARE:	DS	10H
;
;
	SAREA:	DS	40H	;reserve area for stack
	STACK:	DS	10H	;start of stack
;
;; Set up now for service of serial i/p interrupt
;
	KBCHA	EQU	81FEH	;input buffer cNI	7FH	;buffer and strip parity
;
;
;at this point we need to determine if it came from the
;keyboard or the serial input..... if the keyboard then
;it needs to be sent to the serial output ...........
;
;
		CPI	0DH	;if CR or LF
		JZ	GOOD	;then ok
		CPI	0AH	;else
		JZ	GOOD	;
		CPI	20H	;less than 20
		JP	GOOD	;hex
	BAD:	XRA	A	;then
		MOV	E,A	;cleanup
		STA	KBCHA	;its bad so
		STA	KBRDY	;clear all
		RET		;and return
	GOOD:	STA	KBCHA	;else its
		MOV	E,A	;good so
		JMP	SVCHA	;go print it

;
;
		END	TERMNL