Testing For 32KB WRAM Support in an Emulator

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
User avatar
neilbaldwin
Posts: 481
Joined: Tue Apr 28, 2009 4:12 am
Contact:

Testing For 32KB WRAM Support in an Emulator

Post 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
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post 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:
Useless, lumbering half-wits don't scare us.
User avatar
neilbaldwin
Posts: 481
Joined: Tue Apr 28, 2009 4:12 am
Contact:

Post 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*
User avatar
cpow
NESICIDE developer
Posts: 1097
Joined: Mon Oct 13, 2008 7:55 pm
Location: Minneapolis, MN
Contact:

Post 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.
User avatar
neilbaldwin
Posts: 481
Joined: Tue Apr 28, 2009 4:12 am
Contact:

Post 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
frantik
Posts: 370
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik »

now that's what i call a "nag screen" :D
Post Reply