|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
Author | Message |
---|---|
|
Quick-and-dirty P.O.C. changing palettes between scanlines for extra sprite colors
Posted: Fri Mar 04, 2022 11:57 pm Last edited by haroldoop on Sat Mar 05, 2022 9:32 am; edited 1 time in total |
Hello again;
This is a quick-and-dirty test to try to get extra sprite colors by changing palettes between scanlines. I probably won't use it for anything, but here it is, in case somebody is interested. :P Github link: https://github.com/haroldo-ok/rpg-battle-poc |
|
|
Posted: Sat Mar 05, 2022 1:17 am |
Fera! |
|
|
Posted: Sat Mar 05, 2022 4:43 am |
How many Z80 cycles are there between scanlines. For some reason, when I heard that you could move the scanline right or left during this short time gap, I'd assumed that couldn't also color cycle nor do anything else useful at the same time. I've been coming up with ideas for improving color, but I didn't know if there was enough time between lines. |
|
|
Posted: Sat Mar 05, 2022 7:35 am |
Horizontal interrupts are quite inefficient, they fire early (or is it late?) so you have to waste a few cycles to align to the offscreen area, and then I think you only have time to update two colours per line without causing cram dots to be visible in the active area. | |
|
Posted: Sat Mar 05, 2022 11:13 am |
So, in theory, with some really tight timing, someone cold change all of the 16 sprite colors in a spread of 8 scanlines with no visual artifacts? |
|
|
Posted: Sat Mar 05, 2022 6:48 pm |
I think so, yes. It’s not very practical though as there sprites have to avoid each other vertically :) but could be useful for a status area or split screen game. | |
|
Posted: Sat Mar 05, 2022 10:14 pm |
It's good to change the color palette, and that's occasionally needed (especially for color swapping to get flowing waterfalls, lava, animation, etc.), but the more important one is moving that horizontal line at a different rate than its contemporaries, giving us that all important parallax effect. I'd also thought of using that interlude to update the audio, which can be done at 15.7KHz if done at the end of every scanline. That doesn't really need an interrupt sent to the processor, but it seemed handy, if the overhead of a line interrupt is to be accepted anyway. We have only 60,000 cycles per frame and just 310 Z80A cycles per line, IIRC. Accounting for the line interrupt overhead, that only allows a couple of subroutines running about 60-100 instructions per line, depending on how the code is written. |
|