commit b46d317b4f767a9c1b66d56dac73ba8f1ba7dac4
parent 7b7f4fd0f7c4f4f7128cab94fdc68474799f0698
Author: neauoire <aliceffekt@gmail.com>
Date: Wed, 28 Jul 2021 15:41:07 -0700
Added system device to uxncli
Diffstat:
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/projects/examples/devices/console.tal b/projects/examples/devices/console.tal
@@ -1,19 +1,20 @@
( dev/console )
+|0e @System/debug
|18 @Console/write
( init )
|0100 ( -> )
-
- ;hello-word
+ ;hello-word
&loop
( send ) LDAk .Console/write DEO
( incr ) #0001 ADD2
( loop ) LDAk ,&loop JCN
POP2
-
+ #01 .System/debug DEO
+
BRK
@hello-word "Hello 20 "World!
\ No newline at end of file
diff --git a/src/uxncli.c b/src/uxncli.c
@@ -43,6 +43,18 @@ printstack(Stack *s)
#pragma mark - Devices
static void
+system_talk(Device *d, Uint8 b0, Uint8 w)
+{
+ if(!w) {
+ d->dat[0x2] = d->u->wst.ptr;
+ d->dat[0x3] = d->u->rst.ptr;
+ } else if(b0 == 0xe)
+ printstack(&d->u->wst);
+ else if(b0 == 0xf)
+ d->u->ram.ptr = 0x0000;
+}
+
+static void
console_talk(Device *d, Uint8 b0, Uint8 w)
{
if(w && b0 > 0x7)
@@ -121,7 +133,7 @@ main(int argc, char **argv)
if(!loaduxn(&u, argv[1]))
return error("Load", "Failed");
- portuxn(&u, 0x0, "empty", nil_talk);
+ portuxn(&u, 0x0, "system", system_talk);
devconsole = portuxn(&u, 0x1, "console", console_talk);
portuxn(&u, 0x2, "empty", nil_talk);
portuxn(&u, 0x3, "empty", nil_talk);
@@ -140,7 +152,5 @@ main(int argc, char **argv)
run(&u);
- if(argc > 2)
- printstack(&u.wst);
return 0;
}