| ... | ... |
@@ -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/devchord.usm bin/boot.rom |
|
| 23 |
+./bin/assembler examples/images.usm bin/boot.rom |
|
| 24 | 24 |
./bin/emulator bin/boot.rom |
| ... | ... |
@@ -196,7 +196,7 @@ drawdebugger(Uint32 *dst, Uxn *u) |
| 196 | 196 |
Uint8 x = (i % 8) * 3 + 3, y = i / 8 + 3, b = u->ram.dat[i]; |
| 197 | 197 |
drawicn(dst, x * 8, y * 8, icons[(b >> 4) & 0xf], 1, 0); |
| 198 | 198 |
drawicn(dst, x * 8 + 8, y * 8, icons[b & 0xf], 1, 0); |
| 199 |
- y = VER - i / 8, b = u->wst.dat[i]; |
|
| 199 |
+ y = VER - 1 + i / 8, b = u->wst.dat[i]; |
|
| 200 | 200 |
drawicn(dst, x * 8, y * 8, icons[(b >> 4) & 0xf], 1 + (u->wst.ptr == i), 0); |
| 201 | 201 |
drawicn(dst, x * 8 + 8, y * 8, icons[b & 0xf], 1 + (u->wst.ptr == i), 0); |
| 202 | 202 |
} |
| 203 | 203 |
deleted file mode 100644 |
| ... | ... |
@@ -1,112 +0,0 @@ |
| 1 |
-( drag ) |
|
| 2 |
- |
|
| 3 |
-:dev/r fff8 ( std read port ) |
|
| 4 |
-:dev/w fff9 ( std write port ) |
|
| 5 |
- |
|
| 6 |
-;dragx 2 ;dragy 2 |
|
| 7 |
-;mousex 2 ;mousey 2 |
|
| 8 |
-;lastx 2 ;lasty 2 |
|
| 9 |
-;originx 2 ;originy 2 |
|
| 10 |
-;down 1 ;state 1 |
|
| 11 |
- |
|
| 12 |
-|0100 @RESET |
|
| 13 |
- |
|
| 14 |
- #05 =dev/r ( set dev/read mouse ) |
|
| 15 |
- #02 =dev/w ( set dev/write to sprite ) |
|
| 16 |
- ,draw-picture JSR |
|
| 17 |
- |
|
| 18 |
-BRK |
|
| 19 |
- |
|
| 20 |
-|c000 @FRAME |
|
| 21 |
- |
|
| 22 |
- ( clear last cursor ) |
|
| 23 |
- #10 ,clear_icn ~lastx ~lasty ,draw-sprite JSR |
|
| 24 |
- ( record mouse values ) |
|
| 25 |
- #00 IOR2 =mousex #02 IOR2 =mousey |
|
| 26 |
- #04 IOR #11 ADD =state |
|
| 27 |
- ( draw mouse ) |
|
| 28 |
- ~state ,cursor_icn ~mousex ~mousey ,draw-sprite JSR |
|
| 29 |
- ( update last pos ) |
|
| 30 |
- ~mousex =lastx ~mousey =lasty |
|
| 31 |
- |
|
| 32 |
- ( get touch ) |
|
| 33 |
- #05 IOR #01 EQU ,on-touch ROT JMP? POP2 |
|
| 34 |
- #05 IOR #10 EQU ,on-release ROT JMP? POP2 |
|
| 35 |
- #01 ~down EQU ,on-drag ROT JMP? POP2 |
|
| 36 |
- |
|
| 37 |
- BRK |
|
| 38 |
- |
|
| 39 |
- @on-touch |
|
| 40 |
- #01 =down |
|
| 41 |
- #00 IOR2 =originx #02 IOR2 =originy |
|
| 42 |
- ,update JSR |
|
| 43 |
- BRK |
|
| 44 |
- |
|
| 45 |
- @on-release |
|
| 46 |
- #00 =down |
|
| 47 |
- ,update JSR |
|
| 48 |
- BRK |
|
| 49 |
- |
|
| 50 |
- @on-drag |
|
| 51 |
- #00 IOR2 ~originx SUBS2 ~dragx ADDS2 =dragx |
|
| 52 |
- #02 IOR2 ~originy SUBS2 ~dragy ADDS2 =dragy |
|
| 53 |
- #00 IOR2 =originx #02 IOR2 =originy |
|
| 54 |
- ,update JSR |
|
| 55 |
- BRK |
|
| 56 |
- |
|
| 57 |
- @update |
|
| 58 |
- ,draw-picture JSR |
|
| 59 |
- |
|
| 60 |
-BRK |
|
| 61 |
- |
|
| 62 |
-@draw-picture |
|
| 63 |
- #01 ,graphic #0040 ~dragx ADD2 #0040 ~dragy ADD2 ,draw-sprite JSR |
|
| 64 |
- #01 ,graphic #0008 ADD2 #0048 ~dragx ADD2 #0040 ~dragy ADD2 ,draw-sprite JSR |
|
| 65 |
- #01 ,graphic #0010 ADD2 #0050 ~dragx ADD2 #0040 ~dragy ADD2 ,draw-sprite JSR |
|
| 66 |
- #01 ,graphic #0018 ADD2 #0058 ~dragx ADD2 #0040 ~dragy ADD2 ,draw-sprite JSR |
|
| 67 |
- #01 ,graphic #0020 ADD2 #0040 ~dragx ADD2 #0048 ~dragy ADD2 ,draw-sprite JSR |
|
| 68 |
- #01 ,graphic #0028 ADD2 #0048 ~dragx ADD2 #0048 ~dragy ADD2 ,draw-sprite JSR |
|
| 69 |
- #01 ,graphic #0030 ADD2 #0050 ~dragx ADD2 #0048 ~dragy ADD2 ,draw-sprite JSR |
|
| 70 |
- #01 ,graphic #0038 ADD2 #0058 ~dragx ADD2 #0048 ~dragy ADD2 ,draw-sprite JSR |
|
| 71 |
- #01 ,graphic #0040 ADD2 #0040 ~dragx ADD2 #0050 ~dragy ADD2 ,draw-sprite JSR |
|
| 72 |
- #01 ,graphic #0048 ADD2 #0048 ~dragx ADD2 #0050 ~dragy ADD2 ,draw-sprite JSR |
|
| 73 |
- #01 ,graphic #0050 ADD2 #0050 ~dragx ADD2 #0050 ~dragy ADD2 ,draw-sprite JSR |
|
| 74 |
- #01 ,graphic #0058 ADD2 #0058 ~dragx ADD2 #0050 ~dragy ADD2 ,draw-sprite JSR |
|
| 75 |
- #01 ,graphic #0060 ADD2 #0040 ~dragx ADD2 #0058 ~dragy ADD2 ,draw-sprite JSR |
|
| 76 |
- #01 ,graphic #0068 ADD2 #0048 ~dragx ADD2 #0058 ~dragy ADD2 ,draw-sprite JSR |
|
| 77 |
- #01 ,graphic #0070 ADD2 #0050 ~dragx ADD2 #0058 ~dragy ADD2 ,draw-sprite JSR |
|
| 78 |
- #01 ,graphic #0078 ADD2 #0058 ~dragx ADD2 #0058 ~dragy ADD2 ,draw-sprite JSR |
|
| 79 |
- RTS |
|
| 80 |
- |
|
| 81 |
-@draw-sprite |
|
| 82 |
- IOW2 ( y byte ) |
|
| 83 |
- IOW2 ( x byte ) |
|
| 84 |
- IOW2 ( sprite address ) |
|
| 85 |
- IOW ( layer-color ) |
|
| 86 |
- RTS |
|
| 87 |
- |
|
| 88 |
-@clear_icn [ 0000 0000 0000 0000 ] |
|
| 89 |
-@cursor_icn [ 80c0 e0f0 f8e0 1000 ] |
|
| 90 |
- |
|
| 91 |
-@graphic [ |
|
| 92 |
- ff80 8080 8080 8088 |
|
| 93 |
- ffff fffc f8f9 f1f4 |
|
| 94 |
- ffff 0010 c721 2120 |
|
| 95 |
- ffff 3f0f 0717 c343 |
|
| 96 |
- 8888 8080 8080 8080 |
|
| 97 |
- f0f1 f2f5 f2f1 f0f4 |
|
| 98 |
- 1208 804c 9212 4c00 |
|
| 99 |
- 7303 0343 1b1b fbfb |
|
| 100 |
- 8080 8f83 8383 8393 |
|
| 101 |
- f0f3 f1f0 e4c0 80ff |
|
| 102 |
- 00c7 c7c6 4606 00ff |
|
| 103 |
- c3d3 c307 870f 3fff |
|
| 104 |
- 8f83 8383 8383 83ff |
|
| 105 |
- fff7 fdff c0e2 f1ff |
|
| 106 |
- 7fef bfff 07af 5fff |
|
| 107 |
- ffff ffff ffff ffff |
|
| 108 |
-] |
|
| 109 |
- |
|
| 110 |
-|d000 @ERROR BRK |
|
| 111 |
-|FFF0 [ f0ac f0bb f053 ] ( palette ) |
|
| 112 |
-|FFFA .RESET .FRAME .ERROR ( vectors ) |
| 113 | 0 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,87 @@ |
| 1 |
+( drag ) |
|
| 2 |
+ |
|
| 3 |
+:dev/r fff8 ( std read port ) |
|
| 4 |
+:dev/w fff9 ( std write port ) |
|
| 5 |
+ |
|
| 6 |
+&Point { x 1 y 1 }
|
|
| 7 |
+ |
|
| 8 |
+&Point2d { x 2 y 2 }
|
|
| 9 |
+&Picture2d { x 2 y 2 width 1 height 1 color 1 addr 2 }
|
|
| 10 |
+ |
|
| 11 |
+;pict Picture2d ;pictpt Point |
|
| 12 |
+ |
|
| 13 |
+|0100 @RESET |
|
| 14 |
+ |
|
| 15 |
+ #05 =dev/r ( set dev/read mouse ) |
|
| 16 |
+ #02 =dev/w ( set dev/write to sprite ) |
|
| 17 |
+ |
|
| 18 |
+ #0030 #0042 #04 #04 #01 ,graphic ,draw-picture JSR |
|
| 19 |
+ #0040 #0052 #04 #04 #02 ,graphic ,draw-picture JSR |
|
| 20 |
+ #0050 #0062 #04 #04 #03 ,graphic ,draw-picture JSR |
|
| 21 |
+ |
|
| 22 |
+ #0058 #0042 #04 #04 #05 ,graphic ,draw-picture JSR |
|
| 23 |
+ #0068 #0052 #04 #04 #06 ,graphic ,draw-picture JSR |
|
| 24 |
+ #0078 #0062 #04 #04 #07 ,graphic ,draw-picture JSR |
|
| 25 |
+ |
|
| 26 |
+ #0080 #0042 #04 #04 #0a ,graphic ,draw-picture JSR |
|
| 27 |
+ #0090 #0052 #04 #04 #0c ,graphic ,draw-picture JSR |
|
| 28 |
+ #00a0 #0062 #04 #04 #0e ,graphic ,draw-picture JSR |
|
| 29 |
+ |
|
| 30 |
+BRK |
|
| 31 |
+ |
|
| 32 |
+@draw-picture ( x y width height addr -> picture ) |
|
| 33 |
+ |
|
| 34 |
+ =pict.addr =pict.color =pict.height =pict.width =pict.y =pict.x |
|
| 35 |
+ #00 =pictpt.y |
|
| 36 |
+ @draw-picture-row |
|
| 37 |
+ #00 =pictpt.x |
|
| 38 |
+ @draw-picture-col |
|
| 39 |
+ ( draw ) |
|
| 40 |
+ ~pict.color |
|
| 41 |
+ ~pict.addr |
|
| 42 |
+ #0008 #00 ~pictpt.x MUL2 ADD2 ( x ) |
|
| 43 |
+ #0008 #00 ~pictpt.y ~pict.width MUL MUL2 ADD2 ( y * width ) |
|
| 44 |
+ ~pict.x #0008 #00 ~pictpt.x MUL2 ADD2 |
|
| 45 |
+ ~pict.y #0008 #00 ~pictpt.y MUL2 ADD2 |
|
| 46 |
+ ,draw-sprite JSR |
|
| 47 |
+ ( draw - end ) |
|
| 48 |
+ ( incr x ) ~pictpt.x #01 ADD =pictpt.x |
|
| 49 |
+ ~pictpt.x ~pict.width LTH ,draw-picture-col ROT JMP? POP2 |
|
| 50 |
+ ( incr y ) ~pictpt.y #01 ADD =pictpt.y |
|
| 51 |
+ ~pictpt.y ~pict.height LTH ,draw-picture-row ROT JMP? POP2 |
|
| 52 |
+ |
|
| 53 |
+RTS |
|
| 54 |
+ |
|
| 55 |
+@draw-sprite |
|
| 56 |
+ IOW2 ( y byte ) |
|
| 57 |
+ IOW2 ( x byte ) |
|
| 58 |
+ IOW2 ( sprite address ) |
|
| 59 |
+ IOW ( layer-color ) |
|
| 60 |
+ RTS |
|
| 61 |
+ |
|
| 62 |
+@clear_icn [ 0000 0000 0000 0000 ] |
|
| 63 |
+@cursor_icn [ 80c0 e0f0 f8e0 1000 ] |
|
| 64 |
+ |
|
| 65 |
+@graphic [ |
|
| 66 |
+ ff80 8080 8080 8088 |
|
| 67 |
+ ffff fffc f8f9 f1f4 |
|
| 68 |
+ ffff 0010 c721 2120 |
|
| 69 |
+ ffff 3f0f 0717 c343 |
|
| 70 |
+ 8888 8080 8080 8080 |
|
| 71 |
+ f0f1 f2f5 f2f1 f0f4 |
|
| 72 |
+ 1208 804c 9212 4c00 |
|
| 73 |
+ 7303 0343 1b1b fbfb |
|
| 74 |
+ 8080 8f83 8383 8393 |
|
| 75 |
+ f0f3 f1f0 e4c0 80ff |
|
| 76 |
+ 00c7 c7c6 4606 00ff |
|
| 77 |
+ c3d3 c307 870f 3fff |
|
| 78 |
+ 8f83 8383 8383 83ff |
|
| 79 |
+ fff7 fdff c0e2 f1ff |
|
| 80 |
+ 7fef bfff 07af 5fff |
|
| 81 |
+ ffff ffff ffff ffff |
|
| 82 |
+] |
|
| 83 |
+ |
|
| 84 |
+|c000 @FRAME BRK |
|
| 85 |
+|d000 @ERROR BRK |
|
| 86 |
+|FFF0 [ f0ac f0bb f053 ] ( palette ) |
|
| 87 |
+|FFFA .RESET .FRAME .ERROR ( vectors ) |
| ... | ... |
@@ -108,7 +108,7 @@ Uint8 opr[][2] = {
|
| 108 | 108 |
{1,0}, {1,2}, {2,2}, {2,3}, {3,3}, {1,0}, {0,1}, {2,1},
|
| 109 | 109 |
{2,1}, {2,1}, {2,1}, {2,1}, {2,1}, {2,1}, {2,1}, {2,1},
|
| 110 | 110 |
/* 16-bit */ |
| 111 |
- {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, /* TODO */
|
|
| 111 |
+ {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {2,2}, {4,0}, /* TODO */
|
|
| 112 | 112 |
{0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, /* TODO */
|
| 113 | 113 |
{0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {1,0}, {0,1}, {0,0}, /* TODO */
|
| 114 | 114 |
{4,2}, {4,2}, {4,2}, {4,2}, {4,2}, {4,2}, {4,2}, {4,2}
|