Writing to 8-bit SRAM
Moderator: BigEvilCorporation
-
- Very interested
- Posts: 60
- Joined: Wed Mar 12, 2014 11:11 pm
- Location: Michigan
- Contact:
Writing to 8-bit SRAM
How do I write to my SRAM? As all of you know, the SRAM in official games is connected only to the Lower byte of the data bus, and writing is enabled by making the !LDSW pin go low.
My parallel SRAM is located between 0x200000 and 0x23FFFF. please help me write bytes to it.
My parallel SRAM is located between 0x200000 and 0x23FFFF. please help me write bytes to it.
-
- Very interested
- Posts: 616
- Joined: Thu Nov 30, 2006 6:30 am
You don't need assembly to write to SRAM, unless you want to use movep. That doesn't really seem like it's worth the trouble though since SRAM access is usually not performance sensitive.
Something like this should work:
Alternatively, you can tree sram like an array and only access every other location.
Something like this should work:
Code: Select all
char * sram = (char *)0x200001;
*sram = FIRST_BYTE;
sram += 2;
*sram = SECOND_BYTE;
-
- Very interested
- Posts: 149
- Joined: Sat Nov 17, 2012 3:58 am
I'd assume that it's the same as writing to RAM in assembly anyways.Mask of Destiny wrote:You don't need assembly to write to SRAM, unless you want to use movep. That doesn't really seem like it's worth the trouble though since SRAM access is usually not performance sensitive.
Something like this should work:Alternatively, you can tree sram like an array and only access every other location.Code: Select all
char * sram = (char *)0x200001; *sram = FIRST_BYTE; sram += 2; *sram = SECOND_BYTE;
Code: Select all
SRAMADDRESS equ 0x200001
move.b #0x3A, SRAMADDRESS
EDIT: Oh wow. Yeah missed that movep part, time to learn a new asm instruction.
-
- Very interested
- Posts: 616
- Joined: Thu Nov 30, 2006 6:30 am
!LDSW is the write strobe for the lower byte. Whenever there's a write that involves the low byte, this pin goes low (the ! indicates an active low signal). So it will go low for a word write or for a byte write to an odd address. Similarly !UDSW will be low for both word writes and byte writes to even addresses.Count SymphoniC wrote:Is that really all there is to it though? He said something about "making the !LDSW pin go low" and I know squat about that.
-
- Very interested
- Posts: 60
- Joined: Wed Mar 12, 2014 11:11 pm
- Location: Michigan
- Contact:
I was hoping that was the case. CheersMask of Destiny wrote:!LDSW is the write strobe for the lower byte. Whenever there's a write that involves the low byte, this pin goes low (the ! indicates an active low signal). So it will go low for a word write or for a byte write to an odd address. Similarly !UDSW will be low for both word writes and byte writes to even addresses.Count SymphoniC wrote:Is that really all there is to it though? He said something about "making the !LDSW pin go low" and I know squat about that.
-
- Very interested
- Posts: 89
- Joined: Mon Feb 24, 2014 6:04 pm
- Location: Kapuskasing, Ontario, Canada
- Contact:
I used FRAM (FM1808-70-SG) on my cartridge and it's proven to work very well with Megaman Wily Wars (SRAM hack) and Sonic 3.
!LDSW is connected to RAM #WE, the RAM is mapped to 0x200000 using a 74HC139.
The nice thing about using FM1808-70-SG is that it's pin compatible with SRAM AS6C62256-55SCN and thus you can easily make a cart which can take either FRAM or SRAM.
!LDSW is connected to RAM #WE, the RAM is mapped to 0x200000 using a 74HC139.
The nice thing about using FM1808-70-SG is that it's pin compatible with SRAM AS6C62256-55SCN and thus you can easily make a cart which can take either FRAM or SRAM.
What does db stand for? Well that's an excellent question...
http://www.db-electronics.ca
http://www.db-electronics.ca