diff --git a/.gitignore b/.gitignore index 282ccec..42bec0a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ *png~ *gif~ *bmp~ -/bin \ No newline at end of file +/bin +*io.bit \ No newline at end of file diff --git a/build.sh b/build.sh index edfdfaa..539d023 100755 --- a/build.sh +++ b/build.sh @@ -20,5 +20,5 @@ cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werr # cc uxn.c emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator # run -./bin/assembler examples/app.nasu.usm bin/boot.rom +./bin/assembler projects/software/nasu.usm bin/boot.rom ./bin/emulator bin/boot.rom diff --git a/examples/blank.usm b/projects/examples/blank.usm similarity index 100% rename from examples/blank.usm rename to projects/examples/blank.usm diff --git a/examples/dev.console.usm b/projects/examples/dev.console.usm similarity index 100% rename from examples/dev.console.usm rename to projects/examples/dev.console.usm diff --git a/examples/dev.ctrl.usm b/projects/examples/dev.ctrl.usm similarity index 100% rename from examples/dev.ctrl.usm rename to projects/examples/dev.ctrl.usm diff --git a/examples/dev.key.usm b/projects/examples/dev.key.usm similarity index 100% rename from examples/dev.key.usm rename to projects/examples/dev.key.usm diff --git a/examples/dev.mouse.usm b/projects/examples/dev.mouse.usm similarity index 100% rename from examples/dev.mouse.usm rename to projects/examples/dev.mouse.usm diff --git a/examples/dev.screen.usm b/projects/examples/dev.screen.usm similarity index 100% rename from examples/dev.screen.usm rename to projects/examples/dev.screen.usm diff --git a/examples/gui.hover.usm b/projects/examples/gui.hover.usm similarity index 100% rename from examples/gui.hover.usm rename to projects/examples/gui.hover.usm diff --git a/examples/gui.label.usm b/projects/examples/gui.label.usm similarity index 100% rename from examples/gui.label.usm rename to projects/examples/gui.label.usm diff --git a/examples/gui.picture.usm b/projects/examples/gui.picture.usm similarity index 100% rename from examples/gui.picture.usm rename to projects/examples/gui.picture.usm diff --git a/examples/gui.shapes.usm b/projects/examples/gui.shapes.usm similarity index 100% rename from examples/gui.shapes.usm rename to projects/examples/gui.shapes.usm diff --git a/examples/win.editor.usm b/projects/examples/win.editor.usm similarity index 100% rename from examples/win.editor.usm rename to projects/examples/win.editor.usm diff --git a/projects/fonts/from-exed.bit b/projects/fonts/from-exed.bit new file mode 100644 index 0000000..7319f98 --- /dev/null +++ b/projects/fonts/from-exed.bit @@ -0,0 +1,128 @@ +0000 0000 0000 0000 0000 2400 7e3c 0000 +0000 2400 3c42 0000 0000 6c7c 7c38 1000 +0010 387c 7c38 1000 0038 387c 6c10 3800 +0010 387c 7c10 3800 0000 0018 1800 0000 +007e 4242 4242 7e00 0000 1824 2418 0000 +003c 665a 5a66 3c00 001e 063a 4a48 3000 +0038 446c 107c 1000 000e 0808 0838 3800 +003e 3e22 2266 6600 0000 1044 0044 1000 +0000 1018 1c18 1000 0000 0818 3818 0800 +0008 1c00 001c 0800 0028 2828 2800 2800 +003e 4a4a 3a0a 0a00 000c 3046 620c 3000 +0000 0000 0000 ffff 0010 3800 3810 0038 +0010 3854 1010 1000 0010 1010 5438 1000 +0000 0804 7e04 0800 0000 1020 7e20 1000 +0000 4040 7e00 0000 0000 0024 6624 0000 +0000 1038 7c00 0000 0000 007c 3810 0000 +0000 0000 0000 0000 0010 1010 1000 1000 +0024 2400 0000 0000 0024 7e24 247e 2400 +0008 1e28 1c0a 3c08 0062 6408 1026 4600 +0030 4832 4c44 3a00 0008 1000 0000 0000 +0004 0808 0808 0400 0020 1010 1010 2000 +0000 1408 3e08 1400 0000 0808 3e08 0800 +0000 0000 0008 0810 0000 0000 3c00 0000 +0000 0000 0018 1800 0000 0204 0810 2000 +003c 464a 5262 3c00 0018 2808 0808 3e00 +003c 4202 3c40 7e00 003c 421c 0242 3c00 +0008 1828 487e 0800 007e 407c 0242 3c00 +003c 407c 4242 3c00 007e 0204 0810 1000 +003c 423c 4242 3c00 003c 4242 3e02 3c00 +0000 0010 0000 1000 0000 1000 0010 1020 +0000 0810 2010 0800 0000 003e 003e 0000 +0000 1008 0408 1000 003c 420c 1000 1000 +003c 4252 5e40 3c00 003c 4242 7e42 4200 +007c 427c 4242 7c00 003c 4240 4042 3c00 +0078 4442 4244 7800 007e 407c 4040 7e00 +007e 4040 7c40 4000 003c 4240 4e42 3c00 +0042 427e 4242 4200 003e 0808 0808 3e00 +0002 0202 4242 3c00 0044 4870 4844 4200 +0040 4040 4040 7e00 0042 665a 4242 4200 +0042 6252 4a46 4200 003c 4242 4242 3c00 +007c 4242 7c40 4000 003c 4242 524a 3c00 +007c 4242 7c44 4200 003c 403c 0242 3c00 +00fe 1010 1010 1000 0042 4242 4242 3c00 +0042 4242 4224 1800 0042 4242 5a66 4200 +0042 2418 1824 4200 0082 4428 1010 1000 +007e 0408 1020 7e00 000e 0808 0808 0e00 +0000 4020 1008 0400 0070 1010 1010 7000 +0008 1422 0000 0000 0000 0000 0000 00ff +0010 0804 0000 0000 0000 3804 3c44 3c00 +0020 203c 2222 3c00 0000 1c20 2020 1c00 +0004 043c 4444 3c00 0000 3844 7840 3c00 +000c 101c 1010 1000 0000 3844 443c 0438 +0040 4058 6444 4400 0010 0030 1010 0c00 +0008 0008 0808 4830 0020 2028 3028 2400 +0010 1010 1010 0c00 0000 6854 5454 5400 +0000 5864 4444 4400 0000 3844 4444 3800 +0000 7844 4478 4040 0000 3c44 443c 0406 +0000 2c30 2020 2000 0000 3840 3804 7800 +0010 103c 1010 0c00 0000 4444 4444 3800 +0000 4444 2828 1000 0000 4454 5454 2800 +0000 4428 1028 4400 0000 4444 443c 0438 +0000 7c08 1020 7c00 000e 0830 0808 0e00 +0008 0808 0808 0800 0070 100c 1010 7000 +0032 4c00 0000 0000 3c42 99a1 a199 423c +003c 4240 423c 1070 0044 0044 4444 3800 +0810 3844 7840 3c00 1028 003c 444c 3400 +0024 003c 444c 3400 0020 103c 444c 3400 +1028 103c 444c 3400 0000 1c20 201c 0818 +1028 3844 7840 3c00 2800 3844 7840 3c00 +2010 3c44 7840 3c00 0028 0030 1010 0c00 +1028 0030 1010 0c00 2010 0030 1010 0c00 +423c 4242 7e42 4200 0814 3c42 7e42 4200 +0810 7e40 7c40 7e00 0000 6c12 3c50 6e00 +003e 507c 5050 5e00 1028 0038 4444 3800 +2800 3844 4444 3800 2010 3844 4444 3800 +1028 0044 4444 3800 2010 4444 4444 3800 +4400 4444 443c 0438 423c 4242 4242 3c00 +4200 4242 4242 3c00 0010 3840 4038 1000 +001c 2278 2020 7e00 0044 287c 107c 1000 +007c 4252 7c50 4c00 000c 107c 1010 6000 +0810 003c 444c 3400 0810 0030 1010 0c00 +0810 3844 4444 3800 0810 4444 4444 3800 +324c 005c 6242 4200 324c 0062 524a 4600 +3848 5828 0078 0000 3048 4830 0078 0000 +0008 0008 3042 3c00 0000 0000 7c40 4000 +0000 0000 7c04 0400 4448 502c 4204 0e00 +4448 5024 541e 0400 0010 0010 1010 1000 +0000 1224 4824 1200 0000 4824 1224 4800 +8844 2211 8844 2211 aa55 aa55 aa55 aa55 +4411 4411 4411 4411 1010 1010 1010 1010 +1010 1010 f010 1010 1010 10f0 10f0 1010 +2828 2828 e828 2828 0000 0000 f828 2828 +0000 00f0 10f0 1010 2828 28e8 08e8 2828 +2828 2828 2828 2828 0000 00f8 08e8 2828 +2828 28e8 08f8 0000 2828 2828 f800 0000 +1010 10f0 10f0 0000 0000 0000 f010 1010 +1010 1010 1f00 0000 1010 1010 ff00 0000 +0000 0000 ff10 1010 1010 1010 1f10 1010 +0000 0000 ff00 0000 1010 1010 ff10 1010 +1010 101f 101f 1010 2828 2828 2f28 2828 +2828 282f 203f 0000 0000 003f 202f 2828 +2828 28ef 00ff 0000 0000 00ff 00ef 2828 +2828 282f 202f 2828 0000 00ff 00ff 0000 +2828 28ef 00ef 2828 1010 10ff 00ff 0000 +2828 2828 ff00 0000 0000 00ff 00ff 1010 +0000 0000 ff28 2828 2828 2828 3f00 0000 +1010 101f 101f 0000 0000 001f 101f 1010 +0000 0000 3f28 2828 2828 2828 ef28 2828 +1010 10ff 00ff 1010 1010 1010 f000 0000 +0000 0000 1f10 1010 ffff ffff ffff ffff +0000 0000 ffff ffff f0f0 f0f0 f0f0 f0f0 +0f0f 0f0f 0f0f 0f0f ffff ffff 0000 0000 +0000 324a 4444 3a00 0038 445c 4262 5c40 +007e 4240 4040 4000 0000 7c28 2828 2400 +007e 2210 1022 7e00 0000 3e44 4444 3800 +0000 4444 4444 7a40 0000 7c10 1010 0800 +0010 3854 5438 1000 003c 4242 7e42 3c00 +003c 4242 4224 6600 7820 1844 4444 3800 +0000 6c92 926c 0000 0000 1854 5438 1000 +003e 407e 4040 3e00 003c 4242 4242 4200 +0000 7e00 7e00 7e00 0008 083e 0800 3e00 +0010 0804 0810 3c00 0008 1020 1008 3c00 +0000 0814 1010 1010 1010 1010 5020 0000 +0000 0800 3e00 0800 0000 324c 0032 4c00 +0018 2424 1800 0000 0000 0018 1800 0000 +0000 0000 1000 0000 000e 0808 4828 1800 +0050 6848 4800 0000 0060 1020 7000 0000 +0000 3c3c 3c3c 0000 0000 3c3c 3c3c 0000 \ No newline at end of file diff --git a/projects/fonts/from-left-a.bit b/projects/fonts/from-left-a.bit new file mode 100644 index 0000000..7327e77 Binary files /dev/null and b/projects/fonts/from-left-a.bit differ diff --git a/projects/fonts/from-left-b.bit b/projects/fonts/from-left-b.bit new file mode 100644 index 0000000..ce0e43c Binary files /dev/null and b/projects/fonts/from-left-b.bit differ diff --git a/projects/fonts/from-left-c.bit b/projects/fonts/from-left-c.bit new file mode 100644 index 0000000..be5e79d Binary files /dev/null and b/projects/fonts/from-left-c.bit differ diff --git a/projects/fonts/from-orca-a.bit b/projects/fonts/from-orca-a.bit new file mode 100644 index 0000000..8b015cd Binary files /dev/null and b/projects/fonts/from-orca-a.bit differ diff --git a/projects/fonts/from-orca-b.bit b/projects/fonts/from-orca-b.bit new file mode 100644 index 0000000..95ece68 Binary files /dev/null and b/projects/fonts/from-orca-b.bit differ diff --git a/projects/fonts/katahira8.bit b/projects/fonts/katahira8.bit new file mode 100644 index 0000000..328e2b3 --- /dev/null +++ b/projects/fonts/katahira8.bit @@ -0,0 +1,52 @@ +fc04 2438 2020 c000 0408 1030 d010 1000 +10fe 8282 0204 3800 00fe 1010 1010 fe00 +08fe 1828 4888 1800 40fc 4444 4444 8800 +10fc 10fc 1010 1000 7c44 8404 0408 3000 +80fe 8888 0808 3000 fc04 0404 0404 fc00 +44fe 4444 0404 3800 c004 c404 0808 f000 +fc04 0810 2844 8200 40fe 4244 4040 3e00 +8282 4202 0408 7000 7c44 7c84 0404 3800 +1cf0 10fe 1010 3000 a4a4 a404 0408 7000 +7c00 fe10 1010 6000 4040 4078 4440 4000 +0808 fe08 0808 7000 7800 0000 0000 fc00 +fc04 0468 1028 c600 10fe 0408 3cd2 1000 +0404 0408 0810 6000 1008 8884 8484 8400 +8080 fc80 8080 7c00 fc04 0404 0408 7000 +0020 5088 8402 0000 10fe 1010 9292 9200 +fc04 0408 5020 1000 f00e 601c 00e0 1e00 +0810 2040 8482 7e00 0404 4828 1028 c400 +fc20 fc20 2020 1c00 20fc 2424 2820 2000 +7808 0808 0808 fe00 fc04 04fc 0404 fc00 +fc00 fc04 0408 7000 4444 4444 0408 3000 +1050 5050 5252 9c00 8080 8084 8488 f000 +fc84 8484 8484 fc00 fc84 8404 0404 3800 +c000 0404 0808 f000 fc04 fc04 0408 7000 +0000 7c04 1810 1000 0000 0418 7010 1000 +0000 107c 4404 1800 0000 3810 1010 7c00 +0000 087c 1828 4800 0000 207c 2428 2000 +0000 3808 0808 7c00 0000 7808 7808 7800 +0000 5454 0404 3800 0020 7820 7caa b2e4 +0000 8884 8282 a240 0078 00f8 0404 0870 +0038 0078 1020 508e 0024 7220 3c62 a26c +0020 24f2 4a4a 88b0 0020 f810 fc08 807c +0008 1020 4020 1008 0084 84be 8484 8498 +0000 7c08 0040 807e 0010 fc08 7c80 807c +0080 8080 8084 8870 0008 fe38 4838 0830 +0044 44fe 4448 403c 0078 1020 fc20 403c +0040 f04e 4080 908e 0020 f840 7884 0478 +0000 3cc2 0202 0418 00fe 0810 2020 201c +0040 2c30 4080 807c 0040 ee44 849c a61c +0000 9e84 80a0 a09e 0010 bc52 d2a6 aa4e +0040 dc62 424e d24e 0000 3854 92a2 a24c +0084 be84 849c a69c 00e0 4486 8484 8870 +0020 1830 148a ca9a 0000 2050 8804 0200 +00be 84be 849c a69c 0010 fc10 fc70 9874 +0070 1414 7ca6 a4c8 0020 f422 60a2 a27c +0010 bc52 d2a2 a24c 0040 f044 f242 423c +0050 5c6a c22c 2020 0088 bcca 8abc 0810 +0010 1c10 1070 9874 0020 9880 f884 0478 +0088 8888 8808 1060 00f0 2078 8464 9478 +0048 d464 4444 c442 0078 1020 7884 0478 +0040 dc62 4242 c24c 1078 2034 5828 201c +0010 1020 2052 528c 0000 2078 2078 b4e4 +0000 0088 8484 a440 0000 0000 0000 0000 diff --git a/projects/fonts/specter8-frag(32-128).bit b/projects/fonts/specter8-frag(32-128).bit new file mode 100644 index 0000000..97de12f --- /dev/null +++ b/projects/fonts/specter8-frag(32-128).bit @@ -0,0 +1,48 @@ +0000 0000 0000 0000 0008 0808 0800 0800 +0014 1400 0000 0000 0024 7e24 247e 2400 +0008 1e28 1c0a 3c08 0000 2204 0810 2200 +0030 4832 4c44 3a00 0008 1000 0000 0000 +0004 0808 0808 0400 0020 1010 1010 2000 +0000 2214 0814 2200 0000 0808 3e08 0800 +0000 0000 0000 0810 0000 0000 3e00 0000 +0000 0000 0000 0800 0000 0204 0810 2000 +003c 464a 5262 3c00 0018 0808 0808 1c00 +003c 4202 3c40 7e00 003c 421c 0242 3c00 +000c 1424 447e 0400 007e 407c 0242 3c00 +003c 407c 4242 3c00 007e 0204 0810 1000 +003c 423c 4242 3c00 003c 4242 3e02 3c00 +0000 0010 0000 1000 0000 1000 0010 1020 +0000 0810 2010 0800 0000 003e 003e 0000 +0000 1008 0408 1000 003c 420c 1000 1000 +003c 4232 4a42 3c00 003c 4242 7e42 4200 +007c 427c 4242 7c00 003c 4240 4042 3c00 +007c 4242 4242 7c00 007e 4078 4040 7e00 +007e 4078 4040 4000 003c 4240 4642 3c00 +0042 427e 4242 4200 001c 0808 0808 1c00 +007e 0202 0242 3c00 0042 4478 4442 4200 +0040 4040 4040 7e00 0042 665a 4242 4200 +0042 6252 4a46 4200 003c 4242 4242 3c00 +007c 4242 7c40 4000 003c 4242 4244 3a00 +007c 4242 7c44 4200 003e 403c 0242 3c00 +007e 0808 0808 1000 0042 4242 4244 3a00 +0042 4242 4224 1800 0042 4242 5a66 4200 +0042 423c 4242 4200 0042 423e 0242 3c00 +007e 020c 3040 7e00 000c 0808 0808 0c00 +0040 2010 0804 0200 0030 1010 1010 3000 +0008 1400 0000 0000 0000 0000 0000 7e00 +0008 0400 0000 0000 0000 3c02 3e42 3a00 +0040 407c 4242 7c00 0000 3c42 4042 3c00 +0002 023e 4242 3e00 0000 3c42 7e40 3e00 +0000 3e40 7840 4000 0000 3c42 3e02 3c00 +0040 405c 6242 4200 0008 0018 0808 0400 +0008 0018 0808 4830 0040 4244 7844 4200 +0010 1010 1010 0c00 0000 6c52 5252 5200 +0000 5c62 4242 4200 0000 3c42 4242 3c00 +0000 7c42 427c 4040 0000 3e42 423e 0202 +0000 5c62 4040 4000 0000 3e40 3c02 7c00 +0008 7e08 0808 1000 0000 4242 4244 3a00 +0000 4242 4224 1800 0000 5252 5252 2e00 +0000 4224 1824 4200 0000 4242 3e02 7c00 +0000 7e02 3c40 7e00 000c 0810 1008 0c00 +0008 0808 0808 0800 0030 1008 0810 3000 +0000 0032 4c00 0000 3c42 99a1 a199 423c diff --git a/projects/fonts/specter8.bit b/projects/fonts/specter8.bit new file mode 100644 index 0000000..64b18ef --- /dev/null +++ b/projects/fonts/specter8.bit @@ -0,0 +1,128 @@ +0000 0000 0000 0000 0000 2400 7e3c 0000 +0000 2400 3c42 0000 0000 6c7c 7c38 1000 +0010 387c 7c38 1000 0038 387c 6c10 3800 +0010 387c 7c10 3800 0000 0018 1800 0000 +007e 4242 4242 7e00 0000 1824 2418 0000 +003c 665a 5a66 3c00 001e 063a 4a48 3000 +0038 446c 107c 1000 000e 0808 0838 3800 +003e 3e22 2266 6600 0000 1044 0044 1000 +0000 1018 1c18 1000 0000 0818 3818 0800 +0008 1c00 001c 0800 0028 2828 2800 2800 +003e 4a4a 3a0a 0a00 000c 3046 620c 3000 +0000 0000 0000 ffff 0010 3800 3810 0038 +0010 3854 1010 1000 0010 1010 5438 1000 +0000 0804 7e04 0800 0000 1020 7e20 1000 +0000 4040 7e00 0000 0000 0024 6624 0000 +0000 1038 7c00 0000 0000 007c 3810 0000 +0000 0000 0000 0000 0008 0808 0800 0800 +0014 1400 0000 0000 0024 7e24 247e 2400 +0008 1e28 1c0a 3c08 0000 2204 0810 2200 +0030 4832 4c44 3a00 0008 1000 0000 0000 +0004 0808 0808 0400 0020 1010 1010 2000 +0000 2214 0814 2200 0000 0808 3e08 0800 +0000 0000 0000 0810 0000 0000 3e00 0000 +0000 0000 0000 0800 0000 0204 0810 2000 +003c 464a 5262 3c00 0018 0808 0808 1c00 +003c 4202 3c40 7e00 003c 421c 0242 3c00 +000c 1424 447e 0400 007e 407c 0242 3c00 +003c 407c 4242 3c00 007e 0204 0810 1000 +003c 423c 4242 3c00 003c 4242 3e02 3c00 +0000 0010 0000 1000 0000 1000 0010 1020 +0000 0810 2010 0800 0000 003e 003e 0000 +0000 1008 0408 1000 003c 420c 1000 1000 +003c 4232 4a42 3c00 003c 4242 7e42 4200 +007c 427c 4242 7c00 003c 4240 4042 3c00 +007c 4242 4242 7c00 007e 4078 4040 7e00 +007e 4078 4040 4000 003c 4240 4642 3c00 +0042 427e 4242 4200 001c 0808 0808 1c00 +007e 0202 0242 3c00 0042 4478 4442 4200 +0040 4040 4040 7e00 0042 665a 4242 4200 +0042 6252 4a46 4200 003c 4242 4242 3c00 +007c 4242 7c40 4000 003c 4242 4244 3a00 +007c 4242 7c44 4200 003e 403c 0242 3c00 +007e 0808 0808 1000 0042 4242 4244 3a00 +0042 4242 4224 1800 0042 4242 5a66 4200 +0042 423c 4242 4200 0042 423e 0242 3c00 +007e 020c 3040 7e00 000c 0808 0808 0c00 +0040 2010 0804 0200 0030 1010 1010 3000 +0008 1400 0000 0000 0000 0000 0000 7e00 +0008 0400 0000 0000 0000 3c02 3e42 3a00 +0040 407c 4242 7c00 0000 3c42 4042 3c00 +0002 023e 4242 3e00 0000 3c42 7e40 3e00 +0000 3e40 7840 4000 0000 3c42 3e02 3c00 +0040 405c 6242 4200 0008 0018 0808 0400 +0008 0018 0808 4830 0040 4244 7844 4200 +0010 1010 1010 0c00 0000 6c52 5252 5200 +0000 5c62 4242 4200 0000 3c42 4242 3c00 +0000 7c42 427c 4040 0000 3e42 423e 0202 +0000 5c62 4040 4000 0000 3e40 3c02 7c00 +0008 7e08 0808 1000 0000 4242 4244 3a00 +0000 4242 4224 1800 0000 5252 5252 2e00 +0000 4224 1824 4200 0000 4242 3e02 7c00 +0000 7e02 3c40 7e00 000c 0810 1008 0c00 +0008 0808 0808 0800 0030 1008 0810 3000 +0000 0032 4c00 0000 3c42 99a1 a199 423c +003c 4240 423c 1070 0044 0044 4444 3800 +0810 3844 7840 3c00 0814 3c02 3e42 3a00 +1400 3c02 3e42 3a00 0804 3c02 3e42 3a00 +0814 2c02 3e42 3a00 0000 1c20 201c 0818 +1028 3844 7840 3c00 2800 3844 7840 3c00 +2010 3c44 7840 3c00 0028 0030 1010 0c00 +1028 0030 1010 0c00 2010 0030 1010 0c00 +423c 4242 7e42 4200 0814 3c42 7e42 4200 +0810 7e40 7c40 7e00 0000 6c12 3c50 6e00 +003e 507c 5050 5e00 1028 0038 4444 3800 +2800 3844 4444 3800 2010 3844 4444 3800 +1028 0044 4444 3800 2010 4444 4444 3800 +4400 4444 443c 0438 423c 4242 4242 3c00 +4200 4242 4242 3c00 0010 3840 4038 1000 +001c 2278 2020 7e00 0044 287c 107c 1000 +007c 4252 7c50 4c00 000c 107c 1010 6000 +0810 3c02 3e42 3a00 0810 0030 1010 0c00 +0810 3844 4444 3800 0810 4444 4444 3800 +324c 005c 6242 4200 324c 0062 524a 4600 +3848 5828 0078 0000 3048 4830 0078 0000 +0008 0008 3042 3c00 0000 0000 7c40 4000 +0000 0000 7c04 0400 4448 502c 4204 0e00 +4448 5024 541e 0400 0010 0010 1010 1000 +0000 1224 4824 1200 0000 4824 1224 4800 +8844 2211 8844 2211 aa55 aa55 aa55 aa55 +4411 4411 4411 4411 1010 1010 1010 1010 +1010 1010 f010 1010 1010 10f0 10f0 1010 +2828 2828 e828 2828 0000 0000 f828 2828 +0000 00f0 10f0 1010 2828 28e8 08e8 2828 +2828 2828 2828 2828 0000 00f8 08e8 2828 +2828 28e8 08f8 0000 2828 2828 f800 0000 +1010 10f0 10f0 0000 0000 0000 f010 1010 +1010 1010 1f00 0000 1010 1010 ff00 0000 +0000 0000 ff10 1010 1010 1010 1f10 1010 +0000 0000 ff00 0000 1010 1010 ff10 1010 +1010 101f 101f 1010 2828 2828 2f28 2828 +2828 282f 203f 0000 0000 003f 202f 2828 +2828 28ef 00ff 0000 0000 00ff 00ef 2828 +2828 282f 202f 2828 0000 00ff 00ff 0000 +2828 28ef 00ef 2828 1010 10ff 00ff 0000 +2828 2828 ff00 0000 0000 00ff 00ff 1010 +0000 0000 ff28 2828 2828 2828 3f00 0000 +1010 101f 101f 0000 0000 001f 101f 1010 +0000 0000 3f28 2828 2828 2828 ef28 2828 +1010 10ff 00ff 1010 1010 1010 f000 0000 +0000 0000 1f10 1010 ffff ffff ffff ffff +0000 0000 ffff ffff f0f0 f0f0 f0f0 f0f0 +0f0f 0f0f 0f0f 0f0f ffff ffff 0000 0000 +0000 324a 4444 3a00 0038 445c 4262 5c40 +007e 4240 4040 4000 0000 7c28 2828 2400 +007e 2210 1022 7e00 0000 3e44 4444 3800 +0000 4444 4444 7a40 0000 7c10 1010 0800 +0010 3854 5438 1000 003c 4242 7e42 3c00 +003c 4242 4224 6600 7820 1844 4444 3800 +0000 6c92 926c 0000 0000 1854 5438 1000 +003e 407e 4040 3e00 003c 4242 4242 4200 +0000 7e00 7e00 7e00 0008 083e 0800 3e00 +0010 0804 0810 3c00 0008 1020 1008 3c00 +0000 0814 1010 1010 1010 1010 5020 0000 +0000 0800 3e00 0800 0000 324c 0032 4c00 +0018 2424 1800 0000 0000 0018 1800 0000 +0000 0000 1000 0000 000e 0808 4828 1800 +0050 6848 4800 0000 0060 1020 7000 0000 +0000 3c3c 3c3c 0000 0000 3c3c 3c3c 0000 diff --git a/projects/software/left.usm b/projects/software/left.usm new file mode 100644 index 0000000..bac2af9 --- /dev/null +++ b/projects/software/left.usm @@ -0,0 +1,102 @@ +( + app/left : text editor +) + +&Console { pad 8 stdio 1 } +&Screen { width 2 height 2 pad 4 x 2 y 2 color 1 } +&Sprite { pad 8 x 2 y 2 addr 2 color 1 } +&Controller { buttons 1 } +&Keyboard { key 1 } +&Mouse { x 2 y 2 state 1 chord 1 } +&File { pad 8 name 2 length 2 load 2 save 2 } + +&Textarea2d { x1 2 y1 2 x2 2 y2 2 color 1 addr 2 cursor 1 } + +;textarea Textarea2d + +|0100 @RESET + + ,filepath =dev/file.name + #0300 =dev/file.length + ,body =dev/file.load + + #0000 #0000 #0e ,body ,draw-textarea JSR + +BRK + +|2000 @FRAME BRK + +@draw-textarea ( x y color addr ) + + ( load ) =textarea.addr =textarea.color =dev/sprite.y =dev/sprite.x + ~textarea.addr + @draw-textarea-left-loop + ( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =dev/sprite.addr ~textarea.color =dev/sprite.color + + ( detect linebreaks ) + DUP2 LDR #0a NEQ ,no-return ROT JMP? POP2 + ~textarea.x1 =dev/sprite.x + ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y + ( decr ) ~dev/sprite.x #0008 SUB2 =dev/sprite.x + @no-return + + ( incr ) #0001 ADD2 + ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x + + DUP2 LDR #00 NEQ ,draw-textarea-left-loop ROT JMP? POP2 + POP2 + +RTS + +@font ( spectrum-zx font ) +[ + 0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000 + 0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000 + 007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000 + 0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800 + 0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800 + 003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038 + 0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000 + 0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000 + 0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400 + 0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000 + 0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800 + 0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000 + 003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00 + 0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000 + 003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810 + 0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800 + 003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00 + 0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00 + 0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200 + 0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00 + 007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00 + 00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200 + 0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00 + 0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00 + 0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00 + 0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c + 0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400 + 0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800 + 0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800 + 0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800 + 0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00 + 0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c +] + +@filepath [ examples/app.left.usm ] + +|4000 @body [ ] + +|d000 @ERROR BRK + +|FF00 ;dev/console Console +|FF10 ;dev/screen Screen +|FF20 ;dev/sprite Sprite +|FF30 ;dev/ctrl Controller +|FF40 ;dev/key Keyboard +|FF50 ;dev/mouse Mouse +|FF60 ;dev/file File + +|FFF0 .RESET .FRAME .ERROR ( vectors ) +|FFF8 [ 320c 350b fb03 ] ( palette ) diff --git a/examples/app.nasu.usm b/projects/software/nasu.usm similarity index 90% rename from examples/app.nasu.usm rename to projects/software/nasu.usm index 58181fa..e4d4441 100644 --- a/examples/app.nasu.usm +++ b/projects/software/nasu.usm @@ -33,11 +33,11 @@ |0100 @RESET ~dev/screen.width #0002 DIV2 #008a SUB2 =bankview.x - ~dev/screen.height #0002 DIV2 #0040 SUB2 =bankview.y + ~dev/screen.height #0002 DIV2 #003f SUB2 =bankview.y ,bank1 =bankview.addr - ~dev/screen.width #0002 DIV2 #0004 ADD2 =tileview.x - ~dev/screen.height #0002 DIV2 #0040 SUB2 =tileview.y + ~dev/screen.width #0002 DIV2 #0002 ADD2 =tileview.x + ~dev/screen.height #0002 DIV2 #003f SUB2 =tileview.y ,bank1 #0448 ADD2 =tileview.addr ,redraw JSR @@ -171,16 +171,62 @@ BRK ( mask ) #01 #07 ~pos.x #0008 DIV2 SWP POP SUB ROL XOR ( save ) ~addr ~pos.y #0008 DIV2 ADD2 STR - ,redraw JSR + ,redraw JSR ,click-end JMP @no-tile-click + ( operations ) + + ,no-operations ~dev/mouse.y ~tileview.y SUB2 #0008 DIV2 #000c NEQ2 JMP? POP2 + + ,no-move-up ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #0011 NEQ2 JMP? POP2 + ,op_shiftup JSR + ( release ) #00 =dev/mouse.state + ,redraw JSR ,click-end JMP + @no-move-up + + ,no-move-down ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #0012 NEQ2 JMP? POP2 + ,op_shiftdown JSR + ( release ) #00 =dev/mouse.state + ,redraw JSR ,click-end JMP + @no-move-down + + @no-operations + @click-end ,draw-cursor JSR BRK +@op_shiftup + + ~tileview.addr LDR + ~tileview.addr #0001 ADD2 LDR ~tileview.addr STR + ~tileview.addr #0002 ADD2 LDR ~tileview.addr #0001 ADD2 STR + ~tileview.addr #0003 ADD2 LDR ~tileview.addr #0002 ADD2 STR + ~tileview.addr #0004 ADD2 LDR ~tileview.addr #0003 ADD2 STR + ~tileview.addr #0005 ADD2 LDR ~tileview.addr #0004 ADD2 STR + ~tileview.addr #0006 ADD2 LDR ~tileview.addr #0005 ADD2 STR + ~tileview.addr #0007 ADD2 LDR ~tileview.addr #0006 ADD2 STR + ~tileview.addr #0007 ADD2 STR + +RTS + +@op_shiftdown + + ~tileview.addr #0007 ADD2 LDR + ~tileview.addr #0006 ADD2 LDR ~tileview.addr #0007 ADD2 STR + ~tileview.addr #0005 ADD2 LDR ~tileview.addr #0006 ADD2 STR + ~tileview.addr #0004 ADD2 LDR ~tileview.addr #0005 ADD2 STR + ~tileview.addr #0003 ADD2 LDR ~tileview.addr #0004 ADD2 STR + ~tileview.addr #0002 ADD2 LDR ~tileview.addr #0003 ADD2 STR + ~tileview.addr #0001 ADD2 LDR ~tileview.addr #0002 ADD2 STR + ~tileview.addr LDR ~tileview.addr #0001 ADD2 STR + ~tileview.addr STR + +RTS + @redraw ,draw-bankview JSR @@ -229,7 +275,7 @@ RTS ~bankview.y #00 ~i #08 MUL ADD2 =dev/sprite.y ( draw ) #02 =dev/sprite.color ~bankview.x #00 ~i #08 MUL ADD2 =dev/sprite.x - ~bankview.y #0089 ADD2 =dev/sprite.y + ~bankview.y #0088 ADD2 =dev/sprite.y ( draw ) #02 =dev/sprite.color ~dev/sprite.addr #0008 ADD2 =dev/sprite.addr ( incr ) ~i #01 ADD =i @@ -328,6 +374,16 @@ RTS ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y ,draw-tileview-bytes ~i #08 LTH JMP? POP2 + ( operations ) + + ~dev/sprite.y #0008 ADD2 =dev/sprite.y + ,movedown_icn =dev/sprite.addr + #01 =dev/sprite.color + ~dev/sprite.x #0008 SUB2 =dev/sprite.x + ,moveup_icn =dev/sprite.addr + #01 =dev/sprite.color + + ( draw tiles ) ~tileview.y =dev/sprite.y #00 =pt.x #00 =pt.y ~tileview.addr =dev/sprite.addr @@ -435,18 +491,20 @@ RTS @cell1_icn [ 7cfe fefe fefe 7c00 ] @load_icn [ feaa d6aa d4aa f400 ] @save_icn [ fe82 8282 848a f400 ] -@filename [ nasu_project.chr 00 ] +@moveup_icn [ 0010 387c fe10 1000 ] +@movedown_icn [ 0010 1010 fe7c 3810 ] +@filename [ nasu-io.bit 00 ] @font_hex ( 0-F ) [ - 7c82 8282 8282 7c00 3010 1010 1010 1000 - 7c82 027c 8080 fe00 7c82 027c 0282 7c00 - 4282 82fe 0202 0200 fc82 807c 0282 7c00 - 7c82 80fc 8282 7c00 7c82 021e 0202 0200 - 7c82 827c 8282 7c00 7c82 827e 0202 0400 - 7c82 027e 8282 7e00 fc82 82fc 8282 fc00 - 7c82 8080 8082 7c00 fc82 8282 8282 fc00 - 7c82 80f0 8082 7c00 7c82 80f0 8080 8000 + 007c 8282 8282 827c 0030 1010 1010 1010 + 007c 8202 7c80 80fe 007c 8202 1c02 827c + 000c 1424 4484 fe04 00fe 8080 7c02 827c + 007c 8280 fc82 827c 007c 8202 1e02 0202 + 007c 8282 7c82 827c 007c 8282 7e02 827c + 007c 8202 7e82 827e 00fc 8282 fc82 82fc + 007c 8280 8080 827c 00fc 8282 8282 82fc + 007c 8280 f080 827c 007c 8280 f080 8080 ] |E000 @bank1 @@ -719,7 +777,7 @@ RTS |FF10 ;dev/screen Screen |FF20 ;dev/sprite Sprite |FF30 ;dev/ctrl Controller -|FF40 ;dev/key Keyboard +|FF40 ;dev/key Keyboard |FF50 ;dev/mouse Mouse |FF60 ;dev/file File