gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Hardware > Solving the 8bit Write problem for RAM in cart address space

#111014 - cesium - Sun Dec 03, 2006 5:49 pm

Reading and writing 16 and 32 bit words to RAM on a
GBA cart works fine.

The problem arises when you try to write an 8 bit byte to
RAM in the cart address space: The upper byte and lower byte
in the 16 bit word at that RAM locaction BOTH become the
value in the byte you are writing.

Not good.

The DSLinux folks have modified their compiler so that they can
read and write to RAM that has been mapped into the GBA cart
address space.

I'm not exactly sure how they did it, but it had something to do with
trapping 8 bit writes. Maybe they used the memory cache too.

Anyway, has anyone tried to use their compiler for GBA apps?

I have a cart with 8 MBytes of Flash and 16 MBytes of RAM and
I'd like to use the RAM in my C/C++ apps.

Any ideas on how to apply their success to GBA RAM expansion?
Can their toolchain be used to compile our C/C++ apps?

cesium

#111026 - Dwedit - Sun Dec 03, 2006 7:21 pm

The GBA doesn't support traps on 8-bit writes to the cartridge area, so the exception handling method won't work. But a complier modified to never emit 8 bit writes would work great on a GBA.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#111027 - cesium - Sun Dec 03, 2006 7:24 pm

I'm sorry I said trapping. That really implies expection handling.

I know that they modified the compiler to handle not trap
8bit writes.

Anyone ever use their modified compiler?

cesium

#111057 - Ant6n - Sun Dec 03, 2006 9:15 pm

well, the simplest solution is always to read the word where you want to put your byte, then either update the lower or higher byte of it and write it back. not good enough?
caching would probably work fine, too, but you'd have to do it all by yourself.

#111077 - cesium - Sun Dec 03, 2006 11:29 pm

I'm hoping to use a wide range of open source libraries in my
application. I would have to go through the source code, line by line
to ensure there were no 8 bit writes.

Not a pleasing idea.

I'd rather a compiler do the checking, not me.

cesium