Compucolor.org – Virtual Media

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

;*************************************************************
;*
;*  CC2CAS - This is a standalone program to make the
;*  CCII emulate a cassette recorder to allow the saving
;*  and loading of 6800 programs on disc.
;*
;*************************************************************
;*************************************************************
;*
;*  Transfer rates are:-
;*
;*		a.  CCII to 6800 - 4800 baud,and
;*		b.  6800 to CCII - 300 baud.
;*
;*
;*
;*
;*
;**************************************************************
;*
;*  Program Sequence.
;*
;*  1. Set up serial input vector to test for characters
;*     entered and ignore Control codes.
;*
;*  2. Set up memory storage pointers.
;*
;*  3. Clear Character in Flag.
;*
;*  4. Call GET CHARACTER subroutine( this will read
;*     in one character on the serial line).
;*
;*  5. Decision - was it a "B" - if not, back to 4.
;*
;*  6. Save char in memory and bump pointers.
;*
;*  7. Call GET CHARACTER.
;*
;*  8. Save character in memory as Byte Count.
;*
;*  9. Call GET CHARACTER.
;*
;*  10.Save in memory as load address(high byte).
;*
;*  11.Call GET CHARACTER.
;*
;*  12.Save in memory as load address(low byte).
;*
;*  13.Call GET CHARACTER.
;*
;*  14.Save in memory.
;*
;*  15.Decrement byte count.
;*
;*************************************************************
;*************************************************************
;*
;*
;*  The program will loop scan the serial input line
;*  to check for characters being entered from the
;*  6800. Upon receipt of a valid record, it will
;*  start saving the records at C000 hex upwards.
;*  Maximum storage of one file transfer (7 records).
;*  Program will terminate at this point to allow
;*  received data to be stored on disc.
;*
;*
;*  Formatt:
;*
;*  ______________________________________//_______________
;*        I     I          I     i     I      I     I
;*  NULLS I "B" I BYTE CNT I LOAD ADDR I DATA I "G" I NULLS
;*  ______I_____I__________I_____i_____I__//__I_____I______
;*
;*
;*  Byte Count - One byte value of number of data bytes
;*  in data field. Range 0 thru 255.
;*
;*  Load Address - Two byte value specifying the absolute
;*  memory address at which data will start loading.
;*
;*  "B" - Beginning of record indicator.
;*  "G" - End of record indicator.
;*
;*  Data - Up to 256 bytes of data.
;*
;*
;*
;
;
	ORG	9000H
	;
	;
	INIT:	MVI	A,1FH	;user input flag
		STA	81EFH
		MVI	A,0C3H
		STA	81C5H
		LXI	H,9100H	;user serial int vector
		SHLD	81C6H
	;
	;
	;Go to main program loop.
	;
	;
	;
	MAINLP	EQU	9200H
	;
	;
		JMP	MAINLP
	;
	;
		ORG	9200H
	;
	;
	MAINLP:	LXI	H,0C000H;save area
		XRA	A
		STA	81FEH
	START:	CALL	GETCH	;get character subroutine
		CPI	'B'
		JNZ	START	;keep looking for 'B'
		MOV	M,A
		INX	H
		CALL	GETCH
		MOV	M,A
		INX	H
		MOV	C,A
		CALL	GETCH
		MOV	M,A
		INX	H
		CALL	GETCH
		MOV	M,A
		INX	H
	;
	;
	DATALP:	CALL	GETCH
		MOV	M,A
		INX	H
		DCR	C
		JNZ	DATALP	;keep going until BC=0
		CALL	GETCH
		CPI	'G'
		JNZ	START
		MOV	M,A
		JMP	FCS	;return back to FCS
	;
	;GETCH - get character subroutine
	;
	;
	GETCH:	IN	3	;read 5501 status
		PUSH	A	;save for later
		ANI	08H	;strip except rx loaded
		JZ	GETCH
		POP	A
		PUSH	A
		ANI	03H	;strip except error bits