Page 1 of 1

Grey screen in some emulators

Posted: Mon Nov 09, 2015 8:52 pm
by OscarRichard
Hi, I was trying my work-in-progress game in my emulators and it was running well (I use FCEUX, Jnes, Nintendulator and Nestopia), but then I needed extra 8K of RAM in order to use more variables and it just run in FCEUX and Jnes. In the rest of my emulators just got the grey screen and nothing else. I'd like to know if it is normal in some emulators or if I need to fix something in the code. I use C language. This is what I got in my nes.cfg file (just a part of it):

Code: Select all

	# First 28 bytes of the zero page are used by NES library
    ZP: start = $28, size = $d8, type = rw, define = yes;

    # INES Cartridge Header
    HEADER: start = $0, size = $10, file = %O ,fill = yes;

    # 2 16K ROM Banks
    # - startup
    # - code
    # - rodata
    # - data (load)
	# NROM256
	PRG: start = $8000, size = $7f00, file = %O ,fill = yes, define = yes;

	# DPCM Samples at end of the ROM
	# NROM256
	DMC: start = $ff00, size = $fa, file = %O, fill = yes;

    # Hardware Vectors at end of the ROM
	# NROM256
	VECTORS: start = $fffa, size = $6, file = %O, fill = yes;

    # 1 8K CHR Bank
    CHR: start = $0000, size = $4000, file = %O, fill = yes;

    # standard 2K SRAM (-zeropage)
    # $0100 famitone, palette, cpu stack
	# $0200 oam buffer
	# $0300..$800 ca65 stack

    #RAM: start = $0300, size = $0500, define = yes;

	# Use this definition instead if you going to use extra 8K RAM
	RAM: start = $6000, size = $2000, define = yes;
All I did is set the very last line of this code and changed the CHR size to $4000 in order to use 2 chr files.
Greetings ans thanks!

Re: Grey screen in some emulators

Posted: Mon Nov 09, 2015 9:06 pm
by rainwarrior
A grey screen usually indicates a crash or fail to start. Colour 0 on the NES/Famicom is grey, and many emulators initialize the palette to 0, showing a grey screen if nothing else happens.

If your ROM fails to run in lots of emulators it's probably your own fault. Especially when it comes to invalid files, what an emulator does in response is not well defined, so different emulators will cope in different ways.

1. If you change the size of your CHR region in the MEMORY definition of your CFG file, you need to change the number of CHR banks specified in the iNES header. Where it specified 1 8k bank before, it should now specify 2 8k banks. I suspect this is what is failing to run in some emulators. See iNES format.

2. $28 means 40 bytes, not 28 bytes. Did you really mean $28 or did you mean 28? $ makes the number hexadecimal.

Re: Grey screen in some emulators

Posted: Tue Nov 10, 2015 2:08 pm
by MottZilla
Some emulators allow NROM to have RAM at $6000-$7FFF but many or most do not allow for this. This could be related to your issue.

Re: Grey screen in some emulators

Posted: Thu Nov 12, 2015 9:04 pm
by OscarRichard
Just resolved the problem by moving a pragma in my source code above more variables. Thanks, anyway.
rainwarrior wrote: 1. If you change the size of your CHR region in the MEMORY definition of your CFG file, you need to change the number of CHR banks specified in the iNES header. Where it specified 1 8k bank before, it should now specify 2 8k banks. I suspect this is what is failing to run in some emulators. See iNES format.
Yes, it is in 2 in the header.
rainwarrior wrote: 2. $28 means 40 bytes, not 28 bytes. Did you really mean $28 or did you mean 28? $ makes the number hexadecimal.
It is $28 in hexadecimal. Didn't see that well.
MottZilla wrote:Some emulators allow NROM to have RAM at $6000-$7FFF but many or most do not allow for this.
I see. I'll consider it, thanks.