KERNAL: Video and Sound ABI Layer
Posted: Tue Sep 28, 2021 6:14 pm
Micheal Steil has extended the KERNAL with lots of neat stuff -- more support for BASIC stuff, the DOS wedge, subdirectories, those 16 bit pseudo-registers in zero page, and so on.
We also know that the KERNAL has calls for sprite management.
It seems to me that KERNAL calls for PSG sound setup and copying memory to video would be generally useful.
https://github.com/commanderx16/x16-docs/blob/master/Commander X16 Programmer's Reference Guide.md#sprites
$FEF0: sprite_set_image - set the image of a sprite
bool sprite_set_image(byte number: .a, width: .x, height: .y, apply_mask: .c, word pixels: r0, word mask: r1, byte bpp: r2L); Error returns: .C = 1 in case of error
Fairly generic, in that this data is generally sufficient to describe a wide range of sprites, including C64 sprites, and including sprites that might exceed VERA's capability.
So then, how about something like this:
$FEE7 (memory_copy): extend this to allow copying memory to the video card.
And:
$FEF0: psg_set_sound: define and play a sound on a given voice
bool psg_set_sount(byte voice: .a, word frequency: r0, byte channel: .x, byte volume: .y, word waveform: r1, word pulse_width: r2)