| ... | ... |
@@ -4,6 +4,7 @@ echo "Cleaning.." |
| 4 | 4 |
rm -f ./bin/uxnasm |
| 5 | 5 |
rm -f ./bin/uxnemu |
| 6 | 6 |
rm -f ./bin/uxncli |
| 7 |
+rm -f ./bin/hypervisor.rom |
|
| 7 | 8 |
rm -f ./bin/boot.rom |
| 8 | 9 |
rm -f ./bin/asma.rom |
| 9 | 10 |
|
| ... | ... |
@@ -73,8 +74,9 @@ then |
| 73 | 74 |
cp bin/uxnemu bin/uxnasm bin/uxncli $HOME/bin/ |
| 74 | 75 |
fi |
| 75 | 76 |
|
| 76 |
-echo "Assembling(boot).." |
|
| 77 |
+echo "Assembling(boot+hypervisor).." |
|
| 77 | 78 |
./bin/uxnasm projects/software/boot.tal bin/boot.rom |
| 79 |
+./bin/uxnasm projects/software/hypervisor.tal bin/hypervisor.rom |
|
| 78 | 80 |
echo "Assembling(asma).." |
| 79 | 81 |
./bin/uxnasm projects/software/asma.tal bin/asma.rom |
| 80 | 82 |
|
| 81 | 83 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,192 @@ |
| 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 |
+%RTN { JMP2r }
|
|
| 9 |
+%TOS { #00 SWP }
|
|
| 10 |
+ |
|
| 11 |
+%DEBUG { ;print-hex/byte JSR2 #0a18 DEO }
|
|
| 12 |
+%DEBUG2 { ;print-hex JSR2 #0a18 DEO }
|
|
| 13 |
+%AUTO-YADDR { #06 .Screen/auto DEO }
|
|
| 14 |
+ |
|
| 15 |
+( devices ) |
|
| 16 |
+ |
|
| 17 |
+|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |
|
| 18 |
+|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
| 19 |
+ |
|
| 20 |
+( variables ) |
|
| 21 |
+ |
|
| 22 |
+|0000 |
|
| 23 |
+ |
|
| 24 |
+( init ) |
|
| 25 |
+ |
|
| 26 |
+|0100 ( -> ) |
|
| 27 |
+ |
|
| 28 |
+ #0010 .Screen/x DEO2 |
|
| 29 |
+ #0010 .Screen/y DEO2 |
|
| 30 |
+ |
|
| 31 |
+ AUTO-YADDR |
|
| 32 |
+ |
|
| 33 |
+ #0010 #0000 |
|
| 34 |
+ &wst |
|
| 35 |
+ ( color ) DUP #fe00 LDA EQU #41 + STH |
|
| 36 |
+ DUP2 #fe01 ++ LDA STHr ;draw-hex JSR2 |
|
| 37 |
+ .Screen/x DEI2k #0008 ++ ROT DEO2 |
|
| 38 |
+ INC2 GTH2k ,&wst JCN |
|
| 39 |
+ POP2 POP2 |
|
| 40 |
+ |
|
| 41 |
+ #0010 .Screen/x DEO2 |
|
| 42 |
+ #0020 .Screen/y DEO2 |
|
| 43 |
+ |
|
| 44 |
+ #0010 #0000 |
|
| 45 |
+ &rst |
|
| 46 |
+ ( color ) DUP #ff00 LDA EQU #41 + STH |
|
| 47 |
+ DUP2 #ff01 ++ LDA STHr ;draw-hex JSR2 |
|
| 48 |
+ .Screen/x DEI2k #0008 ++ ROT DEO2 |
|
| 49 |
+ INC2 GTH2k ,&rst JCN |
|
| 50 |
+ POP2 POP2 |
|
| 51 |
+ |
|
| 52 |
+BRK |
|
| 53 |
+ |
|
| 54 |
+@draw-hex ( byte color -- ) |
|
| 55 |
+ |
|
| 56 |
+ STH |
|
| 57 |
+ |
|
| 58 |
+ DUP #04 SFT ;print-hex/parse JSR2 STHkr ;draw-char JSR2 |
|
| 59 |
+ #0f AND ;print-hex/parse JSR2 STHr ;draw-char JSR2 |
|
| 60 |
+ |
|
| 61 |
+RTN |
|
| 62 |
+ |
|
| 63 |
+@print-hex ( value* -- ) |
|
| 64 |
+ |
|
| 65 |
+ SWP ,&byte JSR |
|
| 66 |
+ &byte ( byte -- ) |
|
| 67 |
+ STHk #04 SFT ,&parse JSR #18 DEO |
|
| 68 |
+ STHr #0f AND ,&parse JSR #18 DEO |
|
| 69 |
+ JMP2r |
|
| 70 |
+ &parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r |
|
| 71 |
+ &above #57 ADD JMP2r |
|
| 72 |
+ |
|
| 73 |
+JMP2r |
|
| 74 |
+ |
|
| 75 |
+@hello-str "Hello $1 |
|
| 76 |
+ |
|
| 77 |
+@draw-str ( str* color -- ) |
|
| 78 |
+ |
|
| 79 |
+ STH |
|
| 80 |
+ &while |
|
| 81 |
+ LDAk STHkr ,draw-char JSR |
|
| 82 |
+ INC2 LDAk ,&while JCN |
|
| 83 |
+ POP2 |
|
| 84 |
+ POPr |
|
| 85 |
+ |
|
| 86 |
+JMP2r |
|
| 87 |
+ |
|
| 88 |
+@draw-char ( char color -- ) |
|
| 89 |
+ |
|
| 90 |
+ SWP |
|
| 91 |
+ [ #20 - #00 SWP #40 SFT2 ;font ++ ] .Screen/addr DEO2 |
|
| 92 |
+ .Screen/sprite DEOk DEO |
|
| 93 |
+ .Screen/y DEI2 #0010 -- .Screen/y DEO2 |
|
| 94 |
+ .Screen/x DEI2 #0008 ++ .Screen/x DEO2 |
|
| 95 |
+ |
|
| 96 |
+JMP2r |
|
| 97 |
+ |
|
| 98 |
+@font |
|
| 99 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 100 |
+ 0000 183c 3c3c 1818 1800 1818 0000 0000 |
|
| 101 |
+ 0066 6666 2400 0000 0000 0000 0000 0000 |
|
| 102 |
+ 0000 006c 6cfe 6c6c 6cfe 6c6c 0000 0000 |
|
| 103 |
+ 1818 7cc6 c2c0 7c06 0686 c67c 1818 0000 |
|
| 104 |
+ 0000 0000 c2c6 0c18 3060 c686 0000 0000 |
|
| 105 |
+ 0000 386c 6c38 76dc cccc cc76 0000 0000 |
|
| 106 |
+ 0030 3030 6000 0000 0000 0000 0000 0000 |
|
| 107 |
+ 0000 0c18 3030 3030 3030 180c 0000 0000 |
|
| 108 |
+ 0000 3018 0c0c 0c0c 0c0c 1830 0000 0000 |
|
| 109 |
+ 0000 0000 0066 3cff 3c66 0000 0000 0000 |
|
| 110 |
+ 0000 0000 0018 187e 1818 0000 0000 0000 |
|
| 111 |
+ 0000 0000 0000 0000 0018 1818 3000 0000 |
|
| 112 |
+ 0000 0000 0000 00fe 0000 0000 0000 0000 |
|
| 113 |
+ 0000 0000 0000 0000 0000 1818 0000 0000 |
|
| 114 |
+ 0000 0000 0206 0c18 3060 c080 0000 0000 |
|
| 115 |
+ 0000 386c c6c6 d6d6 c6c6 6c38 0000 0000 |
|
| 116 |
+ 0000 1838 7818 1818 1818 187e 0000 0000 |
|
| 117 |
+ 0000 7cc6 060c 1830 60c0 c6fe 0000 0000 |
|
| 118 |
+ 0000 7cc6 0606 3c06 0606 c67c 0000 0000 |
|
| 119 |
+ 0000 0c1c 3c6c ccfe 0c0c 0c1e 0000 0000 |
|
| 120 |
+ 0000 fec0 c0c0 fc06 0606 c67c 0000 0000 |
|
| 121 |
+ 0000 3860 c0c0 fcc6 c6c6 c67c 0000 0000 |
|
| 122 |
+ 0000 fec6 0606 0c18 3030 3030 0000 0000 |
|
| 123 |
+ 0000 7cc6 c6c6 7cc6 c6c6 c67c 0000 0000 |
|
| 124 |
+ 0000 7cc6 c6c6 7e06 0606 0c78 0000 0000 |
|
| 125 |
+ 0000 0000 1818 0000 0018 1800 0000 0000 |
|
| 126 |
+ 0000 0000 1818 0000 0018 1830 0000 0000 |
|
| 127 |
+ 0000 0006 0c18 3060 3018 0c06 0000 0000 |
|
| 128 |
+ 0000 0000 007e 0000 7e00 0000 0000 0000 |
|
| 129 |
+ 0000 0060 3018 0c06 0c18 3060 0000 0000 |
|
| 130 |
+ 0000 7cc6 c60c 1818 1800 1818 0000 0000 |
|
| 131 |
+ 0000 007c c6c6 dede dedc c07c 0000 0000 |
|
| 132 |
+ 0000 1038 6cc6 c6fe c6c6 c6c6 0000 0000 |
|
| 133 |
+ 0000 fc66 6666 7c66 6666 66fc 0000 0000 |
|
| 134 |
+ 0000 3c66 c2c0 c0c0 c0c2 663c 0000 0000 |
|
| 135 |
+ 0000 f86c 6666 6666 6666 6cf8 0000 0000 |
|
| 136 |
+ 0000 fe66 6268 7868 6062 66fe 0000 0000 |
|
| 137 |
+ 0000 fe66 6268 7868 6060 60f0 0000 0000 |
|
| 138 |
+ 0000 3c66 c2c0 c0de c6c6 663a 0000 0000 |
|
| 139 |
+ 0000 c6c6 c6c6 fec6 c6c6 c6c6 0000 0000 |
|
| 140 |
+ 0000 3c18 1818 1818 1818 183c 0000 0000 |
|
| 141 |
+ 0000 1e0c 0c0c 0c0c cccc cc78 0000 0000 |
|
| 142 |
+ 0000 e666 666c 7878 6c66 66e6 0000 0000 |
|
| 143 |
+ 0000 f060 6060 6060 6062 66fe 0000 0000 |
|
| 144 |
+ 0000 c6ee fefe d6c6 c6c6 c6c6 0000 0000 |
|
| 145 |
+ 0000 c6e6 f6fe dece c6c6 c6c6 0000 0000 |
|
| 146 |
+ 0000 7cc6 c6c6 c6c6 c6c6 c67c 0000 0000 |
|
| 147 |
+ 0000 fc66 6666 7c60 6060 60f0 0000 0000 |
|
| 148 |
+ 0000 7cc6 c6c6 c6c6 c6d6 de7c 0c0e 0000 |
|
| 149 |
+ 0000 fc66 6666 7c6c 6666 66e6 0000 0000 |
|
| 150 |
+ 0000 7cc6 c660 380c 06c6 c67c 0000 0000 |
|
| 151 |
+ 0000 7e7e 5a18 1818 1818 183c 0000 0000 |
|
| 152 |
+ 0000 c6c6 c6c6 c6c6 c6c6 c67c 0000 0000 |
|
| 153 |
+ 0000 c6c6 c6c6 c6c6 c66c 3810 0000 0000 |
|
| 154 |
+ 0000 c6c6 c6c6 d6d6 d6fe ee6c 0000 0000 |
|
| 155 |
+ 0000 c6c6 6c7c 3838 7c6c c6c6 0000 0000 |
|
| 156 |
+ 0000 6666 6666 3c18 1818 183c 0000 0000 |
|
| 157 |
+ 0000 fec6 860c 1830 60c2 c6fe 0000 0000 |
|
| 158 |
+ 0000 3c30 3030 3030 3030 303c 0000 0000 |
|
| 159 |
+ 0000 0080 c0e0 7038 1c0e 0602 0000 0000 |
|
| 160 |
+ 0000 3c0c 0c0c 0c0c 0c0c 0c3c 0000 0000 |
|
| 161 |
+ 1038 6cc6 0000 0000 0000 0000 0000 0000 |
|
| 162 |
+ 0000 0000 0000 0000 0000 0000 00ff 0000 |
|
| 163 |
+ 3030 1800 0000 0000 0000 0000 0000 0000 |
|
| 164 |
+ 0000 0000 0078 0c7c cccc cc76 0000 0000 |
|
| 165 |
+ 0000 e060 6078 6c66 6666 667c 0000 0000 |
|
| 166 |
+ 0000 0000 007c c6c0 c0c0 c67c 0000 0000 |
|
| 167 |
+ 0000 1c0c 0c3c 6ccc cccc cc76 0000 0000 |
|
| 168 |
+ 0000 0000 007c c6fe c0c0 c67c 0000 0000 |
|
| 169 |
+ 0000 386c 6460 f060 6060 60f0 0000 0000 |
|
| 170 |
+ 0000 0000 0076 cccc cccc cc7c 0ccc 7800 |
|
| 171 |
+ 0000 e060 606c 7666 6666 66e6 0000 0000 |
|
| 172 |
+ 0000 1818 0038 1818 1818 183c 0000 0000 |
|
| 173 |
+ 0000 0606 000e 0606 0606 0606 6666 3c00 |
|
| 174 |
+ 0000 e060 6066 6c78 786c 66e6 0000 0000 |
|
| 175 |
+ 0000 3818 1818 1818 1818 183c 0000 0000 |
|
| 176 |
+ 0000 0000 00ec fed6 d6d6 d6c6 0000 0000 |
|
| 177 |
+ 0000 0000 00dc 6666 6666 6666 0000 0000 |
|
| 178 |
+ 0000 0000 007c c6c6 c6c6 c67c 0000 0000 |
|
| 179 |
+ 0000 0000 00dc 6666 6666 667c 6060 f000 |
|
| 180 |
+ 0000 0000 0076 cccc cccc cc7c 0c0c 1e00 |
|
| 181 |
+ 0000 0000 00dc 7666 6060 60f0 0000 0000 |
|
| 182 |
+ 0000 0000 007c c660 380c c67c 0000 0000 |
|
| 183 |
+ 0000 1030 30fc 3030 3030 361c 0000 0000 |
|
| 184 |
+ 0000 0000 00cc cccc cccc cc76 0000 0000 |
|
| 185 |
+ 0000 0000 0066 6666 6666 3c18 0000 0000 |
|
| 186 |
+ 0000 0000 00c6 c6d6 d6d6 fe6c 0000 0000 |
|
| 187 |
+ 0000 0000 00c6 6c38 3838 6cc6 0000 0000 |
|
| 188 |
+ 0000 0000 00c6 c6c6 c6c6 c67e 060c f800 |
|
| 189 |
+ 0000 0000 00fe cc18 3060 c6fe 0000 0000 |
|
| 190 |
+ 0000 0e18 1818 7018 1818 180e 0000 0000 |
|
| 191 |
+ 0000 1818 1818 0018 1818 1818 0000 0000 |
|
| 192 |
+ 0000 7018 1818 0e18 1818 1870 0000 0000 |
| ... | ... |
@@ -22,24 +22,6 @@ static Uint8 blending[5][16] = {
|
| 22 | 22 |
{2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2},
|
| 23 | 23 |
{1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0}};
|
| 24 | 24 |
|
| 25 |
-static Uint8 font[][8] = {
|
|
| 26 |
- {0x00, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c},
|
|
| 27 |
- {0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10},
|
|
| 28 |
- {0x00, 0x7c, 0x82, 0x02, 0x7c, 0x80, 0x80, 0xfe},
|
|
| 29 |
- {0x00, 0x7c, 0x82, 0x02, 0x1c, 0x02, 0x82, 0x7c},
|
|
| 30 |
- {0x00, 0x0c, 0x14, 0x24, 0x44, 0x84, 0xfe, 0x04},
|
|
| 31 |
- {0x00, 0xfe, 0x80, 0x80, 0x7c, 0x02, 0x82, 0x7c},
|
|
| 32 |
- {0x00, 0x7c, 0x82, 0x80, 0xfc, 0x82, 0x82, 0x7c},
|
|
| 33 |
- {0x00, 0x7c, 0x82, 0x02, 0x1e, 0x02, 0x02, 0x02},
|
|
| 34 |
- {0x00, 0x7c, 0x82, 0x82, 0x7c, 0x82, 0x82, 0x7c},
|
|
| 35 |
- {0x00, 0x7c, 0x82, 0x82, 0x7e, 0x02, 0x82, 0x7c},
|
|
| 36 |
- {0x00, 0x7c, 0x82, 0x02, 0x7e, 0x82, 0x82, 0x7e},
|
|
| 37 |
- {0x00, 0xfc, 0x82, 0x82, 0xfc, 0x82, 0x82, 0xfc},
|
|
| 38 |
- {0x00, 0x7c, 0x82, 0x80, 0x80, 0x80, 0x82, 0x7c},
|
|
| 39 |
- {0x00, 0xfc, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfc},
|
|
| 40 |
- {0x00, 0x7c, 0x82, 0x80, 0xf0, 0x80, 0x82, 0x7c},
|
|
| 41 |
- {0x00, 0x7c, 0x82, 0x80, 0xf0, 0x80, 0x80, 0x80}};
|
|
| 42 |
- |
|
| 43 | 25 |
static void |
| 44 | 26 |
screen_write(UxnScreen *p, Layer *layer, Uint16 x, Uint16 y, Uint8 color) |
| 45 | 27 |
{
|
| ... | ... |
@@ -125,35 +107,6 @@ screen_redraw(UxnScreen *p, Uint32 *pixels) |
| 125 | 107 |
p->fg.changed = p->bg.changed = 0; |
| 126 | 108 |
} |
| 127 | 109 |
|
| 128 |
-void |
|
| 129 |
-screen_debug(UxnScreen *p, Uint8 *stack, Uint8 wptr, Uint8 rptr, Uint8 *memory) |
|
| 130 |
-{
|
|
| 131 |
- Uint8 i, x, y, b; |
|
| 132 |
- for(i = 0; i < 0x20; i++) {
|
|
| 133 |
- x = ((i % 8) * 3 + 1) * 8, y = (i / 8 + 1) * 8, b = stack[i]; |
|
| 134 |
- /* working stack */ |
|
| 135 |
- screen_blit(p, &p->fg, x, y, font[(b >> 4) & 0xf], 1 + (wptr == i) * 0x7, 0, 0, 0); |
|
| 136 |
- screen_blit(p, &p->fg, x + 8, y, font[b & 0xf], 1 + (wptr == i) * 0x7, 0, 0, 0); |
|
| 137 |
- y = 0x28 + (i / 8 + 1) * 8; |
|
| 138 |
- b = memory[i]; |
|
| 139 |
- /* return stack */ |
|
| 140 |
- screen_blit(p, &p->fg, x, y, font[(b >> 4) & 0xf], 3, 0, 0, 0); |
|
| 141 |
- screen_blit(p, &p->fg, x + 8, y, font[b & 0xf], 3, 0, 0, 0); |
|
| 142 |
- } |
|
| 143 |
- /* return pointer */ |
|
| 144 |
- screen_blit(p, &p->fg, 0x8, y + 0x10, font[(rptr >> 4) & 0xf], 0x2, 0, 0, 0); |
|
| 145 |
- screen_blit(p, &p->fg, 0x10, y + 0x10, font[rptr & 0xf], 0x2, 0, 0, 0); |
|
| 146 |
- /* guides */ |
|
| 147 |
- for(x = 0; x < 0x10; x++) {
|
|
| 148 |
- screen_write(p, &p->fg, x, p->height / 2, 2); |
|
| 149 |
- screen_write(p, &p->fg, p->width - x, p->height / 2, 2); |
|
| 150 |
- screen_write(p, &p->fg, p->width / 2, p->height - x, 2); |
|
| 151 |
- screen_write(p, &p->fg, p->width / 2, x, 2); |
|
| 152 |
- screen_write(p, &p->fg, p->width / 2 - 0x10 / 2 + x, p->height / 2, 2); |
|
| 153 |
- screen_write(p, &p->fg, p->width / 2, p->height / 2 - 0x10 / 2 + x, 2); |
|
| 154 |
- } |
|
| 155 |
-} |
|
| 156 |
- |
|
| 157 | 110 |
/* IO */ |
| 158 | 111 |
|
| 159 | 112 |
Uint8 |
| ... | ... |
@@ -34,7 +34,6 @@ void screen_palette(UxnScreen *p, Uint8 *addr); |
| 34 | 34 |
void screen_resize(UxnScreen *p, Uint16 width, Uint16 height); |
| 35 | 35 |
void screen_clear(UxnScreen *p, Layer *layer); |
| 36 | 36 |
void screen_redraw(UxnScreen *p, Uint32 *pixels); |
| 37 |
-void screen_debug(UxnScreen *p, Uint8 *stack, Uint8 wptr, Uint8 rptr, Uint8 *memory); |
|
| 38 | 37 |
|
| 39 | 38 |
Uint8 screen_dei(Device *d, Uint8 port); |
| 40 | 39 |
void screen_deo(Device *d, Uint8 port); |
| 41 | 40 |
\ No newline at end of file |
| ... | ... |
@@ -124,10 +124,8 @@ set_size(Uint16 width, Uint16 height, int is_resize) |
| 124 | 124 |
} |
| 125 | 125 |
|
| 126 | 126 |
static void |
| 127 |
-redraw(Uxn *u) |
|
| 127 |
+redraw(void) |
|
| 128 | 128 |
{
|
| 129 |
- if(devsystem->dat[0xe]) |
|
| 130 |
- screen_debug(&uxn_screen, u->wst->dat, u->wst->ptr, u->rst->ptr, u->ram); |
|
| 131 | 129 |
screen_redraw(&uxn_screen, uxn_screen.pixels); |
| 132 | 130 |
if(SDL_UpdateTexture(gTexture, NULL, uxn_screen.pixels, uxn_screen.width * sizeof(Uint32)) != 0) |
| 133 | 131 |
error("SDL_UpdateTexture", SDL_GetError());
|
| ... | ... |
@@ -281,12 +279,14 @@ start(Uxn *u, char *rom) |
| 281 | 279 |
memory = (Uint8 *)calloc(0xffff, sizeof(Uint8)); |
| 282 | 280 |
shadow = (Uint8 *)calloc(0xffff, sizeof(Uint8)); |
| 283 | 281 |
|
| 284 |
- if(!uxn_boot(&hypervisor, (Stack *)(shadow + 0x600), (Stack *)(shadow + 0x800), shadow)) |
|
| 282 |
+ if(!uxn_boot(&hypervisor, (Stack *)(shadow + 0xfc00), (Stack *)(shadow + 0xfd00), shadow)) |
|
| 285 | 283 |
return error("Boot", "Failed to start uxn.");
|
| 286 |
- if(!uxn_boot(u, (Stack *)(shadow + 0x200), (Stack *)(shadow + 0x400), memory)) |
|
| 284 |
+ if(!uxn_boot(u, (Stack *)(shadow + 0xfe00), (Stack *)(shadow + 0xff00), memory)) |
|
| 287 | 285 |
return error("Boot", "Failed to start uxn.");
|
| 288 | 286 |
if(!load(u, rom)) |
| 289 | 287 |
return error("Boot", "Failed to load rom.");
|
| 288 |
+ if(!load(&hypervisor, "hypervisor.rom")) |
|
| 289 |
+ error("Hypervisor", "No debugger found.");
|
|
| 290 | 290 |
|
| 291 | 291 |
/* system */ devsystem = uxn_port(u, 0x0, system_dei, system_deo); |
| 292 | 292 |
/* console */ devconsole = uxn_port(u, 0x1, nil_dei, console_deo); |
| ... | ... |
@@ -305,6 +305,10 @@ start(Uxn *u, char *rom) |
| 305 | 305 |
/* unused */ uxn_port(u, 0xe, nil_dei, nil_deo); |
| 306 | 306 |
/* unused */ uxn_port(u, 0xf, nil_dei, nil_deo); |
| 307 | 307 |
|
| 308 |
+ /* Hypervisor */ |
|
| 309 |
+ uxn_port(&hypervisor, 0x1, nil_dei, console_deo); |
|
| 310 |
+ uxn_port(&hypervisor, 0x2, screen_dei, screen_deo); |
|
| 311 |
+ |
|
| 308 | 312 |
if(!uxn_eval(u, PAGE_PROGRAM)) |
| 309 | 313 |
return error("Boot", "Failed to start rom.");
|
| 310 | 314 |
|
| ... | ... |
@@ -415,7 +419,7 @@ console_input(Uxn *u, char c) |
| 415 | 419 |
static int |
| 416 | 420 |
run(Uxn *u) |
| 417 | 421 |
{
|
| 418 |
- redraw(u); |
|
| 422 |
+ redraw(); |
|
| 419 | 423 |
while(!devsystem->dat[0xf]) {
|
| 420 | 424 |
SDL_Event event; |
| 421 | 425 |
double elapsed, begin; |
| ... | ... |
@@ -426,7 +430,7 @@ run(Uxn *u) |
| 426 | 430 |
if(event.type == SDL_QUIT) |
| 427 | 431 |
return error("Run", "Quit.");
|
| 428 | 432 |
else if(event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_EXPOSED) |
| 429 |
- redraw(u); |
|
| 433 |
+ redraw(); |
|
| 430 | 434 |
else if(event.type == SDL_DROPFILE) {
|
| 431 | 435 |
set_size(WIDTH, HEIGHT, 0); |
| 432 | 436 |
start(u, event.drop.file); |
| ... | ... |
@@ -480,9 +484,11 @@ run(Uxn *u) |
| 480 | 484 |
else if(event.type == stdin_event) |
| 481 | 485 |
console_input(u, event.cbutton.button); |
| 482 | 486 |
} |
| 487 |
+ if(devsystem->dat[0xe]) |
|
| 488 |
+ uxn_eval(&hypervisor, PAGE_PROGRAM); |
|
| 483 | 489 |
uxn_eval(u, devscreen->vector); |
| 484 | 490 |
if(uxn_screen.fg.changed || uxn_screen.bg.changed || devsystem->dat[0xe]) |
| 485 |
- redraw(u); |
|
| 491 |
+ redraw(); |
|
| 486 | 492 |
if(!BENCH) {
|
| 487 | 493 |
elapsed = (SDL_GetPerformanceCounter() - begin) / (double)SDL_GetPerformanceFrequency() * 1000.0f; |
| 488 | 494 |
SDL_Delay(clamp(16.666f - elapsed, 0, 1000)); |