It is currently Sun Sep 22, 2019 11:19 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Aug 23, 2019 7:00 pm 
Offline

Joined: Fri Aug 23, 2019 4:36 pm
Posts: 3
A while back a created a working Gameboy rom dumper and I am now trying to add save dumping to it. I am having trouble finding information on the chip select pin, and what I need to do to it to read the sram. I have written code so far that:
-finds the number of sram banks
-enables ram banking mode
-enables ram
-reads data from address range for each bank
-disables ram

I have not messed with the CS pin, but I believe there is something I need to do with it to get this working. I am getting most of my information from GbdevWiki. Any help would be great.


Top
 Profile  
 
PostPosted: Fri Aug 23, 2019 8:28 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8571
Location: Seattle
Treat the /CS pin as NOT(A15).

It isn't exactly, but as far as the cart's concerned it's close enough.


Top
 Profile  
 
PostPosted: Fri Aug 23, 2019 9:44 pm 
Offline

Joined: Fri Aug 23, 2019 4:36 pm
Posts: 3
I'm not sure I completely understand what you mean. I am wondering when I need to set the CS pin to high or low when accessing the sram.


Top
 Profile  
 
PostPosted: Fri Aug 23, 2019 10:49 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8571
Location: Seattle
"A15" on the game boy cartridge connector isn't exactly A15 from the CPU. It's a signal that's low when the Game Boy is accessing $0000-$7FFF, but its timing is different from the rest of the address bus and it acts more like a bus enable signal. Similarly, "CS" is low when the Game Boy is accessing $A000-$FDFF, but it shares this same different timing with "A15".

Nothing on the cartridge cares about how /CS isn't low for $8000-$9FFF or $FE00-$FFFF. You can safely just treat /CS as though it were exactly the opposite of A15.


Top
 Profile  
 
PostPosted: Fri Aug 23, 2019 11:29 pm 
Offline

Joined: Fri Aug 23, 2019 4:36 pm
Posts: 3
so for me, interfacing directly to the cart to read and write the sram, I don't need to worry about the CS pin?


Top
 Profile  
 
PostPosted: Fri Aug 23, 2019 11:49 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8571
Location: Seattle
That's not what I said. "A15" isn't an address line. It's just another enable, like /RD and /WR.

A15 or /CS or neither can be low, but never both. /RD or /WR or neither can be low, but never both. The bus is only active when one of the first two and one of the latter two are both active (low) simultaneously. Most MBCs place cart RAM in the region where /CS and A14 are both low (i.e. $A000-$BFFF), but I believe I read that at least one requires "A15" be high instead of /CS be low.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group