... | ... |
@@ -1,19 +1,20 @@ |
1 | 1 |
( dev/console ) |
2 | 2 |
|
3 |
+|0e @System/debug |
|
3 | 4 |
|18 @Console/write |
4 | 5 |
|
5 | 6 |
( init ) |
6 | 7 |
|
7 | 8 |
|0100 ( -> ) |
8 |
- |
|
9 |
- ;hello-word |
|
10 | 9 |
|
10 |
+ ;hello-word |
|
11 | 11 |
&loop |
12 | 12 |
( send ) LDAk .Console/write DEO |
13 | 13 |
( incr ) #0001 ADD2 |
14 | 14 |
( loop ) LDAk ,&loop JCN |
15 | 15 |
POP2 |
16 |
- |
|
16 |
+ #01 .System/debug DEO |
|
17 |
+ |
|
17 | 18 |
BRK |
18 | 19 |
|
19 | 20 |
@hello-word "Hello 20 "World! |
20 | 21 |
\ No newline at end of file |
... | ... |
@@ -42,6 +42,18 @@ printstack(Stack *s) |
42 | 42 |
|
43 | 43 |
#pragma mark - Devices |
44 | 44 |
|
45 |
+static void |
|
46 |
+system_talk(Device *d, Uint8 b0, Uint8 w) |
|
47 |
+{ |
|
48 |
+ if(!w) { |
|
49 |
+ d->dat[0x2] = d->u->wst.ptr; |
|
50 |
+ d->dat[0x3] = d->u->rst.ptr; |
|
51 |
+ } else if(b0 == 0xe) |
|
52 |
+ printstack(&d->u->wst); |
|
53 |
+ else if(b0 == 0xf) |
|
54 |
+ d->u->ram.ptr = 0x0000; |
|
55 |
+} |
|
56 |
+ |
|
45 | 57 |
static void |
46 | 58 |
console_talk(Device *d, Uint8 b0, Uint8 w) |
47 | 59 |
{ |
... | ... |
@@ -121,7 +133,7 @@ main(int argc, char **argv) |
121 | 133 |
if(!loaduxn(&u, argv[1])) |
122 | 134 |
return error("Load", "Failed"); |
123 | 135 |
|
124 |
- portuxn(&u, 0x0, "empty", nil_talk); |
|
136 |
+ portuxn(&u, 0x0, "system", system_talk); |
|
125 | 137 |
devconsole = portuxn(&u, 0x1, "console", console_talk); |
126 | 138 |
portuxn(&u, 0x2, "empty", nil_talk); |
127 | 139 |
portuxn(&u, 0x3, "empty", nil_talk); |
... | ... |
@@ -140,7 +152,5 @@ main(int argc, char **argv) |
140 | 152 |
|
141 | 153 |
run(&u); |
142 | 154 |
|
143 |
- if(argc > 2) |
|
144 |
- printstack(&u.wst); |
|
145 | 155 |
return 0; |
146 | 156 |
} |