[MZ-80K] RAMTEST

Post Reply
hlide
Posts: 312
Joined: Thu Jan 25, 2018 9:31 pm

[MZ-80K] RAMTEST

Post by hlide » Sat May 26, 2018 6:37 pm

Here are the source and MZF file of my RAMTEST program.

I wrote it from scratch so it can be very fast and can tell you which chip is defective in which row and it can be easily modified in the binary through a hexadecimal editor :

0080h: 2 bytes, little endianness, RAM size in bytes to test, default: 0xBDFF, that is 48 KByte minus 512 bytes because the range $1000-$11FF are used by MONITOR.
0082h: 2 bytes, little endianness, RAM start address in bytes to test, default: 0x1200 because the range $1000-$11FF are used by MONITOR.
0084h: 1 byte, bit pattern. Bits D0...D7 of a row. A bit set to 0 is the tested chip and the other bits are set to 1. Default: 0xFE.
0085h: 1 byte, exclusion mask. Bits D0...D7 of a row. A bit #n set to 1 means the chip #n is not tested and may not be socketed. Default: 0x00 (all are tested)

The program test a chip #n in the given memory range then rotates bits in 0084h to redo the test with the next chip forever until one defective chip is detected and get back to monitor prompt.

EDIT: it seems I cannot attach any files here so I insert the source here. If soemone wants to add them on the website sharpmz.org, just ask me.

Code: Select all

	org 	0xd000
size:	dw	0xbdff	; size in bytes (minus 512 bytes because ROM monitor use them)
addr:	dw	0x1200	; start address (minus 512 bytes because ROM monitor use them)
patt:	db	0xfe	; bit pattern, all bits but bit 0 initially set to 1 (testing D0)
mask:	db	0x00	; exclusion mask, chip #n is excluded with bit #n set to 1 so the slot of chip #n may be empty
_main:
l0:
	ld	de,0x0f10	; column: 16, line: 15
	ld	(0x1171),de	; set monitor cursor
	ld	hl,(patt)	; load pattern into L and mask into H
	ld	a,l		; set current pattern to test
	or	h		; current pattern is OR-ed with exclusion mask
	push	af		; save the current pattern
	cpl			; for display, we prefer a two-complemented pattern to determine which chip is tested (01, 02, 04, 08, 10, 20, 40 and 80)
	call	0x03c3		; monitor call to display hexadecimal byte from A
	pop	af		; restore the current pattern
	ld	bc,(size)	; set the size to fill
	ld	hl,(addr)	; set the start address to fill
	push	bc		; save the size for scan
	push	hl		; save the start address for scan
	push	hl		; transfer HL into DE
	pop	de
	inc	de		; and increase DE
	ld	(hl),a		; set the first byte with the current pattern
	ldir			; trick to fill all the memory block with the current pattern
	pop	hl		; restore the start address to scan
	pop	bc		; restore the size to scan
l2:	cpi			; read the byte and compare to the current pattern 
	jr	nz,x0		; if not equal a chip must be defective
	jp	pe,l2		; otherwise loop to scan the next byte
	ld	hl,patt	
	rlc	(hl)		; rotate the byte in patt (next chip)
	jr	l0		; loop for testing the next chip
x0:	dec	hl		; retrieve the faultive address
	push	hl		; save it
	ld	a,(hl)		; read the byte at this address
	cpl			; for display, we prefer a two-complemented bytes
	call	0x03c3		; monitor call to display hexadecimal byte from A so the defective chip can be determined
	pop	hl		; restore the faultive address
	call	0x03ba		; monitor call to display hexadecimal word from HL so the RAM row can be determined
	jp	0x0082		; back to monitor prompt
end	_main

hlide
Posts: 312
Joined: Thu Jan 25, 2018 9:31 pm

Re: [MZ-80K] RAMTEST

Post by hlide » Sat May 26, 2018 6:53 pm

And with this program, I quickly determined I had 6 over 8 RAM chips which are defective in the last row by inserting a new chip after a defective chip is found out.

hlide
Posts: 312
Joined: Thu Jan 25, 2018 9:31 pm

Re: [MZ-80K] RAMTEST

Post by hlide » Sun May 27, 2018 10:51 am

I didn't remember I already made a similar post. About the source, the main difference is adding the comments and the fact that I have a working 48KB RAM now.

Post Reply