doomhack / GBADoom

A port of prBoom to the Nintendo GBA.
182 stars 25 forks source link

Port to rp2040 Sparkfun Board #32

Closed oflebbe closed 1 year ago

oflebbe commented 2 years ago

There is a port to the SparkFun rp2040 Board at github.com/oflebbe/GBADoom .

I think the changes would mostly apply cleanly, however I tried to Scale it up to 240x240, but failed. I guess I missed to detect some of the optimizations on the GBA part. So the original GBA 240x160 resolution is still in place with some of the Magic Constants replaced by Preprocessor Tokens.

In case you are interested I can do some PR's and we have to sort out how to merge.

doomhack commented 2 years ago

Hi,

Nice work.

There are a bunch of lookup tables in tables.c that need changing if you change the resolution. (In vanilla Doom, they are computed at runtime and re-computed when you change the screen size in the menu.

There is a trick used that is specific to the GBA for writing screen pixels. On the GBA byte (8bit) writes to the frambuffer are not supported. (Only 16 and 32bit writes work correctly) What actually happens is that writing 8 bits to an even address actually writes 16 bits. (Both bytes are the 8 bits you wrote) so we use this to get a free pixel doubling effect.

Internally the resolution is actually only 120*160. (I recently added some code that allows sprites to be drawn at full resolution but it's slower as you have to read/modify/write in 16bits to do this)