Conversation
Notices
-
Embed this notice
seeing how simple it is to get a basic GBA demo going on Zig with minimal effort makes it interesting to me.
also generics are always neat, I don't like how clumsy they are in C11.
I feel like in C you'd need a specialized makefile calling a bunch of tools, plus a linker script at minimum.
-
Embed this notice
@nick I set it aside because of a couple issues but they are resolvable. The first one is I need to find a way to link in the libgba malloc. Then I need to make a Zig allocator that uses that malloc. The reason that malloc is needed is some libraries you'd want to link in that are in C require it. Another difficulty is some libs assume you are using libgba and if you're not things break. for example libgba has its own abstraction library for hooking things into the vblank interrupt.
-
Embed this notice
@nick I got around it temporarily by using a super simple malloc implementation that didn't have free(). That probably would work good enough for the stuff I was doing since the main purpose of malloc is just to set up some buffers for audio playback. I don't think it uses malloc except to set those up, so if playback never frees then that would work.
GBA has two RAM locations: work ram (ewram) and fast ram (iwram) so you need two separate allocators somehow. Also interrupt functions need to be in iwram so during build you have to copy those functions and then somehow make sure your malloc doesn't overwrite them.
this is ALL just to get a common sound library to work lol
-
Embed this notice
@nick yeah same, GBA is so close to a SNES but easier to program. The only thing I would change is I wish the screen res was higher.
-
Embed this notice
@sun I was about to assume that the ISR has to be in some sort of RAM, thanks for the details!
yeah sounds pretty involved when it comes to more complex code.
I read that GBC development is easier, but I like the hardware capabilities of the GBA more.
-
Embed this notice
@nick I do in fact have code that copies a function from ROM into IWRAM. I have a demo project I can put on my git server for you. The only issue is again no way to easily prevent overwriting it with a malloc. Well, I have an idea but it still involves two allocators.