| ... | ... |
@@ -67,7 +67,7 @@ BRK |
| 67 | 67 |
|
| 68 | 68 |
@on-button ( -> ) |
| 69 | 69 |
|
| 70 |
- .Controller/func DEI |
|
| 70 |
+ .Controller/func DEI DUP DEBUG |
|
| 71 | 71 |
DUP #02 ! ,&no-f2 JCN |
| 72 | 72 |
;toggle-debugger JSR2 |
| 73 | 73 |
&no-f2 |
| ... | ... |
@@ -124,7 +124,8 @@ BRK |
| 124 | 124 |
|
| 125 | 125 |
@toggle-debugger ( -- ) |
| 126 | 126 |
|
| 127 |
- ( toggle debug ) #fd0e STH2k LDA #00 = STH2r STA |
|
| 127 |
+ ( toggle debug ) |
|
| 128 |
+ ( #fd0e STH2k LDA #00 = STH2r STA ) |
|
| 128 | 129 |
|
| 129 | 130 |
RTN |
| 130 | 131 |
|
| ... | ... |
@@ -133,6 +134,9 @@ RTN |
| 133 | 134 |
( clear devices/stacks ) |
| 134 | 135 |
#fd00 #0300 ;mclr JSR2 |
| 135 | 136 |
|
| 137 |
+ ( load rom ) |
|
| 138 |
+ |
|
| 139 |
+ |
|
| 136 | 140 |
RTN |
| 137 | 141 |
&boot-path "boot.rom $1 |
| 138 | 142 |
|
| ... | ... |
@@ -149,7 +149,7 @@ file_deo(Device *d, Uint8 port) |
| 149 | 149 |
case 0x5: |
| 150 | 150 |
DEVPEEK16(a, 0x4); |
| 151 | 151 |
DEVPEEK16(b, 0xa); |
| 152 |
- res = file_stat(&d->mem[a], b); |
|
| 152 |
+ res = file_stat(&memory[a], b); |
|
| 153 | 153 |
DEVPOKE16(0x2, res); |
| 154 | 154 |
break; |
| 155 | 155 |
case 0x6: |
| ... | ... |
@@ -158,19 +158,19 @@ file_deo(Device *d, Uint8 port) |
| 158 | 158 |
break; |
| 159 | 159 |
case 0x9: |
| 160 | 160 |
DEVPEEK16(a, 0x8); |
| 161 |
- res = file_init(&d->mem[a]); |
|
| 161 |
+ res = file_init(&memory[a]); |
|
| 162 | 162 |
DEVPOKE16(0x2, res); |
| 163 | 163 |
break; |
| 164 | 164 |
case 0xd: |
| 165 | 165 |
DEVPEEK16(a, 0xc); |
| 166 | 166 |
DEVPEEK16(b, 0xa); |
| 167 |
- res = file_read(&d->mem[a], b); |
|
| 167 |
+ res = file_read(&memory[a], b); |
|
| 168 | 168 |
DEVPOKE16(0x2, res); |
| 169 | 169 |
break; |
| 170 | 170 |
case 0xf: |
| 171 | 171 |
DEVPEEK16(a, 0xe); |
| 172 | 172 |
DEVPEEK16(b, 0xa); |
| 173 |
- res = file_write(&d->mem[a], b, d->dat[0x7]); |
|
| 173 |
+ res = file_write(&memory[a], b, d->dat[0x7]); |
|
| 174 | 174 |
DEVPOKE16(0x2, res); |
| 175 | 175 |
break; |
| 176 | 176 |
} |
| ... | ... |
@@ -4,6 +4,9 @@ |
| 4 | 4 |
#include <time.h> |
| 5 | 5 |
|
| 6 | 6 |
#include "uxn.h" |
| 7 |
+ |
|
| 8 |
+Uint8 *supervisor_memory, *memory; |
|
| 9 |
+ |
|
| 7 | 10 |
#include "devices/system.h" |
| 8 | 11 |
#include "devices/file.h" |
| 9 | 12 |
#include "devices/datetime.h" |
| ... | ... |
@@ -110,17 +113,15 @@ load(Uxn *u, char *filepath) |
| 110 | 113 |
return 1; |
| 111 | 114 |
} |
| 112 | 115 |
|
| 113 |
-static Uint8 *shadow, *memory; |
|
| 114 |
- |
|
| 115 | 116 |
int |
| 116 | 117 |
main(int argc, char **argv) |
| 117 | 118 |
{
|
| 118 | 119 |
Uxn u; |
| 119 | 120 |
int i, loaded = 0; |
| 120 | 121 |
|
| 121 |
- shadow = (Uint8 *)calloc(0x10000, sizeof(Uint8)); |
|
| 122 |
+ supervisor_memory = (Uint8 *)calloc(0x10000, sizeof(Uint8)); |
|
| 122 | 123 |
memory = (Uint8 *)calloc(0x10000, sizeof(Uint8)); |
| 123 |
- if(!uxn_boot(&u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST))) |
|
| 124 |
+ if(!uxn_boot(&u, memory, supervisor_memory + PAGE_DEV, (Stack *)(supervisor_memory + PAGE_WST), (Stack *)(supervisor_memory + PAGE_RST))) |
|
| 124 | 125 |
return error("Boot", "Failed");
|
| 125 | 126 |
|
| 126 | 127 |
/* system */ devsystem = uxn_port(&u, 0x0, system_dei, system_deo); |
| ... | ... |
@@ -1,8 +1,11 @@ |
| 1 | 1 |
#include <stdio.h> |
| 2 | 2 |
#include <unistd.h> |
| 3 | 3 |
#include <time.h> |
| 4 |
+ |
|
| 4 | 5 |
#include "uxn.h" |
| 5 | 6 |
|
| 7 |
+Uint8 *supervisor_memory, *memory; |
|
| 8 |
+ |
|
| 6 | 9 |
#pragma GCC diagnostic push |
| 7 | 10 |
#pragma clang diagnostic push |
| 8 | 11 |
#pragma GCC diagnostic ignored "-Wpedantic" |
| ... | ... |
@@ -246,17 +249,15 @@ load(Uxn *u, char *rom) |
| 246 | 249 |
return 1; |
| 247 | 250 |
} |
| 248 | 251 |
|
| 249 |
-static Uint8 *shadow, *memory; |
|
| 250 |
- |
|
| 251 | 252 |
static int |
| 252 | 253 |
start(Uxn *u, char *rom) |
| 253 | 254 |
{
|
| 254 | 255 |
memory = (Uint8 *)calloc(0x10000, sizeof(Uint8)); |
| 255 |
- shadow = (Uint8 *)calloc(0x10000, sizeof(Uint8)); |
|
| 256 |
+ supervisor_memory = (Uint8 *)calloc(0x10000, sizeof(Uint8)); |
|
| 256 | 257 |
|
| 257 |
- if(!uxn_boot(&supervisor, shadow, shadow + VISOR_DEV, (Stack *)(shadow + VISOR_WST), (Stack *)(shadow + VISOR_RST))) |
|
| 258 |
+ if(!uxn_boot(&supervisor, supervisor_memory, supervisor_memory + VISOR_DEV, (Stack *)(supervisor_memory + VISOR_WST), (Stack *)(supervisor_memory + VISOR_RST))) |
|
| 258 | 259 |
return error("Boot", "Failed to start uxn.");
|
| 259 |
- if(!uxn_boot(u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST))) |
|
| 260 |
+ if(!uxn_boot(u, memory, supervisor_memory + PAGE_DEV, (Stack *)(supervisor_memory + PAGE_WST), (Stack *)(supervisor_memory + PAGE_RST))) |
|
| 260 | 261 |
return error("Boot", "Failed to start uxn.");
|
| 261 | 262 |
if(!load(&supervisor, "supervisor.rom")) |
| 262 | 263 |
error("Supervisor", "No debugger found.");
|
| ... | ... |
@@ -458,10 +459,11 @@ run(Uxn *u) |
| 458 | 459 |
controller_key(devctrl, get_key(&event)); |
| 459 | 460 |
else if(get_button(&event)) |
| 460 | 461 |
controller_down(devctrl, get_button(&event)); |
| 461 |
- /* else if(get_fkey(&event)) |
|
| 462 |
- controller_special(&supervisor.dev[0x8], get_fkey(&event)); */ |
|
| 463 | 462 |
else |
| 464 | 463 |
do_shortcut(u, &event); |
| 464 |
+ /* function keys are sent to supervisor */ |
|
| 465 |
+ if(get_fkey(&event)) |
|
| 466 |
+ controller_special(&supervisor.dev[0x8], get_fkey(&event)); |
|
| 465 | 467 |
ksym = event.key.keysym.sym; |
| 466 | 468 |
if(SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_KEYUP, SDL_KEYUP) == 1 && ksym == event.key.keysym.sym) |
| 467 | 469 |
break; |