2 ms·
I have long dreamed of a language for 8-bit computers/consoles with a compiler that helps scheduling routines. For example, let's say I have a short snippet of
by mungoman2 4y ago
I have long dreamed of a language for 8-bit computers/consoles with a compiler that helps scheduling routines.
For example, let's say I have a short snippet of code that needs to run every H blanking period.
I should just declare something like
@every_hblank
Blabla_code()
Or scheduling some code for X pixels into a line.
Actual scheduling can be done however the compiler wants to, using interrupts or inserting dummy instructions for delays.
I guess in the end it's a constraint problem to solve where all these snippets fit in.
I imagine this makes it easier to write games/special effects as you remove the tricky cycle counting. Easier, but maybe less fun...
- JohnBooty 4y agoI know that the SGDK (libraries and toolchain for Sega Genesis/Megadrive) lets you do what you're asking for, within plain old C. You just do: SYS_setHIntCallback(foo); SYS_setVIntCallback(bar); Where "foo" and "bar" are the functions you want to be called during hblank and vblank. Here's somebody showing how to pull off some scaling effects using them: https://under-prog.ru/en/sgdk-image-resize/ https://under-prog.ru/en/sgdk-image-resize/ A lot of recent commercial Genesis/MD releases have been made with SGDK; performance seems quite nice. After all, theoretically, if your libraries go hard enough and lean on macros and/or inline assembler C doesn't need to carry a big speed penalty vs. assembler. I think this is also made possible by the Genesis/Megadrive hardware throwing interrupts during hblank/vblank but don't quote me on that. Of course, the really insane effects still require cycle counting. My understanding is that the Overdrive 2 demo uses heaps of it. It's strictly 50hz only because it's that tightly coupled to various specific timings (also obviously 50hz gives you room for a few more instructions during blanking intervals vs. 60hz) https://www.youtube.com/watch?v=OeGdJk5zb6c https://www.youtube.com/watch?v=OeGdJk5zb6c