* SEGA MD / GENESIS - AXELAY WIP !! *
Well where to begin on this one? It starts with a little music playing demo I did for a friend in 2024 , what I had back then was two scrolling cloud layers moving over the top of each other in Axelay fashion playing to some of his music. It was done in a hurry and wasn't optimal , but from that experience I knew a good attempt at Axelay could be made .
So the start of an engine has been there for a while, recently I have picked this up again and started heavily modifying the code , we don't have HDMA or COPPER hardware features for the color / Y scroll updates on the MD which the game heavily relies on, so we will just have to do it with pure CPU grunt !!
As the game is a real technical challenge on the MD ( part of its appeal ) , here are a few notes about what drives it.
Dual-Plane Per-Scanline Rolling Perspective, this recreates Axelay’s signature curved-horizon / rolling-cylinder effect across both background planes simultaneously.
Zero wait midscreen color updates using horizontal interrupts ( H-ints ) with zero CRAM dots ! normally changing colors midscreen on the MD means losing that scanline completely as the cpu has to wait until near h-blank ( border area) to get a clean (CRAM dot free) color change, with zero-wait h-ints a large % of the scanline is freed up and its 100 % clean.
This is pretty advanced, needs a full Assembly code base, certain long running instructions have to be avoided and the 68k registers gets physically partitioned so the non h-int code gets one set and the h-int code gets another set. Self modifying h-int code was also used to further fine tune the performance.
The result - a solid 60 FPS at all times ! Whilst we may lose some cpu to driving the h-int effects in relation to HDMA we make up speed in other areas such as sprite handling for one. The SNES original has to use 3-4 sprites in many cases to a single MD sprite thanks to more flexible sprite sizing on MD , so its not all bad for the MD !
Total system for color change / Vscroll updates is ~ 28% CPU - so still heavy but its not game breaking , allowing 72% of the cpu to run the rest of the game which is more than enough. Infact I'm working on a Mega Mode that considerably increases the action and still maintains 60 FPS !
Full time shadow and Highlight ( S & H ) mode used throughout the whole level ! This gets closer to the SNES original shading , the sky remains normal brightness , then Shadow is used from the Horizon down - this generates some new darker shades on the MD. Up to 195 color changes per frame drive the fading and palette changes. Active dither and Temporal dither were used to simulate more colors in areas, Alpha blending was also simulated with S & H effects + palette fades / layering effects. Up to 120 unique colors (and a few more simulated ) onscreen so this does push the Genesis vs its normal limit of 61 colors onscreen.
Some Real-Time effects such as 68k CPU Cloud Compositing (Mid-Boss) are used also , clouds are composited with progressive scrolling cloud layers onto the Mid-Boss’s tiles in RAM in real time to mimic SNES cloud translucency.
A Modified SGDKs XGM1 sound driver is used for the Audio - modified so the z80 sound processor steals the 68k main cpu bus less often allowing cleaner H-int color updates ( otherwise the z80 plays havoc with the 68ks timing as it halts the 68k when it takes the bus ) , optimised the PCM SFX buffer filling with more granular PCM stream blocking. The mods ensure that even with less 68k bus access the driver doesn't slow down playback under any situation.
@GabrielPyron has helped with some advice on gradients / horizon blending and redrew the final boss in MD color scheme - thankyou my friend ! much of the artwork is converted by scripts/tooling for the MD color palette and is yet to be hand tweaked.
@VTRCHIPMUSIC has done the honours on the sound front and as usual he's knocked it out of the park here . It sounds very close to the SNES even with some reverb achieved also. FM & Full PSG usage with very light PCM usage in the Audio. I am grateful he found the time to help me with this project , Vector does amazingly accurate covers for the Megadrive so please check out his other work !
Some AI assistance was used to convert art/sfx , developing analytical tools to compare the ports to original etc, also to analyse logic of enemies in some cases where observation was not accurate enough. The logic still needs some work on some objects - its not perfect. The engine was hand coded and particularly the h-int work sets new ground for me on this port !
Programmed heavily in Assembly , with some coldpath setup code in C only.
#SGDK #SegaMegadrive #SegaGenesis #Axelay
来源:Shannon Birt · x.com