[MZ-80K/A, MZ-700] MZRAMTEST

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

[MZ-80K/A, MZ-700] MZRAMTEST

Post by hlide » Sun May 06, 2018 11:44 am

After acquiring an MZ-80 K, I had an issue with its DRAM. I found out a RAMTEST program on www.sharpmz.org but I wasn't satisfied with the result.

So I decided to modify it to be able to display what byte unmatches at which address to determine which chip in which row is faulty.

Here are the changes:

- at $D000, two bytes give the size in byte minus one of the DRAM to scan. By default, it is $BDFF to cover the full 48KB except for the first 512 bytes because if $1000-$11ff were corrupted, you should not be able to load/run this program safely. You can alter those two bytes in the MZF file for a particular size.
- at $D002, two bytes give the start address in bytes of the DRAM to scan. By default, it is $1200 because if $1000-$11ff were corrupted, you should not be able to load/run this program safely. You can alter those two bytes in the MZF file for a particular address.
- at $D004, one byte as the start pattern byte. Every time a scan succeeds, this pattern byte is left rotated. By default, Pattern byte is all set to 1 except for bit 0 set to 0 -> the byte, when displayed, is inverted to tell which chip[s] is/are tested. This start pattern byte can be altered in the MZF file.
- at $D005, one byte as the OR mask byte. By default, mask byte is set to 0. This pattern byte is OR-ed with this mask byte before scanning. This mask byte can be altered in the MZF file.
- at $D006, the code starts.

Rational behind pattern and mask bytes:

Suppose you determine two chips of the second row were faulty and you took two chips of the third rows to replace them and scanning is now successful for the second row. You want to determine whether the other chips of the third row are working as well. You can use the mask byte to tell which chip to ignore (an empty socket returns a bit set to 1). That way, you can still determine which chips are working even with empty sockets in the row.

When an issue occurs, it displays in the middle of the display three numbers in hexadecimal: the first is the pattern byte tested (bits are inverted), the second is the read byte unmatching the pattern byte (bits not matching are the faulty chips) and the third is the faulty address to determine which row.

Here is the code:

Code: Select all

	org 	0xd000
size:	dw	0xbdff
addr:	dw	0x1200
patt:	db	0xfe
mask:	db	0x00
_main:
l0:
	ld	de,0x0f10
	ld	(0x1171),de
	ld	hl,(patt)
	ld	a,l
	or	h
	push	af
	cpl
	call	0x03c3
	pop	af
	ld	bc,(size)
	ld	hl,(addr)
	push	bc
	push	hl
	push	hl
	pop	de
	inc	de
	ld	(hl),a
	ldir
	pop	hl
	pop	bc
l2:	cpi
	jr	nz,x0
	jp	pe,l2
	ld	hl,patt
	rlc	(hl)
	jr	l0
x0:	dec	hl
	push	hl
	ld	a,(hl)
	cpl
	call	0x03c3
	pop	hl
	call	0x03ba
	jp	0x0082
end	_main
I see some improvements which might be done:
- avoid using calls to monitor ROM to display to be able to scan $1000-$11FF (MONITOR workplace) safely.
- display something like that:

Code: Select all

      DDDDDDDDD
      012345678
ROW 1 ---------
ROW 2 -X-----X-
ROW 3 -----XX--
where X determines a faulty chip.

I can provide the A80 (using Z80as) and MZF files if they are of some interest for the websites.

Post Reply