[Coco] Memory testing a CoCo1 or CoCo2

Robert Gault robert.gault at att.net
Wed Dec 15 10:59:49 EST 2021


There has been some interest in this subject so here is a program I wrote to test memory up to 64K.

Sent from AT&T Yahoo Mail on Android
-------------- next part --------------
* 64K Core memory test by Robert Gault
* This is designed to test most of the 64K memory of a Coco1 OR 2.
* With a 4K RAM CoCo1, you must enter CLEAR10 before CLOADM!

PRINT	EQU	$B99C	ROM ROUTINE Prints a string
NUMBR	EQU	$BDCC	ROM ROUTINE Prints an integer
RAM	EQU	$FFDF
ROM	EQU	$FFDE
CLOSE	EQU	$A416

Casette	EQU	1	*1=cassette 0=disk

	ORG	$E00
	ifeq	Casette
START	JSR	CLOSE	This is not needed if there are no floppies.
	CLRA
	STA	$FF40
	STA	$71
	endc
	ifne	Casette
START	equ	*
	endc
	ORCC	#$50	Turn off interrupts
	STA	ROM
	LEAX	MSG1-1,PCR
	JSR	PRINT
	LEAY	MEMTBL,PCR	Test for 4K, 16K, 32K
	CLRB
A@	LDX	,Y++	get an address to test
	INCB
	STB	AMNT2,PCR
	LDA	,X	get the byte
	COM	,X	Change what might be ROM
	CMPA	,X	did it change?
	BNE	A@	Go if a change as it was RAM
	LEAX	-1,X	Adjust to the last RAM byte
	STX	ADDR,PCR
	CMPX	#$7FFF
	BNE	TSTING	less than 32K RAM
	STA	RAM
	LDA	$A000	Test for more than 32K RAM
	COM	$A000
	CMPA	$A000
	BEQ	TSTING	32K RAM
	INC	AMNT2,PCR
	LDX	#$FF00
	STX	ADDR,PCR
	JSR	TMPVAL
	STA	RAM
	BRA	TST2

TSTING	JSR	TMPVAL
TST2	LDX	#$0	Test from $0000-$0DFF
	LEAY	TABLE,PCR
A@	LDA	,X
	LDB	#3
	STA	TMP,PCR
B@	LDA	B,Y
	STA	,X
	LDA	,X
	CMPA	B,Y
	BNE	ERR
	DECB
	BPL	B@
	LDA	TMP,PCR
	STA	,X+
	CMPX	#$E00
	BNE	A@

	LDX	#Endd	Test from Endd-$FEFF or less
A@	LDA	,X
	LDB	#3
	STA	TMP,PCR
B@	LDA	B,Y
	STA	,X
	LDA	,X
	CMPA	B,Y
	BNE	ERR
	DECB
	BPL	B@
	LDA	TMP
	STA	,X+
	CMPX	ADDR	Limit for testing
	BNE	A@
	BRA	OK

TMPVAL	STA	ROM	Just 32K RAM so go back to ROM
	LEAX	MSG2-1,PCR
	JSR	PRINT
	LEAX	AMNT-1,PCR
	LDA	#5
	LDB	AMNT2
	MUL
	LEAX	D,X
	JMP	PRINT

ERR	STA	ROM
	STX	LOC
	LEAX	ERRMSG-1,PCR
	JSR	PRINT
	LDD	LOC,PCR
	JSR	NUMBR
	BRA	EXIT
	
OK	STA	ROM
	LEAX	OKMSG-1,PCR
	JSR	PRINT
EXIT	JSR	$ADFB
	BEQ	EXIT
	ANDCC	#$AF
	JMP	$A027

ADDR	RMB	2
TMP	RMB	1
LOC	RMB	2
TOGL	FCB	0	*Used to return to correct RAM/ROM mode
MEMTBL	FDB	$1000,$4000,$8000
TABLE	FCB	0,$FF,%10101010,%01010101
MSG2	FCC	/YOU SEEM TO HAVE/
	FCB	$0D,0
AMNT2	FCB	0
AMNT	RMB	5
	FCC	/04K/
	FCB	$0D,0
	FCC	/16K/
	FCB	$0D,0
	FCC	/32K/
	FCB	$0D,0
	FCC	/64K/
	FCB	$0D,0
MSG1	FCC	/TESTING MEMORY/
	FCB	$0D,0
ERRMSG	FCC	/AN ERROR OCCURED AT /
	FCB	0
OKMSG	FCC	/NO ERRORS IN MEMORY/
	FCB	$0D,0
Endd	equ	*
	ifeq	Casette
	ORG	$16A
	JMP	START	Auto start on a LOADM
	endc
	END	START


More information about the Coco mailing list