| ... | ... |
@@ -36,7 +36,6 @@ echo "Cleaning.." |
| 36 | 36 |
rm -f ./bin/uxnasm |
| 37 | 37 |
rm -f ./bin/uxnemu |
| 38 | 38 |
rm -f ./bin/uxncli |
| 39 |
-rm -f ./bin/supervisor.rom |
|
| 40 | 39 |
rm -f ./bin/launcher.rom |
| 41 | 40 |
rm -f ./bin/asma.rom |
| 42 | 41 |
|
| ... | ... |
@@ -108,8 +107,6 @@ then |
| 108 | 107 |
cp bin/uxnemu bin/uxnasm bin/uxncli $HOME/bin/ |
| 109 | 108 |
fi |
| 110 | 109 |
|
| 111 |
-echo "Assembling(supervisor).." |
|
| 112 |
-./bin/uxnasm projects/software/supervisor.tal bin/supervisor.rom |
|
| 113 | 110 |
echo "Assembling(launcher).." |
| 114 | 111 |
./bin/uxnasm projects/software/launcher.tal bin/launcher.rom |
| 115 | 112 |
echo "Assembling(asma).." |
| 116 | 113 |
deleted file mode 100644 |
| ... | ... |
@@ -1,314 +0,0 @@ |
| 1 |
-( launcher ) |
|
| 2 |
- |
|
| 3 |
-%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
|
|
| 4 |
-%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
|
|
| 5 |
-%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
|
|
| 6 |
-%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
|
|
| 7 |
- |
|
| 8 |
-%AUTO-X { #01 .Screen/auto DEO }
|
|
| 9 |
-%AUTO-Y { #02 .Screen/auto DEO }
|
|
| 10 |
-%AUTO-YADDR { #06 .Screen/auto DEO }
|
|
| 11 |
- |
|
| 12 |
-%HALT { #010f DEO }
|
|
| 13 |
-%EMIT { #18 DEO }
|
|
| 14 |
-%PRINT { ;print-str JSR2 #0a EMIT }
|
|
| 15 |
-%DEBUG { ;print-hex/byte JSR2 #0a EMIT }
|
|
| 16 |
-%DEBUG2 { ;print-hex JSR2 #0a EMIT }
|
|
| 17 |
- |
|
| 18 |
-%MODALW { #0024 }
|
|
| 19 |
-%MODALH { #0009 }
|
|
| 20 |
- |
|
| 21 |
-%RTN { JMP2r }
|
|
| 22 |
-%2// { #01 SFT2 }
|
|
| 23 |
-%8** { #30 SFT2 }
|
|
| 24 |
- |
|
| 25 |
-%SYS_EADDR { #fd04 }
|
|
| 26 |
-%SYS_ECODE { #fd06 }
|
|
| 27 |
-%SYS_DEBUG { #fd0e }
|
|
| 28 |
-%WST { #fe00 }
|
|
| 29 |
-%RST { #ff00 }
|
|
| 30 |
- |
|
| 31 |
-( devices ) |
|
| 32 |
- |
|
| 33 |
-|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
|
| 34 |
-|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
| 35 |
-|80 @Controller &vector $2 &button $1 &key $1 &func $1 |
|
| 36 |
- |
|
| 37 |
-( variables ) |
|
| 38 |
- |
|
| 39 |
-|0000 |
|
| 40 |
- |
|
| 41 |
-@center |
|
| 42 |
- &x $2 &y $2 |
|
| 43 |
-@modal |
|
| 44 |
- &x $2 &y $2 |
|
| 45 |
- |
|
| 46 |
-( init ) |
|
| 47 |
- |
|
| 48 |
-|0100 ( -> ) |
|
| 49 |
- |
|
| 50 |
- .Screen/width DEI2 2// |
|
| 51 |
- DUP2 .center/x STZ2 |
|
| 52 |
- MODALW #31 SFT2 -- .modal/x STZ2 |
|
| 53 |
- .Screen/height DEI2 2// |
|
| 54 |
- DUP2 .center/y STZ2 |
|
| 55 |
- MODALH #31 SFT2 -- .modal/y STZ2 |
|
| 56 |
- |
|
| 57 |
- ( vectors ) |
|
| 58 |
- ;on-error .System/vector DEO2 |
|
| 59 |
- ;on-frame .Screen/vector DEO2 |
|
| 60 |
- ;on-button .Controller/vector DEO2 |
|
| 61 |
- |
|
| 62 |
- ( print initial memory ) |
|
| 63 |
- SYS_DEBUG LDA #00 = ,&no-debug JCN |
|
| 64 |
- ;print-stacks JSR2 |
|
| 65 |
- &no-debug |
|
| 66 |
- |
|
| 67 |
-BRK |
|
| 68 |
- |
|
| 69 |
-@on-frame ( -> ) |
|
| 70 |
- |
|
| 71 |
- ;draw-cross JSR2 |
|
| 72 |
- ;draw-stacks JSR2 |
|
| 73 |
- |
|
| 74 |
-BRK |
|
| 75 |
- |
|
| 76 |
-@on-button ( -> ) |
|
| 77 |
- |
|
| 78 |
- .Controller/func DEI DUP DEBUG |
|
| 79 |
- DUP #02 ! ,&no-f2 JCN |
|
| 80 |
- ;toggle-debugger JSR2 |
|
| 81 |
- &no-f2 |
|
| 82 |
- DUP #08 ! ,&no-f4 JCN |
|
| 83 |
- ;reboot JSR2 |
|
| 84 |
- &no-f4 |
|
| 85 |
- POP |
|
| 86 |
- |
|
| 87 |
-BRK |
|
| 88 |
- |
|
| 89 |
-@on-error ( -> ) |
|
| 90 |
- |
|
| 91 |
- ( background ) |
|
| 92 |
- #00 .Screen/auto DEO |
|
| 93 |
- ;bg-icn .Screen/addr DEO2 |
|
| 94 |
- MODALH #0000 |
|
| 95 |
- &ver |
|
| 96 |
- DUP2 8** .modal/y LDZ2 ++ .Screen/y DEO2 |
|
| 97 |
- MODALW #0000 |
|
| 98 |
- &hor |
|
| 99 |
- DUP2 8** .modal/x LDZ2 ++ .Screen/x DEO2 |
|
| 100 |
- #42 .Screen/sprite DEO |
|
| 101 |
- INC2 GTH2k ,&hor JCN |
|
| 102 |
- POP2 POP2 |
|
| 103 |
- INC2 GTH2k ,&ver JCN |
|
| 104 |
- POP2 POP2 |
|
| 105 |
- |
|
| 106 |
- ( corners ) |
|
| 107 |
- ;corner-icn .Screen/addr DEO2 |
|
| 108 |
- .modal/x LDZ2 .Screen/x DEO2 |
|
| 109 |
- .modal/y LDZ2 .Screen/y DEO2 |
|
| 110 |
- #42 .Screen/sprite DEO |
|
| 111 |
- .modal/x LDZ2 MODALW #0001 -- 8** ++ .Screen/x DEO2 |
|
| 112 |
- #52 .Screen/sprite DEO |
|
| 113 |
- |
|
| 114 |
- .modal/y LDZ2 MODALH #0001 -- 8** ++ .Screen/y DEO2 |
|
| 115 |
- #72 .Screen/sprite DEO |
|
| 116 |
- |
|
| 117 |
- .modal/x LDZ2 .Screen/x DEO2 |
|
| 118 |
- #62 .Screen/sprite DEO |
|
| 119 |
- |
|
| 120 |
- ( text ) |
|
| 121 |
- .modal/x LDZ2 #0010 ++ .Screen/x DEO2 |
|
| 122 |
- .modal/y LDZ2 #0010 ++ .Screen/y DEO2 |
|
| 123 |
- ;error-txts/0 #4f ;draw-str JSR2 |
|
| 124 |
- |
|
| 125 |
- ;at-txt #4f ;draw-str JSR2 |
|
| 126 |
- |
|
| 127 |
- SYS_EADDR LDA2 #47 ;draw-short JSR2 |
|
| 128 |
- |
|
| 129 |
- #0000 SYS_EADDR STA2 |
|
| 130 |
- |
|
| 131 |
-BRK |
|
| 132 |
- |
|
| 133 |
-@toggle-debugger ( -- ) |
|
| 134 |
- |
|
| 135 |
- ( toggle debug ) |
|
| 136 |
- ( #fd0e STH2k LDA #00 = STH2r STA ) |
|
| 137 |
- |
|
| 138 |
-RTN |
|
| 139 |
- |
|
| 140 |
-@reboot ( -- ) |
|
| 141 |
- |
|
| 142 |
- ( clear devices/stacks ) |
|
| 143 |
- #fd00 #0300 ;mclr JSR2 |
|
| 144 |
- |
|
| 145 |
- ( load rom ) |
|
| 146 |
- |
|
| 147 |
-RTN |
|
| 148 |
- &boot-path "launcher.rom $1 |
|
| 149 |
- |
|
| 150 |
-@draw-stacks ( -- ) |
|
| 151 |
- |
|
| 152 |
- AUTO-YADDR |
|
| 153 |
- #0010 #0000 |
|
| 154 |
- &wst |
|
| 155 |
- ( working stack ) |
|
| 156 |
- #0010 .Screen/y DEO2 |
|
| 157 |
- DUP2 #0018 ** #0010 ++ .Screen/x DEO2 |
|
| 158 |
- DUP #fe00 LDA ( ptr ) EQU #41 + STH |
|
| 159 |
- DUP2 #fe01 ++ LDA STHr ;draw-byte JSR2 |
|
| 160 |
- ( return stack ) |
|
| 161 |
- #0028 .Screen/y DEO2 |
|
| 162 |
- DUP2 #0018 ** #0010 ++ .Screen/x DEO2 |
|
| 163 |
- DUP #ff00 LDA ( ptr ) EQU #41 + STH |
|
| 164 |
- DUP2 #ff01 ++ LDA STHr ;draw-byte JSR2 |
|
| 165 |
- INC2 GTH2k ,&wst JCN |
|
| 166 |
- POP2 POP2 |
|
| 167 |
- |
|
| 168 |
-RTN |
|
| 169 |
- |
|
| 170 |
-@draw-cross ( -- ) |
|
| 171 |
- |
|
| 172 |
- ( ver ) |
|
| 173 |
- AUTO-Y |
|
| 174 |
- #0000 .Screen/y DEO2 |
|
| 175 |
- .center/x LDZ2 .Screen/x DEO2 |
|
| 176 |
- .Screen/height DEI2 #0000 |
|
| 177 |
- &ver |
|
| 178 |
- #43 .Screen/pixel DEO |
|
| 179 |
- .Screen/y DEI2k INC2 ROT DEO2 |
|
| 180 |
- INC2 GTH2k ,&ver JCN |
|
| 181 |
- POP2 POP2 |
|
| 182 |
- |
|
| 183 |
- ( hor ) |
|
| 184 |
- AUTO-X |
|
| 185 |
- #0000 .Screen/x DEO2 |
|
| 186 |
- .center/y LDZ2 .Screen/y DEO2 |
|
| 187 |
- .Screen/width DEI2 #0000 |
|
| 188 |
- &hor |
|
| 189 |
- #43 .Screen/pixel DEO |
|
| 190 |
- .Screen/x DEI2k INC2 ROT DEO2 |
|
| 191 |
- INC2 GTH2k ,&hor JCN |
|
| 192 |
- POP2 POP2 |
|
| 193 |
- |
|
| 194 |
-RTN |
|
| 195 |
- |
|
| 196 |
-@draw-str ( text* color -- ) |
|
| 197 |
- |
|
| 198 |
- AUTO-YADDR |
|
| 199 |
- STH |
|
| 200 |
- &while |
|
| 201 |
- LDAk STHkr ,draw-char JSR |
|
| 202 |
- INC2 LDAk ,&while JCN |
|
| 203 |
- POP2 |
|
| 204 |
- POPr |
|
| 205 |
- |
|
| 206 |
-RTN |
|
| 207 |
- |
|
| 208 |
-@draw-short ( short* color -- ) |
|
| 209 |
- |
|
| 210 |
- STH SWP STHkr ,draw-byte JSR |
|
| 211 |
- STHr ,draw-byte JSR |
|
| 212 |
- |
|
| 213 |
-RTN |
|
| 214 |
- |
|
| 215 |
-@draw-byte ( byte color -- ) |
|
| 216 |
- |
|
| 217 |
- STH |
|
| 218 |
- DUP #04 SFT ,&parse JSR STHkr ,draw-char JSR |
|
| 219 |
- #0f AND ,&parse JSR STHr ,draw-char JSR |
|
| 220 |
- |
|
| 221 |
-RTN |
|
| 222 |
- &parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r |
|
| 223 |
- &above #57 ADD JMP2r |
|
| 224 |
- |
|
| 225 |
-@draw-char ( char color -- ) |
|
| 226 |
- |
|
| 227 |
- SWP |
|
| 228 |
- [ #20 - #00 SWP #40 SFT2 ;font ++ ] .Screen/addr DEO2 |
|
| 229 |
- .Screen/sprite DEOk DEO |
|
| 230 |
- .Screen/x DEI2k #0008 ++ ROT DEO2 |
|
| 231 |
- .Screen/y DEI2k #0010 -- ROT DEO2 |
|
| 232 |
- |
|
| 233 |
-JMP2r |
|
| 234 |
- |
|
| 235 |
-@mclr ( addr* len* -- ) |
|
| 236 |
- |
|
| 237 |
- OVR2 ++ SWP2 |
|
| 238 |
- &loop |
|
| 239 |
- STH2k #00 STH2r STA |
|
| 240 |
- INC2 GTH2k ,&loop JCN |
|
| 241 |
- POP2 POP2 |
|
| 242 |
- |
|
| 243 |
-JMP2r |
|
| 244 |
- |
|
| 245 |
-@print-stacks ( -- ) |
|
| 246 |
- |
|
| 247 |
- #0a EMIT |
|
| 248 |
- WST ;&wst-txt ,print-stack JSR |
|
| 249 |
- RST ;&rst-txt ,print-stack JSR |
|
| 250 |
- |
|
| 251 |
-RTN |
|
| 252 |
- &wst-txt "Working-stack $1 |
|
| 253 |
- &rst-txt "Return-stack $1 |
|
| 254 |
- |
|
| 255 |
-@print-stack ( addr* name* -- ) |
|
| 256 |
- |
|
| 257 |
|
|
| 258 |
- ( keep ptr ) LDAk STH |
|
| 259 |
- ( keep counter ) LITr 00 |
|
| 260 |
- ( skip ptr ) INC2 |
|
| 261 |
- DUP2 #0020 ++ SWP2 |
|
| 262 |
- &loop |
|
| 263 |
- ( print cell ) |
|
| 264 |
- EQUkr STHr #3b * #20 + EMIT |
|
| 265 |
- LDAk ;print-hex/byte JSR2 |
|
| 266 |
- EQUkr STHr #3d * #20 + EMIT |
|
| 267 |
- ( break into columns ) |
|
| 268 |
- SUB2k #0001 -- #0007 AND2 #0000 !! ,&no-lb JCN |
|
| 269 |
- #0a EMIT |
|
| 270 |
- &no-lb |
|
| 271 |
- INCr |
|
| 272 |
- INC2 GTH2k ,&loop JCN |
|
| 273 |
- POP2 POP2 |
|
| 274 |
- POP2r |
|
| 275 |
- |
|
| 276 |
-RTN |
|
| 277 |
- |
|
| 278 |
-@print-hex ( value* -- ) |
|
| 279 |
- |
|
| 280 |
- SWP ,&byte JSR |
|
| 281 |
- &byte ( byte -- ) |
|
| 282 |
- STHk #04 SFT ,&parse JSR #18 DEO |
|
| 283 |
- STHr #0f AND ,&parse JSR #18 DEO |
|
| 284 |
- JMP2r |
|
| 285 |
- &parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r |
|
| 286 |
- &above #57 ADD JMP2r |
|
| 287 |
- |
|
| 288 |
-JMP2r |
|
| 289 |
- |
|
| 290 |
-@print-str ( string* -- ) |
|
| 291 |
- |
|
| 292 |
- #0001 SUB2 |
|
| 293 |
- &while |
|
| 294 |
- INC2 LDAk DUP #18 DEO ,&while JCN |
|
| 295 |
- POP2 |
|
| 296 |
- |
|
| 297 |
-JMP2r |
|
| 298 |
- |
|
| 299 |
-@error-txts |
|
| 300 |
- &0 "Working-stack 20 "underflow $1 |
|
| 301 |
- &1 "Return-stack 20 "underflow $1 |
|
| 302 |
- &2 "Working-stack 20 "overflow $1 |
|
| 303 |
- &3 "Return-stack 20 "overflow $1 |
|
| 304 |
- &4 "Working-stack 20 "division 20 "by 20 "zero $1 |
|
| 305 |
- &5 "Return-stack 20 "division 20 "by 20 "zero $1 |
|
| 306 |
-@at-txt |
|
| 307 |
- ', 20 "at 20 $1 |
|
| 308 |
- |
|
| 309 |
-@bg-icn |
|
| 310 |
- ffff ffff ffff ffff |
|
| 311 |
-@corner-icn |
|
| 312 |
- 1f7f 7fff ffff ffff |
|
| 313 |
- |
|
| 314 |
-~projects/assets/msx01x02.tal |
|
| 315 | 0 |
\ No newline at end of file |
| ... | ... |
@@ -150,7 +150,7 @@ file_deo(Device *d, Uint8 port) |
| 150 | 150 |
case 0x5: |
| 151 | 151 |
DEVPEEK16(a, 0x4); |
| 152 | 152 |
DEVPEEK16(b, 0xa); |
| 153 |
- res = file_stat(&bank1[a], b); |
|
| 153 |
+ res = file_stat(&bank0[a], b); |
|
| 154 | 154 |
DEVPOKE16(0x2, res); |
| 155 | 155 |
break; |
| 156 | 156 |
case 0x6: |
| ... | ... |
@@ -159,19 +159,19 @@ file_deo(Device *d, Uint8 port) |
| 159 | 159 |
break; |
| 160 | 160 |
case 0x9: |
| 161 | 161 |
DEVPEEK16(a, 0x8); |
| 162 |
- res = file_init(&bank1[a]); |
|
| 162 |
+ res = file_init(&bank0[a]); |
|
| 163 | 163 |
DEVPOKE16(0x2, res); |
| 164 | 164 |
break; |
| 165 | 165 |
case 0xd: |
| 166 | 166 |
DEVPEEK16(a, 0xc); |
| 167 | 167 |
DEVPEEK16(b, 0xa); |
| 168 |
- res = file_read(&bank1[a], b); |
|
| 168 |
+ res = file_read(&bank0[a], b); |
|
| 169 | 169 |
DEVPOKE16(0x2, res); |
| 170 | 170 |
break; |
| 171 | 171 |
case 0xf: |
| 172 | 172 |
DEVPEEK16(a, 0xe); |
| 173 | 173 |
DEVPEEK16(b, 0xa); |
| 174 |
- res = file_write(&bank1[a], b, d->dat[0x7]); |
|
| 174 |
+ res = file_write(&bank0[a], b, d->dat[0x7]); |
|
| 175 | 175 |
DEVPOKE16(0x2, res); |
| 176 | 176 |
break; |
| 177 | 177 |
} |
| ... | ... |
@@ -14,8 +14,6 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 14 | 14 |
WITH REGARD TO THIS SOFTWARE. |
| 15 | 15 |
*/ |
| 16 | 16 |
|
| 17 |
-Uxn supervisor; |
|
| 18 |
- |
|
| 19 | 17 |
static const char *errors[] = {
|
| 20 | 18 |
"Working-stack underflow", |
| 21 | 19 |
"Return-stack underflow", |
| ... | ... |
@@ -31,7 +29,6 @@ uxn_halt(Uxn *u, Uint8 error, Uint16 addr) |
| 31 | 29 |
Uint16 vec = GETVECTOR(d); |
| 32 | 30 |
DEVPOKE16(0x4, addr); |
| 33 | 31 |
d->dat[0x6] = error; |
| 34 |
- uxn_eval(&supervisor, GETVECTOR(&supervisor.dev[0])); |
|
| 35 | 32 |
if(vec) {
|
| 36 | 33 |
/* need to rearm to run System/vector again */ |
| 37 | 34 |
d->dat[0] = 0; |
| ... | ... |
@@ -50,8 +47,8 @@ Uint8 |
| 50 | 47 |
system_dei(Device *d, Uint8 port) |
| 51 | 48 |
{
|
| 52 | 49 |
switch(port) {
|
| 53 |
- case 0x2: return d->u->wst->ptr; |
|
| 54 |
- case 0x3: return d->u->rst->ptr; |
|
| 50 |
+ case 0x2: return d->u->wst.ptr; |
|
| 51 |
+ case 0x3: return d->u->rst.ptr; |
|
| 55 | 52 |
default: return d->dat[port]; |
| 56 | 53 |
} |
| 57 | 54 |
} |
| ... | ... |
@@ -60,8 +57,8 @@ void |
| 60 | 57 |
system_deo(Device *d, Uint8 port) |
| 61 | 58 |
{
|
| 62 | 59 |
switch(port) {
|
| 63 |
- case 0x2: d->u->wst->ptr = d->dat[port]; break; |
|
| 64 |
- case 0x3: d->u->rst->ptr = d->dat[port]; break; |
|
| 60 |
+ case 0x2: d->u->wst.ptr = d->dat[port]; break; |
|
| 61 |
+ case 0x3: d->u->rst.ptr = d->dat[port]; break; |
|
| 65 | 62 |
default: system_deo_special(d, port); |
| 66 | 63 |
} |
| 67 | 64 |
} |
| ... | ... |
@@ -39,13 +39,13 @@ uxn_eval(Uxn *u, Uint16 pc) |
| 39 | 39 |
Stack *src, *dst; |
| 40 | 40 |
Device *dev; |
| 41 | 41 |
if(!pc || u->dev[0].dat[0xf]) return 0; |
| 42 |
- if(u->wst->ptr > 0xf8) u->wst->ptr = 0xf8; |
|
| 42 |
+ if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8; |
|
| 43 | 43 |
while((instr = u->ram[pc++])) {
|
| 44 | 44 |
/* Return Mode */ |
| 45 | 45 |
if(instr & 0x40) {
|
| 46 |
- src = u->rst; dst = u->wst; |
|
| 46 |
+ src = &u->rst; dst = &u->wst; |
|
| 47 | 47 |
} else {
|
| 48 |
- src = u->wst; dst = u->rst; |
|
| 48 |
+ src = &u->wst; dst = &u->rst; |
|
| 49 | 49 |
} |
| 50 | 50 |
/* Keep Mode */ |
| 51 | 51 |
if(instr & 0x80) {
|
| ... | ... |
@@ -112,16 +112,13 @@ err: |
| 112 | 112 |
/* clang-format on */ |
| 113 | 113 |
|
| 114 | 114 |
int |
| 115 |
-uxn_boot(Uxn *u, Uint8 *ram, Uint8 *devices, Stack *wst, Stack *rst) |
|
| 115 |
+uxn_boot(Uxn *u, Uint8 *ram) |
|
| 116 | 116 |
{
|
| 117 | 117 |
Uint32 i; |
| 118 | 118 |
char *cptr = (char *)u; |
| 119 | 119 |
for(i = 0; i < sizeof(*u); i++) |
| 120 | 120 |
cptr[i] = 0x00; |
| 121 | 121 |
u->ram = ram; |
| 122 |
- u->devices = devices; |
|
| 123 |
- u->wst = wst; |
|
| 124 |
- u->rst = rst; |
|
| 125 | 122 |
return 1; |
| 126 | 123 |
} |
| 127 | 124 |
|
| ... | ... |
@@ -130,7 +127,6 @@ uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *d, Uint8 port), void (*deofn)( |
| 130 | 127 |
{
|
| 131 | 128 |
Device *d = &u->dev[id]; |
| 132 | 129 |
d->u = u; |
| 133 |
- d->dat = u->devices + id * 0x10; |
|
| 134 | 130 |
d->dei = deifn; |
| 135 | 131 |
d->deo = deofn; |
| 136 | 132 |
return d; |
| ... | ... |
@@ -37,18 +37,18 @@ typedef struct {
|
| 37 | 37 |
|
| 38 | 38 |
typedef struct Device {
|
| 39 | 39 |
struct Uxn *u; |
| 40 |
- Uint8 *dat, *mem; |
|
| 40 |
+ Uint8 dat[16], *mem; |
|
| 41 | 41 |
Uint8 (*dei)(struct Device *d, Uint8); |
| 42 | 42 |
void (*deo)(struct Device *d, Uint8); |
| 43 | 43 |
} Device; |
| 44 | 44 |
|
| 45 | 45 |
typedef struct Uxn {
|
| 46 |
- Uint8 *ram, *devices; |
|
| 47 |
- Stack *wst, *rst; |
|
| 46 |
+ Uint8 *ram; |
|
| 47 |
+ Stack wst, rst; |
|
| 48 | 48 |
Device dev[16]; |
| 49 | 49 |
} Uxn; |
| 50 | 50 |
|
| 51 |
-int uxn_boot(Uxn *u, Uint8 *ram, Uint8 *devices, Stack *wst, Stack *rst); |
|
| 51 |
+int uxn_boot(Uxn *u, Uint8 *ram); |
|
| 52 | 52 |
int uxn_eval(Uxn *u, Uint16 pc); |
| 53 | 53 |
int uxn_halt(Uxn *u, Uint8 error, Uint16 addr); |
| 54 | 54 |
int uxn_interrupt(Uxn *u); |
| ... | ... |
@@ -3,7 +3,7 @@ |
| 3 | 3 |
|
| 4 | 4 |
#include "uxn.h" |
| 5 | 5 |
|
| 6 |
-Uint8 *bank0, *bank1; |
|
| 6 |
+Uint8 *bank0; |
|
| 7 | 7 |
|
| 8 | 8 |
#include "devices/system.h" |
| 9 | 9 |
#include "devices/file.h" |
| ... | ... |
@@ -23,6 +23,7 @@ WITH REGARD TO THIS SOFTWARE. |
| 23 | 23 |
int |
| 24 | 24 |
uxn_interrupt(Uxn *u) |
| 25 | 25 |
{
|
| 26 |
+ (void)u; |
|
| 26 | 27 |
return 0; |
| 27 | 28 |
} |
| 28 | 29 |
|
| ... | ... |
@@ -53,8 +54,8 @@ void |
| 53 | 54 |
system_deo_special(Device *d, Uint8 port) |
| 54 | 55 |
{
|
| 55 | 56 |
if(port == 0xe) {
|
| 56 |
- inspect(d->u->wst, "Working-stack"); |
|
| 57 |
- inspect(d->u->rst, "Return-stack"); |
|
| 57 |
+ inspect(&d->u->wst, "Working-stack"); |
|
| 58 |
+ inspect(&d->u->rst, "Return-stack"); |
|
| 58 | 59 |
} |
| 59 | 60 |
} |
| 60 | 61 |
|
| ... | ... |
@@ -118,8 +119,7 @@ static int |
| 118 | 119 |
start(Uxn *u) |
| 119 | 120 |
{
|
| 120 | 121 |
bank0 = (Uint8 *)calloc(0x10000, sizeof(Uint8)); |
| 121 |
- bank1 = (Uint8 *)calloc(0x10000, sizeof(Uint8)); |
|
| 122 |
- if(!uxn_boot(u, bank1, bank0 + PAGE_DEV, (Stack *)(bank0 + PAGE_WST), (Stack *)(bank0 + PAGE_RST))) |
|
| 122 |
+ if(!uxn_boot(u, bank0)) |
|
| 123 | 123 |
return error("Boot", "Failed");
|
| 124 | 124 |
/* system */ uxn_port(u, 0x0, system_dei, system_deo); |
| 125 | 125 |
/* console */ uxn_port(u, 0x1, nil_dei, console_deo); |
| ... | ... |
@@ -3,7 +3,7 @@ |
| 3 | 3 |
|
| 4 | 4 |
#include "uxn.h" |
| 5 | 5 |
|
| 6 |
-Uint8 *bank0, *bank1; |
|
| 6 |
+Uint8 *bank0; |
|
| 7 | 7 |
|
| 8 | 8 |
#pragma GCC diagnostic push |
| 9 | 9 |
#pragma clang diagnostic push |
| ... | ... |
@@ -87,6 +87,7 @@ audio_finished_handler(UxnAudio *c) |
| 87 | 87 |
int |
| 88 | 88 |
uxn_interrupt(Uxn *u) |
| 89 | 89 |
{
|
| 90 |
+ (void)u; |
|
| 90 | 91 |
return 0; |
| 91 | 92 |
} |
| 92 | 93 |
|
| ... | ... |
@@ -261,10 +262,9 @@ load(Uxn *u, char *rom) |
| 261 | 262 |
static int |
| 262 | 263 |
start(Uxn *u, char *rom) |
| 263 | 264 |
{
|
| 264 |
- bank1 = (Uint8 *)calloc(0x10000, sizeof(Uint8)); |
|
| 265 | 265 |
bank0 = (Uint8 *)calloc(0x10000, sizeof(Uint8)); |
| 266 | 266 |
|
| 267 |
- if(!uxn_boot(u, bank1, bank0 + PAGE_DEV, (Stack *)(bank0 + PAGE_WST), (Stack *)(bank0 + PAGE_RST))) |
|
| 267 |
+ if(!uxn_boot(u, bank0)) |
|
| 268 | 268 |
return error("Boot", "Failed to start uxn.");
|
| 269 | 269 |
if(!load(u, rom)) |
| 270 | 270 |
return error("Boot", "Failed to load rom.");
|
| ... | ... |
@@ -285,21 +285,9 @@ start(Uxn *u, char *rom) |
| 285 | 285 |
/* unused */ uxn_port(u, 0xe, nil_dei, nil_deo); |
| 286 | 286 |
/* unused */ uxn_port(u, 0xf, nil_dei, nil_deo); |
| 287 | 287 |
|
| 288 |
- /* Supervisor */ |
|
| 289 |
- if(!uxn_boot(&supervisor, bank0, bank0 + VISOR_DEV, (Stack *)(bank0 + VISOR_WST), (Stack *)(bank0 + VISOR_RST))) |
|
| 290 |
- return error("Boot", "Failed to start uxn.");
|
|
| 291 |
- if(!load(&supervisor, "supervisor.rom")) |
|
| 292 |
- error("Supervisor", "No debugger found.");
|
|
| 293 |
- /* system */ uxn_port(&supervisor, 0x0, system_dei, system_deo); |
|
| 294 |
- /* console */ uxn_port(&supervisor, 0x1, nil_dei, console_deo); |
|
| 295 |
- /* screen */ uxn_port(&supervisor, 0x2, screen_dei, screen_deo); |
|
| 296 |
- /* control */ uxn_port(&supervisor, 0x8, nil_dei, nil_deo); |
|
| 297 |
- |
|
| 298 | 288 |
if(!uxn_eval(u, PAGE_PROGRAM)) |
| 299 | 289 |
return error("Boot", "Failed to start rom.");
|
| 300 | 290 |
|
| 301 |
- uxn_eval(&supervisor, PAGE_PROGRAM); |
|
| 302 |
- |
|
| 303 | 291 |
return 1; |
| 304 | 292 |
} |
| 305 | 293 |
|
| ... | ... |
@@ -357,22 +345,6 @@ get_button(SDL_Event *event) |
| 357 | 345 |
return 0x00; |
| 358 | 346 |
} |
| 359 | 347 |
|
| 360 |
-static Uint8 |
|
| 361 |
-get_fkey(SDL_Event *event) |
|
| 362 |
-{
|
|
| 363 |
- switch(event->key.keysym.sym) {
|
|
| 364 |
- case SDLK_F1: return 0x01; |
|
| 365 |
- case SDLK_F2: return 0x02; |
|
| 366 |
- case SDLK_F3: return 0x04; |
|
| 367 |
- case SDLK_F4: return 0x08; |
|
| 368 |
- case SDLK_F5: return 0x10; |
|
| 369 |
- case SDLK_F6: return 0x20; |
|
| 370 |
- case SDLK_F7: return 0x40; |
|
| 371 |
- case SDLK_F8: return 0x80; |
|
| 372 |
- } |
|
| 373 |
- return 0x00; |
|
| 374 |
-} |
|
| 375 |
- |
|
| 376 | 348 |
static Uint8 |
| 377 | 349 |
get_button_joystick(SDL_Event *event) |
| 378 | 350 |
{
|
| ... | ... |
@@ -468,9 +440,6 @@ run(Uxn *u) |
| 468 | 440 |
controller_down(devctrl, get_button(&event)); |
| 469 | 441 |
else |
| 470 | 442 |
do_shortcut(u, &event); |
| 471 |
- /* function keys are sent to supervisor */ |
|
| 472 |
- if(get_fkey(&event)) |
|
| 473 |
- controller_special(&supervisor.dev[0x8], get_fkey(&event)); |
|
| 474 | 443 |
ksym = event.key.keysym.sym; |
| 475 | 444 |
if(SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_KEYUP, SDL_KEYUP) == 1 && ksym == event.key.keysym.sym) |
| 476 | 445 |
break; |
| ... | ... |
@@ -490,8 +459,6 @@ run(Uxn *u) |
| 490 | 459 |
else if(event.type == stdin_event) |
| 491 | 460 |
console_input(u, event.cbutton.button); |
| 492 | 461 |
} |
| 493 |
- if(devsystem->dat[0xe]) |
|
| 494 |
- uxn_eval(&supervisor, GETVECTOR(&supervisor.dev[2])); |
|
| 495 | 462 |
uxn_eval(u, GETVECTOR(devscreen)); |
| 496 | 463 |
if(uxn_screen.fg.changed || uxn_screen.bg.changed || devsystem->dat[0xe]) |
| 497 | 464 |
redraw(); |