Page 1 of 1

Testing For 32KB WRAM Support in an Emulator

Posted: Wed Feb 16, 2011 12:43 pm
by neilbaldwin
I'm trying to figure a way to test whether emulators *truly* support WRAM bigger than 8K.

The test I came up with was to write a different value to the last byte of each 8K WRAM bank and then when all 4 banks have been written, read the values back from each bank and check that they are still set correctly.

The logic behind this is that if the WRAM bank-switching is not implemented, the value from each bank will read the same value (the last value that was written) and therefore I can trap that condition.

However, I've tested this in FCEUX, NesterJ and VirtuaNES and the odd thing is, despite the fact that I *know* these emulators don't support WRAM>8K, the test doesn't catch.

Can anyone suggest another test?

Here's the code from my test:

Code: Select all

	lda #WRAM_BANK_00
	jsr setMMC1r1
	lda #$01
	sta WRAM0_TEST	
	lda #WRAM_BANK_01
	jsr setMMC1r1
	lda #$02
	sta WRAM1_TEST	
	lda #WRAM_BANK_02
	jsr setMMC1r1
	lda #$04
	sta WRAM2_TEST	
	lda #WRAM_BANK_03
	jsr setMMC1r1
	lda #$08
	sta WRAM3_TEST
		
	lda #WRAM_BANK_00
	jsr setMMC1r1
	lda WRAM0_TEST
	cmp #$01
	bne @lockUp	
	lda #WRAM_BANK_01
	jsr setMMC1r1
	lda WRAM1_TEST
	cmp #$02
	bne @lockUp
	lda #WRAM_BANK_02
	jsr setMMC1r1
	lda WRAM2_TEST
	cmp #$04
	bne @lockUp
	lda #WRAM_BANK_03
	jsr setMMC1r1
	lda WRAM3_TEST
	cmp #$08
	beq @noLock

@lockUp:	jmp @lockUp
	
@noLock:
'setMMC1r1' sets the WRAM bank
WRAM0_TEST is a RAM variable in bank 0
WRAM1_TEST is in bank 1 etc

Posted: Wed Feb 16, 2011 1:28 pm
by Bregalad
Mmh maybe it's possible that those emulators *does* emulate 32k WRAM, but does only *save* 8k ? If they would emulate 8k or 16k this code would obviously detect that.

Also this might seems like a stupid question, but does WRAM0_TEST WRAM1_TEST, WRAM2_TEST and WRAM3_TEST equals the same adress (exept the bank) ? If they're not, it's no wonder why your program doesn't lead to the expected results. :wink:

Posted: Wed Feb 16, 2011 1:45 pm
by neilbaldwin
Bregalad wrote:Mmh maybe it's possible that those emulators *does* emulate 32k WRAM, but does only *save* 8k ? If they would emulate 8k or 16k this code would obviously detect that.

Also this might seems like a stupid question, but does WRAM0_TEST WRAM1_TEST, WRAM2_TEST and WRAM3_TEST equals the same adress (exept the bank) ? If they're not, it's no wonder why your program doesn't lead to the expected results. :wink:
Doh, they were *supposed* to be pointing to the same address. Would help if I'd setup the RAM segment properly in my CA65 config file.

Thanks for being the voice of clarity Bregalad. :)

Everyone else feel free to ignore this thread. *shame*

Posted: Wed Feb 16, 2011 6:51 pm
by cpow
neilbaldwin wrote: Everyone else feel free to ignore this thread. *shame*
Any chance you could put up the generated ROM for those of us with emulators not in your "tested on" list to test with? :D

Yes...I'm being lazy.

Posted: Thu Feb 17, 2011 12:57 am
by neilbaldwin
NESICIDE wrote:
neilbaldwin wrote: Everyone else feel free to ignore this thread. *shame*
Any chance you could put up the generated ROM for those of us with emulators not in your "tested on" list to test with? :D

Yes...I'm being lazy.
Already done :)

http://blog.ntrq.net/?p=494

Posted: Thu Feb 17, 2011 1:01 am
by frantik
now that's what i call a "nag screen" :D