pete286/adlib.c
Jeremy Penner 49f532a85b JOPL adlib livecoding environment; stop including JIM files in git
I now have multiple executables that depend on the same .jor source files
and I am not diligent about ensuring that both are up-to-date and working.
As small changes to source files can cause .jim files to fail silently,
I've removed them from the repo for now.
2019-03-31 19:29:16 -04:00

27 lines
417 B
C
Executable file

#include "adlib.h"
static void adlib_wait(int delay) {
int i;
for (i = 0; i < delay; i ++) adlib_read();
}
void adlib_write(int reg, int val) {
int i;
outp(0x388, reg);
adlib_wait(6);
outp(0x389, val);
adlib_wait(35);
}
void adlib_reset() {
int i;
for (i = 0; i < 0xff; i ++) {
adlib_write(i, 0);
}
}
void adlib_init() {
adlib_reset();
atexit(adlib_reset);
}