Jeremy Penner
49f532a85b
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.
55 lines
837 B
C
Executable file
55 lines
837 B
C
Executable file
#include "jorth.h"
|
|
#include "adlib.h"
|
|
#include "kbd.h"
|
|
#include "timer.h"
|
|
|
|
cell ontick = 0;
|
|
void f_adlib_read() {
|
|
PUSHU(adlib_read());
|
|
}
|
|
|
|
void f_adlib_write() {
|
|
adlib_write(TOP().u & 0xff, ST1().u & 0xff);
|
|
DROP(2);
|
|
}
|
|
|
|
static void timer_callback() {
|
|
if (ontick.p) {
|
|
f_execcp(ontick);
|
|
}
|
|
}
|
|
|
|
int DONE = 0;
|
|
static void f_quit() {
|
|
DONE = 1;
|
|
}
|
|
|
|
void do_repl() {
|
|
char buf[128];
|
|
|
|
adlib_init();
|
|
|
|
timer_init(TIMER_18HZ);
|
|
f_init();
|
|
|
|
CDEF("quit", f_quit);
|
|
CDEF("adlib!", f_adlib_write);
|
|
CDEF("adlib@", f_adlib_read);
|
|
|
|
f_loadfile("jopl.jor");
|
|
ontick = f_lookupcp("ontick");
|
|
timer_setcallback(timer_callback);
|
|
|
|
f_taskloop();
|
|
|
|
while (!DONE) {
|
|
PUSHS(gets(buf));
|
|
f_runstring("REPL send");
|
|
f_taskloop();
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
do_repl();
|
|
return 0;
|
|
} |