| ... | ... |
@@ -20,5 +20,5 @@ cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werr |
| 20 | 20 |
# cc uxn.c emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator |
| 21 | 21 |
|
| 22 | 22 |
# run |
| 23 |
-./bin/assembler examples/dev.mouse.usm bin/boot.rom |
|
| 23 |
+./bin/assembler examples/gui.hover.usm bin/boot.rom |
|
| 24 | 24 |
./bin/emulator bin/boot.rom |
| ... | ... |
@@ -329,7 +329,11 @@ doctrl(Uxn *u, SDL_Event *event, int z) |
| 329 | 329 |
Uint8 |
| 330 | 330 |
console_poke(Uint8 *m, Uint16 ptr, Uint8 b0, Uint8 b1) |
| 331 | 331 |
{
|
| 332 |
- printf("%c", b1);
|
|
| 332 |
+ switch(b0) {
|
|
| 333 |
+ case 0x08: printf("%c", b1); break;
|
|
| 334 |
+ case 0x09: printf("%02x", b1); break;
|
|
| 335 |
+ case 0x0a: printf("%d", b1); break;
|
|
| 336 |
+ } |
|
| 333 | 337 |
fflush(stdout); |
| 334 | 338 |
(void)m; |
| 335 | 339 |
(void)ptr; |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
( hello world ) |
| 2 | 2 |
|
| 3 |
-&Console { pad 8 stdio 1 }
|
|
| 3 |
+&Console { pad 8 char 1 byte 1 }
|
|
| 4 | 4 |
|
| 5 | 5 |
|0100 @RESET |
| 6 | 6 |
|
| ... | ... |
@@ -11,11 +11,11 @@ BRK |
| 11 | 11 |
@print-label ( text ) |
| 12 | 12 |
|
| 13 | 13 |
@cliloop |
| 14 |
- DUP2 LDR =dev/console.stdio ( write pointer value to console ) |
|
| 14 |
+ DUP2 LDR =dev/console.char ( write pointer value to console ) |
|
| 15 | 15 |
#0001 ADD2 ( increment string pointer ) |
| 16 | 16 |
DUP2 LDR #00 NEQ ,cliloop ROT JMP? POP2 ( while *ptr!=0 goto loop ) |
| 17 | 17 |
POP2 |
| 18 |
- |
|
| 18 |
+ |
|
| 19 | 19 |
RTS |
| 20 | 20 |
|
| 21 | 21 |
@text1 [ Hello World ] <1 .00 ( add text to memory, return 1 byte, add null byte ) |
| ... | ... |
@@ -22,31 +22,32 @@ |
| 22 | 22 |
|
| 23 | 23 |
BRK |
| 24 | 24 |
|
| 25 |
- |
|
| 26 | 25 |
|0200 @FRAME |
| 27 | 26 |
|
| 28 | 27 |
,pointer_icn =cursor |
| 29 | 28 |
|
| 30 | 29 |
#01 =color |
| 31 |
- |
|
| 30 |
+ ( matrix comparison ) |
|
| 32 | 31 |
~dev/mouse.x ~r1.x1 GTH2 ~dev/mouse.x ~r1.x2 LTH2 #0101 EQU2 |
| 33 | 32 |
~dev/mouse.y ~r1.y1 GTH2 ~dev/mouse.y ~r1.y2 LTH2 #0101 EQU2 |
| 34 |
- #0101 NEQ2 ,skip1 ROT JMP? POP2 #02 =color ,hand_icn =cursor @skip1 |
|
| 35 |
- ~r1.x1 ~r1.y1 ~r1.x2 ~r1.y2 ~color ,line-rect JSR |
|
| 33 |
+ #0101 NEQ2 ,draw1 ROT JMP? POP2 #02 =color ,hand_icn =cursor |
|
| 34 |
+ @draw1 ~r1.x1 ~r1.y1 ~r1.x2 ~r1.y2 ~color ,line-rect JSR |
|
| 36 | 35 |
|
| 37 | 36 |
#01 =color |
| 38 |
- |
|
| 39 |
- ~dev/mouse.x ~r2.x1 GTH2 ~dev/mouse.x ~r2.x2 LTH2 #0101 EQU2 |
|
| 40 |
- ~dev/mouse.y ~r2.y1 GTH2 ~dev/mouse.y ~r2.y2 LTH2 #0101 EQU2 |
|
| 41 |
- #0101 NEQ2 ,skip2 ROT JMP? POP2 #02 =color ,hand_icn =cursor @skip2 |
|
| 42 |
- ~r2.x1 ~r2.y1 ~r2.x2 ~r2.y2 ~color ,line-rect JSR |
|
| 37 |
+ ( 2-step comparison ) |
|
| 38 |
+ ,draw2 ~dev/mouse.x ~r2.x1 GTH2 ~dev/mouse.x ~r2.x2 LTH2 #0101 NEQ2 JMP? POP2 |
|
| 39 |
+ ,draw2 ~dev/mouse.y ~r2.y1 GTH2 ~dev/mouse.y ~r2.y2 LTH2 #0101 NEQ2 JMP? POP2 |
|
| 40 |
+ #03 =color ,hand_icn =cursor |
|
| 41 |
+ @draw2 ~r2.x1 ~r2.y1 ~r2.x2 ~r2.y2 ~color ,line-rect JSR |
|
| 43 | 42 |
|
| 44 | 43 |
#01 =color |
| 45 |
- |
|
| 46 |
- ~dev/mouse.x ~r3.x1 GTH2 ~dev/mouse.x ~r3.x2 LTH2 #0101 EQU2 |
|
| 47 |
- ~dev/mouse.y ~r3.y1 GTH2 ~dev/mouse.y ~r3.y2 LTH2 #0101 EQU2 |
|
| 48 |
- #0101 NEQ2 ,skip3 ROT JMP? POP2 #02 =color ,hand_icn =cursor @skip3 |
|
| 49 |
- ~r3.x1 ~r3.y1 ~r3.x2 ~r3.y2 ~color ,line-rect JSR |
|
| 44 |
+ ( 4-step comparison ) |
|
| 45 |
+ ,draw3 ~dev/mouse.x ~r3.x1 LTH2 JMP? POP2 |
|
| 46 |
+ ,draw3 ~dev/mouse.x ~r3.x2 GTH2 JMP? POP2 |
|
| 47 |
+ ,draw3 ~dev/mouse.y ~r3.y1 LTH2 JMP? POP2 |
|
| 48 |
+ ,draw3 ~dev/mouse.y ~r3.y2 GTH2 JMP? POP2 |
|
| 49 |
+ #02 =color ,hand_icn =cursor |
|
| 50 |
+ @draw3 ~r3.x1 ~r3.y1 ~r3.x2 ~r3.y2 ~color ,line-rect JSR |
|
| 50 | 51 |
|
| 51 | 52 |
,draw-cursor JSR |
| 52 | 53 |
|