From 64e9f46f790eec0acafa516bcc325a8b39bcfe98 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sun, 28 Dec 2025 16:56:51 -0800 Subject: [PATCH] Archived uxnasm --- README.md | 6 +- {src => archive}/uxnasm.c | 0 {projects/assets => assets}/logo05x05.tal | 0 {projects/assets => assets}/mascot0cx0c.tal | 0 {projects/assets => assets}/msx01x02.tal | 0 {projects/assets => assets}/terminus01x02.tal | 0 boot.rom | Bin 16226 -> 0 bytes build.sh | 102 ---- etc/circle128/build.sh | 6 - etc/circle128/circle128.c | 60 -- etc/hello.tal | 28 - etc/syntax-highlight/tal.nanorc | 51 -- etc/syntax-highlight/tal.sublime-syntax | 126 ---- etc/wavpcm/build.sh | 16 - etc/wavpcm/wavpcm.c | 63 -- {projects/fonts => fonts}/816.uf1 | Bin {projects/fonts => fonts}/acorn8-italic.uf1 | Bin {projects/fonts => fonts}/acorn8-regular.uf1 | Bin {projects/fonts => fonts}/atari8.uf1 | Bin {projects/fonts => fonts}/bbcmicro8.uf1 | Bin {projects/fonts => fonts}/chicago12.uf2 | Bin {projects/fonts => fonts}/courier12.uf2 | Bin {projects/fonts => fonts}/cream.uf2 | Bin {projects/fonts => fonts}/diamond12.uf2 | Bin {projects/fonts => fonts}/diamond20.uf3 | Bin {projects/fonts => fonts}/geneva12.uf2 | Bin {projects/fonts => fonts}/geneva14.uf2 | Bin {projects/fonts => fonts}/geneva24.uf3 | Bin {projects/fonts => fonts}/helvetica12.uf2 | Bin {projects/fonts => fonts}/helvetica14.uf2 | Bin {projects/fonts => fonts}/helvetica24.uf3 | Bin {projects/fonts => fonts}/left8.uf1 | Bin {projects/fonts => fonts}/losangeles12.uf2 | Bin {projects/fonts => fonts}/monaco12.uf2 | Bin {projects/fonts => fonts}/msx816.uf2 | Bin {projects/fonts => fonts}/newyork12.uf2 | Bin {projects/fonts => fonts}/newyork14.uf2 | Bin {projects/fonts => fonts}/newyork24.uf3 | Bin {projects/fonts => fonts}/orca8.uf1 | Bin {projects/fonts => fonts}/palatino12.uf2 | Bin {projects/fonts => fonts}/palatino14.uf2 | Bin {projects/fonts => fonts}/palatino24.uf3 | Bin {projects/fonts => fonts}/sans10-bold.uf2 | Bin {projects/fonts => fonts}/sans10-regular.uf2 | Bin {projects/fonts => fonts}/sans12-bold.uf2 | Bin {projects/fonts => fonts}/sans12-regular.uf2 | Bin {projects/fonts => fonts}/sans14-bold.uf2 | Bin {projects/fonts => fonts}/sans14-regular.uf2 | Bin {projects/fonts => fonts}/sapphire14.uf2 | Bin {projects/fonts => fonts}/sapphire19.uf3 | Bin {projects/fonts => fonts}/specter8.uf1 | Bin {projects/fonts => fonts}/terminal12.uf2 | Bin {projects/fonts => fonts}/times12.uf2 | Bin {projects/fonts => fonts}/times15.uf2 | Bin {projects/fonts => fonts}/times24.uf3 | Bin {projects/fonts => fonts}/venice14.uf2 | Bin mkfile | 64 -- .../pictures => pictures}/akane20x10.icn | Bin {projects/pictures => pictures}/ako10x10.chr | Bin .../pictures => pictures}/bulma37x29.chr | Bin {projects/pictures => pictures}/cibo10x10.icn | Bin {projects/pictures => pictures}/cyr0cx08.chr | Bin {projects/pictures => pictures}/dafu10x10.icn | Bin .../pictures => pictures}/daria10x10.chr | Bin {projects/pictures => pictures}/ergo20x1a.icn | Bin .../pictures => pictures}/felix0cx0c.chr | Bin {projects/pictures => pictures}/logo02x02.icn | Bin {projects/pictures => pictures}/logo04x04.chr | Bin {projects/pictures => pictures}/logo08x08.icn | Bin {projects/pictures => pictures}/pc9820x10.chr | Bin {projects/pictures => pictures}/pjw20x20.icn | Bin {projects/pictures => pictures}/tima2ax1a.icn | Bin .../pictures => pictures}/zerotwo10x10.chr | Bin .../pictures => pictures}/zerotwo20x20.chr | Bin projects/examples/demos/amiga.tal | 314 ---------- projects/examples/demos/bifurcan.tal | 131 ----- projects/examples/demos/bitwise.tal | 250 -------- projects/examples/demos/bunnymark.tal | 221 ------- projects/examples/demos/circles.tal | 45 -- projects/examples/demos/cube3d.tal | 127 ---- projects/examples/demos/drool.tal | 236 -------- projects/examples/demos/dvd.tal | 56 -- projects/examples/demos/hilbert.tal | 71 --- projects/examples/demos/life.tal | 221 ------- projects/examples/demos/mandelbrot.tal | 172 ------ projects/examples/demos/move.tal | 63 -- projects/examples/demos/polycat.tal | 145 ----- projects/examples/demos/pond.tal | 145 ----- projects/examples/demos/snake.tal | 171 ------ projects/examples/devices/audio-tests.tal | 430 -------------- projects/examples/devices/audio.channels.tal | 139 ----- projects/examples/devices/audio.tal | 177 ------ projects/examples/devices/console.read.tal | 16 - projects/examples/devices/console.tal | 83 --- projects/examples/devices/console.write.tal | 22 - projects/examples/devices/controller.tal | 191 ------ projects/examples/devices/datetime.tal | 94 --- projects/examples/devices/file.cat.tal | 14 - projects/examples/devices/file.tal | 97 --- projects/examples/devices/mouse.tal | 186 ------ projects/examples/devices/screen.auto.tal | 152 ----- projects/examples/devices/screen.blending.tal | 94 --- projects/examples/devices/screen.bounds.tal | 141 ----- projects/examples/devices/screen.pixel.tal | 96 --- projects/examples/devices/screen.tal | 217 ------- .../examples/devices/system.expansion.tal | 56 -- projects/examples/exercises/ack.tal | 6 - projects/examples/exercises/brainfuck.tal | 56 -- projects/examples/exercises/fib.tal | 47 -- projects/examples/exercises/fizzbuzz.tal | 20 - projects/examples/exercises/hello.bf | 2 - projects/examples/exercises/primes.tal | 36 -- projects/examples/exercises/quine.tal | 1 - projects/examples/exercises/sierpinski.tal | 17 - projects/examples/exercises/subleq.tal | 41 -- projects/examples/exercises/tak.tal | 12 - projects/examples/gui/button.tal | 166 ------ projects/examples/gui/hover.tal | 119 ---- projects/examples/gui/label.tal | 466 --------------- projects/examples/gui/monospace.tal | 148 ----- projects/examples/gui/picture.tal | 449 -------------- projects/examples/gui/shapes.tal | 203 ------- projects/examples/gui/terminal.tal | 250 -------- projects/examples/gui/timer.tal | 83 --- projects/software/clock.tal | 323 ---------- projects/software/piano.tal | 552 ------------------ {projects/sounds => sounds}/bdr1.pcm | 0 {projects/sounds => sounds}/bdr2.pcm | 0 {projects/sounds => sounds}/chat.pcm | 0 {projects/sounds => sounds}/cym1.pcm | 0 {projects/sounds => sounds}/hhat.pcm | 0 {projects/sounds => sounds}/kck1.pcm | 0 {projects/sounds => sounds}/kck2.pcm | 0 {projects/sounds => sounds}/ohat.pcm | 0 {projects/sounds => sounds}/pad1.pcm | 0 {projects/sounds => sounds}/pad2.pcm | 0 {projects/sounds => sounds}/piano.pcm | 0 {projects/sounds => sounds}/ride.pcm | 0 {projects/sounds => sounds}/saw.pcm | 0 {projects/sounds => sounds}/sid1.pcm | 0 {projects/sounds => sounds}/sid2.pcm | 0 {projects/sounds => sounds}/sin.pcm | 0 {projects/sounds => sounds}/snr1.pcm | 0 {projects/sounds => sounds}/snr2.pcm | 0 {projects/sounds => sounds}/sqr.pcm | Bin {projects/sounds => sounds}/sub1.pcm | 0 {projects/sounds => sounds}/syn1.pcm | 0 {projects/sounds => sounds}/syn2.pcm | 0 {projects/sounds => sounds}/tri.pcm | 0 {projects/sounds => sounds}/violin.pcm | 0 src/devices/audio.c | 125 ---- src/devices/audio.h | 22 - src/devices/console.c | 49 -- src/devices/console.h | 22 - src/devices/controller.c | 51 -- src/devices/controller.h | 16 - src/devices/datetime.c | 39 -- src/devices/datetime.h | 12 - src/devices/file.c | 386 ------------ src/devices/file.h | 15 - src/devices/mouse.c | 56 -- src/devices/mouse.h | 17 - src/devices/screen.c | 241 -------- src/devices/screen.h | 33 -- src/devices/system.c | 160 ----- src/devices/system.h | 21 - src/uxn.c | 94 --- src/uxn.h | 42 -- src/uxncli.c | 61 -- src/uxnemu.c | 500 ---------------- 170 files changed, 3 insertions(+), 10051 deletions(-) rename {src => archive}/uxnasm.c (100%) rename {projects/assets => assets}/logo05x05.tal (100%) rename {projects/assets => assets}/mascot0cx0c.tal (100%) rename {projects/assets => assets}/msx01x02.tal (100%) rename {projects/assets => assets}/terminus01x02.tal (100%) delete mode 100644 boot.rom delete mode 100755 build.sh delete mode 100755 etc/circle128/build.sh delete mode 100644 etc/circle128/circle128.c delete mode 100644 etc/hello.tal delete mode 100644 etc/syntax-highlight/tal.nanorc delete mode 100644 etc/syntax-highlight/tal.sublime-syntax delete mode 100755 etc/wavpcm/build.sh delete mode 100644 etc/wavpcm/wavpcm.c rename {projects/fonts => fonts}/816.uf1 (100%) rename {projects/fonts => fonts}/acorn8-italic.uf1 (100%) rename {projects/fonts => fonts}/acorn8-regular.uf1 (100%) rename {projects/fonts => fonts}/atari8.uf1 (100%) rename {projects/fonts => fonts}/bbcmicro8.uf1 (100%) rename {projects/fonts => fonts}/chicago12.uf2 (100%) rename {projects/fonts => fonts}/courier12.uf2 (100%) rename {projects/fonts => fonts}/cream.uf2 (100%) rename {projects/fonts => fonts}/diamond12.uf2 (100%) rename {projects/fonts => fonts}/diamond20.uf3 (100%) rename {projects/fonts => fonts}/geneva12.uf2 (100%) rename {projects/fonts => fonts}/geneva14.uf2 (100%) rename {projects/fonts => fonts}/geneva24.uf3 (100%) rename {projects/fonts => fonts}/helvetica12.uf2 (100%) rename {projects/fonts => fonts}/helvetica14.uf2 (100%) rename {projects/fonts => fonts}/helvetica24.uf3 (100%) rename {projects/fonts => fonts}/left8.uf1 (100%) rename {projects/fonts => fonts}/losangeles12.uf2 (100%) rename {projects/fonts => fonts}/monaco12.uf2 (100%) rename {projects/fonts => fonts}/msx816.uf2 (100%) rename {projects/fonts => fonts}/newyork12.uf2 (100%) rename {projects/fonts => fonts}/newyork14.uf2 (100%) rename {projects/fonts => fonts}/newyork24.uf3 (100%) rename {projects/fonts => fonts}/orca8.uf1 (100%) rename {projects/fonts => fonts}/palatino12.uf2 (100%) rename {projects/fonts => fonts}/palatino14.uf2 (100%) rename {projects/fonts => fonts}/palatino24.uf3 (100%) rename {projects/fonts => fonts}/sans10-bold.uf2 (100%) rename {projects/fonts => fonts}/sans10-regular.uf2 (100%) rename {projects/fonts => fonts}/sans12-bold.uf2 (100%) rename {projects/fonts => fonts}/sans12-regular.uf2 (100%) rename {projects/fonts => fonts}/sans14-bold.uf2 (100%) rename {projects/fonts => fonts}/sans14-regular.uf2 (100%) rename {projects/fonts => fonts}/sapphire14.uf2 (100%) rename {projects/fonts => fonts}/sapphire19.uf3 (100%) rename {projects/fonts => fonts}/specter8.uf1 (100%) rename {projects/fonts => fonts}/terminal12.uf2 (100%) rename {projects/fonts => fonts}/times12.uf2 (100%) rename {projects/fonts => fonts}/times15.uf2 (100%) rename {projects/fonts => fonts}/times24.uf3 (100%) rename {projects/fonts => fonts}/venice14.uf2 (100%) delete mode 100644 mkfile rename {projects/pictures => pictures}/akane20x10.icn (100%) rename {projects/pictures => pictures}/ako10x10.chr (100%) rename {projects/pictures => pictures}/bulma37x29.chr (100%) rename {projects/pictures => pictures}/cibo10x10.icn (100%) rename {projects/pictures => pictures}/cyr0cx08.chr (100%) rename {projects/pictures => pictures}/dafu10x10.icn (100%) rename {projects/pictures => pictures}/daria10x10.chr (100%) rename {projects/pictures => pictures}/ergo20x1a.icn (100%) rename {projects/pictures => pictures}/felix0cx0c.chr (100%) rename {projects/pictures => pictures}/logo02x02.icn (100%) rename {projects/pictures => pictures}/logo04x04.chr (100%) rename {projects/pictures => pictures}/logo08x08.icn (100%) rename {projects/pictures => pictures}/pc9820x10.chr (100%) rename {projects/pictures => pictures}/pjw20x20.icn (100%) rename {projects/pictures => pictures}/tima2ax1a.icn (100%) rename {projects/pictures => pictures}/zerotwo10x10.chr (100%) rename {projects/pictures => pictures}/zerotwo20x20.chr (100%) delete mode 100644 projects/examples/demos/amiga.tal delete mode 100644 projects/examples/demos/bifurcan.tal delete mode 100644 projects/examples/demos/bitwise.tal delete mode 100644 projects/examples/demos/bunnymark.tal delete mode 100644 projects/examples/demos/circles.tal delete mode 100644 projects/examples/demos/cube3d.tal delete mode 100644 projects/examples/demos/drool.tal delete mode 100644 projects/examples/demos/dvd.tal delete mode 100644 projects/examples/demos/hilbert.tal delete mode 100644 projects/examples/demos/life.tal delete mode 100644 projects/examples/demos/mandelbrot.tal delete mode 100644 projects/examples/demos/move.tal delete mode 100644 projects/examples/demos/polycat.tal delete mode 100644 projects/examples/demos/pond.tal delete mode 100644 projects/examples/demos/snake.tal delete mode 100644 projects/examples/devices/audio-tests.tal delete mode 100644 projects/examples/devices/audio.channels.tal delete mode 100644 projects/examples/devices/audio.tal delete mode 100644 projects/examples/devices/console.read.tal delete mode 100644 projects/examples/devices/console.tal delete mode 100644 projects/examples/devices/console.write.tal delete mode 100644 projects/examples/devices/controller.tal delete mode 100644 projects/examples/devices/datetime.tal delete mode 100644 projects/examples/devices/file.cat.tal delete mode 100644 projects/examples/devices/file.tal delete mode 100644 projects/examples/devices/mouse.tal delete mode 100644 projects/examples/devices/screen.auto.tal delete mode 100644 projects/examples/devices/screen.blending.tal delete mode 100644 projects/examples/devices/screen.bounds.tal delete mode 100644 projects/examples/devices/screen.pixel.tal delete mode 100644 projects/examples/devices/screen.tal delete mode 100644 projects/examples/devices/system.expansion.tal delete mode 100644 projects/examples/exercises/ack.tal delete mode 100644 projects/examples/exercises/brainfuck.tal delete mode 100644 projects/examples/exercises/fib.tal delete mode 100644 projects/examples/exercises/fizzbuzz.tal delete mode 100644 projects/examples/exercises/hello.bf delete mode 100644 projects/examples/exercises/primes.tal delete mode 100644 projects/examples/exercises/quine.tal delete mode 100644 projects/examples/exercises/sierpinski.tal delete mode 100644 projects/examples/exercises/subleq.tal delete mode 100644 projects/examples/exercises/tak.tal delete mode 100644 projects/examples/gui/button.tal delete mode 100644 projects/examples/gui/hover.tal delete mode 100644 projects/examples/gui/label.tal delete mode 100644 projects/examples/gui/monospace.tal delete mode 100644 projects/examples/gui/picture.tal delete mode 100644 projects/examples/gui/shapes.tal delete mode 100644 projects/examples/gui/terminal.tal delete mode 100644 projects/examples/gui/timer.tal delete mode 100644 projects/software/clock.tal delete mode 100644 projects/software/piano.tal rename {projects/sounds => sounds}/bdr1.pcm (100%) rename {projects/sounds => sounds}/bdr2.pcm (100%) rename {projects/sounds => sounds}/chat.pcm (100%) rename {projects/sounds => sounds}/cym1.pcm (100%) rename {projects/sounds => sounds}/hhat.pcm (100%) rename {projects/sounds => sounds}/kck1.pcm (100%) rename {projects/sounds => sounds}/kck2.pcm (100%) rename {projects/sounds => sounds}/ohat.pcm (100%) rename {projects/sounds => sounds}/pad1.pcm (100%) rename {projects/sounds => sounds}/pad2.pcm (100%) rename {projects/sounds => sounds}/piano.pcm (100%) rename {projects/sounds => sounds}/ride.pcm (100%) rename {projects/sounds => sounds}/saw.pcm (100%) rename {projects/sounds => sounds}/sid1.pcm (100%) rename {projects/sounds => sounds}/sid2.pcm (100%) rename {projects/sounds => sounds}/sin.pcm (100%) rename {projects/sounds => sounds}/snr1.pcm (100%) rename {projects/sounds => sounds}/snr2.pcm (100%) rename {projects/sounds => sounds}/sqr.pcm (100%) rename {projects/sounds => sounds}/sub1.pcm (100%) rename {projects/sounds => sounds}/syn1.pcm (100%) rename {projects/sounds => sounds}/syn2.pcm (100%) rename {projects/sounds => sounds}/tri.pcm (100%) rename {projects/sounds => sounds}/violin.pcm (100%) delete mode 100644 src/devices/audio.c delete mode 100644 src/devices/audio.h delete mode 100644 src/devices/console.c delete mode 100644 src/devices/console.h delete mode 100644 src/devices/controller.c delete mode 100644 src/devices/controller.h delete mode 100644 src/devices/datetime.c delete mode 100644 src/devices/datetime.h delete mode 100644 src/devices/file.c delete mode 100644 src/devices/file.h delete mode 100644 src/devices/mouse.c delete mode 100644 src/devices/mouse.h delete mode 100644 src/devices/screen.c delete mode 100644 src/devices/screen.h delete mode 100644 src/devices/system.c delete mode 100644 src/devices/system.h delete mode 100644 src/uxn.c delete mode 100644 src/uxn.h delete mode 100644 src/uxncli.c delete mode 100644 src/uxnemu.c diff --git a/README.md b/README.md index cb24cbc..c505437 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ So you're interested in find a Varvara emulator for your system. First, based on what you're trying to do, you can pick one of these emulators: -- [uxn2](https://git.sr.ht/~rabbits/uxn2)(recommended), a graphical emulator, written in SDL2. +- Recommended: [uxn2](https://git.sr.ht/~rabbits/uxn2), a portable graphical emulator, written in SDL2. - [uxn11](https://git.sr.ht/~rabbits/uxn11), a partial graphical emulator, ideal for productivity. - [uxncli](https://git.sr.ht/~rabbits/uxncli), a terminal emulator, ideal for running cli tools. -- [uxnmin](https://git.sr.ht/~rabbits/uxnmin), a minimal terminal emulator, ideal for bootstrapping. +- [uxnmin](https://git.sr.ht/~rabbits/uxnmin), a minimal terminal emulator, ideal for [bootstrapping](https://git.sr.ht/~rabbits/drifblim#bootstrap). ## Use the emulator @@ -22,7 +22,7 @@ uxnemu program.rom argument1 argument2 ## Write programs -Lastly, to turn a source file into a rom, you need a compiler, like [Drifblim](https://git.sr.ht/~rabbits/uxnmin), it comes in 3 flavors. +Lastly, to turn a source file into a rom you need a compiler, like [Drifblim](https://git.sr.ht/~rabbits/drifblim)([download it](https://rabbits.srht.site/drifblim/drifblim.rom)): ```sh uxnemu drifblim.rom source.tal program.rom diff --git a/src/uxnasm.c b/archive/uxnasm.c similarity index 100% rename from src/uxnasm.c rename to archive/uxnasm.c diff --git a/projects/assets/logo05x05.tal b/assets/logo05x05.tal similarity index 100% rename from projects/assets/logo05x05.tal rename to assets/logo05x05.tal diff --git a/projects/assets/mascot0cx0c.tal b/assets/mascot0cx0c.tal similarity index 100% rename from projects/assets/mascot0cx0c.tal rename to assets/mascot0cx0c.tal diff --git a/projects/assets/msx01x02.tal b/assets/msx01x02.tal similarity index 100% rename from projects/assets/msx01x02.tal rename to assets/msx01x02.tal diff --git a/projects/assets/terminus01x02.tal b/assets/terminus01x02.tal similarity index 100% rename from projects/assets/terminus01x02.tal rename to assets/terminus01x02.tal diff --git a/boot.rom b/boot.rom deleted file mode 100644 index 37ad1b6b2d130a9255a7b2e130d30526500d71d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16226 zcmch84SZF_nfG(L3FhP`xd{PsLq2aXl9Pb=QEez-TiaUa1`>@u=B6Pa zSQ-cY`BB#{u1oD|YaQ*buWMWBuT`toZPTu`UCaAoTi0&gDzQbNs3ZmuRLp(<&zyS$ z*w)|f{(kQ};hyu%%ri63JYVz7%t0A#($}t5hh?B${U9uZ?dpGpWvE>x?iP_JRmL?} zWsJGPn-Yt!P>C-Knh}M2iB_jaQ={o%_mJ5;+&_{U9UQvST)TDSX#X|Ao~`Bun}#-w z^lvcNr26^>M>htWn#@)GeP&Z*Qwte4wmodC3!apo#-uGhI~tR{OYOK^&|F)YP!W>k zmsXdu`V<9|$wwy_nG}dWs)#zOTVuv;X6BVxADY&7NY7H0nX0x5&X1!vpq&*LR4=H) zq$rng|J*nx-F8e8eg=LnyXN6=)uP^VTNM3}hj=tmS=lm~Ojp~AeDa}o5 zMVE8VD(ZnKMCKoK^V>yeT23~J%$KY=MJlmIlx&X+*X}b~e$FbYa#~`JX!%*)a*Y*w zLM1*TN>-!6*Uo70b*pHuZczAJ-C&6o`axV}GMM&7JLQsqN#}vpX))(1lb!}ND&~CG zr0)T`QOtSJBpc9HG3VeU=G%{}D59vvD*V1KYIIjyg%@bB^7E<@6I!5azoLt(rc^BE6p6wctfH;DwEBdK zg>$90RkWT<#mr~Lob`ersy@!gg>j9lDyudO%r!0wS6W5qsIuK+?i1V1!tE|d8#xs# zacbjM(E`RR<|j-wL`}65*^mu<7z=r%pC$!yGB|N z`~cE8kbb>Wc46v4}VKzoWd50OO<5gvwA{-q9{4 zpm?cjy+JN+mzG#q52n)n^4;cy8bCQ?)wRp|b`U1rU2bU6x!cErYrwd9KLws1!v> zG>NIhlKv&WM|eIV>K1gf3)zhsX01Bp6XA0Owe!S}vO?zgrOsUj7O9eWDQ2%ZN7S?NIa3<+AU^NHq`O6e7W zyvj;xioh3SP=#+TX^|xS84$oehQ+~9A=9rRPqJlk0&U>EUchuIhH+3q~E*TUMu*R~{uv)@D7_2H6Y1!w*eLRM4c;b4@2#?2DZTIl>6H0rh z0K}YQLqXA*s>IrK4-`Pn^2O;()<4cO@oLuoE@toWdgCJgV@bUor|VYI%f!j0&6pUT zBJ*3HYPm zaXcn`w>wm^HoX?J6EayOD~hx=QGjg>lLS*b;w%=Lgc8u@unU^h0~t_m8JUzmLFZ>n z&7^b*TBTKj6~XD`4~0NeOF_$fT;6N*=N@=f>2spp|KhsgCQcOag_UvNCls zbxysNsf?-4i>%C9$US9cid4P}+7k$QTuiz{>}3wIYcO4&;Vw*!XUH62@?}_fiqcvk za`QI0aa`rsLC1wR1VDIi5biI651vmlAKWh!C*4oP;iSVz?$C0>vLa#Sg}_6q^(hEB zASfy4Fl;cqSQaqsV%TK(9_ePdxJT1yPZ&sC4j9g!ezb6 zTEk^%)`sN(7UNhmsS5f%^^9_gbW0RBV073q z`ltcdGd@gJwZ0_C@<|tXUg6R3P&mH0Y6Pi!s~X zXUTj|nKoPaZedJd9N}8bj0j@|$J)Io2p6eZZ_CX|i;>+UoA%z=UlOYVKUqeryHv}& zx*ao@C7|XUZDr>)XQoveWy%M>>&f!mnJb_Rkaij_#}hJlm<0xR*w~eTUN}y=O)hSh z6-~?+Cn`aGqzj!V6|ZbyoDY4n0Gym7fJcFk)sba^orYckk=2%3YH7R#$!HbyOa@`pD|R`YxxvVtDQo~X#R ztiu)+&x11{K65O$hQUODIEVY)DM)fOa=g;kE-&-Pm>t#?Cb@fJ_Bj2b7pOqHOh+wm z#rka3`YA!{0PqCMwB5md1PFBvX}+6ATmtSE?e zWTzVM(aL~@OfPfXd7#CD~8?dkJ_!w8;De)01raP!_Cs$%=F-gkPT+e zua&(Rh=1JmKE$u!V+^h@Tv-f(_eSjrqH*i`aYA`8yoDz^6-(Q)v5dJGvSlrRFaVd# zFm9?6h(4w=ZTn;*=$Fg#%dyk+Nel3&8IJg*0Q?1pp}B;nh8;$LN(Ejo3#?a=#}{2- z?_lY;yOPDd(qAt9p0WyQl-s)yY{In_c2rODJJ3-Law?h=zO>gT15mC7K56FbA;*Fy zmAGoff(sQPm|xHybJ;GjV1diVM5_h4t(j}Yf;%^Xi>iQI$L$G zcb530*l_DzYWG#BpXeT(WPYcL&CJ_K?sD#X+-0GmpME^0 z7L#FvEoT(phyPVWKFXSw#mw78EV6^g)00M zcFt!udZgVt@&Y+Y{mFYB$JB#KU~(~w#n`ClG|%|d@c|Cuqu2ZS?rNUo=N_2T+rO!sM~E< zlvkXMKmCZKJz6TFI+M(yw1rE8B0BPcK4+>jgm3y`R*rD zwmqD}Ne>yH^Zb6@RsGlW6H)C)*RCJw?;qNj+RQbdZDITj;v@?(PjBTEm6TI|Z=yHmpbFpuVfrMiXt zVh~qKx#9by3(L)eyW-Lk?q6djXr*xaHrbLC)H>OkN@35VCzdU%)W;6Nj&EUAOt&(2 zNlhywlytO8L`r{4@tR#7N)o7c_1Wyec!ZVQ{|L6~uDN3BA(JJ ziK4&Zof3Q}PA1CiMD1kDB9l7eli)Of#@fk8s}-z~%@Rv#67-jIC6~HSFZE$nfaUO$ zw6Ev=y-#GoDXk1_d3n6Zzpe+f)xrl_)xs~TD7+sIeW=$mR;juJt$Z>Tg$mW(*sAJ2 zsiGXYqPo#CYSqHcXj0u8R}0$#cvRHyR2ErAkUo%@XJPOKbRlV0&GKefYj^kLX+KEJ z9T78+JBo{$H%Rv#hG(wBcSjgY!M+ICxWp%Bz6>8(EoP*6r(Vol7Z;OT^(0%=lCQUl z$xbnEnKb6wE{m4AcwmzZTg+{`wpON6T8t>eSrnJ0fxlFF$f6SES!7XId9Jf4PkEMG#IQ%>@<3g+v~*y0jhJ{nA=%V zX9C$uTLqsf#&)>OqO%*5bb!Z7p-)kVO_xyTv(JmsB5QVeQYFsHXqrDV{;%2b#Bm_{0~WUtvBl=S(#(f zurgE9g{Vlnt;~Lz->m!LDMLL-y!|xdBT;gx?(k0t@-ud<*M&3nRN@CoaqJekSR6Z!UFNZA#uCT!8Q!nxrw-0< zfU};9ej}fmhrm}Z6UTmm;e4vBr^F|N^96Zj5GQUN3LkrX*5lrK^xi zf3hYuxUrvNRQkxeR3E&3>8G*&poExQjy7?=-MWTjbxD$Lfkt8n$+5a$-q9rvJiyj( zb*XbdrNh+hLDP#dzLU^9g_z!yhImuzTsnxO=gEXPW~%uYilhI;)R$ljEsoy9+l*7l zv7mTkpVLV}^ZgJ9H74cUW~d}6a0q}3VdDsLz)_Hcuy_8#t<&?U@Gjai2=G34~Nezc}i}3Ebm~Rx?sgXnf)*j($XL5l26r zJ#Vv)c3OQ2e_~GOMP<8-B8juwm(}-`?M^Igf37HEP$IVMp0?K3<~Evt+5AW5KdnWu zB4zgvZAgt^vHj~(aDRNT|5~E?^T*evH>9@09OwUf^+^9_^AaraS3w~2k9`zDKsJl; zc)U%nT8cPIUNF~=S@dx(&^Z)~cMe*I4$2GIE(_(V?;>dI@Gf=9RgE&=%KRtH1EAN! zwFgjSK9n{Ltja73OyCK_LHI5=xd3iTy!}a4{#*&v1b#(t&9RpRSlGdPNdk)5r4mrn z>8DTecvYjA?!l>3yVHw!J0Q!7lpmAvWA}Sy8Y-sG(tPsg^8%8}adHykjik02;Bc3) zj_E-b>~paRifmE!y0xEGU3ZbyQ2%`B<|Hc!Ryr()G6*-lJv;8PSCFgN;pBP^acnfK zLVC-Z9mx=H-Q(gxz8UN5vlkTCH=R9y!S%476=^&D;c_#a7;j@?)mj99v*8ylE%WuH z)_?BG5gnCLQ(3<5YbjB4Sww?PL@i|{8f=E5-!;#4;uYM}b-`aE@^yRs*w%35qXXM~ zzYOdUbWyLMBsP+e8cKpF;mt}MCmK#k2qkfp6k~Jbl(;IydnN}rh{OoOtcaG1+IQHrNRA{!P8Y>*K40WT;F86D_X(ZbsQXjm`QwqwchhK zAf~23#mg(~epr)56+dSS!JI07&9*_t`ilEjq=&bXvAN=Vt5djyC66P)|E@R?8jq%l zsN&G-)aYpc$PmL*pBNn4kcN>`#oHIIPY-SUOHzaEAT>Xvb{-^xmq!>2$q_}VAB-07 zd<6@TGH+=WZ}*4;J(k{#Vxe(!^Sz z5C1I3-pbkOo>~x^oeZpvd-jT{XXNcs94@d8?TN{M=YuEhblC@sLx0jMV(ZnsxZrGG zh4Di>arku&Iu&Q(Y=Q%LaKgn$2S=NsfS@(WTfu6aNkVl=AS~eJhSivZq}Mhlc806n zy`C#r%}gp*hTn^wI>IU_T;}X@oGM^FK2^4W3(U9cn=1Y6oDIFpI&Cq;LX_lXPcKB} z>`>x7V2gP5J7Vez6Q_%fZgKdtxX7LwRNaH(@Y)!fL}r_q`f%;c1AACu-u*3#&*%?d z!Dk$=b2wW0h04b&_s1S%Q(*07Q#fzSa0;8aKVPI>dU=RY?2z8nRr&R%j^KecZF5;S zDoN~p1Y2{l_n-M7V3LE)R&4Ss<6`f9X>7oft@@M^P2zGj-;7~uxYCk{9bAYUx*-0f zT*qveZk@+*A?rf{yGh^{BwK2^(-sjZ;B!jitqcy?`P+a({xF0&5(QhvSd zUMya*)4V5kdo9_x4F zZgJ#ZEa^TS4`V`^6 zq<+=kJ8dG>FE|s~<&5>p?O7#!c_Ay|%hhKnVO+dC|CA0&zQVvYD)y#OCs>A#DfMNa z_BY{j4mD5to0U0#1NZUOQsYZz2A7%QEtfO$(aW=ZnEuKvAC9`My;qB=i7duBK5^uC zSw2jsvwS$R*V?-(Zqzr$pQ&-xFFU0~30{Mt20rL_FpisrWU;FGNkgoU$mQ|+^YTMt z>Sm|sBd_MhE}I?u$Su}hkC@t!#rQGCzC1hjTSszZueV;AP~QF6jRo*35mT+!tF4kO zYL|vZP10r266v<6PI@e=l3uJ6(q~bb^jlOc0~SKIJd1)di2V_wIyiAe-JR`X!p#eY znA~qo>{s!FSPYChHctoaz#IG1e-jh`W^+-clYi2hc+$PvM%?+KY7qKJ|JJ^AYGeb> zSZi)tL3C}+Z7ZsXHrDJ|Nz`Anb0snxYVJOdXrSgBtB6KxzPSoTSJpgqKGD{i@0^d! zRW;x1CfZc^lJP0)Pc#-|qnm_VfBW3X&81*&S{{ZCLF45x_ef@cZy5 z;+2;Kz9y^1%^|{L;!`v{C12q4Fsk<1Rz=TZbJwM655O(cc3fNJLEBW_N3)-l$U{Xw z=`M$Uu=(Oj3cIw5CWY%u_Ooq(&eFkm*Hg~2`c>TWDpHDE9e%x4#us1CXmNP}h8ES| zm(c3UxIR3H@<(Bw7|4ptKRMNiV#9Po`XI^&Bfc2c~E>(#uRy%qVTs{(|9I1r5e zxC?w)rj|R`7y7cH`hJ@!CKCIDF|oh?gER-upgHoFXbw`$t%-DqcWBe(yt$Va-hzSe zTDW`RlyTn32(}y?kvLph__TQKu9$cYav<^A?SQ_0YV^eA;Mgm-VWCOcgB#3ssgW!D zN0*(xnNVc@C2IVjCdWsI6!GRK$^G&4;D!%(0aWj)Z>n$Mbt7iu56dn7LHT(lbyeY- zXoAQI35?W1oV<8>EkE4XS81#IQMQ9cjcf;&@bCtoPlLOos^PeB|CVzQVq71phTwY3 z`7qQuJ3;O$+HGM`#9Rg7-1FIh5G;$R8aekg

oAH=^w(hJ(yOZphVQp;OpzGlRdye|044OK7tZ- zs8^DYQA=Pno}{4PRdZPWhI8$2$0{pZdTjm;r5(I?zBC!&_hPhDVmSIu2>OUTj^;KQ9mwmHV&_+{*CKt13V2F4HpmL>9dtU5g-5N2UTYF z^OpO?tCvbsy!taS^9OkljNZqL{?C{#8;UR{bm9G9I9D_0>D)|2mNzpSXZ|;)zC*e5 zdto|!WslEq5!)+B6>AFl4ZY37w;lEE)q;YW(a-C%bLuPzm4V|E?N0`Rk-*ChKi1 z!yZ9c8qTxZae z{Z%8>FueX6Y8Xl5v1y=*8b(t#HBbZoZ5&FC44^>YGB#X0d-XWff9(JcPZ~zCYh1f& zh;T$m>(J*XFvPm6Hqok)L0X#{rHfKSgwM_C5}cNF50Buzl`aDQMVoBu-gG6c?H{Jz z^`rFB^k!Pwzn*w6ydgE3GA|k2xDg++6Q6CF>(XiSVqRGEH9iF8VWG`_QP5DT#v4i} zP)-9ou9cCf53G0fsm3pjPwm_@x3YVWJU%D3N72llo7KsgTJ4_~3Ev1Jqb^bEhH0Hd=sB;Xd6M~C&c1E@QqWTpG zjg5r@x;$Iln0<%zI~t9Sp}}%@QS(@1L^u4fhqRo(@of4q-2az#f)fcE7#MJdv1e@j zqv&$c>Dz{x4cO7ffmM{Wlf$p<-b{?msl1U>IVD4!lECZCbaEG9gTpYujg11&G5nl_ z3b!v5Z4~3wIWV+&V4xFWD;O6A+XuK}jK)IIkPqdd@=kj!6rwS)&ByspA+|C87^5{d z0)K%2@q4+C$LB$_zi70Pc$CIy2;*XS`~%D_opC6N_t4ctVmYKdFffL>ZyOlke<;Tc z(eD-;9I>}xe6dXk(52t_&{v2d49WaLvjOU4@}r%!+=qmAXfuqq%qOHVdiLM0&==P;2@YQ{ zUZ<8zCyn#$eQxU1^6BKI_Su{mh-MIJWYw2Ceaq3mW-sPX%xTd{K9usf$PbJmU*5Ql zdqy7R%YEPp*oE<`0|Kagj| zgDjZ?1<3O-Ob0iEjKP5yxAFR?8Q_$I9tc_M5A;&7Uh3iTfPVV4e&U4Y8&HSNp1W_l z>F%CR%E;4Fh6w*oC1hq?rzP+!+}L}?k9E4Dw=vB4IoFW^NHh`Mcl2GIj_!+2P?x2< zzwd-ccQef`@3XpyF{V8yP=B8;I^mhtMH(CR8XNW7W;kJ5x%99D~@ zP^59&HugKwPHlf5^lwv6qSZ?O(e=8c>*=H(@Fem#-g2Yl{0%?7!G*k@9rBtE&YwJS zGQ;_?OyBX(IU(fycc%v6i5Xyr41ixbd z$@mPs|NcoBp&o;+5rLAE#&dwqmR9H&L;(NT)5H9MSsZZqgQ|lkbUj2+TH*Y4Wzz@c zb?}7qcQTuRt(yW}kCE$=>E{Yy>w2I&W9VGgt{^eay8RlLU%CzJD2lbba(ww~@?u<0 zIeGn$^x5z8FdYyAFEp$`&dVVON+(P%fWU@5I{EwsI%VgfTWrVLm&qXHM-mgmI$<9F zBYQU-BQV@r)+{R?AFnKBa@^zdgvxInpMWWHa%U9?EM)(4Dvh)Dz-Y9xL4Vxre31NE z0QfqO78=Ou%|s3$!+;E6Uao?O_CMRVYcjU?Fh1y!670vz8V>yb@;{nlJTU7VsNb5f z(@HSwTn>oLBS*eY;ThOd!^5mb!?XBV|C7tJ5zoQ^PRC{5qsY$=h;e|*xcvGvf6I6Q zFp}}I>5P8CL!D+TbuWMRa5_ivDLXwACs+Q#_w_$^{&Ltnj^Wovj2HZaui|>H%f3LH zoHzk*lznAsmE)Q|IWbXoc2RL@>Ace1IGOA3JJ7Lb`np{InVEME+^2hVN~Gm%bhK9D zQCeDB6e=pm$Z#O|9U8gk-FKHg*EHK+12gaB^13xT(e3f92s@^7PL~7xpXv8!mKV5~ zKYNaJg$!h}?u0yf5_&r^brJ#AU+W(T|K(&9Y2R$P z!x#rij(?Y%%ZaHITPm`8-gS1^%S;&0`st@JcGh8Qy_nSpM;#nJkP{OSnNB(Rj&)|KPj-jSOwhrIaBazecXIfVbr-rC-APN#NThRf~s`Pn}F2+`cG(+dAD D*k6y- diff --git a/build.sh b/build.sh deleted file mode 100755 index 13ac751..0000000 --- a/build.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -e - -format=0 -console=0 -install=0 -debug=0 -norun=0 - -while [ $# -gt 0 ]; do - case $1 in - --format) - format=1 - shift - ;; - - --console) - console=1 - shift - ;; - - --install) - install=1 - shift - ;; - - --debug) - debug=1 - shift - ;; - - --no-run) - norun=1 - shift - ;; - - *) - shift - esac -done - -rm -f bin/* - -# When clang-format is present - -if [ $format = 1 ]; -then - clang-format -i src/uxnasm.c - clang-format -i src/uxncli.c - clang-format -i src/uxnemu.c - clang-format -i src/devices/* -fi - -mkdir -p bin -CC="${CC:-cc}" -CFLAGS="${CFLAGS:--std=c89 -Wall -Wno-unknown-pragmas}" -case "$(uname -s 2>/dev/null)" in -MSYS_NT*|MINGW*) # MSYS2 on Windows - FILE_LDFLAGS="-liberty" - if [ $console = 1 ]; - then - UXNEMU_LDFLAGS="-static $(sdl2-config --cflags --static-libs | sed -e 's/ -mwindows//g')" - else - UXNEMU_LDFLAGS="-static $(sdl2-config --cflags --static-libs)" - fi - ;; -Darwin) # macOS - CFLAGS="${CFLAGS} -Wno-typedef-redefinition -D_C99_SOURCE -D_DARWIN_BETTER_REALPATH" - UXNEMU_LDFLAGS="$(sdl2-config --cflags --static-libs)" - ;; -Linux|*) - UXNEMU_LDFLAGS="-L/usr/local/lib $(sdl2-config --cflags --libs)" - ;; -esac - -if [ $debug = 1 ]; -then - echo "[debug]" - CFLAGS="${CFLAGS} -DDEBUG -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined" -else - CFLAGS="${CFLAGS} -DNDEBUG -O2 -g0 -s" -fi - -${CC} ${CFLAGS} src/uxnasm.c -o bin/uxnasm -${CC} ${CFLAGS} src/uxn.c src/devices/system.c src/devices/console.c src/devices/file.c src/devices/datetime.c src/devices/mouse.c src/devices/controller.c src/devices/screen.c src/devices/audio.c src/uxnemu.c ${UXNEMU_LDFLAGS} ${FILE_LDFLAGS} -o bin/uxnemu -${CC} ${CFLAGS} src/uxn.c src/devices/system.c src/devices/console.c src/devices/file.c src/devices/datetime.c src/uxncli.c ${FILE_LDFLAGS} -o bin/uxncli - -if [ $install = 1 ] -then - cp bin/uxnemu bin/uxnasm bin/uxncli $HOME/bin/ -fi - -if [ $norun = 1 ]; then exit; fi - -# Test version - -bin/uxnasm -v -bin/uxncli -v -bin/uxnemu -v - -# Start potato - -bin/uxnemu -2x diff --git a/etc/circle128/build.sh b/etc/circle128/build.sh deleted file mode 100755 index 2bc7a30..0000000 --- a/etc/circle128/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -e - -clang-format -i circle128.c -rm -f circle128 -cc -lm -o circle128 circle128.c -./circle128 64 diff --git a/etc/circle128/circle128.c b/etc/circle128/circle128.c deleted file mode 100644 index 3ab9688..0000000 --- a/etc/circle128/circle128.c +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include - -/* -Copyright (c) 2020-2023 Devine Lu Linvega - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -#define PI 3.14159265358979323846 - -typedef unsigned char Uint8; - -int -clamp(int val, int min, int max) -{ - return (val >= min) ? (val <= max) ? val : max : min; -} - -int -sint(char *s) -{ - int i = 0, num = 0; - while(s[i] && s[i] >= '0' && s[i] <= '9') - num = num * 10 + (s[i++] - '0'); - return num; -} - -int -main(int argc, char *argv[]) -{ - int seg, offset, i; - double segf, cx = 128, cy = 128, r; - if(argc < 2) { - printf("usage: circle128 length [radius]\n", argc); - return 1; - } - seg = sint(argv[1]); - segf = (double)seg; - offset = seg / 4; - r = argc < 3 ? 128 : (double)sint(argv[2]); - printf("%d points on a circle%d:\n\n", seg, (int)r); - for(i = 0; i < seg; ++i) { - double pos = (i - offset) % seg; - double deg = (pos / segf) * 360.0; - double rad = deg * (PI / 180); - double x = cx + r * cos(rad); - double y = cy + r * sin(rad); - if(i > 0 && i % 8 == 0) - printf("\n"); - printf("%02x%02x ", (Uint8)clamp(x, 0x00, 0xff), (Uint8)clamp(y, 0x00, 0xff)); - } - printf("\n\n"); - return 0; -} diff --git a/etc/hello.tal b/etc/hello.tal deleted file mode 100644 index 67533a2..0000000 --- a/etc/hello.tal +++ /dev/null @@ -1,28 +0,0 @@ -( init ) - -|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 - -%emit ( byte -- ) { ( hey ) #18 DEO } - -|0100 @program - - #1234 SWP - #010e DEO - #010f DEO - - #1234 #5678 SWP2 - - ;hello-word - - &while - ( send ) LDAk emit - ( loop ) INC2 LDAk ?&while - POP2 - - #010f DEO - -BRK - -@program/extend BRK - -@hello-word "Hello 20 "World? 00 diff --git a/etc/syntax-highlight/tal.nanorc b/etc/syntax-highlight/tal.nanorc deleted file mode 100644 index daff96b..0000000 --- a/etc/syntax-highlight/tal.nanorc +++ /dev/null @@ -1,51 +0,0 @@ -# include this file in your ~/.nanorc: -# include "path/to/uxntal.nanorc" - -syntax "uxntal" "\.tal$" - -# numbers -color lightblue "[0-9a-f]{2}(\s|$)" -color lightblue "[0-9a-f]{4}(\s|$)" - -# literal hex -color cyan "#[0-9a-f]{2}(\s|$)" -color cyan "#[0-9a-f]{4}(\s|$)" - -# absolute pad -color bold,blue "\|[0-9a-f]{2}" -color bold,blue "\|[0-9a-f]{4}" - -# labels -# label define -color green "@\S+" -# sub-label define -color green "&\S+" -# literal addr absolute -color magenta ";\S+" -# literal addr relative -color magenta ",\S+" -# literal addr zero page -color lightmagenta "\.\S+" - -# raw -# character -color lightred "'\S" -# string -color lightred ""\S+" -# addr -color lightyellow ":\S+" - -# include -color lightcyan "~\S+" - -# macros definition -color yellow "\%\S+" -color yellow "[{}]" - -# instructions -color bold,cyan "(BRK|LIT|INC|POP|DUP|NIP|SWP|OVR|ROT|EQU|NEQ|GTH|LTH|JMP|JCN|JSR|STH|LDZ|STZ|LDR|STR|LDA|STA|DEI|DEO|ADD|SUB|MUL|DIV|AND|ORA|EOR|SFT)[2kr]{,3}(\s|$)" - -# comments -comment "( | )" -color blue start="\(" end="\)" - diff --git a/etc/syntax-highlight/tal.sublime-syntax b/etc/syntax-highlight/tal.sublime-syntax deleted file mode 100644 index 1850315..0000000 --- a/etc/syntax-highlight/tal.sublime-syntax +++ /dev/null @@ -1,126 +0,0 @@ -%YAML 1.2 ---- -# See http://www.sublimetext.com/docs/3/syntax.html -name: Uxn Assembly -scopeName: tal. -fileTypes: [tal] -file_extensions: - - tal -scope: source.tal - -contexts: - main: - - # get - - match: '\.(\S+)\sDEI2' - scope: entity.name.type.typedef - pop: true - - match: '\.(\S+)\sDEI' - scope: entity.name.type.typedef - pop: true - - match: '\.(\S+)\sLDZ2' - scope: entity.name.type.typedef - pop: true - - match: '\.(\S+)\sLDZ' - scope: entity.name.type.typedef - pop: true - - match: '\,(\S+)\sLDR2' - scope: entity.name.type.typedef - pop: true - - match: '\,(\S+)\sLDR' - scope: entity.name.type.typedef - pop: true - - match: '\;(\S+)\sLDA2' - scope: entity.name.type.typedef - pop: true - - match: '\;(\S+)\sLDA' - scope: entity.name.type.typedef - pop: true - # set - - match: '\.(\S+)\sDEO2' - scope: constant.numeric - pop: true - - match: '\.(\S+)\sDEO' - scope: constant.numeric - pop: true - - match: '\.(\S+)\sSTZ2' - scope: constant.numeric - pop: true - - match: '\.(\S+)\sSTZ' - scope: constant.numeric - pop: true - - match: '\,(\S+)\sSTR2' - scope: constant.numeric - pop: true - - match: '\,(\S+)\sSTR' - scope: constant.numeric - pop: true - - match: '\;(\S+)\sSTA2' - scope: constant.numeric - pop: true - - match: '\;(\S+)\sSTA' - scope: constant.numeric - pop: true - - # label - - match: '\@(\S+)\s?' - scope: string.control - pop: true - # sublabel - - match: '\&(\S+)\s?' - scope: string.control - pop: true - # include - - match: 'include' - scope: string.control - pop: true - - # jump - - match: '\|(\S+)\s?' - scope: entity.name.tag.structure.any - pop: true - # pad - - match: '\$(\S+)\s?' - scope: entity.name.tag.structure.any - pop: true - - # Pushing to stack - - match: '\"(\S+)\s?' - scope: constant.numeric - pop: true - - # Addressing - - match: '\.(\S+)\s?' # zero-page - scope: variable.function.shell - pop: true - - match: '\,(\S+)\s?' # relative - scope: entity.name.tag.yaml - pop: true - - match: '\;(\S+)\s?' # absolute - scope: keyword.control - pop: true - - match: '\:(\S+)\s?' # raw - scope: keyword.control - pop: true - - # Blocks - - match: '\[\s?' - scope: comment - pop: true - - match: '\]\s?' - scope: comment - pop: true - - - match: '\{' - scope: variable.control - push: - - meta_scope: variable.control - - match: '\}' - pop: true - - - match: '\s\(\s' - scope: comment - push: - - meta_scope: comment.line - - match: '\s\)\s' - pop: true diff --git a/etc/wavpcm/build.sh b/etc/wavpcm/build.sh deleted file mode 100755 index 6a61b18..0000000 --- a/etc/wavpcm/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -echo "Formatting.." -clang-format -i wavpcm.c - -echo "Cleaning.." -rm -f ../../bin/wavpcm - -echo "Building.." -mkdir -p ../../bin -cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined -lm wavpcm.c -o ../../bin/wavpcm - -echo "Running.." -../../bin/wavpcm - -echo "Done." diff --git a/etc/wavpcm/wavpcm.c b/etc/wavpcm/wavpcm.c deleted file mode 100644 index c9b83f2..0000000 --- a/etc/wavpcm/wavpcm.c +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include - -/* -Copyright (c) 2020 Devine Lu Linvega - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -#define PI 3.14159265358979323846 -#define SAMPLES 256 -#define RATE 1 - -typedef unsigned char Uint8; - -int -clamp(int val, int min, int max) -{ - return (val >= min) ? (val <= max) ? val : max : min; -} - -Uint8 -sinw(int i) -{ - return 0x7f * sin(i * RATE * 2 * PI / SAMPLES); -} - -Uint8 -triw(int i) -{ - if(i < 0x40) - return i * 2; - if(i >= 0xc0) - return (i - 0xc0) * 2 - 0x7f; - return 0x7f - (i - 0x40) * 2; -} - -Uint8 -sqrw(int i) -{ - return ((i * RATE) % 0xff) < 0x80 ? 0x7f : 0x80; -} - -int -main() -{ - int i; - printf("%d:\n\n", SAMPLES); - for(i = 0; i < SAMPLES; ++i) { - if(i % 0x10 == 0) - printf("\n"); - else if(i % 2 == 0) - printf(" "); - printf("%02x", (triw(i) + sinw(i)) / 2); - } - printf("\n\n"); - return 0; -} diff --git a/projects/fonts/816.uf1 b/fonts/816.uf1 similarity index 100% rename from projects/fonts/816.uf1 rename to fonts/816.uf1 diff --git a/projects/fonts/acorn8-italic.uf1 b/fonts/acorn8-italic.uf1 similarity index 100% rename from projects/fonts/acorn8-italic.uf1 rename to fonts/acorn8-italic.uf1 diff --git a/projects/fonts/acorn8-regular.uf1 b/fonts/acorn8-regular.uf1 similarity index 100% rename from projects/fonts/acorn8-regular.uf1 rename to fonts/acorn8-regular.uf1 diff --git a/projects/fonts/atari8.uf1 b/fonts/atari8.uf1 similarity index 100% rename from projects/fonts/atari8.uf1 rename to fonts/atari8.uf1 diff --git a/projects/fonts/bbcmicro8.uf1 b/fonts/bbcmicro8.uf1 similarity index 100% rename from projects/fonts/bbcmicro8.uf1 rename to fonts/bbcmicro8.uf1 diff --git a/projects/fonts/chicago12.uf2 b/fonts/chicago12.uf2 similarity index 100% rename from projects/fonts/chicago12.uf2 rename to fonts/chicago12.uf2 diff --git a/projects/fonts/courier12.uf2 b/fonts/courier12.uf2 similarity index 100% rename from projects/fonts/courier12.uf2 rename to fonts/courier12.uf2 diff --git a/projects/fonts/cream.uf2 b/fonts/cream.uf2 similarity index 100% rename from projects/fonts/cream.uf2 rename to fonts/cream.uf2 diff --git a/projects/fonts/diamond12.uf2 b/fonts/diamond12.uf2 similarity index 100% rename from projects/fonts/diamond12.uf2 rename to fonts/diamond12.uf2 diff --git a/projects/fonts/diamond20.uf3 b/fonts/diamond20.uf3 similarity index 100% rename from projects/fonts/diamond20.uf3 rename to fonts/diamond20.uf3 diff --git a/projects/fonts/geneva12.uf2 b/fonts/geneva12.uf2 similarity index 100% rename from projects/fonts/geneva12.uf2 rename to fonts/geneva12.uf2 diff --git a/projects/fonts/geneva14.uf2 b/fonts/geneva14.uf2 similarity index 100% rename from projects/fonts/geneva14.uf2 rename to fonts/geneva14.uf2 diff --git a/projects/fonts/geneva24.uf3 b/fonts/geneva24.uf3 similarity index 100% rename from projects/fonts/geneva24.uf3 rename to fonts/geneva24.uf3 diff --git a/projects/fonts/helvetica12.uf2 b/fonts/helvetica12.uf2 similarity index 100% rename from projects/fonts/helvetica12.uf2 rename to fonts/helvetica12.uf2 diff --git a/projects/fonts/helvetica14.uf2 b/fonts/helvetica14.uf2 similarity index 100% rename from projects/fonts/helvetica14.uf2 rename to fonts/helvetica14.uf2 diff --git a/projects/fonts/helvetica24.uf3 b/fonts/helvetica24.uf3 similarity index 100% rename from projects/fonts/helvetica24.uf3 rename to fonts/helvetica24.uf3 diff --git a/projects/fonts/left8.uf1 b/fonts/left8.uf1 similarity index 100% rename from projects/fonts/left8.uf1 rename to fonts/left8.uf1 diff --git a/projects/fonts/losangeles12.uf2 b/fonts/losangeles12.uf2 similarity index 100% rename from projects/fonts/losangeles12.uf2 rename to fonts/losangeles12.uf2 diff --git a/projects/fonts/monaco12.uf2 b/fonts/monaco12.uf2 similarity index 100% rename from projects/fonts/monaco12.uf2 rename to fonts/monaco12.uf2 diff --git a/projects/fonts/msx816.uf2 b/fonts/msx816.uf2 similarity index 100% rename from projects/fonts/msx816.uf2 rename to fonts/msx816.uf2 diff --git a/projects/fonts/newyork12.uf2 b/fonts/newyork12.uf2 similarity index 100% rename from projects/fonts/newyork12.uf2 rename to fonts/newyork12.uf2 diff --git a/projects/fonts/newyork14.uf2 b/fonts/newyork14.uf2 similarity index 100% rename from projects/fonts/newyork14.uf2 rename to fonts/newyork14.uf2 diff --git a/projects/fonts/newyork24.uf3 b/fonts/newyork24.uf3 similarity index 100% rename from projects/fonts/newyork24.uf3 rename to fonts/newyork24.uf3 diff --git a/projects/fonts/orca8.uf1 b/fonts/orca8.uf1 similarity index 100% rename from projects/fonts/orca8.uf1 rename to fonts/orca8.uf1 diff --git a/projects/fonts/palatino12.uf2 b/fonts/palatino12.uf2 similarity index 100% rename from projects/fonts/palatino12.uf2 rename to fonts/palatino12.uf2 diff --git a/projects/fonts/palatino14.uf2 b/fonts/palatino14.uf2 similarity index 100% rename from projects/fonts/palatino14.uf2 rename to fonts/palatino14.uf2 diff --git a/projects/fonts/palatino24.uf3 b/fonts/palatino24.uf3 similarity index 100% rename from projects/fonts/palatino24.uf3 rename to fonts/palatino24.uf3 diff --git a/projects/fonts/sans10-bold.uf2 b/fonts/sans10-bold.uf2 similarity index 100% rename from projects/fonts/sans10-bold.uf2 rename to fonts/sans10-bold.uf2 diff --git a/projects/fonts/sans10-regular.uf2 b/fonts/sans10-regular.uf2 similarity index 100% rename from projects/fonts/sans10-regular.uf2 rename to fonts/sans10-regular.uf2 diff --git a/projects/fonts/sans12-bold.uf2 b/fonts/sans12-bold.uf2 similarity index 100% rename from projects/fonts/sans12-bold.uf2 rename to fonts/sans12-bold.uf2 diff --git a/projects/fonts/sans12-regular.uf2 b/fonts/sans12-regular.uf2 similarity index 100% rename from projects/fonts/sans12-regular.uf2 rename to fonts/sans12-regular.uf2 diff --git a/projects/fonts/sans14-bold.uf2 b/fonts/sans14-bold.uf2 similarity index 100% rename from projects/fonts/sans14-bold.uf2 rename to fonts/sans14-bold.uf2 diff --git a/projects/fonts/sans14-regular.uf2 b/fonts/sans14-regular.uf2 similarity index 100% rename from projects/fonts/sans14-regular.uf2 rename to fonts/sans14-regular.uf2 diff --git a/projects/fonts/sapphire14.uf2 b/fonts/sapphire14.uf2 similarity index 100% rename from projects/fonts/sapphire14.uf2 rename to fonts/sapphire14.uf2 diff --git a/projects/fonts/sapphire19.uf3 b/fonts/sapphire19.uf3 similarity index 100% rename from projects/fonts/sapphire19.uf3 rename to fonts/sapphire19.uf3 diff --git a/projects/fonts/specter8.uf1 b/fonts/specter8.uf1 similarity index 100% rename from projects/fonts/specter8.uf1 rename to fonts/specter8.uf1 diff --git a/projects/fonts/terminal12.uf2 b/fonts/terminal12.uf2 similarity index 100% rename from projects/fonts/terminal12.uf2 rename to fonts/terminal12.uf2 diff --git a/projects/fonts/times12.uf2 b/fonts/times12.uf2 similarity index 100% rename from projects/fonts/times12.uf2 rename to fonts/times12.uf2 diff --git a/projects/fonts/times15.uf2 b/fonts/times15.uf2 similarity index 100% rename from projects/fonts/times15.uf2 rename to fonts/times15.uf2 diff --git a/projects/fonts/times24.uf3 b/fonts/times24.uf3 similarity index 100% rename from projects/fonts/times24.uf3 rename to fonts/times24.uf3 diff --git a/projects/fonts/venice14.uf2 b/fonts/venice14.uf2 similarity index 100% rename from projects/fonts/venice14.uf2 rename to fonts/venice14.uf2 diff --git a/mkfile b/mkfile deleted file mode 100644 index b4bc1ef..0000000 --- a/mkfile +++ /dev/null @@ -1,64 +0,0 @@ -/dev/null - -bin/uxncli: file.$O datetime.$O system.$O console.$O uxncli.$O uxn.$O - $LD $LDFLAGS -o $target $prereq - -bin/uxnasm: uxnasm.$O - $LD $LDFLAGS -o $target $prereq - -bin/uxnemu: audio.$O controller.$O datetime.$O file.$O mouse.$O screen.$O system.$O console.$O uxn.$O uxnemu.$O - $LD $LDFLAGS -o $target $prereq - -(uxnasm|uxncli|uxnemu|uxn)\.$O:R: src/\1.c - $CC $CFLAGS -Isrc -o $target src/$stem1.c - -(audio|controller|datetime|file|mouse|screen|system|console)\.$O:R: src/devices/\1.c - $CC $CFLAGS -Isrc -o $target src/devices/$stem1.c - -nuke:V: clean - -clean:V: - rm -f *.[$OS] [$OS].??* $TARG $CLEANFILES - -%.clean:V: - rm -f $stem.[$OS] [$OS].$stem $stem - -install:V: all - cp $TARG $BIN/ - -#LDFLAGS=-p diff --git a/projects/pictures/akane20x10.icn b/pictures/akane20x10.icn similarity index 100% rename from projects/pictures/akane20x10.icn rename to pictures/akane20x10.icn diff --git a/projects/pictures/ako10x10.chr b/pictures/ako10x10.chr similarity index 100% rename from projects/pictures/ako10x10.chr rename to pictures/ako10x10.chr diff --git a/projects/pictures/bulma37x29.chr b/pictures/bulma37x29.chr similarity index 100% rename from projects/pictures/bulma37x29.chr rename to pictures/bulma37x29.chr diff --git a/projects/pictures/cibo10x10.icn b/pictures/cibo10x10.icn similarity index 100% rename from projects/pictures/cibo10x10.icn rename to pictures/cibo10x10.icn diff --git a/projects/pictures/cyr0cx08.chr b/pictures/cyr0cx08.chr similarity index 100% rename from projects/pictures/cyr0cx08.chr rename to pictures/cyr0cx08.chr diff --git a/projects/pictures/dafu10x10.icn b/pictures/dafu10x10.icn similarity index 100% rename from projects/pictures/dafu10x10.icn rename to pictures/dafu10x10.icn diff --git a/projects/pictures/daria10x10.chr b/pictures/daria10x10.chr similarity index 100% rename from projects/pictures/daria10x10.chr rename to pictures/daria10x10.chr diff --git a/projects/pictures/ergo20x1a.icn b/pictures/ergo20x1a.icn similarity index 100% rename from projects/pictures/ergo20x1a.icn rename to pictures/ergo20x1a.icn diff --git a/projects/pictures/felix0cx0c.chr b/pictures/felix0cx0c.chr similarity index 100% rename from projects/pictures/felix0cx0c.chr rename to pictures/felix0cx0c.chr diff --git a/projects/pictures/logo02x02.icn b/pictures/logo02x02.icn similarity index 100% rename from projects/pictures/logo02x02.icn rename to pictures/logo02x02.icn diff --git a/projects/pictures/logo04x04.chr b/pictures/logo04x04.chr similarity index 100% rename from projects/pictures/logo04x04.chr rename to pictures/logo04x04.chr diff --git a/projects/pictures/logo08x08.icn b/pictures/logo08x08.icn similarity index 100% rename from projects/pictures/logo08x08.icn rename to pictures/logo08x08.icn diff --git a/projects/pictures/pc9820x10.chr b/pictures/pc9820x10.chr similarity index 100% rename from projects/pictures/pc9820x10.chr rename to pictures/pc9820x10.chr diff --git a/projects/pictures/pjw20x20.icn b/pictures/pjw20x20.icn similarity index 100% rename from projects/pictures/pjw20x20.icn rename to pictures/pjw20x20.icn diff --git a/projects/pictures/tima2ax1a.icn b/pictures/tima2ax1a.icn similarity index 100% rename from projects/pictures/tima2ax1a.icn rename to pictures/tima2ax1a.icn diff --git a/projects/pictures/zerotwo10x10.chr b/pictures/zerotwo10x10.chr similarity index 100% rename from projects/pictures/zerotwo10x10.chr rename to pictures/zerotwo10x10.chr diff --git a/projects/pictures/zerotwo20x20.chr b/pictures/zerotwo20x20.chr similarity index 100% rename from projects/pictures/zerotwo20x20.chr rename to pictures/zerotwo20x20.chr diff --git a/projects/examples/demos/amiga.tal b/projects/examples/demos/amiga.tal deleted file mode 100644 index 50e2f2a..0000000 --- a/projects/examples/demos/amiga.tal +++ /dev/null @@ -1,314 +0,0 @@ -( Boing ) - -|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 - -|0000 - - @ball &x $2 &y $2 &vx $2 &vy $2 - @timer $1 - @frame $1 - @direction $1 -( -@|vectors ) - -|0100 - ( variables ) - [ LIT2 01 -direction ] STZ - ( vectors ) - ;on-frame .Screen/vector DEO2 - ( theme ) - #aff5 .System/r DEO2 - #af00 .System/g DEO2 - #af05 .System/b DEO2 - ( screen size ) - #0140 .Screen/width DEO2 - #0100 .Screen/height DEO2 - ( inital position ) - #0020 .ball/x STZ2 - #0020 .ball/y STZ2 - ( initial velocity ) - #0003 .ball/vx STZ2 - #0000 .ball/vy STZ2 - ( once ) - make-shadow - draw-background - -BRK - -@on-frame ( -> ) - - ( 12 frames animation ) - .frame LDZk .direction LDZ ADD #0c DIVk MUL SUB SWP STZ - move-ball - -BRK - -( -@|core ) - -@flip-direction ( zp^ -- ) - - LDZ2k #ffff EOR2 INC2 ROT STZ2 - -JMP2r - -@check-flip-vx ( x -- x ) - - ( left ) DUP2 #0010 LTH2 ?&flip - ( right ) DUP2 .Screen/width DEI2 #0050 SUB2 GTH2 ?&flip - -JMP2r - &flip - .direction LDZk #0a EOR SWP STZ - .ball/vx !flip-direction - -@check-flip-vy ( y -- y ) - - ( bottom ) DUP2 .Screen/height DEI2 #0050 SUB2 GTH2 ?&flip !&else - &flip .ball/vy !flip-direction - &else - -JMP2r - -@move-ball ( -- ) - - ( clear ) - .ball/x LDZ2 .Screen/x DEO2 - .ball/y LDZ2 .Screen/y DEO2 - ;fill-icn .Screen/addr DEO2 - [ LIT2 71 -Screen/auto ] DEO - #f8 - &loop-bg - [ LIT2 40 -Screen/sprite ] DEO - INC DUP ?&loop-bg - POP - [ LIT2 76 -Screen/auto ] DEO - .ball/vx LDZ2k STH2k ROT STZ2 - .ball/x LDZ2k STH2r ADD2 check-flip-vx ROT STZ2 - .timer LDZk INC DUP ROT STZ #06 EQU ?&pull - -!&pass - &pull [ LIT2 00 -timer ] STZ .ball/vy LDZ2k INC2 STH2k ROT STZ2 !&end - &pass .ball/vy LDZ2k STH2k ROT STZ2 !&end - &end .ball/y LDZ2k STH2r ADD2 check-flip-vy ROT STZ2 - -@draw-ball ( -- ) - - ( shadow ) - .ball/x LDZ2 #0008 ADD2 .Screen/x DEO2 - .ball/y LDZ2 #0008 ADD2 .Screen/y DEO2 - ;shadow .Screen/addr DEO2 - [ LIT2 66 -Screen/auto ] DEO - #f9 - &loop-shadow - [ LIT2 4f -Screen/sprite ] DEO - INC DUP ?&loop-shadow - POP - .frame LDZ - ( bg ) - DUP #06 DIV INC #05 MUL #40 ADD ,&bg STR - .ball/x LDZ2 .Screen/x DEO2 - .ball/y LDZ2 .Screen/y DEO2 - ;bg .Screen/addr DEO2 - [ LIT2 66 -Screen/auto ] DEO - #f9 - &loop-bg - [ LIT2 &bg $1 -Screen/sprite ] DEO - INC DUP ?&loop-bg - POP - ( fg ) - DUP #06 DIV #00 EQU INC #05 MUL #40 ADD ,&fg STR - .ball/x LDZ2 .Screen/x DEO2 - .ball/y LDZ2 .Screen/y DEO2 - #06 DIVk MUL SUB #00 SWP #0188 MUL2 ;ball-icn ADD2 .Screen/addr DEO2 - [ LIT2 66 -Screen/auto ] DEO - #f9 - &loop-fg - [ LIT2 &fg $1 -Screen/sprite ] DEO - INC DUP ?&loop-fg - POP - -JMP2r - -@draw-background ( -- ) - - ( hor lines ) - [ LIT2 01 -Screen/auto ] DEO - ;hor-icn .Screen/addr DEO2 - .Screen/height DEI2 #04 SFT2 NIP #04 SUB #00 - &horver - #0020 .Screen/x DEO2 - #00 OVR #40 SFT2 #0020 ADD2 .Screen/y DEO2 - .Screen/width DEI2 #03 SFT2 NIP #08 SUB #00 - &horhor - [ LIT2 0f -Screen/sprite ] DEO - INC GTHk ?&horhor - POP2 - INC GTHk ?&horver - POP2 - - ( ver lines ) - [ LIT2 02 -Screen/auto ] DEO - ;ver-icn .Screen/addr DEO2 - .Screen/width DEI2 #04 SFT2 NIP #03 SUB #00 - &verver - #0027 .Screen/y DEO2 - #00 OVR #40 SFT2 #0019 ADD2 .Screen/x DEO2 - .Screen/height DEI2 #03 SFT2 NIP #0a SUB #00 - &verhor - [ LIT2 0f -Screen/sprite ] DEO - INC GTHk ?&verhor - POP2 - INC GTHk ?&verver - POP2 - -JMP2r - -@make-shadow ( -- ) - - ;bg ;shadow #0188 mcpy - #0188 #0000 - &loop - DUP2 ;shadow ADD2 LDA2k #aa55 AND2 SWP2 STA2 - INC2 INC2 GTH2k ?&loop - POP2 POP2 - -JMP2r - -@mcpy ( src* dst* len* -- ) - - SWP2 STH2 - OVR2 ADD2 SWP2 - &loop - LDAk STH2kr STA INC2r - INC2 GTH2k ?&loop - POP2 POP2 - POP2r - -JMP2r - -( -@|assets ) - -@fill-icn - ffff ffff ffff ffff -@hor-icn - 0000 0000 0000 00ff -@ver-icn - 0101 0101 0101 0101 - -@ball-icn ( 56 x 56 ) - ( 00 ) - 0000 0000 0000 0000 0000 0000 0304 0830 0000 073f 180c 1f3f 00f4 c103 070f bf8f - 0040 0cfc e2c1 c1c1 0000 0000 80a0 e0e4 0000 0000 0000 0000 0000 0000 0101 0303 - 60c0 01e3 fbf0 f0e0 7fff fefe fc78 000f 8100 0000 0001 0103 8040 f8ff ffff ffff - f2f1 f9f8 1c00 0303 0000 8080 4020 b0e0 0707 0f1f 2720 2060 e0c0 c080 8000 e0fc - 0f1f 1f3f 3f3f 7f7f e3ff f8f8 f8f0 f0f0 fefe 7e0e 0001 0103 0101 0101 01c1 f9fe - e0e0 e0f0 f0f0 f0f8 6060 4041 4141 0139 ffff ffff fefe fefe 7f0f 0100 0000 0000 - e0e0 e000 3c3f 7f7f 0303 0707 0787 fff1 fefe fefc fcfc fcfc 1804 0606 0e0e 0e0e - 3e1e 1e1e 1e0e 0f0f fe1c 0003 0303 0303 0000 0080 f1ff fefe 7fff ffff ffff 3f07 - f0e0 e0e0 c0c0 8080 3800 070f 0f1f 1f3f 0e0c 0cfc e0c0 c080 0f09 0400 0001 0000 - 0303 c37b 3c3c 9e1e fcfc fcfc f818 040f 0000 0101 0303 078f 80e0 feff fffe fcf8 - 3f7f 7f3e 0603 070e 8000 0000 0000 0000 0000 0000 0000 0000 0e1e 0500 0000 0000 - 0f0f 0f4f 2703 0200 ffe1 c080 030f 1e00 f0e0 00f9 f8c0 0000 3c70 e0c0 0000 0000 - 0000 0000 0000 0000 - ( 01 ) - 0000 0000 0000 0000 0000 0000 0204 0800 0001 0f7c 101c 3fff 00e7 8307 0f3f ff0f - 0040 0cdc c083 8101 0000 0000 80a0 c0e4 0000 0000 0000 0000 0000 0003 0103 0307 - 4183 07ef f3e0 e0c0 fefe fcf8 f070 181f 0101 0103 0303 0707 01c1 f9fe fefc fcfc - e2f3 f1f8 1804 0707 0000 0080 4060 b0c0 070f 3f1f 2721 0101 c080 8000 0000 e1fd - 3f3f 7f7f ffff ffff eff3 f0e0 e0c0 c0c0 fcfc 7c0c 0607 0707 0303 0303 03c3 fbfc - c0e0 e0e4 e0e0 f0f0 4141 4343 4343 433b fefe fcfc fcfc f8f8 7f0f 0100 0000 0001 - 8080 80c0 fcff ffff 0f0f 0f1f 1f9f efc1 fcf8 f8f8 f8f8 f0f0 100c 0e0e 0e1e 1e1e - 3c3c 3c1c 3c1e 0e0e f818 0407 0707 0707 0101 0383 f3f9 f8f8 ffff ffff ffff 3f06 - c0c0 8080 0000 0000 3008 1f1f 3f3f 7f7f 1c1c 1cfc c0c4 8000 0e08 0400 0000 0000 - 0707 c7ff 7838 bc1c f8f8 f0f0 f010 1c1f 0103 0307 070f 0f9f 00e0 fefe fcf8 f0e0 - 7ffe fe3c 0407 0f1e 0000 0000 4000 0000 0000 0000 0000 0000 0c1e 0400 0000 0000 - 1f1f 1fdf 2607 0200 cfc1 8001 071f 1c00 e0c0 41fb f080 0000 38f0 e0c0 0000 0000 - 0000 0000 0000 0000 - ( 02 ) - 0000 0000 0000 0000 0000 0000 0000 0001 0001 1ff8 003c fefe 00e7 030f 3f7f 7f0e - 0000 1cd8 8003 0303 0000 0000 80c0 c0c4 0000 0000 0000 0000 0000 0103 0307 070f - 0307 0fff e3c0 c080 fcf8 f0f0 e040 787f 0203 0707 0f0f 1f1f 03c3 fbf8 f8f8 f8f8 - e6e3 e1f1 100c 0f0f 0000 0080 c060 e0c0 0f1f 3f3e 0403 0303 8000 0001 0103 e3fb - 7fff ffff ffff ffff ffc3 c080 8080 0000 f8f0 7000 0e1f 1f1f 0f0f 0707 07c7 fff0 - c8c0 c0c4 e0e0 e0e2 0303 0707 0707 477f f8f8 f8f8 f0f0 f0f0 7f0e 0001 0303 0307 - 0000 00c0 fcff ffff 1f3f 3f3f 7fff 8f01 f0f0 f0f0 e0e0 e0e0 001c 1e1e 1e1c 3c3c - 7838 3838 3c1c 1c1c f000 1c1f 1f1f 0f0f 0707 078f fff1 f0e0 ffff fefe fefc 3c00 - 0000 0000 0000 0001 2038 3f7f 7fff fffe 3c3c 3cdc 8004 0800 0c00 0100 0000 0000 - 0f0f cff7 7078 3818 e0e0 e0e0 e020 3c3f 0707 0f0f 1f1f 3fbf 01e1 fdf8 f0f0 e0c0 - fefc fc38 000f 1e3c 1000 2000 4000 0000 0000 0000 0000 0000 1c1c 0400 0000 0000 - 3f3f 3ffe 6407 0300 8f01 0103 0f3f 1800 8080 c3ff e008 0000 78f0 c080 0000 0000 - 0000 0000 0000 0000 - ( 03 ) - 0000 0000 0000 0000 0000 0000 0000 0003 0001 1ef0 207d fcf8 00c7 071f 7ffe 7c0c - 0080 1c9a 0407 0707 0000 0000 80c0 80cc 0000 0000 0000 0000 0000 0103 0307 070f - 070f 1fdf c380 8001 f8f0 e0c0 8080 f8ff 060f 0f1f 1f3f 3f7f 07c7 f7f0 f0f0 e0e0 - c6c2 e3e1 001c 1f1f 0000 0080 c0c0 e080 0f1e 3c3c 0007 0707 0101 0303 0707 eff3 - ffff ffff fefe fcfc 9f03 0000 0000 0000 e0e0 6030 3e3f 7f7f 1f1f 1f1f 1fdf e7e0 - 8888 80c4 c4c0 c0c2 0707 070f 0f0f 4f77 f0f0 e0e0 e0e0 e0c0 7c08 0607 070f 0f0f - 0000 00c0 fcfe fefe 7fff ffff ff7f 0f01 e0e0 c0c0 c0c0 8080 223c 3c3c 3c3c 7c7c - 7030 3838 3818 181c c020 3c3f 3f3f 3f3f 1f1f 1f9f cfc1 c0c0 fcfc fcf8 f8f0 3008 - 0000 0000 0101 0303 4078 ffff fffe fefc 7c7c 7818 0404 0810 0c02 0101 0000 0000 - 1f1f dfe7 e070 3038 c0c0 c080 8060 7c7f 1f1f 3f3f 3f7f 7f7f 07e7 f1f0 e0c0 8080 - fcf8 f830 081f 3e7c 1020 2040 4080 0000 0000 0000 0000 0000 181c 0200 0000 0000 - 7f7e 3efc 440f 0100 0f00 030f 1f3e 1800 0003 c7f7 c108 0000 f8e0 c080 0000 0000 - 0000 0000 0000 0000 - ( 04 ) - 0000 0000 0000 0000 0000 0000 0000 0103 0001 1ce0 60ff f8f0 0087 0f3f fefc 7800 - 0080 3c1a 0d0f 0f0f 0000 0000 8040 808c 0000 0000 0000 0000 0000 0103 0307 070e - 0f1f 3f9f 8301 0103 e0c0 8000 0080 f8fe 0e1f 3f3f 7f7f ffff 0fdf e7e0 c0c0 c0c0 - 8686 c3c3 213c 3f3f 0000 0080 c0c0 6000 0e1c 3c38 000f 0f0f 0307 070f 0f1f ffe3 - fefe fcfc f8f8 f8f0 1f03 0000 0000 0001 8080 0070 feff ffff 3f3f 3f3f 3fff c780 - 0808 8884 8484 8482 0f0f 0f0f 1f1f 5f67 c0c0 c0c0 c080 8080 7000 1e1f 1f1f 3f3f - 0101 03c3 fff8 f8f8 ffff ffff ff7f 0f01 8080 8080 0000 0000 627e 7c7c 7cfc f8f8 - 6030 3030 3018 1818 8060 7c7f 7f7f 7f7f 3f7f 7fff 8f81 8080 f0f0 f0e0 e0e0 0038 - 0101 0303 0307 070f c0f8 fffe fefc fcf8 f8f8 f818 040c 1810 0802 0301 0000 0000 - 3f3f ffc7 e060 7030 0000 0000 00e0 fdfe 3f7f 7fff ffff ff7e 0fff e1c0 8080 0001 - f8f0 f020 387f fcf8 3020 6040 c080 0000 0000 0000 0000 0000 1818 0200 0000 0000 - 7c7c 7cb8 400f 0100 0e02 0f1f 3f7c d000 0307 cfe7 0318 8000 f0e0 c000 0000 0000 - 0000 0000 0000 0000 - ( 05 ) - 0000 0000 0000 0000 0000 0000 0001 0307 0001 18c0 e1fb f0e0 0087 1f7e fcf8 7010 - 0080 7012 0d1f 1f1f 0000 0000 0040 100c 0000 0000 0000 0000 0000 0103 0306 060c - 0f3f 7f9e 0003 0707 c080 0000 0081 fbfc 3e7f 7fff ffff ffff 3fff c780 8080 0000 - 0c86 8783 637d 7e7e 0000 0080 80c0 6010 0c18 3830 080f 0f1f 0f0f 1f1f 3f3f 9f83 - f8f8 f8f0 f0e0 e0e0 1f02 0101 0303 0307 0000 80f0 feff ffff 7e7f 7f7f 7f3f 0700 - 1808 080c 0c04 0406 1f1f 1f1f 1f1f 7f67 8080 8080 0000 0000 4030 3e7f 7f7f 7fff - 0707 0fcf f3f0 e0e0 fffe fefe fe7c 0c02 0000 0000 0101 0101 e6fe f8f8 f8f8 f8f8 - 6020 2030 3010 1018 00e0 fcfe fefe fe7e ffff ff7f 0f01 0000 e0c0 c0c0 8080 40f8 - 0707 070f 0f1f 1f1f c1f9 fcfc f8f8 f0f0 f8f0 f010 0c1c 1830 0806 0301 0100 0000 - 7e7e bec6 c1e1 6130 0000 0101 01e3 fffc ffff ffff fffe fe7c 3fdf 8100 0000 0103 - e0e0 c000 79fe fcf0 3060 60c0 c080 0000 0000 0000 0000 0000 3008 0200 0000 0000 - f8f8 f8b0 480e 0100 080e 1f3f 7ef8 e100 070f df87 0318 8000 e0c0 8000 0000 0000 - 0000 0000 0000 0000 - -@bg - 0000 0000 0000 0000 0000 0000 0307 0f3f - 0001 1fff ffff ffff 00ff ffff ffff ffff - 00c0 fcfe ffff ffff 0000 0000 80e0 f8fc - 0000 0000 0000 0000 0000 0103 0307 070f - 7fff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - feff ffff ffff ffff 0000 8080 c0e0 f0f0 - 0f1f 3f3f 3f3f 7f7f ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - f8f8 f8fc fcfc fcfe 7f7f 7f7f 7f7f 7f7f - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff fefe fefe fefe fefe - 7f3f 3f3f 3f1f 1f1f ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - fefe fcfc fcfc f8f0 0f0f 0703 0101 0000 - ffff ffff ffff ff7f ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff fffe f0e0 e0c0 c080 0000 - 0000 0000 0000 0000 3f1f 0701 0000 0000 - ffff ffff 7f3f 0300 ffff ffff ffff ff00 - ffff ffff fff8 8000 fcf0 e0c0 0000 0000 - 0000 0000 0000 0000 - -@shadow $0188 diff --git a/projects/examples/demos/bifurcan.tal b/projects/examples/demos/bifurcan.tal deleted file mode 100644 index c62dc8e..0000000 --- a/projects/examples/demos/bifurcan.tal +++ /dev/null @@ -1,131 +0,0 @@ -( Bifurcan ) - -|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1 -|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 -|80 @Controller &vector $2 &button $1 &key $1 -|000 - - @last $1 - @style $1 - @center &x $2 &y $2 - -|100 - -@on-reset ( -> ) - ( | theme ) - #0f3a .System/r DEO2 - #0fda .System/g DEO2 - #0faa .System/b DEO2 - ( | vectors ) - ;on-frame .Screen/vector DEO2 - ;on-mouse .Mouse/vector DEO2 - ;on-button .Controller/vector DEO2 - ( | find center ) - .Screen/width DEI2 #01 SFT2 #33 SFT2 .center/x STZ2 - .Screen/height DEI2 #01 SFT2 #33 SFT2 .center/y STZ2 - ( | background ) - ;tiles - - BRK - -@on-frame ( -> ) - ( | only draw once per second ) - .DateTime/second DEI .last LDZ NEQk ?{ POP2 BRK } - .last STZ - POP - BRK - -@on-mouse ( -> ) - [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;cursor-icn - .Mouse/state DEI ?{ BRK } - select [ LIT2 00 -Mouse/state ] DEO - BRK - -@on-button ( -> ) - .Controller/button DEI ?{ BRK } - select [ LIT2 00 -Controller/button ] DEO - BRK - -@select ( -- ) - .style LDZ INC #03 DIVk MUL SUB .style STZ - ;tiles [ LIT2 00 -style ] LDZ #40 SFT ADD2 - ( >> ) - -( -@|drawing ) - -@ ( -- ) - ( | hrs ) - [ .center/x LDZ2 #0018 SUB2 ] [ .center/y LDZ2 #0048 SUB2 ] .DateTime/hour DEI #0a DIV - [ .center/x LDZ2 #0008 ADD2 ] [ .center/y LDZ2 #0048 SUB2 ] .DateTime/hour DEI #0a DIVk MUL SUB - ( | min ) - [ .center/x LDZ2 #0018 SUB2 ] [ .center/y LDZ2 #0018 SUB2 ] .DateTime/minute DEI #0a DIV - [ .center/x LDZ2 #0008 ADD2 ] [ .center/y LDZ2 #0018 SUB2 ] .DateTime/minute DEI #0a DIVk MUL SUB - ( | sec ) - [ .center/x LDZ2 #0018 SUB2 ] [ .center/y LDZ2 #0018 ADD2 ] .DateTime/second DEI #0a DIV - [ .center/x LDZ2 #0008 ADD2 ] [ .center/y LDZ2 #0018 ADD2 ] .DateTime/second DEI #0a DIVk MUL SUB - -@ ( x* y* n -- ) - ,&digit STR - ,&y STR2 - ,&x STR2 - #0f00 - &>loop ( -- ) - ( save-x ) DUP #03 DIVk MUL SUB #00 SWP #30 SFT2 [ LIT2 &x $2 ] ADD2 .Screen/x DEO2 - ( save-y ) DUP #03 DIV #00 SWP #30 SFT2 [ LIT2 &y $2 ] ADD2 .Screen/y DEO2 - ( get digit* ) DUP [ LIT &digit $1 ] DUP ADD #00 SWP ;digits ADD2 LDA2 - ( get bit ) ROT #0e SWP SUB SFT2 #0001 AND2 - ( set tile ) #30 SFT2 ;tiles ADD2 - ( set style ) .style LDZ #40 SFT #00 SWP ADD2 .Screen/addr DEO2 - ( draw ) [ LIT2 01 -Screen/sprite ] DEO - INC GTHk ?&>loop - POP2 JMP2r - -@ ( addr* -- ) - .Screen/addr DEO2 - .Screen/height DEI2 #03 SFT2 ,&h STR - POP .Screen/width DEI2 #03 SFT2 ,&w STR - POP [ LIT &h $1 ] #00 - &>ver ( -- ) - #00 OVR #30 SFT2 .Screen/y DEO2 - [ LIT &w $1 ] #00 - &>hor ( -- ) - #00 OVR #30 SFT2 .Screen/x DEO2 - [ LIT2 01 -Screen/sprite ] DEO - INC GTHk ?&>hor - POP2 INC GTHk ?&>ver - POP2 JMP2r - -@ ( color addr* -- ) - [ LIT2 00 -Screen/auto ] DEO - ;fill-icn .Screen/addr DEO2 - #40 - .Mouse/x DEI2 ,/x STR2 - .Mouse/y DEI2 ,/y STR2 - .Screen/addr DEO2 - ( >> ) - -@ ( color -- ) - [ LIT2 &x $2 ] .Screen/x DEO2 - [ LIT2 &y $2 ] .Screen/y DEO2 - .Screen/sprite DEO - JMP2r - -( -@|assets ) - -@cursor-icn [ 80c0 e0f0 f8e0 1000 ] - -@fill-icn [ ffff ffff ffff ffff ] - -@digits [ - 7b6f 2492 73e7 73cf 5bc9 79cf 49ef 7249 - 7bef 7bc9 ] - -@tiles [ - 0102 0408 1020 4080 8040 2010 0804 0201 - 0718 2040 4080 8080 0101 0102 0204 18e0 - 0808 0810 e304 0808 0808 0804 e310 0808 ] - diff --git a/projects/examples/demos/bitwise.tal b/projects/examples/demos/bitwise.tal deleted file mode 100644 index 94f5570..0000000 --- a/projects/examples/demos/bitwise.tal +++ /dev/null @@ -1,250 +0,0 @@ -( bitwise ) - -|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ] -|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ] -|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] -|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|80 @Controller [ &vector $2 &button $1 &key $1 ] -|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ] -|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ] -|c0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ] - -( variables ) - -|0000 - -@a-frame - &x $2 &y $2 &x2 $2 &y2 $2 -@b-frame - &x $2 &y $2 &x2 $2 &y2 $2 -@input - &a $1 &b $1 -@pointer - &x $2 &y $2 - -( program ) - -|0100 ( -> ) - - ( theme ) - #0fe7 .System/r DEO2 - #0fce .System/g DEO2 - #0f2c .System/b DEO2 - - ;on-mouse .Mouse/vector DEO2 - - .Screen/width DEI2 #01 SFT2 - DUP2 #0040 SUB2 .a-frame/x STZ2 DUP2 #0040 ADD2 .a-frame/x2 STZ2 - DUP2 #0040 SUB2 .b-frame/x STZ2 #0040 ADD2 .b-frame/x2 STZ2 - - .Screen/height DEI2 #01 SFT2 #0020 SUB2 - DUP2 #0010 SUB2 .a-frame/y STZ2 DUP2 .a-frame/y2 STZ2 - DUP2 .b-frame/y STZ2 #0010 ADD2 .b-frame/y2 STZ2 - - ;redraw JSR2 - -BRK - -@on-mouse ( -> ) - - ;draw-cursor JSR2 - - .Mouse/state DEI #00 NEQ JMP [ BRK ] - - .Mouse/x DEI2 .Mouse/y DEI2 .a-frame ;within-rect JSR2 - ;on-touch-a JCN2 - .Mouse/x DEI2 .Mouse/y DEI2 .b-frame ;within-rect JSR2 - ;on-touch-b JCN2 - -BRK - -@on-touch-a ( -> ) - - .Mouse/x DEI2 .a-frame/x LDZ2 SUB2 - #04 SFT2 NIP #07 SWP SUB STH - - .input/a LDZ - #01 [ STHr #40 SFT ] SFT EOR - .input/a STZ - - ;redraw JSR2 - #00 .Mouse/state DEO - -BRK - -@on-touch-b ( -> ) - - .Mouse/x DEI2 .b-frame/x LDZ2 SUB2 - #04 SFT2 NIP #07 SWP SUB STH - - .input/b LDZ - #01 [ STHr #40 SFT ] SFT EOR - .input/b STZ - - ;redraw JSR2 - #00 .Mouse/state DEO - -BRK - -@redraw ( -- ) - - .a-frame/x LDZ2 .Screen/x DEO2 - .a-frame/y LDZ2 .Screen/y DEO2 - .input/a LDZ #01 ;draw-byte JSR2 - - .b-frame/x LDZ2 .Screen/x DEO2 - .b-frame/y LDZ2 .Screen/y DEO2 - .input/b LDZ #01 ;draw-byte JSR2 - - .b-frame/x LDZ2 .Screen/x DEO2 - .Screen/y DEI2 #000d ADD2 .Screen/y DEO2 - .input LDZ2 AND #03 ;draw-byte JSR2 - - .b-frame/x LDZ2 .Screen/x DEO2 - .Screen/y DEI2 #000d ADD2 .Screen/y DEO2 - .input LDZ2 ORA #03 ;draw-byte JSR2 - - .b-frame/x LDZ2 .Screen/x DEO2 - .Screen/y DEI2 #000d ADD2 .Screen/y DEO2 - .input LDZ2 EOR #03 ;draw-byte JSR2 - - ( labels ) - #05 .Screen/auto DEO - .b-frame/x LDZ2 #0020 SUB2 .Screen/x DEO2 - ;names-icn/and .Screen/addr DEO2 - .b-frame/y2 LDZ2 #0004 ADD2 .Screen/y DEO2 - ,&draw-label JSR - .b-frame/y2 LDZ2 #0014 ADD2 .Screen/y DEO2 - ,&draw-label JSR - .b-frame/y2 LDZ2 #0024 ADD2 .Screen/y DEO2 - ,&draw-label JSR - #00 .Screen/auto DEO - -JMP2r - &draw-label - .b-frame/x LDZ2 #0020 SUB2 .Screen/x DEO2 - #03 .Screen/sprite DEOk DEOk DEO - JMP2r - -@draw-byte ( value -- ) - - STH STH - #0800 - &loop - #07 OVR SUB - STHkr SWP SFT #01 AND OVRr STHr ;draw-bit JSR2 - INC GTHk ,&loop JCN - POP2 - .Screen/y DEI2 #0003 ADD2 .Screen/y DEO2 - .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 - STHr ;draw-hex JSR2 - POPr - -JMP2r - -@draw-bit ( value color -- ) - - STH STH - - #05 .Screen/auto DEO - ;button-icns/off [ #00 STHkr #50 SFT ADD2 ] .Screen/addr DEO2 - OVRr STHr .Screen/sprite DEO - OVRr STHr .Screen/sprite DEO - .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2 - .Screen/x DEI2 #0010 SUB2 .Screen/x DEO2 - OVRr STHr .Screen/sprite DEO - OVRr STHr .Screen/sprite DEO - #00 .Screen/auto DEO - .Screen/y DEI2 #0008 SUB2 .Screen/y DEO2 - - POP2r - -JMP2r - -@draw-hex ( value -- ) - - #01 .Screen/auto DEO - DUP #04 SFT ,&draw JSR - #0f AND ,&draw JSR - #01 .Screen/auto DEO - -JMP2r - &draw - #00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 - ( draw ) #01 .Screen/sprite DEO - JMP2r - -@draw-cursor ( -- ) - - ( clear last cursor ) - ;cursor .Screen/addr DEO2 - .pointer/x LDZ2 .Screen/x DEO2 - .pointer/y LDZ2 .Screen/y DEO2 - #40 .Screen/sprite DEO - ( record pointer positions ) - .Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 - .Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 - ( colorize on state ) - #42 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/sprite DEO - -JMP2r - -@within-rect ( x* y* rect -- flag ) - - STH - ( y < rect.y1 ) DUP2 STHkr INC INC LDZ2 LTH2 ,&skip JCN - ( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN - SWP2 - ( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN - ( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN - POP2 POP2 POPr - #01 -JMP2r - &skip - POP2 POP2 POPr - #00 - -JMP2r - -@cursor - 80c0 e0f0 f8e0 1000 - -@button-icns - &off - 3f40 8080 8080 8080 - f804 0202 0202 0202 - 8080 8080 8040 3f00 - 0202 0202 0204 f800 - &on - 3f40 9fbf bfbf bfbf - f804 f2fa fafa fafa - bfbf bfbf 9f40 3f00 - fafa fafa f204 f800 - -@names-icn - &and - fc02 027e 8286 fa00 - bcc2 8282 8282 8200 - fc82 8282 8282 fc00 - &ora - 7c82 8282 8282 7c00 - fc82 82fc 8282 8200 - fc02 027e 8286 fa00 - &eor - 8282 4438 4482 8200 - 7c82 8282 8282 7c00 - fc82 82fc 8282 8200 - -@font-hex ( 0-F ) - 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 - diff --git a/projects/examples/demos/bunnymark.tal b/projects/examples/demos/bunnymark.tal deleted file mode 100644 index 579d305..0000000 --- a/projects/examples/demos/bunnymark.tal +++ /dev/null @@ -1,221 +0,0 @@ -( bunnymark.tal ) - ( November 2021, Kira Oakley ) - ( March 2022, Devine Lu Linvega ) - -|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|80 @Controller &vector $2 &button $1 &key $1 -|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1 -|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 - -|0000 - - @frames $2 - @last $1 - -|0100 - -@on-reset ( -> ) - ( | theme ) - #2ce9 .System/r DEO2 - #01c0 .System/g DEO2 - #2ce5 .System/b DEO2 - ( | interrupts ) - ;on-frame .Screen/vector DEO2 - ( | fps label ) - .Screen/width DEI2 #0046 SUB2 .Screen/x DEO2 - #0008 .Screen/y DEO2 - ;text/fps #42 - ( | bunnies label ) - #0004 .Screen/x DEO2 - ;text/bunnies #42 - ( | instructions label ) - .Screen/width DEI2 #01 SFT2 #0050 SUB2 .Screen/x DEO2 - ;text/instructions #43 - #0028 #0008 #0000 - ( | seed prng ) - prng-init BRK - -@on-frame ( -> ) - .frames LDZ2k INC2 ROT STZ2 - .DateTime/second DEI .last LDZ EQU ?{ - .DateTime/second DEI .last STZ - .Screen/width DEI2 #002b SUB2 #0008 .frames LDZ2 - #0000 .frames STZ2 } - ( | mouse handling ) - .Mouse/state DEI - ( ) DUP #01 NEQ ?{ add-bunny } - ( ) #02 LTH ?{ remove-bunny } - ( | controller handling ) - .Controller/button DEI - ( ) DUP #01 NEQ ?{ add-bunny } - ( ) #02 LTH ?{ remove-bunny } - ( | clear ) - #0000 DUP2 .Screen/x DEO2 - .Screen/y DEO2 - [ LIT2 80 -Screen/pixel ] DEO - ;sprite/length LDA2 #0000 - &loop ( -- ) - EQU2k ?&bail - DUP2 - INC2 !&loop - &bail ( -- ) - POP2 POP2 BRK - -@add-bunny ( -- ) - ;sprite/length LDA2 - ( | cap bunny count at 65535 ) - DUP2 #ffff EQU2 ?&bail - ( | compute the offset to the beginning of this new bunny's data ) - DUP2 #30 SFT2 ;sprite/array ADD2 - ( | populate the new bunny's x/y/xvel/yvel with random values ) - #00 rand OVR2 STA2 - rand #1f AND rand OVR2 INC2 INC2 STA2 - #00 rand #7f AND OVR2 #0004 ADD2 STA2 - #00 rand #7f AND OVR2 #0006 ADD2 STA2 - ( | pop ptr to bunny data ) - POP2 - ( | write new increased array length ) - INC2 DUP2 ;sprite/length STA2 - ( | update label ) - STH2k #0028 #0008 STH2r - &bail ( pop sprite/length ) - POP2 JMP2r - -@remove-bunny ( -- ) - ;sprite/length LDA2 - ( don't let length go below 0 ) ORAk #00 EQU ?&bail - #0001 SUB2 DUP2 ;sprite/length STA2 - ( update label ) STH2k #0028 #0008 STH2r - &bail POP2 JMP2r - -( -@|drawing ) - -@ ( idx -- ) - ( | compute the offset to the beginning of this bunny's data ) - #30 SFT2 ;sprite/array ADD2 - ( | move the sprite by its velocity ) - LDA2k OVR2 #0004 ADD2 LDA2 ADD2 OVR2 STA2 - INC2k INC2 LDA2 OVR2 #0006 ADD2 LDA2 ADD2 OVR2 INC2 INC2 STA2 - ( | check for right wall collision + bounce x ) - DUP2 #0004 ADD2 LDA2 #0f SFT2 #0001 EQU2 ?&skip-max-x - LDA2k #05 SFT2 #0008 ADD2 .Screen/width DEI2 LTH2 ?&skip-max-x - DUP2 #0004 ADD2 LDA2 #ffff MUL2 OVR2 #0004 ADD2 STA2 - &skip-max-x ( check for left wall collision + bounce x ) - LDA2k #0f SFT2 #0000 EQU2 ?&skip-min-x - DUP2 #0004 ADD2 LDA2 #ffff MUL2 OVR2 #0004 ADD2 STA2 - &skip-min-x ( check for bottom wall collision + bounce y ) - DUP2 #0006 ADD2 LDA2 #0f SFT2 #0001 EQU2 ?&skip-max-y - INC2k INC2 LDA2 #05 SFT2 #0010 ADD2 .Screen/height DEI2 LTH2 ?&skip-max-y - DUP2 #0006 ADD2 LDA2 #ffff MUL2 OVR2 #0006 ADD2 STA2 - !&skip-gravity - &skip-max-y ( check for top wall collision + bounce x ) - INC2k INC2 LDA2 #0f SFT2 #0000 EQU2 ?&skip-min-y - DUP2 #0006 ADD2 LDA2 #ffff MUL2 OVR2 #0006 ADD2 STA2 - !&skip-gravity - &skip-min-y ( apply gravity ) - DUP2 #0006 ADD2 LDA2 #0004 ADD2 OVR2 #0006 ADD2 STA2 - &skip-gravity ( draw the sprite ) - ( top ) LDA2k #05 SFT2 .Screen/x DEO2 - INC2 INC2 LDA2 #05 SFT2 .Screen/y DEO2 - ( draw ) [ LIT2 15 -Screen/auto ] DEO - ;bunny-chr .Screen/addr DEO2 - [ LIT2 85 -Screen/sprite ] DEO - [ LIT2 00 -Screen/auto ] DEO - JMP2r - -@ ( x* y* text* color -- ) - ,&t STR - [ LIT2 01 -Screen/auto ] DEO - &loop ( -- ) - LDAk #20 SUB #00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2 - [ LIT2 &t $1 -Screen/sprite ] DEO - INC2 LDAk ?&loop - POP2 JMP2r - -@ ( x* y* num* -- ) - [ LIT2 01 -Screen/auto ] DEO - SWP2 .Screen/y DEO2 - SWP2 .Screen/x DEO2 - #2710 DIV2k DUP - MUL2 SUB2 #03e8 DIV2k DUP - MUL2 SUB2 #0064 DIV2k DUP - MUL2 SUB2 NIP #0a DIVk DUP - MUL SUB - [ LIT2 00 -Screen/auto ] DEO - JMP2r - -@ ( num -- ) - #30 SFT #00 SWP ;font/num ADD2 .Screen/addr DEO2 - [ LIT2 41 -Screen/sprite ] DEO - JMP2r - -( -@|random ) - -@prng-init ( -- ) - [ LIT2 00 -DateTime/second ] DEI [ LIT2 00 -DateTime/minute ] DEI #60 SFT2 EOR2 [ LIT2 00 -DateTime/hour ] DEI #c0 SFT2 EOR2 ,prng/x STR2 - [ LIT2 00 -DateTime/hour ] DEI #04 SFT2 [ LIT2 00 -DateTime/day ] DEI #10 SFT2 EOR2 [ LIT2 00 -DateTime/month ] DEI #60 SFT2 EOR2 .DateTime/year DEI2 #a0 SFT2 EOR2 ,prng/y STR2 - JMP2r - -@prng ( -- number* ) - [ LIT2 &x $2 ] DUP2 #50 SFT2 EOR2 DUP2 #03 SFT2 EOR2 [ LIT2 &y $2 ] DUP2 ,&x STR2 - DUP2 #01 SFT2 EOR2 EOR2 ,&y STR2k POP JMP2r - -@rand ( -- number ) - prng ADD JMP2r - ( static string data ) - -( -@|assets ) - -@text &fps "FPS: $1 - &bunnies "BUNS: $1 - &instructions "CLICK 20 "TO 20 "ADD 20 "BUNNIES! $1 - -@font ( atari8.uf1 ) - [ - 0000 0000 0000 0000 6060 6060 6000 6000 - 6666 6600 0000 0000 006c fe6c 6cfe 6c00 - 183e 603c 067c 1800 0066 6c18 3066 4600 - 386c 3870 decc 7600 6060 6000 0000 0000 - 0e1c 1818 181c 0e00 7038 1818 1838 7000 - 0066 3cff 3c66 0000 0018 187e 1818 0000 - 0000 0000 0030 3060 0000 007e 0000 0000 - 0000 0000 0018 1800 0206 0c18 3060 4000 ] &num [ - 3c66 6e76 6666 3c00 1838 1818 1818 7e00 - 3c66 060c 1830 7e00 7e0c 180c 0666 3c00 - 0c1c 3c6c 7e0c 0c00 7e60 7c06 0666 3c00 - 3c60 607c 6666 3c00 7e06 0c18 3030 3000 - 3c66 663c 6666 3c00 3c66 663e 060c 3800 - 0060 6000 6060 0000 0030 3000 3030 6000 - 0c18 3060 3018 0c00 0000 7e00 007e 0000 - 6030 180c 1830 6000 3c66 060c 1800 1800 - 3c66 6e6a 6e60 3e00 183c 6666 7e66 6600 - 7c66 667c 6666 7c00 3c66 6060 6066 3c00 - 786c 6666 666c 7800 7e60 607c 6060 7e00 - 7e60 607c 6060 6000 3e60 606e 6666 3e00 - 6666 667e 6666 6600 7830 3030 3030 7800 - 0606 0606 0666 3c00 666c 7870 786c 6600 - 6060 6060 6060 7e00 c6ee fed6 c6c6 c600 - 6676 7e7e 6e66 6600 3c66 6666 6666 3c00 - 7c66 667c 6060 6000 3c66 6666 766c 3600 - 7c66 667c 6c66 6600 3c66 603c 0666 3c00 - 7e18 1818 1818 1800 6666 6666 6666 3e00 - 6666 6666 663c 1800 c6c6 c6d6 feee c600 - 6666 3c18 3c66 6600 6666 663c 1818 1800 - 7e06 0c18 3060 7e00 7860 6060 6060 7800 ] - -@fill-icn [ ffff ffff ffff ffff ] - -@bunny-chr [ - 2466 6600 2424 003c 4200 007e 7e7e 7e7e - 1818 3c3c 1800 0000 ff66 4242 667e 4242 ] - -( -@|memory ) - -@sprite &length $2 - &array &x 0600 &y 0500 &xvel 0060 &yvel 0010 - diff --git a/projects/examples/demos/circles.tal b/projects/examples/demos/circles.tal deleted file mode 100644 index d5bde4a..0000000 --- a/projects/examples/demos/circles.tal +++ /dev/null @@ -1,45 +0,0 @@ -( draw a circle at the center of the screen ) - -|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 - -|100 - -@on-reset ( -> ) - #f0ff .System/r DEO2 - #f0f6 .System/g DEO2 - #f0f2 .System/b DEO2 - #300c - &>l ( -- ) - STHk - ( x ) #00 STHkr DUP2 MUL2 #03 SFT2 #00c0 ADD2 - ( y ) #00a0 - ( radius ) #00 #30 STHkr SUB #20 SFT - ( color ) STHr #01 AND INC - INC GTHk ?&>l - POP2 BRK - -@ ( x* y* r* color -- ) - ,&color STR - DUP2k MUL2 ,&r STR2 - [ LIT2r 0000 ] STH2 - ,&y STR2 - ,&x STR2 - STH2kr SUB2kr STH2r INC2 - &>y ( -- ) - DUP2 [ LIT2 &y $2 ] ADD2 .Screen/y DEO2 - STH2kr SUB2kr STH2r INC2 - &>x ( -- ) - ( x ) ROT2k ABS2-SQ - ( y ) SWP2 ABS2-SQ - ( + ) ADD2 NIP2 [ LIT2 &r $2 ] GTH2 ?{ - DUP2 [ LIT2 &x $2 ] ADD2 .Screen/x DEO2 - [ LIT2 &color 02 -Screen/pixel ] DEO } - ( ) INC2 NEQ2k ?&>x - POP2 POP2 - ( ) INC2 NEQ2k ?&>y - POP2 POP2 POP2r POP2r JMP2r - -@ABS2-SQ ( a* -- res* ) - DUP2k #1f SFT2 MUL2 SUB2 DUP2 MUL2 JMP2r - diff --git a/projects/examples/demos/cube3d.tal b/projects/examples/demos/cube3d.tal deleted file mode 100644 index 8d0683f..0000000 --- a/projects/examples/demos/cube3d.tal +++ /dev/null @@ -1,127 +0,0 @@ -( Cube3d: Just a cube, y'know ) - -|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|000 - - @cube &v0 $8 &v4 $8 - @center &x $2 &y $2 - @timer $1 - -|100 - -@on-reset ( -> ) - ( | theme ) - #4fcd .System/r DEO2 - #4fc3 .System/g DEO2 - #dfc2 .System/b DEO2 - ( | center ) - .Screen/width DEI2 #01 SFT2 #0040 SUB2 .center/x STZ2 - .Screen/height DEI2 #01 SFT2 #0040 SUB2 .center/y STZ2 - ( | begin. ) - ;on-frame .Screen/vector DEO2 - -@on-frame ( -> ) - [ LIT &f $1 ] INCk ,&f STR - DUP #01 AND ?{ POP BRK } - #01 SFT .timer STZ - ( | clear ) - #0000 DUP2 .Screen/x DEO2 - .Screen/y DEO2 - [ LIT2 80 -Screen/pixel ] DEO - ( | draw ) - - BRK - -@ ( frame -- ) - ( | create box ) - #0800 - &>loop ( -- ) - STHk [ LIT2 00 -timer ] LDZ #00 STHkr INC #07 AND #60 SFT ADD2 #00ff AND2 ;table ADD2 LDA #01 SFT #00 .timer LDZ #00 STHkr #60 SFT ADD2 #00ff AND2 ;table ADD2 LDA #02 SFT #00 STHkr #62 SFT2 ADD2 .cube/v0 STHr DUP ADD ADD STZ2 - INC GTHk ?&>loop - POP2 - ( | vertices ) - #0800 - &>ver-loop ( -- ) - DUP DUP ADD LDZ2 - INC GTHk ?&>ver-loop - POP2 - ( lines ) #0400 - &>line-loop ( -- ) - STHk .cube/v0 STHkr DUP ADD ADD .cube/v0 STHkr INC #03 AND DUP ADD ADD - .cube/v0 STHkr DUP ADD ADD .cube/v4 STHkr DUP ADD ADD - .cube/v4 STHkr DUP ADD ADD .cube/v4 STHr INC #03 AND DUP ADD ADD - INC GTHk ?&>line-loop - POP2 JMP2r - -@ ( a b -- ) - STH - STH - ( ) #00 STHkr LDZ .center/x LDZ2 ADD2 - ( ) #00 STHr INC LDZ .center/y LDZ2 ADD2 - ( ) #00 STHkr LDZ .center/x LDZ2 ADD2 - ( ) #00 STHr INC LDZ .center/y LDZ2 ADD2 #05 ! - -@ ( x y -- ) - #00 SWP #0004 SUB2 .center/y LDZ2 ADD2 .Screen/y DEO2 - #00 SWP #0003 SUB2 .center/x LDZ2 ADD2 .Screen/x DEO2 - ;&icn .Screen/addr DEO2 - [ LIT2 05 -Screen/sprite ] DEO - JMP2r - &icn [ 0000 387c 7c7c 3800 ] - -@ ( x1* y1* x2* y2* color -- ) - ,&color STR - ,&y STR2 - ,&x STR2 - ,&y2 STR2 - ,&x2 STR2 - ,&x LDR2 ,&x2 LDR2 SUB2 abs2 ,&dx STR2 - #0000 ,&y LDR2 ,&y2 LDR2 SUB2 abs2 SUB2 ,&dy STR2 - #ffff [ LIT2 00 _&x2 ] LDR2 ,&x LDR2 lts2 DUP2 ADD2 ADD2 ,&sx STR2 - #ffff [ LIT2 00 _&y2 ] LDR2 ,&y LDR2 lts2 DUP2 ADD2 ADD2 ,&sy STR2 - [ LIT2 &dx $2 ] [ LIT2 &dy $2 ] ADD2 STH2 - &while ( -- ) - [ LIT2 &x2 $2 ] DUP2 .Screen/x DEO2 - [ LIT2 &x $2 ] EQU2 [ LIT2 &y2 $2 ] DUP2 .Screen/y DEO2 - [ LIT2 &y $2 ] EQU2 [ LIT2 &color $1 -Screen/pixel ] DEO - AND ?&end - STH2kr DUP2 ADD2 DUP2 ,&dy LDR2 lts2 ?&skipy - STH2r ,&dy LDR2 ADD2 STH2 - ,&x2 LDR2 [ LIT2 &sx $2 ] ADD2 ,&x2 STR2 - &skipy ( -- ) - ,&dx LDR2 gts2 ?&while - STH2r ,&dx LDR2 ADD2 STH2 - ,&y2 LDR2 [ LIT2 &sy $2 ] ADD2 ,&y2 STR2 - !&while - &end POP2r JMP2r - -@abs2 ( a* -- f ) - DUP2 #0f SFT2 EQU ?{ #0000 SWP2 SUB2 } - JMP2r - -@lts2 ( a* b* -- f ) - #8000 STH2k ADD2 SWP2 STH2r ADD2 GTH2 JMP2r - -@gts2 ( a* b* -- f ) - #8000 STH2k ADD2 SWP2 STH2r ADD2 LTH2 JMP2r - -@table ( 256 xy ) - [ - f7f8 f9fa fbfc fcfd fefe ffff ffff ffff - ffff ffff fffe fefd fcfc fbfa f9f8 f7f6 - f5f3 f2f0 efed ecea e8e6 e4e2 e0de dcda - d8d5 d3d1 cecc c9c7 c4c1 bfbc b9b6 b3b0 - aeab a8a5 a29f 9c98 9592 8f8c 8986 8380 - 7c79 7673 706d 6a67 6360 5d5a 5754 514f - 4c49 4643 403e 3b38 3633 312e 2c2a 2725 - 2321 1f1d 1b19 1715 1312 100f 0d0c 0a09 - 0807 0605 0403 0302 0101 0000 0000 0000 - 0000 0000 0001 0102 0303 0405 0607 0809 - 0a0c 0d0f 1012 1315 1719 1b1d 1f21 2325 - 272a 2c2e 3133 3638 3b3e 4043 4649 4c4f - 5154 575a 5d60 6367 6a6d 7073 7679 7c7f - 8386 898c 8f92 9598 9c9f a2a5 a8ab aeb0 - b3b6 b9bc bfc1 c4c7 c9cc ced1 d3d5 d8da - dcde e0e2 e4e6 e8ea eced eff0 f2f3 f5f6 ] - diff --git a/projects/examples/demos/drool.tal b/projects/examples/demos/drool.tal deleted file mode 100644 index 41a35de..0000000 --- a/projects/examples/demos/drool.tal +++ /dev/null @@ -1,236 +0,0 @@ -( - 100r animated logo splash screen - by Andrew Alderwick, 2021 - based on artwork by Hundred Rabbits -) - -( devices ) - -|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ] -|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] -|c0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ] - -( variables ) - -|0000 - -( program ) - -|0100 @Reset ( -> ) - ( seed prng (must be nonzero) ) - #00 .DateTime/second DEI - #00 .DateTime/minute DEI #60 SFT2 EOR2 - #00 .DateTime/hour DEI #c0 SFT2 EOR2 ;prng/x STA2 - #00 .DateTime/hour DEI #04 SFT2 - #00 .DateTime/day DEI DUP2 ADD2 EOR2 - #00 .DateTime/month DEI #60 SFT2 EOR2 - .DateTime/year DEI2 #a0 SFT2 EOR2 ;prng/y STA2 - ;prng/x LDA2 ;prng/y LDA2 EOR2 - - LIT2r =rabbits #0f05 &loop-x - #0f05 &loop-y - ROTk SWP STH2kr STA2 POP - INC2r INC2r - INC - GTHk ,&loop-y JCN - POP2 - INC - GTHk ,&loop-x JCN - POP2 POP2r - ( fall through ) - -@repeat - ;init-occupancy JSR2 - #00 ;precalc-frame STA - ;precalculate-vector .Screen/vector DEO2 - BRK - -@init-occupancy ( -- ) - #1400 &loop-y - #1400 &loop-x - ROTk #00 ;set-occupied JSR2 POP - INC - GTHk ,&loop-x JCN - POP2 - INC - GTHk ,&loop-y JCN - POP2 - ;rabbits - DUP2 #00c8 ADD2 SWP2 &loop-rabbits - LDA2k #01 ;set-occupied JSR2 - INC2 INC2 - GTH2k ,&loop-rabbits JCN - POP2 POP2 - JMP2r - -@precalculate-vector ( -> ) - ,precalculate JSR BRK - -@precalculate ( -- ) - ;rabbits #00c8 OVR ,precalc-frame LDR MUL2 ADD2 ( first rabbit address ) - DUP2 #00c8 ADD2 SWP2 &loop-rabbits - DUP2 ,move-rabbit JSR - INC2 INC2 - GTH2k ,&loop-rabbits JCN - POP2 POP2 - ,precalc-frame LDR INC DUP ,precalc-frame STR - #05 EQU JMP JMP2r - ;display-init JSR2 - ;display .Screen/vector DEO2 - JMP2r - -@precalc-frame $1 - -@set-occupied ( x y value -- ) - STH - #00 SWP #0014 MUL2 ( x yoffset* / value ) - ROT #00 SWP ADD2 ( offset* / value ) - ;occupied ADD2 STH2 STAr - JMP2r - -@move-rabbit ( addr* -- ) - STH2k LDA2 ( x y / addr* ) - DUP2 #00 ,set-occupied JSR - ;&possible-moves ( x y possible* / addr* ) - OVR2 #01 SUB ,&check-move JSR ( up ) - OVR2 INC INC ,&check-move JSR ( down ) - OVR2 #0100 SUB2 ,&check-move JSR ( left ) - OVR2 #0100 ADD2 ,&check-move JSR ( right ) - ;&possible-moves SUB2 ( x y num-possible-times-2* / addr* ) - DUP ,&can-move JCN - POP2 - &write ( x y / addr* ) - DUP2 #01 ,set-occupied JSR - STH2r #00c8 ADD2 STA2 - JMP2r - - &can-move ( x y num-possible-times-2* / addr* ) - NIP2 ( num-possible-times-2* / addr* ) - ,prng JSR SWP2 DIV2k MUL2 SUB2 #fe AND ( chosen-move* / addr* ) - ;&possible-moves ADD2 LDA2 - ,&write JMP - - &check-move ( possible* new-x new-y -- possible'* ) - DUP2 ,get-occupied JSR ,&blocked JCN - OVR2r LIT2r 00c8 SUB2r ( possible* new-x new-y / previous-frame-addr* ) - &check-history-loop - ;rabbits INC2 STH2kr GTH2 ,&history-okay JCN - DUP2 STH2kr LDA2 EQU2 ,&history-clash JCN - LIT2r 00c8 SUB2r - ,&check-history-loop JMP - &history-okay - POP2r - OVR2 STA2 INC2 INC2 - JMP2r - &history-clash ( possible* new-x new-y / previous-frame-addr* ) - POP2r - &blocked ( possible* new-x new-y ) - POP2 - JMP2r - - &possible-moves $10 - -@get-occupied ( x y -- value ) - #00 SWP #0014 MUL2 ( x yoffset* ) - ROT #00 SWP ADD2 ( offset* ) - ;occupied ADD2 LDA - JMP2r - -@prng ( -- number* ) - LIT2 &x $2 - DUP2 #50 SFT2 EOR2 - DUP2 #03 SFT2 EOR2 - LIT2 &y $2 DUP2 ,&x STR2 - DUP2 #01 SFT2 EOR2 EOR2 - ,&y STR2k POP - JMP2r - -@display-init ( -- ) - .Screen/width DEI2 #01 SFT2 #0050 SUB2 ;display-rabbit/xoffset STA2 - .Screen/height DEI2 #01 SFT2 #0050 SUB2 ;display-rabbit/yoffset STA2 - ;rabbit-sprite .Screen/addr DEO2 - JMP2r - -@display-rabbit ( color n counter -- ) - OVR LTHk ,&finish JCN - SUB ( color n timeline ) - DUP #63 GTH ,&start JCN - #17 DIVk STHk MUL SUB ( color n stage-timeline / frame ) - DUP #07 GTH ,&static JCN - ( rabbit is in-between two frames ) - #08 OVR SUB ,&from-weight STR - ,&to-weight STR ( color n / frame ) - #00 SWP DUP2 ADD2 ;rabbits ADD2 #00c8 #00 STHr MUL2 ADD2 ( color from-addr* ) - LDA2k STH2 #00c8 ADD2 LDA2 - &draw ( color to-x to-y / from-x from-y ) - STHr ,&mix JSR LIT2 &yoffset $2 ADD2 .Screen/y DEO2 - STHr ,&mix JSR LIT2 &xoffset $2 ADD2 .Screen/x DEO2 - .Screen/sprite DEO - JMP2r - - &mix ( to-z from-z -- mixed* ) - #00 SWP LIT2 00 &from-weight 00 MUL2 ( to-n from-mixed* ) - ROT #00 SWP LIT2 00 &to-weight 00 MUL2 ADD2 - JMP2r - - &finish ( color n counter n ) - POP - LITr ff ,&static JMP - &start ( color n counter ) - LITr 04 - &static ( color n counter / frame ) - INCr - POP - #00 SWP DUP2 ADD2 ;rabbits ADD2 #00c8 #00 STHr MUL2 ADD2 - LDA2 STH2k - ,&draw JMP - -@display-counter $1 - -@display ( -> ) - ,display-counter LDR #01 SUB DUP ,display-counter STR - DUP #f0 LTH ,&skip-palette JCN - #ff OVR SUB #00 - DUP2 .System/r DEO2 - DUP2 .System/g DEO2 - .System/b DEO2 - &skip-palette - INCk #0000 &clear-loop - ROTk ;display-rabbit JSR2 - INC - DUP #64 LTH ,&clear-loop JCN - POP2 POP - #0500 &draw-loop - ROTk ;display-rabbit JSR2 - INC - DUP #64 LTH ,&draw-loop JCN - POP2 - ,&no-finish JCN - ;sunset .Screen/vector DEO2 - &no-finish - BRK - -@sunset ( -> ) - ;display-counter LDA #02 SUB DUP ;display-counter STA - DUP #1f GTH ,&skip-palette JCN - DUP #01 SFT #00 - DUP2 .System/r DEO2 - DUP2 .System/g DEO2 - .System/b DEO2 - #6400 &draw-loop - #05 OVR #00 ;display-rabbit JSR2 - INC - GTHk ,&draw-loop JCN - POP2 - &skip-palette - ,&no-finish JCN - ;repeat JMP2 - &no-finish - BRK - -@rabbit-sprite 003c 7e7e 7e7e 3c00 - -@occupied $190 - -@rabbits - diff --git a/projects/examples/demos/dvd.tal b/projects/examples/demos/dvd.tal deleted file mode 100644 index 6233d8c..0000000 --- a/projects/examples/demos/dvd.tal +++ /dev/null @@ -1,56 +0,0 @@ -( DVD Bounce ) - -|00 @System/vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen/vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 - -|100 - -@on-reset ( -> ) - ( | theme ) - #4cfd .System/r DEO2 - #4cf3 .System/g DEO2 - #dcf2 .System/b DEO2 - ;dvd/on-frame .Screen/vector DEO2 - ( collision x* ) .Screen/width DEI2 DUP2 #0020 SUB2 ,dvd/cox STR2 - #01 SFT2 - ( collision y* ) .Screen/height DEI2 DUP2 #0010 SUB2 ,dvd/coy STR2 - #01 SFT2 dvd/ - BRK - -@dvd/on-frame ( -> ) - ( | x ) - ,&x LDR2 - ( left ) ORAk ?{ LIT2 ADD2 _&opx STR } - ( right ) DUP2 LIT2 &cox $2 NEQ2 ?{ LIT2 SUB2 _&opx STR } - #0001 [ &opx ADD2 ] - ( | y ) - ,&y LDR2 - ( top ) ORAk ?{ LIT2 ADD2 _&opy STR } - ( bottom ) DUP2 LIT2 &coy $2 NEQ2 ?{ LIT2 SUB2 _&opy STR } - #0001 [ &opy ADD2 ] dvd/ - BRK - -@dvd/ ( x* y* -- ) - #00 / - ( >> ) - -@dvd/ ( x* y* -- ) - ,&y STR2 - ,&x STR2 - #01 - ( >> ) - -@dvd/ ( color -- ) - [ LIT2 36 -Screen/auto ] DEO - ;&sprite-icn .Screen/addr DEO2 - [ LIT2 &x $2 ] .Screen/x DEO2 - [ LIT2 &y $2 ] .Screen/y DEO2 - .Screen/sprite DEOk DEO - JMP2r - -@dvd/sprite-icn [ - 001f 3f38 3838 787f 00fe fe7e 7777 e3c3 - 000f 1f3b 7b77 e7c7 00fc fe8f 8707 0efc - 7f00 000f ff7f 0700 0301 00ff f0f8 ff00 - 8700 00ff 7f7f ff00 f000 00e0 fcfc 8000 ] - diff --git a/projects/examples/demos/hilbert.tal b/projects/examples/demos/hilbert.tal deleted file mode 100644 index a18fcff..0000000 --- a/projects/examples/demos/hilbert.tal +++ /dev/null @@ -1,71 +0,0 @@ -|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|100 - -@on-reset ( -> ) - ( | theme ) - #6f04 .System/r DEO2 - #7f00 .System/g DEO2 - #8f00 .System/b DEO2 - ( | screen size ) - #00c0 - ( ) DUP2 .Screen/width DEO2 - ( ) .Screen/height DEO2 - ( | pen ) - #0020 - ( ) DUP2 .Screen/x DEO2 - ( ) .Screen/y DEO2 - ( | vector ) - ;on-frame .Screen/vector DEO2 - BRK - -@on-frame ( -> ) - [ LIT2 &f $2 ] INC2 DUP2 ,&f STR2 - ( | end ) - DUP2 #0400 LTH2 ?{ - POP2 #0000 .Screen/vector DEO2 - BRK } - d2xy - ( | draw line ) - .Screen/y DEI2 diff ,&y STR2 - .Screen/x DEI2 diff ,&x STR2 - #0400 - &>l ( -- ) - .Screen/x DEI2k [ LIT2 &x $2 ] ADD2 ROT DEO2 - .Screen/y DEI2k [ LIT2 &y $2 ] ADD2 ROT DEO2 - [ LIT2 01 -Screen/pixel ] DEO - INC GTHk ?&>l - POP2 BRK - -@diff ( a* b* -- dir* ) - EQU2k ?{ LTH2 ?{ #0001 JMP2r } - #ffff JMP2r } - POP2 POP2 #0000 JMP2r - -@d2xy ( d* -- x* y* ) - ,&t STR2 - #0000 - ( ) DUP2 ,&x STR2 - ( ) ,&y STR2 - #2001 - &>l ( -- ) - #00 OVR STH2 - [ LIT2 &t $2 ] DUP2 #02 SFT2 ,&t STR2 - ( ) DUP2 #01 SFT2 #0001 AND2 DUP2 ,&rx STR2 - ( ) EOR2 #0001 AND2 ,&ry STR2 - [ LIT2 &x $2 ] [ LIT2 &y $2 ] [ LIT2 &ry $2 ] - ( ) DUP2r [ LIT2r 0001 ] SUB2r - ( | rot ) - ORA ?{ - [ LIT2 &rx $2 ] #0001 NEQ2 ?{ - ( rx-n-1 ) SWP2 STH2kr SWP2 SUB2 - ( ry-n-1 ) SWP2 STH2kr SWP2 SUB2 } - ( swap ) SWP2 } - POP2r - ( ) STH2kr ,&ry LDR2 MUL2 ADD2 ,&y STR2 - ( ) STH2r ,&rx LDR2 MUL2 ADD2 ,&x STR2 - DUP ADD GTHk ?&>l - POP2 - ( ) ,&x LDR2 #20 SFT2 #0020 ADD2 - ( ) ,&y LDR2 #20 SFT2 #0020 ADD2 JMP2r - diff --git a/projects/examples/demos/life.tal b/projects/examples/demos/life.tal deleted file mode 100644 index 718068b..0000000 --- a/projects/examples/demos/life.tal +++ /dev/null @@ -1,221 +0,0 @@ -( uxnemu life.rom ) - ( Any live cell with fewer than two live neighbours dies, as if by underpopulation. ) - ( Any live cell with two or three live neighbours lives on to the next generation. ) - ( Any live cell with more than three live neighbours dies, as if by overpopulation. ) - ( Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. ) - -|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 -|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 -|80 @Controller &vector $2 &button $1 &key $1 -|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1 -|000 - - @world &count $2 - @anchor &x $2 &y $2 &x2 $2 &y2 $2 - -|100 - -@on-reset ( -> ) - ( | theme ) - #02cf .System/r DEO2 - #02ff .System/g DEO2 - #024f .System/b DEO2 - ( | resize ) - #00c0 DUP2 .Screen/width DEO2 - .Screen/height DEO2 - ( | vectors ) - ;on-frame .Screen/vector DEO2 - ;on-mouse .Mouse/vector DEO2 - ;on-control .Controller/vector DEO2 - ( | glider ) - #0703 - #0704 - #0504 - #0705 - #0605 - ( | center ) - .Screen/width DEI2 #01 SFT2 #0040 SUB2 DUP2 .anchor/x STZ2 - #007e ADD2 .anchor/x2 STZ2 - .Screen/height DEI2 #01 SFT2 #0040 SUB2 DUP2 .anchor/y STZ2 - #007e ADD2 .anchor/y2 STZ2 - BRK - -@on-frame ( -> ) - [ LIT2 00 -Mouse/state ] DEI EQU ?{ BRK } - #0000 .world/count STZ2 - [ LIT &f $1 ] INCk ,&f STR - ( ) #03 AND #00 EQU ?{ BRK } - - BRK - -@on-mouse ( -> ) - [ LIT2 00 -Mouse/state ] DEI NEQ #42 ADD ;cursor-icn - ( | on touch in rect ) - .Mouse/state DEI ?{ BRK } - .Mouse/x DEI2 .Mouse/y DEI2 .anchor within-rect ?{ BRK } - ( | paint ) - .Mouse/x DEI2 .anchor/x LDZ2 SUB2 #01 SFT NIP - ( ) .Mouse/y DEI2 .anchor/y LDZ2 SUB2 #01 SFT NIP - - BRK - -@on-control ( -> ) - .Controller/key DEI - ( ) DUP #20 NEQ ?{ - #0000 ;on-frame .Screen/vector DEI2 ORA ?{ SWP2 } - POP2 .Screen/vector DEO2 } - ( ) #1b NEQ ?{ ;MMU/clear1 .System/expansion DEO2 } - BRK - -( -@|core ) - -@ ( -- ) - ;MMU/clear2 .System/expansion DEO2 - #4000 - &ver ( -- ) - DUP ,&y STR - #4000 - &hor ( -- ) - DUP [ LIT &y $1 ] - INC GTHk ?&hor - POP2 INC GTHk ?&ver - POP2 - ( move ) ;MMU/move21 .System/expansion DEO2 - ! - -@ ( x y -- ) - ( x y ) DUP2 STH2k - ( neighbours ) get-neighbours - ( state ) STH2r get-index LDA #00 EQU ?&dead - DUP #02 LTH ?&dies - DUP #03 GTH ?&dies - POP !&save - &dies POP POP2 JMP2r - &dead ( -- ) - DUP #03 EQU ?&birth - POP POP2 JMP2r - &birth POP !&save - &save ( x y -- ) - STH2 - #01 STH2r get-index #1000 ADD2 STA - .world/count LDZ2 INC2 .world/count STZ2 - JMP2r - -@get-index ( x y -- index* ) - ( y ) #3f AND #00 SWP #60 SFT2 ROT - ( x ) #3f AND #00 SWP ADD2 ;bank1 ADD2 JMP2r - -@ ( x y -- ) - get-index STH2 - #01 STH2r STA - JMP2r - -@get-neighbours ( x y -- neighbours ) - ,&y STR - ,&x STR - [ LITr 00 ] #0800 - &l ( -- ) - #00 OVRk ADD2 ;&mask ADD2 LDA2 - ( ) [ LIT &y $1 ] ADD SWP - ( ) [ LIT &x $1 ] ADD SWP get-index LDA [ STH ADDr ] - ( stop at 3 ) DUPr [ LITr 03 ] GTHr [ LITr _&end ] JCNr - ( ) INC GTHk ?&l - &end POP2 STHr JMP2r - &mask [ - ffff 00ff 01ff ff00 0100 ff01 0001 0101 ] - -@within-rect ( x* y* rect -- flag ) - STH - ( y < rect.y1 ) DUP2 STHkr INC INC LDZ2 LTH2 ?&skip - ( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ?&skip - SWP2 - ( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ?&skip - ( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ?&skip - POP2 POP2 POPr #01 JMP2r - &skip POP2 POP2 POPr #00 JMP2r - -( -@|drawing ) - -@ ( -- ) - ( | draw count ) - .anchor/x LDZ2 .Screen/x DEO2 - .anchor/y2 LDZ2 #0008 ADD2 .Screen/y DEO2 - [ LIT2 01 -Screen/auto ] DEO - .world/count LDZ2 - ( | draw grid ) - [ LIT2 01 -Screen/auto ] DEO - .anchor/y LDZ2 .Screen/y DEO2 - ;bank2 ;bank1 - &l ( -- ) - DUP #3f AND ?{ - .Screen/y DEI2k INC2 INC2 ROT DEO2 - .anchor/x LDZ2 .Screen/x DEO2 } - LDAk INC .Screen/pixel DEO - [ LIT2 00 -Screen/pixel ] DEO - INC2 GTH2k ?&l - POP2 POP2 JMP2r - -@ ( short* -- ) - SWP - ( >> ) - -@ ( byte color -- ) - DUP #04 SFT - #0f AND - ( >> ) - -@ ( char color -- ) - #00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 - [ LIT2 03 -Screen/sprite ] DEO - JMP2r - -@ ( color addr* -- ) - [ LIT2 00 -Screen/auto ] DEO - ;fill-icn .Screen/addr DEO2 - #40 - .Mouse/x DEI2 ,/x STR2 - .Mouse/y DEI2 ,/y STR2 - .Screen/addr DEO2 - ( >> ) - -@ ( color -- ) - [ LIT2 &x $2 ] .Screen/x DEO2 - [ LIT2 &y $2 ] .Screen/y DEO2 - .Screen/sprite DEO - JMP2r - -( -@|assets ) - -@MMU ( programs ) - &clear1 [ 01 1000 0000 =bank3 0000 =bank1 ] - &clear2 [ 01 1000 0000 =bank3 0000 =bank2 ] - &move21 [ 01 1000 0000 =bank2 0000 =bank1 ] - -@cursor-icn [ 80c0 e0f0 f8e0 1000 ] - -@fill-icn [ ffff ffff ffff ffff ] - -@font-hex [ - 7c82 8282 8282 7c00 3010 1010 1010 3800 - 7c82 027c 8080 fe00 7c82 021c 0282 7c00 - 2242 82fe 0202 0200 fe80 807c 0282 7c00 - 7c82 80fc 8282 7c00 fe82 0408 0810 1000 - 7c82 827c 8282 7c00 7c82 827e 0202 0200 - 7c82 82fe 8282 8200 fc82 82fc 8282 fc00 - 7c82 8080 8082 7c00 fc82 8282 8282 fc00 - fe80 80f0 8080 fe00 fe80 80f0 8080 8000 ] - -( -@|memory ) - -|8000 @bank1 $1000 - -@bank2 $1000 - -@bank3 $1000 - diff --git a/projects/examples/demos/mandelbrot.tal b/projects/examples/demos/mandelbrot.tal deleted file mode 100644 index 5dcffe9..0000000 --- a/projects/examples/demos/mandelbrot.tal +++ /dev/null @@ -1,172 +0,0 @@ -( mandelbrot.tal ) -( ) -( by alderwick and d_m ) -( ) -( uses 4.12 fixed point arithmetic. ) - -( SCALE LOGICAL SCREENSIZE ) -( #0001 21x16 42x32 ) -( #0002 42x32 84x64 ) -( #0004 84x64 168x128 ) -( #0008 168x128 336x256 ) -( #0010 336x256 672x512 ) -( #0020 672x512 1344x1024 ) - -%SCALE { #0009 } ( 32 ) -%WIDTH { #0015 } ( 21 ) -%HEIGHT { #0010 } ( 16 ) -%XMIN { #de69 } ( -8601 => -8601/4096 => -2.100 ) -%XMAX { #0b33 } ( 2867 => 2867/4096 => 0.700 ) -%YMIN { #ecc7 } ( -4915 => -4915/4096 => -1.200 ) -%YMAX { #1333 } ( 4915 => 4915/4096 => 1.200 ) - -|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 - -|0100 ( -> ) - - ( set colors ) - #00ff .System/r DEO2 - #0ff0 .System/g DEO2 - #0f0f .System/b DEO2 - - ( set window size ) - width #10 SFT2 .Screen/width DEO2 - height #10 SFT2 .Screen/height DEO2 - - ( run ) - draw-mandel BRK - -( logical width ) -@width ( -> w* ) - WIDTH SCALE MUL2 JMP2r - -( logical height ) -@height ( -> h* ) - HEIGHT SCALE MUL2 JMP2r - -( draw the mandelbrot set using 4.12 fixed point numbers ) -@draw-mandel ( -> ) - XMAX XMIN SUB2 width DIV2 ,&dx STR2 ( ; &dx<-{xmax-min}/width ) - YMAX YMIN SUB2 height DIV2 ,&dy STR2 ( ; &dy<-{ymax-ymin}/height ) - [ LIT2 01 -Screen/auto ] DEO ( ; auto<-1 ) - LIT2r 8000 ( [8000] ) - YMAX YMIN ( ymax* ymin* [8000] ) - &yloop ( ymax* y* [8000] ) - XMAX XMIN ( ymax* y* xmax* xmin* [8000] ) - &xloop ( ymax* y* xmax* x* [8000] ) - ROT2k evaluate ( ymax* y* xmax* x* xmax* count^ [8000] ) - draw-px POP2 ( ymax* y* xmax* x* [8000] ) - [ LIT2 &dx $2 ] ADD2 ( ymax* y* xmax* x+dx* [8000] ) - OVR2 STH2kr ADD2 ( ymax* y* xmax* x+dx* 8000+xmax* [8000] ) - OVR2 STH2kr ADD2 ( ymax* y* xmax* x+dx* 8000+xmax* 8000+x+dx* [8000] ) - GTH2 ?&xloop ( ymax* y* xmax* x+dx* [8000] ) - POP2 POP2 ( ymax* y* [8000] ) - #0000 .Screen/x DEO2 ( ymax* y* [8000] ; sc/x<-0 ) - .Screen/y ;inc2 adjust ( ymax* y* [8000] ; sc/y<-sy+1 ) - [ LIT2 &dy $2 ] ADD2 ( ymax* y+dy* [8000] ) - OVR2 STH2kr ADD2 ( ymax* y+dy* 8000+ymax* [8000] ) - OVR2 STH2kr ADD2 ( ymax* y+dy* 8000+ymax* 8000+y+dy* [8000] ) - GTH2 ?&yloop ( ymax* y+dy* [8000] ) - POP2 POP2 POP2r JMP2r ( ) - -( dithering pattern for 2x2 pixels: ) -( ) -( |o o| -> |x o| -> |x o| -> |x x| -> |x x| ) -( |o o| -> |o o| -> |o x| -> |o x| -> |x x| ) -( ) -( |[p+3]/4 [px+1]/4| ) -( |[p+0]/4 [px+2]/4| ) -@draw-px ( px^ -> ) - INCk INCk INC ( p+0 p+1 p+3 ) - draw-quad draw-quad ( p+0 ; draw NW, NE ) - .Screen/y ;inc1 adjust ( ; y<-y+1 ) - .Screen/x ;sub2 adjust ( ; x<-x-2 ) - INCk INC SWP ( p+2 p+0 ) - draw-quad draw-quad ( ; draw SW, SE ) - .Screen/y ;sub1 !adjust ( ; y<-y-1 ) - -( draw one quadrant of a 2x2 area ) -@draw-quad ( p^ -> ) - #02 SFT .Screen/pixel DEO JMP2r ( ; pixel<-p/4 ) - -( evaluate the mandelbrot function at one point ) -@evaluate ( x* y* -> count^ ) - #0000 DUP2 ,&x1 STR2 ( x* y* ; x1<-0 ) - DUP2 ,&y1 STR2 ( x* y* ; y1<-0 ) - DUP2 ,&x2 STR2 ( x* y* ; x2<-0 ) - ,&y2 STR2 ( x* y* ; y2<-0 ) - LIT2r 2000 ( x* y* [20 00] ) - &loop ( x* y* [20 n^] ) - [ LIT2 &x1 $2 ] ( x* y* x1* [20 n^] ) - [ LIT2 &y1 $2 ] ( x* y* x1* y1* [20 n^] ) - smul2 DUP2 ADD2 ( x* y* 2x1y1* [20 n^] ) - OVR2 ADD2 ,&y1 STR2 ( x* y* [20 n^] ; y1<-2x1y1+y* ) - SWP2 [ LIT2 &x2 $2 ] ( y* x* x2* [20 n^] ) - [ LIT2 &y2 $2 ] SUB2 ( y* x* x2-y2* [20 n^] ) - OVR2 ADD2 ,&x1 STR2 SWP2 ( x* y* [20 n^] ; x1<-x2-y2+x* ) - ,&x1 LDR2 square ( x* y* x1^2* [20 n^] ) - DUP2 ,&x2 STR2 ( x* y* x1^2* [20 n^] ; x2<-x1^2* ) - ,&y1 LDR2 square ( x* y* x1^2* y1^2* [20 n^] ) - DUP2 ,&y2 STR2 ( x* y* x1^2* y1^2* [20 n^] ; y2<-y1^2* ) - ADD2 #4000 GTH2 ?&end ( x* y* [20 n^] ) - INCr GTHkr STHr ?&loop ( x* y* [20 n+1*] ) - &end ( x* y* [20 count^] ) - POP2 POP2 NIPr STHr JMP2r ( count^ ) - -( is x a non-negative signed value? ) -@non-negative ( x* -> x* x>=0^ ) - DUP2 #8000 LTH2 JMP2r - -( multiply two signed 4.12 fixed point numbers ) -@smul2 ( a* b* -> ab* ) - LIT2r 0001 non-negative ?{ negate SWPr } ( a* |b|* [sign*] ) - SWP2 non-negative ?{ negate SWPr } ( |b|* |a|* [sign*] ) - smul2-pos STHr ?{ negate } POPr JMP2r ( ab* ) - -( multiply two non-negative fixed point numbers ) -( ) -( a * b = {a0/16 + a1/4096} * {b0/16 + b1/4096} ) -( = a0b0/256 + a1b0/65536 + a0b1/65536 + a1b1/16777216 ) -( = x + y + z + 0 ; the last term is too small to represent, i.e. zero ) -( ) -( x = a0b0 << 4 ) -( y = a1b0 >> 4 ) -( z = a0b1 >> 4 ) -@smul2-pos ( a* b* -> ab* ) - aerate ROT2 aerate ( b0* b1* a0* a1* ) - STH2 ROT2k STH2 MUL2r ( b0* b1* a0* b1* a0* [a1b0*] ) - MUL2 STH2 ADD2r ( b0* b1* a0* [a1b0+a0b1*] ) - NIP2 MUL2 #07ff min #40 SFT2 ( a0b0* [y+z*] ) - STH2r #04 SFT2 ADD2 ( x* [y+z*] ) - #7fff !min ( ab* ) - -( equivalent to DUP2 smul2 but faster ) -@square ( a* -> aa* ) - non-negative ?{ negate } ( |a|* ) - aerate ( 00 ahi^ 00 alo^ ) - OVR2 MUL2 #03 SFT2 SWP2 ( yz* ahi* ) - DUP2 MUL2 #07ff min #40 SFT2 ( x* yz* ) - ADD2 #7fff !min ( aa* ) - -( update a device d^ given a function f: x* -> f[x]* ) -@adjust ( d^ f* -> ) - STH2 DEI2k STH2r JSR2 ROT DEO2 JMP2r - -( return the minimum of two non-negative numbers. ) -@min ( x* y* ) - GTH2k [ JMP SWP2 ] NIP2 JMP2r - -( convert each byte of a a short into a short ) -@aerate ( x* -> 00 xhi^ 00 xlo^ ) - SWP #0000 ROT SWP2 SWP JMP2r - -( negate a fixed point number. doesn't work for #8000 ) -@negate ( x* -> -x* ) - DUP2k EOR2 SWP2 SUB2 JMP2r - -( useful arithmetic operations ) -@inc2 ( n* -> n+2* ) INC2 -@inc1 ( n* -> n+1* ) INC2 JMP2r -@sub1 ( n* -> n-1* ) #0001 SUB2 JMP2r -@sub2 ( n* -> n-2* ) #0002 SUB2 JMP2r diff --git a/projects/examples/demos/move.tal b/projects/examples/demos/move.tal deleted file mode 100644 index 21ae1d7..0000000 --- a/projects/examples/demos/move.tal +++ /dev/null @@ -1,63 +0,0 @@ -( Move: Use controller arrows, leave a slime. ) - -|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|80 @Controller &vector $2 &button $1 &key $1 -|000 - - @hello &x $2 &y $2 - -|100 - -@on-reset ( -> ) - ( | theme ) - #c0f4 .System/r DEO2 - #c0fc .System/g DEO2 - #c0f7 .System/b DEO2 - ( | vectors ) - ;on-frame .Screen/vector DEO2 - ( | set origin ) - .Screen/width DEI2 #01 SFT2 .hello/x STZ2 - .Screen/height DEI2 #01 SFT2 .hello/y STZ2 - [ LIT2 16 -Screen/auto ] DEO - #00 !on-frame/draw - -@on-frame ( -> ) - .Controller/button DEI DUP ?{ POP BRK } - ( flip ) #ff EOR - ( | movement ) - DUP #10 AND ?{ - .hello/y LDZ2k #0001 SUB2 ROT STZ2 } - DUP #20 AND ?{ - .hello/y LDZ2k INC2 ROT STZ2 } - DUP #40 AND ?{ - .hello/x LDZ2k #0001 SUB2 ROT STZ2 } - DUP #80 AND ?{ - .hello/x LDZ2k INC2 ROT STZ2 } - &draw ( button -> ) - .hello/x LDZ2 STH2k .Screen/x DEO2 - .hello/y LDZ2 STH2k .Screen/y DEO2 - ;hello-chr .Screen/addr DEO2 - [ LIT2 c1 -Screen/sprite ] DEOk DEO - ( | draw slime ) - [ LITr -Screen/y ] DEO2r - [ LITr -Screen/x ] DEO2r - ;slime-icn .Screen/addr DEO2 - get-slime .Screen/sprite DEOk DEO - BRK - -@get-slime ( button -- color ) - DUP #01 AND ?{ POP #05 JMP2r } - #02 AND ?{ #0a JMP2r } - #0f JMP2r - -@hello-chr [ - 0007 1820 2040 4044 0000 071f 1f3f 3f3b - 00e0 1804 0402 0222 0000 e0f8 f8fc fcdc - 4040 4423 2018 0700 3f3f 3b1c 1f07 0000 - 0202 22c4 0418 e000 fcfc dc38 f8e0 0000 ] - -@slime-icn [ - 0000 0000 0003 0707 0000 0000 00c0 e0e0 - 0707 0300 0000 0000 e0e0 c000 0000 0000 ] - diff --git a/projects/examples/demos/polycat.tal b/projects/examples/demos/polycat.tal deleted file mode 100644 index b1b1075..0000000 --- a/projects/examples/demos/polycat.tal +++ /dev/null @@ -1,145 +0,0 @@ -( Polycat: - A cat with one eye, and the hind and tail of a lizard. - Original character by Rekka Bellum ) - -|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixeld $1 &sprite $1 -|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2 - -|0000 - -@cat &x $2 &y $2 &timer $1 -@pointer &x $2 &y $2 - -|0100 ( -> ) - - ( theme ) - #0a3f .System/r DEO2 - #05df .System/g DEO2 - #0caf .System/b DEO2 - ( DOS resolution ) - #0140 .Screen/width DEO2 - #00c8 .Screen/height DEO2 - ( vectors ) - ;on-mouse .Mouse/vector DEO2 - ( find center ) - .Screen/width DEI2 #01 SFT2 .cat/x STZ2 - .Screen/height DEI2 #01 SFT2 .cat/y STZ2 - ( draw ground ) - #f6 .Screen/auto DEO - .cat/y LDZ2 #0018 ADD2 .Screen/y DEO2 - .cat/x LDZ2 #0010 SUB2 .Screen/x DEO2 - ;ground .Screen/addr DEO2 - #01 .Screen/sprite DEO - ( init ) - #ff ;draw-eye/last STA - #ff ;draw-tail/last STA - ( set screen mode auto-x ) - #05 .Screen/auto DEO - ,draw-polycat JSR - -BRK - -@draw-polycat ( -- ) - - ( ears ) - .cat/y LDZ2 .Screen/y DEO2 - .cat/x LDZ2 #0008 SUB2 .Screen/x DEO2 - ;ears .Screen/addr DEO2 - #81 .Screen/sprite DEOk DEO - ( body ) - .cat/y LDZ2 #0010 ADD2 .Screen/y DEO2 - .cat/x LDZ2 #0008 SUB2 .Screen/x DEO2 - ;body .Screen/addr DEO2 - #81 .Screen/sprite DEO - ( eye/tail ) - #00 ,draw-eye JSR - #00 ;draw-tail ( .. ) - -JMP2 - -@on-mouse ( -> ) - - .Mouse/x DEI2 .cat/x LDZ2 GTH2 #50 SFT - .Mouse/y DEI2 .cat/y LDZ2 GTH2 #60 SFT - ADD ,draw-eye JSR - .cat/timer LDZ INC [ DUP ] .cat/timer STZ - #04 SFT ,draw-tail JSR - ,draw-cursor JSR - -BRK - -@draw-eye ( quad -- ) - - DUP ,&last LDR NEQ ,&changed JCN - POP JMP2r &changed - ( only redraw on change ) - #00 OVR ;eye ADD2 .Screen/addr DEO2 - .cat/y LDZ2 #0008 ADD2 .Screen/y DEO2 - .cat/x LDZ2 #0008 SUB2 .Screen/x DEO2 - #81 .Screen/sprite DEOk DEO - ,&last STR - -JMP2r - &last $1 - -@draw-tail ( frame -- ) - - STHk ,&last LDR NEQ ,&changed JCN - POPr JMP2r &changed - ( only redraw on change ) - STHr #00 OVR ;frames ADD2 LDA - #00 SWP #40 SFT2 ;body/tail ADD2 - .Screen/addr DEO2 - .cat/x LDZ2 .Screen/x DEO2 - .cat/y LDZ2 #0010 ADD2 .Screen/y DEO2 - #81 .Screen/sprite DEO - ,&last STR - -JMP2r - &last $1 - -@draw-cursor ( -- ) - - ( last cursor ) - ;cursor STH2k .Screen/addr DEO2 - .pointer/x LDZ2 .Screen/x DEO2 - .pointer/y LDZ2 .Screen/y DEO2 - #40 .Screen/sprite DEO - ( new cursor ) - STH2r .Screen/addr DEO2 - .Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 - .Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 - #41 .Mouse/state DEI #00 NEQ ADD .Screen/sprite DEO - -JMP2r - -@cursor - 80c0 e0f0 f8e0 1000 -@frames - 00 01 02 03 02 01 00 00 - 00 00 00 00 00 00 00 00 -@ears - 081c 3e3e 7f7f ffff 081c 3e3e 7f7f fffc - 081c 3c3e 7e7e ffff 081c 3c3e 7e7e ff1f -@eye - ffff ffff ff7f 3f0f f7ef cfe7 f07c 3f0f - ffff ffff fffe fcf0 87c3 c183 071e fcf0 - ffff ffff ff7f 3f0f f0e1 c1e0 f07c 3f0f - ffff ffff fffe fcf0 f7fb f9f3 071e fcf0 - ffff ffff ff7f 3f0f f0e7 cfef f77c 3f0f - ffff ffff fffe fcf0 0783 c1c3 871e fcf0 - ffff ffff ff7f 3f0f f0e0 c1e1 f07c 3f0f - ffff ffff fffe fcf0 07f3 f9fb f71e fcf0 -@body - 0707 0707 0302 0200 0107 0707 0300 0000 - &tail - e0f0 f0e0 e080 8000 c0f2 f9f9 fef8 b000 - e0f0 f0e0 e080 8000 c0f2 f9f9 fef8 b000 - e0f0 f0e0 e080 8000 c0f2 faf9 fef8 b000 - e0f0 f0e0 e080 8000 c0f1 faf9 fef8 b000 - 0707 0707 0f08 1000 0307 0707 0f00 0000 - e0e0 e0e0 e080 8000 f2f9 f9fe b884 8400 -@ground - bf00 5c02 0202 020c ef10 6f90 8080 8074 - ff00 fe01 0100 0116 fd00 3c40 4040 4028 diff --git a/projects/examples/demos/pond.tal b/projects/examples/demos/pond.tal deleted file mode 100644 index abfaf6d..0000000 --- a/projects/examples/demos/pond.tal +++ /dev/null @@ -1,145 +0,0 @@ -( pond.tal ) - -|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2 - -|000 - - @circle &xc $2 &yc $2 &x $2 &y $2 &r $2 &d $2 - -|100 - -@on-reset ( -> ) - ( | theme ) - #2c2c DUP2 .System/r DEO2 - DUP2 .System/g DEO2 - .System/b DEO2 - ;on-mouse .Mouse/vector DEO2 - ;on-frame .Screen/vector DEO2 - BRK - -@on-mouse ( -> ) - #c1 ;touch-chr/down ;touch-chr .Mouse/state DEI ?{ SWP2 } - POP2 - BRK - -@on-frame ( -> ) - ( | 30 fps ) - [ LIT &f $1 ] INCk ,&f STR - ?{ BRK } - ( | clear ) - #0000 DUP2 .Screen/x DEO2 - .Screen/y DEO2 - [ LIT2 80 -Screen/pixel ] DEO - ( | draw ) - ;particles/end ;particles - &>l ( -- ) - ( | animate particle ) - DUP2 - ( | increase size ) - DUP2 #0004 ADD2 LDA2k INC2 SWP2 STA2 - #0006 ADD2 GTH2k ?&>l - POP2 POP2 - ( | add particle ) - [ LIT &lock $1 ] DUP ?{ - .Mouse/state DEI ?{ POP BRK } - ( | touch ) - .Mouse/x DEI2 #0004 ADD2 .Mouse/y DEI2 #0004 ADD2 - [ LIT2 08 _&lock ] STR - POP BRK } - #01 SUB ,&lock STR - BRK - -@ ( x* y* -- ) - SWP2 [ LIT2r &ptr =particles ] STH2kr INC2r INC2r STA2 - STH2kr INC2r INC2r STA2 - #0001 STH2kr INC2r INC2r STA2 - STH2r DUP2 ;particles/end LTH2 ?{ POP2 ;particles } - ,&ptr STR2 - JMP2r - -@ ( color addr* -- ) - ;fill-icn .Screen/addr DEO2 - #40 - .Screen/addr DEO2 - .Mouse/x DEI2 ,/x STR2 - .Mouse/y DEI2 ,/y STR2 - ( >> ) - -@ ( color -- ) - [ LIT2 16 -Screen/auto ] DEO - [ LIT2 &x $2 ] .Screen/x DEO2 - [ LIT2 &y $2 ] .Screen/y DEO2 - .Screen/sprite DEOk DEO - JMP2r - -@ ( addr* -- ) - LDA2k ,&x STR2 - INC2 INC2 LDA2k ,&y STR2 - INC2 INC2 LDA2 [ LIT2 &x $2 ] [ LIT2 &y $2 ] ROT2 - ( >> ) - -@ ( xc* yc* r* -- ) - .circle/r STZ2 - .circle/yc STZ2 - .circle/xc STZ2 - #0000 .circle/x STZ2 - .circle/r LDZ2 .circle/y STZ2 - .circle/r LDZ2 #10 SFT2 .circle/d STZ2 - ( draw ) - &>loop ( -- ) - ( incr ) .circle/x LDZ2 INC2 .circle/x STZ2 - .circle/d LDZ2 #0001 LTS2 ?{ - ( decr ) .circle/y LDZ2 #0001 SUB2 .circle/y STZ2 - .circle/x LDZ2 .circle/y LDZ2 SUB2 #20 SFT2 .circle/d LDZ2 ADD2 .circle/d STZ2 !&end } - .circle/x LDZ2 #20 SFT2 .circle/d LDZ2 ADD2 .circle/d STZ2 - &end ( draw ) - - .circle/y LDZ2 .circle/x LDZ2 #0001 SUB2 GTS2 ?&>loop - JMP2r - -@LTS2 ( a* b* -- f ) - #8000 ADD2 SWP2 #8000 ADD2 GTH2 JMP2r - -@GTS2 ( a* b* -- f ) - #8000 ADD2 SWP2 #8000 ADD2 LTH2 JMP2r - -@ ( -- ) - .circle/xc LDZ2 .circle/x LDZ2 ADD2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 - .circle/xc LDZ2 .circle/x LDZ2 SUB2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 - .circle/xc LDZ2 .circle/x LDZ2 ADD2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 - .circle/xc LDZ2 .circle/x LDZ2 SUB2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 - .circle/xc LDZ2 .circle/y LDZ2 ADD2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 - .circle/xc LDZ2 .circle/y LDZ2 SUB2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 - .circle/xc LDZ2 .circle/y LDZ2 ADD2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 - .circle/xc LDZ2 .circle/y LDZ2 SUB2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 - ( >> ) - -@ ( x* y* -- ) - DUP2 .Screen/height DEI2 GTH2 ?{ - .Screen/y DEO2 - DUP2 .Screen/width DEI2 GTH2 ?{ - .Screen/x DEO2 - [ LIT2r 01 -Screen/pixel ] DEOr - JMP2r } - POP2 JMP2r } - POP2 POP2 JMP2r - -@touch-chr [ - 0000 0000 0814 1417 0000 0000 0008 0808 - 0000 0000 0000 00c0 0000 0000 0000 0000 - 1010 2010 1008 0700 0f0f 1f0f 0f07 0000 - 2010 1010 2020 c000 c0e0 e0e0 c0c0 0000 ] - &down [ - 0000 0000 0000 0817 0000 0000 0000 0008 - 0000 0000 0000 00c0 0000 0000 0000 0000 - 1010 2010 1008 0700 0f0f 1f0f 0f07 0000 - 2010 1010 2020 c000 c0e0 e0e0 c0c0 0000 ] - -@fill-icn [ - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff ] - -@particles $60 &end - diff --git a/projects/examples/demos/snake.tal b/projects/examples/demos/snake.tal deleted file mode 100644 index 697ae6f..0000000 --- a/projects/examples/demos/snake.tal +++ /dev/null @@ -1,171 +0,0 @@ -( uxnemu snake.rom ) - -|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|80 @Controller &vector $2 &button $1 &key $1 -|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 -|000 - - @arena &w $1 &h $1 - @apple &pos &x $1 &y $1 - @snake &pos &x $1 &y $1 &direction $1 &length $1 &dead $1 &tail $40 - -|100 - -@on-reset ( -> ) - ( | theme ) - #0f7e .System/r DEO2 - #0fe6 .System/g DEO2 - #0f62 .System/b DEO2 - ( | vectors ) - ;on-frame .Screen/vector DEO2 - ;on-button .Controller/vector DEO2 - ( | resize ) - #00c8 .Screen/width DEO2 - #0100 .Screen/height DEO2 - ( | set arena ) - .Screen/width DEI2 #03 SFT2 .arena/w STZ - POP .Screen/height DEI2 #03 SFT2 .arena/h STZ - POP [ LIT2 01 -Screen/auto ] DEO - reset BRK - -@on-frame ( -> ) - [ LIT &f $1 ] INCk ,&f STR - #04 GTH ?{ BRK } - [ LIT2 00 _&f ] STR - #00 - - [ LIT2 02 -snake/dead ] LDZ ADD - #83 - - BRK - -@on-button ( -> ) - .Controller/button DEI - ( ) DUP #f0 AND ?&arrow - ( ) #0f AND ?&button - BRK - &arrow ( button -> ) - #04 SFT .snake/direction STZ - BRK - &button ( -> ) - reset BRK - -@reset ( -- ) - #00 - #00 - [ LIT2 00 -snake/dead ] STZ - [ LIT2 00 -snake/length ] STZ - [ LIT2 00 -snake/direction ] STZ - .arena/w LDZ #01 SFT #01 SUB .snake/x STZ - .arena/h LDZ #01 SFT #01 SUB .snake/y STZ - #03 - ! - -@ ( -- ) - ( | copy tail ) - [ LITr -snake/pos ] LDZ2r .snake/length LDZ #00 - &>loop ( -- ) - DUPk ADD .snake/tail ADD LDZ2k STH2 - SWP2r STH2r ROT STZ2 - INC GTHk ?&>loop - POP2 POP2r - ( ) .snake/dead LDZ ?&end - .snake/direction LDZ - ( ) DUP #01 NEQ ?{ - .snake/y LDZk #01 SUB .arena/h set-pos } - DUP #02 NEQ ?{ - .snake/y LDZk INC .arena/h set-pos } - DUP #04 NEQ ?{ - .snake/x LDZk #01 SUB .arena/w set-pos } - DUP #08 NEQ ?{ - .snake/x LDZk INC .arena/w set-pos } - POP - ( | detect collision with apple ) - .snake/pos LDZ2 .apple/pos LDZ2 NEQ2 ?{ - #00 - .snake/length LDZk INC SWP STZ - - ! } - ( | detect collision with body ) - .snake/length LDZ #01 - &>loop-body ( -- ) - DUPk ADD .snake/tail ADD LDZ2 .snake/pos LDZ2 NEQ2 ?{ - [ LIT2 01 -snake/dead ] STZ - #03 } - INC GTHk ?&>loop-body - POP2 &end JMP2r - -@set-pos ( z mod max -- ) - LDZ OVR INC ?{ ROT STZ - POP JMP2r } - DIVk MUL SUB SWP STZ - JMP2r - -@ ( -- ) - .DateTime/hour DEI2 .DateTime/minute DEI2 MUL2 - ( ) DUP2 #1234 MUL2 ADD .arena/w LDZ DIVk MUL SUB .apple/x STZ - ( ) #abcd MUL2 ADD .arena/h LDZ DIVk MUL SUB .apple/y STZ - JMP2r - -( -@|drawing ) - -@ ( color -- ) - STH - ( | draw tail ) - ;snake-icns .Screen/addr DEO2 - [ LIT2 -snake/tail -snake/length ] LDZ DUP ADD OVR ADD SWP - &>loop ( -- ) - LDZ2k #0005 SFT2 .Screen/y DEO2 - #0005 SFT2 .Screen/x DEO2 - DUPr [ LITr -Screen/sprite ] DEOr - INC INC GTHk ?&>loop - POP2 - ( | draw head ) - .snake/pos LDZ2 #0005 SFT2 .Screen/y DEO2 - #0005 SFT2 .Screen/x DEO2 - ;snake-icns/face .Screen/addr DEO2 - [ LITr -Screen/sprite ] DEOr - JMP2r - -@ ( color -- ) - .apple/x LDZ #0005 SFT2 .Screen/x DEO2 - .apple/y LDZ #0005 SFT2 .Screen/y DEO2 - STHk ;apple-chr ;fill-icn [ LITr 01 JCNr SWP2 POP2 ] .Screen/addr DEO2 - .Screen/sprite DEO - JMP2r - -@ ( -- ) - #0010 DUP2 .Screen/x DEO2 - .Screen/y DEO2 - .snake/length LDZ - ( x0 ) DUP #04 SFT - ( >> ) - -@ ( num -- ) - #000f ROT AND #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 - [ LIT2 41 -Screen/sprite ] DEO - JMP2r - -( -@|assets ) - -@snake-icns [ 7eff ffff ffff ff7e ] - &face [ 7eff ffdb ffe7 ff7e ] - -@apple-chr [ - 0000 76ff ffff 7e3c 1008 0000 0000 0000 ] - -@fill-icn [ ffff ffff ffff ffff ] - -@font-hex [ - 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 ] - diff --git a/projects/examples/devices/audio-tests.tal b/projects/examples/devices/audio-tests.tal deleted file mode 100644 index 8be0439..0000000 --- a/projects/examples/devices/audio-tests.tal +++ /dev/null @@ -1,430 +0,0 @@ -( dev/audio-tests ) - -|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] -|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] -|30 @Audio0 [ &vector $2 &position $2 &output $1 &duration $2 &pad $1 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|40 @Audio1 [ &vector $2 &position $2 &output $1 &duration $2 &pad $1 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|50 @Audio2 [ &vector $2 &position $2 &output $1 &duration $2 &pad $1 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|60 @Audio3 [ &vector $2 &position $2 &output $1 &duration $2 &pad $1 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|80 @Controller &vector $2 &button $1 &key $1 - -|0100 @on-reset ( -> ) - ( | theme ) - #0f8f .System/r DEO2 - #0f8f .System/g DEO2 - #0f80 .System/b DEO2 - ( | vectors ) - ;on-frame .Screen/vector DEO2 - ;on-button .Controller/vector DEO2 - #0000 .Audio0/vector DEO2 - ;on-audio1 .Audio1/vector DEO2 - ;on-audio2 .Audio2/vector DEO2 - ;on-audio3 .Audio3/vector DEO2 - ( | setup kick ) - ;kick .Audio0/addr DEO2 - ;kick/end ;kick SUB2 .Audio0/length DEO2 - #ff .Audio0/volume DEO - #00ff .Audio0/adsr DEO2 - ( | setup sine ) - ;sine .Audio1/addr DEO2 - ;sine/end ;sine SUB2 - .Audio1/length DEO2 - #ff .Audio1/volume DEO - #01ff .Audio1/adsr DEO2 - #00c0 .Audio1/duration DEO2 - ( | setup sine ) - ;sine .Audio2/addr DEO2 - ;sine/end ;sine SUB2 - .Audio2/length DEO2 - #ff .Audio2/volume DEO - #2200 .Audio2/adsr DEO2 - #00c0 .Audio2/duration DEO2 - ( | setup sine ) - ;sine .Audio3/addr DEO2 - ;sine/end ;sine SUB2 - .Audio3/length DEO2 - #ff .Audio3/volume DEO - #0fff .Audio3/adsr DEO2 - #00c0 .Audio3/duration DEO2 - ( | start ) - #00 .Audio0/pitch DEO - BRK - -@on-button ( -> ) - .Controller/button DEI #02 AND ?play-kick - BRK - -@play-kick ( -> ) - #3c #80 ORA .Audio0/pitch DEO - BRK - -@get-note ( offset* -- ) - #001f AND2 ;melody ADD2 LDA - JMP2r - -@on-audio1 ( -> ) - [ LIT2 00 &f $1 ] INCk ,&f STR - get-note .Audio1/pitch DEO - BRK - -@on-audio2 ( -> ) - [ LIT2 00 &f $1 ] INCk ,&f STR - get-note #0c SUB .Audio2/pitch DEO - BRK - -@on-audio3 ( -> ) - [ LIT2 00 &f $1 ] INCk ,&f STR - get-note #18 SUB .Audio3/pitch DEO - BRK - -@on-frame ( -> ) -BRK - -@melody [ - 54 52 54 4f 4b 4f 48 00 - 54 52 54 4f 4b 4f 48 00 - 54 56 57 56 57 54 56 54 - 56 52 54 52 54 50 54 00 ] - -@sine [ - 8083 8689 8c8f 9295 989b 9ea1 a4a7 aaad - b0b3 b6b9 bbbe c1c3 c6c9 cbce d0d2 d5d7 - d9db dee0 e2e4 e6e7 e9eb ecee f0f1 f2f4 - f5f6 f7f8 f9fa fbfb fcfd fdfe fefe fefe - fffe fefe fefe fdfd fcfb fbfa f9f8 f7f6 - f5f4 f2f1 f0ee eceb e9e7 e6e4 e2e0 dedb - d9d7 d5d2 d0ce cbc9 c6c3 c1be bbb9 b6b3 - b0ad aaa7 a4a1 9e9b 9895 928f 8c89 8683 - 807d 7a77 7471 6e6b 6865 625f 5c59 5653 - 504d 4a47 4542 3f3d 3a37 3532 302e 2b29 - 2725 2220 1e1c 1a19 1715 1412 100f 0e0c - 0b0a 0908 0706 0505 0403 0302 0202 0202 - 0102 0202 0202 0303 0405 0506 0708 090a - 0b0c 0e0f 1012 1415 1719 1a1c 1e20 2225 - 2729 2b2e 3032 3537 3a3d 3f42 4547 4a4d - 5053 5659 5c5f 6265 686b 6e71 7477 7a7d ] &end - -@kick [ -7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7e7f 7e7e -7e7e 7e7e 7e7e 7e7e 7d7d 7d7d 7c7c 7c7c -7c7c 7c7c 7b7b 787a 7576 7775 7a78 7a7a -7b7a 7c7b 7a7c 7879 7a78 7d7b 7f7e 7b7d -6e75 6c6d 8779 a799 949e 5a72 5451 8975 -9b9e 657e 3f4a 403f 4e42 725f 9386 a09c -999f 8290 6675 585b 6157 7168 7475 6d73 -6f6d 7c74 807e 727a 626a 5e60 6863 7a72 -8682 8486 737b 6569 6864 7b74 8786 8186 -7579 7372 7875 7b7b 7d7b 837e 8a86 888c -7c85 7077 706f 8076 968a a29c 9ba0 8b94 -7d84 7f7d 8984 9790 a19c a4a3 9ea1 9a9c -999a 9999 9a99 9b99 a49f aeaa b2b4 a8ae -9ea1 9f9c a9a3 b3af b7b6 b6b8 b2b4 b1b1 -b1b0 b4b2 b4b4 b3b4 b5b4 bab7 bdbb bdbd -bebe bebe babc b9b9 bdbb c0bf c3c2 c2c3 -bebf bdbd c0bf c0c2 bbbc bdb9 c5c2 c7c8 -c3c6 bec0 bbbb bdbb bfbd c0c0 bcbf b9bb -b9b9 bdba bebe b8bc b1b5 b1b1 b3b2 b2b2 -abae a9aa acab b2af b4b3 b2b3 acb0 a4a8 -9ca0 9499 8a8f 8184 837f 9288 a09b a1a4 -969d 8c90 8989 8a88 8789 8084 777c 6c72 -6468 6563 6665 6a68 6d6c 6d6e 696b 6266 -5d5f 5b5c 5b5b 5a5b 5658 5354 5152 4e4f -4b4c 494a 4647 4445 4142 3f40 3c3d 3b3c -383a 3637 3535 3234 3031 2f2f 2d2e 2c2c -292a 2728 2626 2425 2324 2222 2121 1f20 -1e1f 1d1e 1c1c 1f1e 1e1e 1f1f 1f1f 1c1d -1b1c 1b1b 1a1a 1a1a 1c1b 1b1c 1b1a 1b1b -1b1b 1a1b 1b1b 1c1c 1d1c 1d1d 201e 2121 -2021 2020 2020 2221 2222 2423 2524 2827 -2929 2929 2a29 2b2a 2d2d 2e2e 2f2e 3231 -3434 3334 3533 3836 3c3a 3d3d 3e3d 3f3e -4241 4543 4645 4646 4746 4a48 4f4c 5351 -5554 5555 5656 5957 5b5a 5d5c 605e 6462 -6766 6968 6a69 6e6c 7371 7676 7476 7171 -7572 7e78 8682 8889 8588 8283 8483 8a86 -8f8d 9191 9593 9896 9b99 9e9d a09f a1a1 -a1a1 a4a3 a8a6 acaa afad b2b1 b4b3 b7b5 -bbba bcbb bdbc bebe bfbf c0bf c4c2 c7c6 -c8c7 c9c9 cbca cdcc cfcf d1d0 d3d2 d5d4 -d6d6 d7d7 dad8 dcdb dddc dedd dfde e0df -e1e1 e2e2 e5e4 e6e5 e7e6 e8e7 e8e8 e9e9 -eaea ebeb eceb edec eded eeee efee f0ef -eff0 efef f0ef f0f0 f1f1 f1f1 f2f2 f1f2 -eff0 eeef eced edec eded eded eeee eeee -edee ecec ebeb ebeb eaea e9ea e9e9 e7e8 -e6e7 e3e4 e3e3 e3e3 e2e3 e1e2 e0e0 dee0 -dddd dbdc dadb d9da d7d8 d6d6 d4d5 d2d3 -d1d1 ced0 cccd cbcc c9ca c7c8 c5c6 c4c5 -c2c3 c0c1 bfc0 bcbd babb b8b9 b7b7 b5b6 -b2b3 b0b1 adae abac a9aa a7a8 a6a7 a3a5 -a1a2 9fa0 9d9e 9a9b 9899 9596 9293 9091 -8e8f 8d8d 8b8c 888a 8486 8082 7d7f 7b7c -7a7b 7a7a 797a 7678 7274 6e70 6a6d 6568 -6263 6261 6362 6464 6264 5c60 5659 5254 -4e50 4a4c 4b4a 4e4c 4d4e 4c4d 4a4b 4347 -3c3f 3638 3535 3635 3938 3939 3637 3335 -2e30 292b 2627 2625 2727 2627 2525 2324 -2021 1f1f 1d1e 1a1b 191a 1819 1718 1516 -1314 1213 1112 1011 0f10 0e0f 0c0d 0a0b -0a0a 0909 0809 0708 0707 0606 0505 0405 -0404 0303 0203 0202 0101 0101 0202 0202 -0101 0101 0000 0000 0000 0000 0201 0403 -0404 0404 0303 0203 0302 0504 0405 0505 -0606 0707 0808 0808 0a09 0c0b 0c0c 0c0c -0c0d 0c0c 0e0d 1110 1312 1515 1515 1615 -1616 1817 1919 1b1a 1d1c 1f1d 2120 2322 -2424 2625 2727 2827 2a29 2c2a 2e2d 302f -3231 3433 3635 3837 3a39 3a3a 3c3b 3f3e -4241 4443 4645 4847 4a49 4b4a 4d4c 4f4e -5150 5453 5655 5958 5b5a 5c5c 5e5d 6160 -6362 6564 6766 6968 6b6a 6d6c 6f6e 7271 -7574 7777 7878 7979 7b7a 7d7c 7f7e 8281 -8584 8786 8988 8b8a 8c8c 8e8d 8f8e 9291 -9694 9897 9a99 9a9a 9b9a 9d9c 9f9e a1a0 -a3a2 a6a4 a8a7 abaa aead aeae adad aeae -b0af b3b1 b6b4 b8b6 bcba bebd bdbd bcbc -bcbb bebc c0bf c2c1 c5c4 c8c6 cbc9 cbcb -cbcb cccb cdcc cecd cfce d0cf d1d0 d5d3 -d6d6 d5d6 d6d5 d6d6 d7d7 d8d8 d9d8 dad9 -dada dbdb dedd dfdf dedf dddd dfdd e0e0 -e3e1 e4e4 e4e4 e3e3 e0e2 e0e0 e4e2 e6e5 -e6e6 e5e6 e2e4 e2e2 e4e2 e6e5 e7e6 e7e7 -e7e7 e7e7 e7e7 e8e8 e7e8 e4e5 e4e4 e6e5 -e6e6 e6e6 e6e6 e6e6 e6e6 e5e6 e3e5 e2e3 -e3e2 e4e4 e4e4 e4e4 e4e4 e4e4 e3e3 e2e3 -e1e1 e0e0 dfdf dfdf dfdf dbdd dbdb dcdb -dadb dada dbda dadb d8d9 d6d7 d6d5 d7d7 -d6d7 d4d5 d1d2 d1d1 d1d1 d0d1 cecf cdcd -cdcd cbcc cacb c9ca c7c8 c6c6 c5c6 c5c5 -c5c5 c4c4 c1c3 bfc0 bfbf bfbf bebf babc -b8b9 b7b7 b7b7 b6b6 b5b5 b3b4 b3b3 b1b2 -afb0 aeae adad acad aaab a9a9 a9a9 a8a9 -a5a7 a2a3 a1a1 a1a1 a2a1 a1a1 9ea0 9b9c -9899 9797 9797 9897 9999 9999 9798 9495 -9192 8e8f 8b8c 8a8a 8a8a 8a8a 8a8a 898a -8889 8586 8183 7f80 7e7e 7f7e 7f7f 7f7f -7d7e 7b7c 797a 7778 7677 7676 7676 7676 -7475 7273 7071 6f6f 6e6e 6c6d 6b6c 696a -6969 6969 6969 6969 6768 6667 6465 6364 -6263 6061 5f60 5f5f 5f5f 5f5f 5e5f 5d5d -5b5c 595a 5859 5757 5757 5858 5858 5757 -5757 5657 5455 5454 5354 5353 5253 5152 -5050 4f50 4f4f 5050 4f4f 4e4f 4e4e 4d4d -4e4e 4e4e 4e4e 4d4e 4c4c 4a4b 494a 4949 -4949 4949 4949 4949 4949 4848 4747 4847 -4848 4748 4747 4647 4646 4646 4546 4445 -4444 4444 4444 4444 4343 4343 4343 4343 -4343 4343 4242 4141 4040 3f3f 3f3f 4040 -4141 4041 3e3f 3d3d 3d3d 3d3d 3d3d 3e3e -3d3d 3d3d 3c3d 3b3c 3a3b 393a 3939 3a39 -3b3a 3b3b 3a3b 3839 3838 3738 3637 3636 -3736 3838 3838 3738 3637 3435 3333 3534 -3435 3233 3332 3333 3534 3334 3233 3132 -3131 3232 3232 3232 3232 3232 3132 2e2f -2e2e 2f2e 3030 3030 3030 3030 3030 3030 -3030 3030 3030 3030 3030 3030 3030 3030 -3030 3030 3030 3030 3030 3030 3030 3030 -3030 3030 3131 3332 3434 3435 3333 3333 -3333 3433 3635 3737 3636 3636 3636 3837 -3a39 3a3a 3939 3a3a 3c3b 3c3c 3b3b 3c3b -3e3d 403f 4040 4040 4140 4242 4343 4443 -4544 4746 4847 4848 4948 4a4a 4b4a 4c4c -4d4c 4f4e 504f 5151 5151 5251 5453 5554 -5656 5857 5a59 5b5b 5c5c 5d5d 5f5e 605f -6160 6261 6463 6564 6666 6867 6968 6a69 -6c6b 6e6d 6f6f 7070 7171 7372 7574 7676 -7877 7978 7a7a 7c7b 7e7d 7f7f 8180 8281 -8483 8584 8686 8887 8a89 8b8a 8c8c 8e8d -908f 9190 9392 9493 9695 9897 9998 9a9a -9b9a 9d9c 9f9e a1a0 a2a2 a4a3 a5a5 a6a6 -a7a7 a9a8 aaa9 acab aead b0af b1b0 b2b1 -b4b3 b5b4 b6b5 b8b7 bab9 bcbb bdbc bebd -bfbe c1c0 c3c3 c3c3 c4c3 c5c4 c7c6 c9c8 -cbca cccb cccc cecd cfcf cfcf d1cf d4d3 -d5d4 d5d5 d6d6 d8d7 dad9 dcdb dcdc dddd -dedd dddd dddd dfde e2e1 e3e2 e3e3 e3e3 -e3e3 e4e3 e4e4 e7e5 e9e8 e9e9 eaea eaea -ebea ebeb ebeb ecec edec eeee efef eeef -eeee eeee efef efef efef f0f0 f0f0 f0f0 -f1f0 f1f1 f1f1 f1f1 f1f1 f1f1 f1f1 f2f1 -f2f2 f2f2 f2f2 f2f2 f2f2 f1f2 f0f0 efef -f0ef f0f0 eff0 eeef eeee efee efef efef -eeef eced ebeb ebeb ebeb e9ea e9e9 e8e8 -e7e7 e6e6 e5e6 e5e5 e4e5 e3e4 e2e2 e1e2 -e0e0 dfdf dede ddde dcdc dbdb dadb d8d9 -d7d7 d6d7 d4d5 d3d4 d1d2 d0d0 cecf cccd -cbcc cacb caca c8c9 c6c7 c4c5 c2c3 c0c1 -bfc0 bebf bdbd bbbc b9ba b8b9 b6b7 b4b5 -b2b3 b0b1 afaf adae acac aaab a8a9 a5a7 -a3a4 a2a3 a0a1 9fa0 9d9e 9b9c 999a 9899 -9697 9495 9293 9091 8f8f 8d8e 8b8c 898a -8788 8586 8484 8283 8081 7e7f 7d7e 7b7c -797a 7878 7677 7475 7273 7172 6f70 6e6f -6c6d 6a6b 6869 6767 6566 6465 6262 6061 -5f60 5d5e 5c5d 5a5b 595a 5859 5758 5556 -5455 5354 5252 5051 4f50 4d4e 4c4d 4b4c -4a4a 4849 4748 4647 4646 4545 4344 4242 -4142 4041 3f40 3f3f 3e3e 3d3e 3b3c 3a3b -3a3a 3a3a 3a3a 393a 3939 3738 3636 3536 -3334 3333 3433 3434 3334 3333 3233 3232 -3132 3131 3131 3132 2f31 2e2e 2d2e 2e2e -2f2f 302f 3030 3030 2f30 2e2e 2e2e 2e2e -2e2e 2e2d 2f2e 2f2f 2f2f 2f2f 2f2f 2f2f -2f2f 2f2f 3030 3131 3131 3131 3131 3131 -3131 3232 3332 3433 3434 3535 3434 3434 -3535 3635 3736 3737 3838 3838 3838 3939 -3a3a 3b3b 3c3c 3d3c 3d3d 3e3d 3e3e 3f3f -403f 4140 4241 4342 4444 4544 4545 4645 -4746 4747 4848 4949 4a4a 4b4b 4c4c 4d4c -4e4e 4f4f 5050 5150 5251 5353 5454 5554 -5655 5756 5857 5959 5a59 5b5a 5c5b 5d5c -5e5e 5f5e 6060 6161 6262 6362 6463 6565 -6666 6767 6868 6969 6a6a 6b6b 6d6c 6e6d -6f6e 706f 7170 7171 7272 7373 7574 7675 -7676 7777 7978 7a79 7b7a 7b7b 7c7c 7d7d -7e7e 7f7f 8080 8181 8281 8382 8483 8484 -8585 8686 8787 8888 8989 8a8a 8b8a 8b8b -8c8b 8d8c 8e8d 8f8e 8f8f 9090 9090 9191 -9191 9292 9393 9494 9594 9595 9695 9696 -9796 9797 9898 9998 9999 9a99 9a9a 9a9a -9a9a 9b9b 9c9b 9c9c 9c9c 9d9d 9e9d 9e9e -9f9e 9f9f 9f9f 9f9f 9f9f 9f9f 9f9f a0a0 -a0a0 a1a1 a1a1 a1a1 a1a1 a1a1 a2a2 a2a2 -a2a2 a2a2 a2a2 a2a2 a3a2 a3a3 a2a2 a2a2 -a2a2 a2a2 a2a2 a2a2 a3a3 a3a3 a3a3 a3a3 -a3a3 a2a3 a2a2 a2a2 a2a2 a2a2 a2a2 a2a2 -a2a2 a1a1 a1a1 a1a1 a1a1 a1a1 a1a1 a1a1 -a1a1 a0a1 a0a0 a0a0 a0a0 9f9f 9f9f 9f9f -9e9f 9e9e 9e9e 9e9e 9e9e 9d9d 9d9d 9d9d -9c9d 9c9c 9c9c 9b9b 9b9b 9b9b 9a9b 9a9a -9a9a 9a9a 9999 9999 9899 9898 9898 9898 -9798 9797 9697 9696 9596 9595 9595 9595 -9495 9494 9394 9393 9393 9393 9292 9292 -9191 9191 9191 9091 9090 9090 8f8f 8e8f -8e8e 8e8e 8d8e 8d8d 8d8d 8d8d 8c8d 8c8c -8b8c 8b8b 8b8b 8a8a 8a8a 8a8a 8989 8989 -8989 8888 8888 8788 8787 8787 8787 8687 -8686 8686 8585 8585 8585 8485 8484 8484 -8484 8383 8383 8383 8283 8282 8282 8282 -8282 8282 8181 8181 8181 8080 8080 8080 -8080 8080 8080 8080 7f7f 7f7f 7f7f 7f7f -7e7f 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e -7e7e 7d7e 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d -7d7d 7d7d 7e7d 7e7e 7e7e 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7f7f 7f7f 7f7f 7f7f 7f7f -7f7f 7f7f 7f7f 7f7f 8080 8080 8080 8080 -8080 8080 8080 8080 8080 8181 8181 8181 -8181 8181 8181 8181 8181 8181 8181 8181 -8282 8282 8282 8282 8282 8282 8282 8282 -8282 8282 8282 8282 8282 8282 8382 8383 -8383 8383 8383 8383 8383 8383 8383 8383 -8383 8383 8383 8383 8484 8484 8484 8484 -8484 8484 8484 8484 8484 8484 8484 8484 -8484 8484 8484 8484 8484 8484 8484 8484 -8484 8484 8484 8484 8484 8484 8484 8484 -8484 8484 8484 8484 8484 8484 8484 8484 -8484 8484 8384 8383 8383 8383 8383 8383 -8383 8383 8383 8383 8383 8383 8383 8282 -8282 8282 8282 8282 8282 8282 8282 8282 -8181 8181 8181 8181 8181 8181 8181 8181 -8181 8080 8080 8080 8080 8080 8080 8080 -7f80 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f -7e7f 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7d7e -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7c7d -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7b7c -7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b -7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a -7a7a 7a7a 7a7a 7979 7979 7979 7979 7979 -7979 7979 7979 7979 7979 7979 7979 7979 -7979 7979 7979 7979 7979 7979 7878 7878 -7878 7878 7878 7878 7878 7878 7878 7878 -7878 7878 7878 7878 7878 7978 7879 7979 -7878 7878 7878 7878 7979 7979 7979 7979 -7979 7979 7979 7979 7979 7979 7979 7979 -7979 7979 7979 7979 7979 7979 7979 7979 -7979 7979 7979 7a79 7a7a 7a7a 7a7a 7a7a -7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a -7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a -7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b -7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b -7b7b 7b7b 7b7b 7b7b 7c7b 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7d7c 7d7d 7d7d -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d -7d7d 7d7d 7d7d 7d7d 7e7e 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7e7e 7e7e 7f7f 7f7f 7f7f -7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f -7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 8080 -8080 8080 8080 8080 8080 8080 8080 8080 -8080 8080 8080 8080 8080 8080 8080 8080 -8181 8181 8181 8181 8181 8181 8181 8181 -8181 8181 8181 8181 8181 8181 8181 8282 -8282 8282 8282 8282 8282 8282 8282 8282 -8282 8282 8282 8282 8282 8282 8282 8282 -8383 8383 8383 8383 8383 8383 8383 8383 -8383 8383 8383 8383 8383 8383 8383 8383 -8383 8383 8383 8383 8484 8484 8484 8484 -8484 8484 8484 8484 8484 8484 8484 8484 -8484 8484 8484 8484 8484 8484 8484 8484 -8484 8484 8484 8484 8584 8585 8585 8585 -8585 8585 8585 8585 8585 8585 8585 8585 -8585 8585 8585 8585 8585 8585 8585 8585 -8585 8585 8585 8585 8585 8585 8585 8585 -8585 8585 8585 8585 8585 8585 8585 8585 -8585 8585 8585 8585 8585 8585 8585 8585 -8585 8585 8585 8585 8585 8585 8585 8585 -8585 8585 8585 8585 8585 8585 8585 8585 -8585 8585 8585 8585 8585 8585 8484 8484 -8484 8484 8484 8484 8484 8484 8484 8484 -8484 8484 8484 8484 8484 8484 8484 8484 -8383 8383 8383 8383 8383 8383 8383 8383 -8383 8383 8383 8383 8383 8383 8383 8383 -8283 8282 8282 8282 8282 8282 8282 8282 -8282 8282 8282 8282 8282 8282 8182 8181 -8181 8181 8181 8181 8181 8181 8181 8181 -8181 8181 8181 8181 8181 8080 8080 8080 -8080 8080 8080 8080 8080 8080 8080 8080 -8080 8080 8080 8080 8080 7f7f 7f7f 7f7f -7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f -7f7f 7f7f 7f7f 7f7f 7f7f 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7d7e -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c -7c7c 7c7c 7c7c 7c7c 7c7c 7d7d 7d7d 7d7d -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d -7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d -7d7d 7d7d 7e7d 7e7e 7e7e 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e -7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7f7f 7f7f -7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f -7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f -7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f -7f7f 7f7f 7f7f 7f7f -] &end - diff --git a/projects/examples/devices/audio.channels.tal b/projects/examples/devices/audio.channels.tal deleted file mode 100644 index 6b0d46c..0000000 --- a/projects/examples/devices/audio.channels.tal +++ /dev/null @@ -1,139 +0,0 @@ -( dev/audio ) - -( devices ) - -|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] -|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] -|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] - -( variables ) - -|0000 - -@timer $1 -@counter $1 - -|0100 ( -> ) - - ( theme ) - #00ff .System/r DEO2 - #0f0f .System/g DEO2 - #0ff0 .System/b DEO2 - - ( vectors ) - ;on-frame .Screen/vector DEO2 - - ( setup synth ) - #1202 .Audio0/adsr DEO2 - ;saw .Audio0/addr DEO2 - #0100 .Audio0/length DEO2 - #88 .Audio0/volume DEO - - #0101 .Audio1/adsr DEO2 - ;tri .Audio1/addr DEO2 - #0100 .Audio1/length DEO2 - #88 .Audio1/volume DEO - - #0112 .Audio2/adsr DEO2 - ;sin .Audio2/addr DEO2 - #0100 .Audio2/length DEO2 - #88 .Audio2/volume DEO - - #0022 .Audio3/adsr DEO2 - ;piano .Audio3/addr DEO2 - #0100 .Audio3/length DEO2 - #88 .Audio3/volume DEO - -BRK - -@on-frame ( -> ) - - ( incr ) .timer LDZ INC .timer STZ - ( skip ) .timer LDZ #10 EQU #01 JCN [ BRK ] - - ( get note ) - .counter LDZ #18 DIVk MUL SUB #30 ADD - .Audio0/pitch .counter LDZ #03 AND #40 SFT ADD DEO - - .counter LDZ INC .counter STZ - #00 .timer STZ - -BRK - -@saw - 0003 0609 0c0f 1215 181b 1e21 2427 2a2d - 3033 3639 3b3e 4143 4649 4b4e 5052 5557 - 595b 5e60 6264 6667 696b 6c6e 7071 7274 - 7576 7778 797a 7b7b 7c7d 7d7e 7e7e 7e7e - 7f7e 7e7e 7e7e 7d7d 7c7b 7b7a 7978 7776 - 7574 7271 706e 6c6b 6967 6664 6260 5e5b - 5957 5552 504e 4b49 4643 413e 3b39 3633 - 302d 2a27 2421 1e1b 1815 120f 0c09 0603 - 00fd faf7 f4f1 eeeb e8e5 e2df dcd9 d6d3 - d0cd cac7 c5c2 bfbd bab7 b5b2 b0ae aba9 - a7a5 a2a0 9e9c 9a99 9795 9492 908f 8e8c - 8b8a 8988 8786 8585 8483 8382 8282 8282 - 8182 8282 8282 8383 8485 8586 8788 898a - 8b8c 8e8f 9092 9495 9799 9a9c 9ea0 a2a5 - a7a9 abae b0b2 b5b7 babd bfc2 c5c7 cacd - d0d3 d6d9 dcdf e2e5 e8eb eef1 f4f7 fafd -@tri - 8082 8486 888a 8c8e 9092 9496 989a 9c9e - a0a2 a4a6 a8aa acae b0b2 b4b6 b8ba bcbe - c0c2 c4c6 c8ca ccce d0d2 d4d6 d8da dcde - e0e2 e4e6 e8ea ecee f0f2 f4f6 f8fa fcfe - fffd fbf9 f7f5 f3f1 efed ebe9 e7e5 e3e1 - dfdd dbd9 d7d5 d3d1 cfcd cbc9 c7c5 c3c1 - bfbd bbb9 b7b5 b3b1 afad aba9 a7a5 a3a1 - 9f9d 9b99 9795 9391 8f8d 8b89 8785 8381 - 7f7d 7b79 7775 7371 6f6d 6b69 6765 6361 - 5f5d 5b59 5755 5351 4f4d 4b49 4745 4341 - 3f3d 3b39 3735 3331 2f2d 2b29 2725 2321 - 1f1d 1b19 1715 1311 0f0d 0b09 0705 0301 - 0103 0507 090b 0d0f 1113 1517 191b 1d1f - 2123 2527 292b 2d2f 3133 3537 393b 3d3f - 4143 4547 494b 4d4f 5153 5557 595b 5d5f - 6163 6567 696b 6d6f 7173 7577 797b 7d7f -@sin - 8083 8689 8c8f 9295 989b 9ea1 a4a7 aaad - b0b3 b6b9 bbbe c1c3 c6c9 cbce d0d2 d5d7 - d9db dee0 e2e4 e6e7 e9eb ecee f0f1 f2f4 - f5f6 f7f8 f9fa fbfb fcfd fdfe fefe fefe - fffe fefe fefe fdfd fcfb fbfa f9f8 f7f6 - f5f4 f2f1 f0ee eceb e9e7 e6e4 e2e0 dedb - d9d7 d5d2 d0ce cbc9 c6c3 c1be bbb9 b6b3 - b0ad aaa7 a4a1 9e9b 9895 928f 8c89 8683 - 807d 7a77 7471 6e6b 6865 625f 5c59 5653 - 504d 4a47 4542 3f3d 3a37 3532 302e 2b29 - 2725 2220 1e1c 1a19 1715 1412 100f 0e0c - 0b0a 0908 0706 0505 0403 0302 0202 0202 - 0102 0202 0202 0303 0405 0506 0708 090a - 0b0c 0e0f 1012 1415 1719 1a1c 1e20 2225 - 2729 2b2e 3032 3537 3a3d 3f42 4547 4a4d - 5053 5659 5c5f 6265 686b 6e71 7477 7a7d -@piano - 8182 8588 8d91 959b a1a6 aaad b2b5 b8bd - c1c7 cbd0 d5d9 dde1 e5e5 e4e4 e1dc d7d1 - cbc5 bfb8 b2ac a6a2 9c97 928d 8884 807c - 7977 7574 7372 7272 7273 7372 706d 6964 - 605b 5650 4d49 4643 4342 4244 4548 4a4d - 5052 5556 5758 5554 5150 4c4a 4744 423f - 3d3c 3a38 3835 3431 3030 2f31 3336 393e - 4449 4e54 5a60 666b 7175 7b82 8990 989e - a6ab b1b6 babd bebf bfbe bbb9 b6b3 b0ae - aaa8 a6a3 a19e 9c9a 9997 9696 9798 9b9e - a1a4 a6a9 a9ac adad adae aeaf b0b0 b1b1 - b3b3 b4b4 b4b3 b3b1 b0ad abab a9a9 a8a8 - a7a5 a19d 9891 8b84 7e77 726e 6b6b 6b6c - 6f71 7477 7776 7370 6c65 5e56 4e48 423f - 3d3c 3b3a 3a39 3838 3839 393a 3c3e 4146 - 4a50 575b 6064 686a 6e70 7274 7677 7a7d - -@melody [ - 54 52 54 4f 4b 4f 48 ff - 54 52 54 4f 4b 4f 48 ff - 54 56 57 56 57 54 56 54 - 56 52 54 52 54 50 54 ff ] diff --git a/projects/examples/devices/audio.tal b/projects/examples/devices/audio.tal deleted file mode 100644 index e6cc574..0000000 --- a/projects/examples/devices/audio.tal +++ /dev/null @@ -1,177 +0,0 @@ -( dev/audio ) - -%GET-NOTE { #00 SWP ;melody ADD2 LDA } -%GET-HEXCHAR { #00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 } - -( devices ) - -|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] -|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] -|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ] -|80 @Controller [ &vector $2 &button $1 &key $1 ] - -( variables ) - -|0000 - -@timer $1 -@progress $1 -@selection $1 -@offset - &x $2 &y $2 - -|0100 ( -> ) - - ( theme ) - #0f8f .System/r DEO2 - #0f8f .System/g DEO2 - #0f80 .System/b DEO2 - - ( vectors ) - ;on-frame .Screen/vector DEO2 - ;on-button .Controller/vector DEO2 - - ( setup synth ) - #0208 .Audio0/adsr DEO2 - ;saw .Audio0/addr DEO2 - #0100 .Audio0/length DEO2 - #dd .Audio0/volume DEO ( TODO: turn ON ) - - ( center ) - .Screen/width DEI2 #01 SFT2 #0080 SUB2 .offset/x STZ2 - .Screen/height DEI2 #01 SFT2 #0040 SUB2 .offset/y STZ2 - - ;draw JSR2 - #02 ;draw-selector JSR2 - -BRK - -@on-button ( -> ) - - .Controller/button DEI #04 SFT - [ #01 ] NEQk NIP ,&no-up JCN - .selection LDZ STHk - #00 ;draw-note JSR2 - [ STHkr GET-NOTE INC ] #00 STHkr ;melody ADD2 STA - STHr #01 ;draw-note JSR2 - #02 ;draw-selector JSR2 - &no-up - [ #02 ] NEQk NIP ,&no-down JCN - .selection LDZ STHk - #00 ;draw-note JSR2 - [ STHkr GET-NOTE #01 SUB ] #00 STHkr ;melody ADD2 STA - STHr #01 ;draw-note JSR2 - #02 ;draw-selector JSR2 - &no-down - [ #04 ] NEQk NIP ,&no-left JCN - #00 ;draw-selector JSR2 - .selection LDZ #01 SUB #1f AND .selection STZ - #02 ;draw-selector JSR2 - &no-left - [ #08 ] NEQk NIP ,&no-right JCN - #00 ;draw-selector JSR2 - .selection LDZ INC #1f AND .selection STZ - #02 ;draw-selector JSR2 - &no-right - POP - -BRK - -@on-frame ( -> ) - - ( incr ) .timer LDZ INC .timer STZ - ( skip ) .timer LDZ #10 EQU #01 JCN [ BRK ] - .progress LDZ - ( play note ) DUP GET-NOTE .Audio0/pitch DEO - ( erase last ) DUP #01 SUB #1f AND #01 ,draw-note JSR - ( draw current ) #01 ,draw-note JSR - ( incr ) .progress LDZ INC #1f AND .progress STZ - #00 .timer STZ - -BRK - -@draw ( -- ) - - #20 #00 - &loop - DUP #01 ,draw-note JSR - INC GTHk ,&loop JCN - POP2 - -JMP2r - -@draw-note ( id color -- ) - - STH STH - ( set x ) [ #00 STHkr ] #30 SFT2 .offset/x LDZ2 ADD2 .Screen/x DEO2 - ( set y ) [ #00 #00 STHkr ;melody ADD2 LDA ] #20 SFT2 #0100 SWP2 SUB2 .offset/y LDZ2 ADD2 #0080 ADD2 .Screen/y DEO2 - ( set addr ) ;marker-icn [ #00 .progress LDZ STHr EQU #08 MUL ADD2 ] .Screen/addr DEO2 - ( draw ) STHr .Screen/sprite DEO - -JMP2r - -@draw-selector ( color -- ) - - STH - [ #00 .selection LDZ ] #30 SFT2 .offset/x LDZ2 ADD2 .Screen/x DEO2 - #0070 .offset/y LDZ2 ADD2 .Screen/y DEO2 - ;selector-icn .Screen/addr DEO2 - STHkr .Screen/sprite DEO - - .Screen/y DEI2k #0008 ADD2 ROT DEO2 - .selection LDZ GET-NOTE STHr ,draw-byte JSR - -JMP2r - -@draw-byte ( byte color -- ) - - STH - DUP - #04 SFT GET-HEXCHAR - ( draw ) STHkr .Screen/sprite DEO - .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 - #0f AND GET-HEXCHAR - ( draw ) STHr .Screen/sprite DEO - -JMP2r - -@melody - 54 52 54 4f 4b 4f 48 ff - 54 52 54 4f 4b 4f 48 ff - 54 56 57 56 57 54 56 54 - 56 52 54 52 54 50 54 ff - -@selector-icn - 0000 0010 387c 0000 - -@marker-icn - 3844 8282 8244 3800 - 387c fefe fe7c 3800 - -@saw - 0003 0609 0c0f 1215 181b 1e21 2427 2a2d - 3033 3639 3b3e 4143 4649 4b4e 5052 5557 - 595b 5e60 6264 6667 696b 6c6e 7071 7274 - 7576 7778 797a 7b7b 7c7d 7d7e 7e7e 7e7e - 7f7e 7e7e 7e7e 7d7d 7c7b 7b7a 7978 7776 - 7574 7271 706e 6c6b 6967 6664 6260 5e5b - 5957 5552 504e 4b49 4643 413e 3b39 3633 - 302d 2a27 2421 1e1b 1815 120f 0c09 0603 - 00fd faf7 f4f1 eeeb e8e5 e2df dcd9 d6d3 - d0cd cac7 c5c2 bfbd bab7 b5b2 b0ae aba9 - a7a5 a2a0 9e9c 9a99 9795 9492 908f 8e8c - 8b8a 8988 8786 8585 8483 8382 8282 8282 - 8182 8282 8282 8383 8485 8586 8788 898a - 8b8c 8e8f 9092 9495 9799 9a9c 9ea0 a2a5 - a7a9 abae b0b2 b5b7 babd bfc2 c5c7 cacd - d0d3 d6d9 dcdf e2e5 e8eb eef1 f4f7 fafd - -@font-hex ( 0-F ) - 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 diff --git a/projects/examples/devices/console.read.tal b/projects/examples/devices/console.read.tal deleted file mode 100644 index b12c852..0000000 --- a/projects/examples/devices/console.read.tal +++ /dev/null @@ -1,16 +0,0 @@ -( usage: uxncli console.read.rom ) - -|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1 - -|0100 - -@on-reset ( -> ) - ;on-console .Console/vector DEO2 - ( type something in the console ) - BRK - -@on-console ( -> ) - .Console/read DEI .Console/write DEO - #0a .Console/write DEO - BRK - diff --git a/projects/examples/devices/console.tal b/projects/examples/devices/console.tal deleted file mode 100644 index 956d16e..0000000 --- a/projects/examples/devices/console.tal +++ /dev/null @@ -1,83 +0,0 @@ -( usage: uxncli console.rom foo "bar baz" -| Prints Welcome to Uxn!, and listens for incoming stdin events on enter. ) - -|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1 - -|000 - - @arg $40 - @std $40 - -|100 - -@on-reset ( -> ) - ;Dict/hello - .Console/type DEI ?{ - ( | no arguments ) - ;on-std .Console/vector DEO2 - BRK } - ;on-arg .Console/vector DEO2 - BRK - -@on-arg ( -> ) - [ LIT2 02 -Console/type ] DEI NEQ ?{ - .Console/read DEI [ LIT2 00 &ptr -arg ] INCk ,&ptr STR - STZ2 - BRK } - ;arg ;Dict/yousent - [ LIT2 -arg _&ptr ] STR - [ LIT2 04 -Console/type ] DEI NEQ ?{ ;on-std .Console/vector DEO2 } - BRK - -@on-std ( -> ) - [ LIT2 0a -Console/read ] DEI EQU ?{ - .Console/read DEI [ LIT2 00 &ptr -std ] INCk ,&ptr STR - STZ2 - BRK } - ;std DUP2 ;Dict/yousaid - ;Dict/quit scmp ?{ - [ LIT2 -std _&ptr ] STR - BRK } - ( quit ) #800f DEO - BRK - -@ ( buf* name* -- ) - - [ LIT2 "" 18 ] DEO - / - [ LIT2 "" 18 ] DEO - [ LIT2 00 -Console/type ] DEI DUP ADD ;Types ADD2 LDA2 / - #0a18 DEO - JMP2r - -@ ( str* -- ) - LDAk #18 DEO - INC2 & LDAk ? - POP2 JMP2r - -@scmp ( a* b* -- f ) - STH2 - &l ( a* b* -- f ) - LDAk LDAkr STHr NEQk ?&d - DUP EOR EQUk ?&d - POP2 INC2 INC2r !&l - - &d ( a* c1 c2 b* -- f ) - NIP2 POP2r EQU JMP2r - -( -@|assets ) - -@Types =Dict/arg-none =Dict/arg-stdin =Dict/arg-data =Dict/arg-spacer =Dict/arg-end - -@Dict - &hello "Welcome 20 "to 20 "Uxn! 0a $1 - &yousaid "You 20 "said: 20 $1 - &yousent "You 20 "sent: 20 $1 - &quit "quit $1 - &arg-none " $1 - &arg-stdin " $1 - &arg-data " $1 - &arg-spacer " $1 - &arg-end " $1 - diff --git a/projects/examples/devices/console.write.tal b/projects/examples/devices/console.write.tal deleted file mode 100644 index 27cdd3c..0000000 --- a/projects/examples/devices/console.write.tal +++ /dev/null @@ -1,22 +0,0 @@ -( usage: uxncli console.write.rom ) - -|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1 - -|0100 - -@on-reset ( -> ) - ( | write ) - { "Hello 20 "Write 0a 00 } - STH2r - &wa ( -- ) - LDAk .Console/write DEO - INC2 LDAk ?&wa - POP2 - ( | error ) - { "Hello 20 "Error 0a 00 } - STH2r - &wb ( -- ) - LDAk .Console/error DEO - INC2 LDAk ?&wb - POP2 BRK - diff --git a/projects/examples/devices/controller.tal b/projects/examples/devices/controller.tal deleted file mode 100644 index d4e5475..0000000 --- a/projects/examples/devices/controller.tal +++ /dev/null @@ -1,191 +0,0 @@ -( Controller: Buttons should highlight on press and display the button and key bytes. ) - -|00 @System/vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen/vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|80 @Controller/vector $2 &button $1 &key $1 - -|000 - - @center/x $2 &y $2 - -|100 - -@on-reset ( -> ) - ( | theme ) - #0fff .System/r DEO2 - #0f0f .System/g DEO2 - #0f0f .System/b DEO2 - ( | find center ) - .Screen/width DEI2 #01 SFT2 .center/x STZ2 - .Screen/height DEI2 #01 SFT2 .center/y STZ2 - controller/ - ;on-button .Controller/vector DEO2 - BRK - -@on-button ( -> ) - controller/ - ( | print stack on start button ) - [ LIT2 08 -Controller/button ] DEI NEQ ?{ #010e DEO } - BRK - -( -@|Controller ) - -@controller/ ( -- ) - .Controller/button DEI2 - ( | background ) - .center/x LDZ2 #0040 SUB2 .Screen/x DEO2 - .center/y LDZ2 #0020 SUB2 .Screen/y DEO2 - #01f9 ;&icns #f6 - ( | output ) - .Screen/x DEI2 #0010 ADD2 .Screen/x DEO2 - .Screen/y DEI2 #0050 SUB2 .Screen/y DEO2 - DUP2 hex/ - ( | A button ) - OVR #01 AND #00 EQU ?{ - .center/x LDZ2 #0028 ADD2 .Screen/x DEO2 - .center/y LDZ2 .Screen/y DEO2 - #01fe ;large/icns #16 } - ( | B button ) - OVR #02 AND #00 EQU ?{ - .center/x LDZ2 #0010 ADD2 .Screen/x DEO2 - .center/y LDZ2 .Screen/y DEO2 - #01fe ;large/icns #16 } - ( | C button ) - OVR #04 AND #00 EQU ?{ - .center/x LDZ2 #0008 SUB2 .Screen/x DEO2 - .center/y LDZ2 #0008 ADD2 .Screen/y DEO2 - #01ff ;small/icn #16 } - ( | S button ) - OVR #08 AND #00 EQU ?{ - .center/x LDZ2 #0018 SUB2 .Screen/x DEO2 - .center/y LDZ2 #0008 ADD2 .Screen/y DEO2 - #01ff ;small/icn #16 } - ( | Up arrow ) - OVR #10 AND #00 EQU ?{ - .center/x LDZ2 #0030 SUB2 .Screen/x DEO2 - .center/y LDZ2 #0008 SUB2 .Screen/y DEO2 - #05ff ;arrow/icn #00 } - ( | Down arrow ) - OVR #20 AND #00 EQU ?{ - .center/x LDZ2 #0030 SUB2 .Screen/x DEO2 - .center/y LDZ2 #0008 ADD2 .Screen/y DEO2 - #05ff ;arrow/icn #00 } - ( | Left arrow ) - OVR #40 AND #00 EQU ?{ - .center/x LDZ2 #0038 SUB2 .Screen/x DEO2 - .center/y LDZ2 .Screen/y DEO2 - #05ff ;arrow/icn #00 } - ( | Right arrow ) - OVR #80 AND #00 EQU ?{ - .center/x LDZ2 #0028 SUB2 .Screen/x DEO2 - .center/y LDZ2 .Screen/y DEO2 - #05ff ;arrow/icn #00 } - POP2 JMP2r - -@ ( color times addr* auto -- ) - .Screen/auto DEO - .Screen/addr DEO2 - SWP STH - [ LITr -Screen/sprite ] - &>l - DEOkr - INC DUP ?&>l - POP POP2r JMP2r - -( -@|drawing ) - -@hex/ ( short* -- ) - [ LIT2 01 -Screen/auto ] DEO - SWP / - ( >> ) - -@hex/ ( byte -- ) - DUP #04 SFT / - ( >> ) - -@hex/ ( char -- ) - #00 SWP #0f AND #30 SFT2 ;&icns ADD2 .Screen/addr DEO2 - [ LIT2 03 -Screen/sprite ] DEO - JMP2r - -( -@|assets ) - -@large/icns [ - 071f 3f7f 7fff ffff e0f8 fcfe feff ffff - ffff ff7f 7f3f 1f07 ffff fffe fefc f8e0 ] - -@small/icn [ 0000 001f 3f3f 3f1f 0000 00f8 fcfc fcf8 ] - -@arrow/icn [ 187e 7eff ff7e 7e18 ] - -@controller/icns [ - 0000 0f30 4040 8080 0000 ff00 0000 0000 - 0042 8100 0000 0000 0000 ff00 0000 0000 - 0000 ff00 0000 0000 0000 ff00 0000 0000 - 0000 ff00 0000 0000 0000 ff00 0000 0000 - 0000 ff00 0000 0000 0000 ff00 0000 0000 - 0000 ff00 0000 0000 0000 ff00 0000 0000 - 0000 ff00 0000 0000 0000 ff00 0000 0000 - 0000 ff00 0000 0000 0000 f00c 0202 0101 - 8080 8080 8080 8080 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0101 0101 0101 0101 - 8080 8080 8080 8080 0000 0000 0000 0000 - 0000 0000 0000 0018 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0302 0000 0000 0000 8040 - 0000 0000 0000 0000 0000 0000 0000 0102 - 0000 0000 0000 8040 0101 0101 0101 0101 - 8080 8080 8080 8080 0000 0001 0101 011f - 6681 8100 0000 0000 0000 0080 8080 80f8 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0203 0202 0300 0000 4080 4040 8000 0000 - 0000 0000 0000 0000 0203 0202 0200 0000 - 40c0 4040 4000 0000 0101 0101 0101 0101 - 8080 8081 8180 8080 6080 8000 0080 8060 - 0000 0000 0000 0000 0601 0100 0001 0106 - 0000 0080 8000 0000 0001 0202 0100 0201 - 0080 4000 8040 4080 0001 0202 0202 0201 - 0080 4000 0000 4080 0000 0000 0000 0000 - 0718 2040 4080 8080 e018 0402 0201 0101 - 0000 0000 0000 0000 0718 2040 4080 8080 - e018 0402 0201 0101 0101 0101 0101 0101 - 8080 8080 8080 8080 1f01 0101 0100 0000 - 0000 0000 0081 8166 f880 8080 8000 0000 - 0000 0000 0000 0000 0000 001f 2020 201f - 0000 00f8 0404 04f8 0000 001f 2020 201f - 0000 00f8 0404 04f8 0000 0000 0000 0000 - 8080 8040 4020 1807 0101 0102 0204 18e0 - 0000 0000 0000 0000 8080 8040 4020 1807 - 0101 0102 0204 18e0 0101 0101 0101 0101 - 8080 8080 4040 300f 0000 0000 0000 00ff - 1800 0000 0000 00ff 0000 0000 0000 00ff - 0000 0000 0000 00ff 0000 0000 0000 00ff - 0000 0000 0000 00ff 0000 0000 0000 00ff - 0000 0000 0000 00ff 0000 0000 0000 00ff - 0000 0000 0000 00ff 0000 0000 0000 00ff - 0000 0000 0000 00ff 0000 0000 0000 00ff - 0000 0000 0000 00ff 0101 0101 0202 0cf0 ] - -@hex/icns [ - 0018 2424 2424 2418 0008 1808 0808 0808 - 0018 2404 1820 203c 0018 2404 1804 2418 - 0024 2424 1c04 0404 003c 2020 1804 2418 - 0018 2420 3824 2418 003c 0408 1010 1010 - 0018 2424 1824 2418 0018 2424 1c04 2418 - 0018 2424 3c24 2424 0038 2424 3824 2438 - 0018 2420 2020 2418 0038 2424 2424 2438 - 001c 2020 3820 201c 001c 2020 3820 2020 ] - diff --git a/projects/examples/devices/datetime.tal b/projects/examples/devices/datetime.tal deleted file mode 100644 index 38adb05..0000000 --- a/projects/examples/devices/datetime.tal +++ /dev/null @@ -1,94 +0,0 @@ -( usage: uxncli datetime.rom ) - -|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1 -|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 - -|0100 - -@on-reset ( -> ) - - #0a .Console/write DEO - - #0a .Console/write DEO - - #0a .Console/write DEO - - #0a .Console/write DEO - #800f DEO - BRK - -@ ( -- ) - .DateTime/year DEI2k - [ LIT "- ] .Console/write DEO - INC INC DEIk INC - [ LIT "- ] .Console/write DEO - INC DEI ! - -@ ( -- ) - ;dict/date - [ LIT2 00 -DateTime/dotw ] DEI #20 SFT ;week-txt ADD2 - [ LIT2 20 ", ] #18 DEO - #18 DEO - [ LIT2 00 -DateTime/month ] DEI #20 SFT ;month-txt ADD2 - #2018 DEO - [ LIT2 00 -DateTime/day ] DEI - [ LIT2 20 ", ] #18 DEO - #18 DEO - .DateTime/year DEI2 ! - -@ ( -- ) - ;dict/time - .DateTime/hour DEIk - [ LIT2 ": 18 ] DEO - INC DEIk - [ LIT2 ": 18 ] DEO - INC DEI ! - -@ ( str* -- ) - &w ( -- ) - LDAk #18 DEO - INC2 LDAk ?&w - POP2 JMP2r - -@ ( -- ) - ;dict/doty - .DateTime/doty DEI2 - ( >> ) - -@ ( short* -- ) - #2710 [ LIT2r 00fb ] - &w ( -- ) - DIV2k #000a DIV2k MUL2 SUB2 SWPr EQUk OVR STHkr EQU AND ?&>skip - DUP - INCr &>skip - POP2 #000a DIV2 SWPr INCr STHkr ?&w - POP2r POP2 POP2 JMP2r - -@ ( byte -- ) - #0a DIVk - DIVk MUL SUB - ( >> ) - -@ ( byte -- ) - LIT "0 ADD #18 DEO - JMP2r - -( -@|assets ) - -@week-txt - [ - "Sun $1 "Mon $1 "Tue $1 "Wed $1 - "Thu $1 "Fri $1 "Sat $1 ] - -@month-txt - [ - "Jan $1 "Feb $1 "Mar $1 "Apr $1 - "May $1 "Jun $1 "Jul $1 "Aug $1 - "Sep $1 "Oct $1 "Nov $1 "Dec $1 ] - -@dict ( ) - &date "The 20 "date 20 "is: 20 $1 - &time "The 20 "time 20 "is: 20 $1 - &doty "The 20 "day 20 "of 20 "the 20 "year 20 "is: 20 $1 - diff --git a/projects/examples/devices/file.cat.tal b/projects/examples/devices/file.cat.tal deleted file mode 100644 index 78ad771..0000000 --- a/projects/examples/devices/file.cat.tal +++ /dev/null @@ -1,14 +0,0 @@ -|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 - -|0100 - -@on-reset ( -> ) - ;filename .File/name DEO2 - #0001 .File/length DEO2 - &while ( -- ) - ;&byte .File/read DEO2 - .File/success DEI2 ORA ?{ #010f DEO BRK } - [ LIT2 &byte $1 18 ] DEO - !&while - -@filename "cat.tal $1 diff --git a/projects/examples/devices/file.tal b/projects/examples/devices/file.tal deleted file mode 100644 index 3a51460..0000000 --- a/projects/examples/devices/file.tal +++ /dev/null @@ -1,97 +0,0 @@ -( File: - Creates a temporary file called file-output.txt, - then read it back in console, print length and delete it. ) - -|a0 @File0 &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 -|b0 @File1 &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 - -|0100 ( -> ) - - ( write a file with file0 ) - ;filepath-txt .File0/name DEO2 - ;part1 ,append JSR - ;part2 ,append JSR - ( close file before changing device ) - .File0/name DEI2k ROT DEO2 - ( read a file with file1 ) - ;filepath-txt .File1/name DEO2 - ,stream JSR - ( delete file with file0 ) - ;filepath-txt .File0/delete DEO2 - -BRK - -@append ( part* -- ) - - DUP2 ;print-str JSR2 - DUP2 ;slen JSR2 STH2k .File0/length DEO2 - .File0/write DEO2 - ( print result ) - ;saved-txt ;print-str JSR2 - STH2r ;print JSR2 #2018 DEO - ;bytes-txt ;print-str JSR2 #0a18 DEO - -JMP2r - -@stream ( -- ) - - #0001 .File1/length DEO2 - LIT2r 0000 - &stream - ;&buf DUP2 .File1/read DEO2 LDA #18 DEO INC2r - .File1/success DEI2 #0000 NEQ2 ,&stream JCN - ( print result ) - ;loaded-txt ;print-str JSR2 - STH2r ;print JSR2 #2018 DEO - ;bytes-txt ;print-str JSR2 #0a18 DEO - -JMP2r - &buf $1 - -@slen ( str* -- len* ) - - DUP2 ,scap JSR SWP2 SUB2 - -JMP2r - -@scap ( str* -- end* ) - - LDAk #00 NEQ JMP JMP2r - &while INC2 LDAk ,&while JCN - -JMP2r - -@print ( short* -- ) - - &short ( short* -- ) SWP ,&byte JSR - &byte ( byte -- ) DUP #04 SFT ,&char JSR - &char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO - -JMP2r - -@print-str ( str* -- ) - - &while - LDAk #18 DEO - INC2 LDAk ,&while JCN - POP2 - -JMP2r - -@saved-txt "Saved 20 $1 -@loaded-txt "Loaded 20 $1 -@bytes-txt "bytes. $1 -@filepath-txt "file-output.txt $1 - -@part1 - 596f 7572 2073 6163 7265 6420 706c 616e - 7473 2c20 6966 2068 6572 6520 6265 6c6f - 772c 0a4f 6e6c 7920 616d 6f6e 6720 7468 - 6520 706c 616e 7473 2077 696c 6c20 6772 - 6f77 2e0a 00 - -@part2 - 536f 6369 6574 7920 6973 2061 6c6c 2062 - 7574 2072 7564 652c 0a54 6f20 7468 6973 - 2064 656c 6963 696f 7573 2073 6f6c 6974 - 7564 652e 0a diff --git a/projects/examples/devices/mouse.tal b/projects/examples/devices/mouse.tal deleted file mode 100644 index 3461c52..0000000 --- a/projects/examples/devices/mouse.tal +++ /dev/null @@ -1,186 +0,0 @@ -( Mouse: Paint with 3 colors with each mouse button. ) - -|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2 - -|0000 - - @length $2 - @frame $2 - @pen &x $2 &y $2 &x2 $2 &y2 $2 - @pointer &x $2 &y $2 &lastx $2 &lasty $2 &state $1 - -|0100 - -@on-reset ( -> ) - ( | theme ) - #48af .System/r DEO2 - #59bf .System/g DEO2 - #6ace .System/b DEO2 - ( | vectors ) - ;on-mouse .Mouse/vector DEO2 - ;on-frame .Screen/vector DEO2 - - BRK - -( -@|vectors ) - -@on-frame ( -> ) - .Mouse/state DEI ?{ - ;run DUP2 JSR2 JSR2 } - BRK - -@on-mouse ( -> ) - ( | clear last cursor ) - .pointer/x LDZ2 .Screen/x DEO2 - .pointer/y LDZ2 .Screen/y DEO2 - ;fill-icn .Screen/addr DEO2 - [ LIT2 40 -Screen/sprite ] DEO - - ( | draw new cursor ) - ;pointer-icn .Screen/addr DEO2 - #00 .Screen/auto DEO - .Mouse/x DEI2 DUP2 .pointer/x STZ2 - .Screen/x DEO2 - .Mouse/y DEI2 DUP2 .pointer/y STZ2 - .Screen/y DEO2 - #45 .Mouse/state DEI #00 NEQ #05 MUL ADD .Screen/sprite DEO - ( | on down ) - .Mouse/state DEI #00 NEQ .pointer/state LDZ #00 EQU AND ?&down - ( | on drag ) - .Mouse/state DEI ?&drag - .Mouse/state DEI .pointer/state STZ - BRK - &down ( -> ) - #0000 DUP2 .length STZ2 - .frame STZ2 - - ( | record start position ) - .Mouse/x DEI2 DUP2 .pointer/x STZ2 - .pointer/lastx STZ2 - .Mouse/y DEI2 DUP2 .pointer/y STZ2 - .pointer/lasty STZ2 - .Mouse/state DEI .pointer/state STZ - BRK - &drag ( -> ) - ( | record ) - ;stroke .length LDZ2 #20 SFT2 ADD2 STH2 .pointer/x LDZ2 .pointer/lastx LDZ2 SUB2 STH2kr STA2 - .pointer/y LDZ2 .pointer/lasty LDZ2 SUB2 STH2r INC2 INC2 STA2 - ( | move ptr ) - .length LDZ2 INC2 .length STZ2 - ( | draw line ) - .pointer/lastx LDZ2 .pointer/lasty LDZ2 .pointer/x LDZ2 .pointer/y LDZ2 #01 - ( | record last position ) - .Mouse/x DEI2 DUP2 .pointer/lastx STZ2 - DUP2 .pen/x STZ2 - .pen/x2 STZ2 - .Mouse/y DEI2 DUP2 .pointer/lasty STZ2 - DUP2 .pen/y STZ2 - .pen/y2 STZ2 - .Mouse/state DEI DUP #01 NEQ INC ;run/color STA - .pointer/state STZ - BRK - -( -@|main ) - -@run ( -- ) - ( | read ) - ;stroke .frame LDZ2 #20 SFT2 ADD2 STH2 .pen/x LDZ2 STH2kr LDA2 ADD2 .pen/x STZ2 - .pen/y LDZ2 STH2r INC2 INC2 LDA2 ADD2 .pen/y STZ2 - ( | line ) - .pen/x LDZ2 .pen/y LDZ2 .pen/x2 LDZ2 .pen/y2 LDZ2 .frame LDZ2 #01 SFT2 NIP #01 AND [ LIT &color $1 ] ADD INC - ( | history ) - .pen/x LDZ2 .pen/x2 STZ2 - .pen/y LDZ2 .pen/y2 STZ2 - ( | incr frame ) - .frame LDZ2 INC2 .length LDZ2 INC2 - ( mod2 ) DIV2k MUL2 SUB2 .frame STZ2 - JMP2r - -@ ( -- ) - ( | clear ) - #0010 DUP2 .Screen/x DEO2 - .Screen/y DEO2 - #16 .Screen/auto DEO - ;fill-icn .Screen/addr DEO2 - #40 .Screen/sprite DEOk - DEO - ( | buttons ) - #0300 - &l ( -- ) - #01 OVR #40 SFT SFT .Mouse/state DEI AND #00 EQU ?{ - #0010 .Screen/y DEO2 - #00 OVR #40 SFT2 ;button-icn ADD2 .Screen/addr DEO2 - #45 .Screen/sprite DEO } - INC GTHk ?&l - POP2 - ( | outline ) - #0010 .Screen/y DEO2 - ;mouse-icn .Screen/addr DEO2 - #16 .Screen/auto DEO - #4a .Screen/sprite DEOk - DEO - JMP2r - -@ ( x1* y1* x2* y2* color -- ) - ,&color STR - ,&y STR2 - ,&x STR2 - ,&y2 STR2 - ,&x2 STR2 - ,&x LDR2 ,&x2 LDR2 SUB2 abs2 ,&dx STR2 - #0000 ,&y LDR2 ,&y2 LDR2 SUB2 abs2 SUB2 ,&dy STR2 - #ffff [ LIT2 00 _&x2 ] LDR2 ,&x LDR2 lts2 DUP2 ADD2 ADD2 ,&sx STR2 - #ffff [ LIT2 00 _&y2 ] LDR2 ,&y LDR2 lts2 DUP2 ADD2 ADD2 ,&sy STR2 - [ LIT2 &dx $2 ] [ LIT2 &dy $2 ] ADD2 STH2 - &while ( -- ) - [ LIT2 &x2 $2 ] DUP2 .Screen/x DEO2 - [ LIT2 &x $2 ] EQU2 [ LIT2 &y2 $2 ] DUP2 .Screen/y DEO2 - [ LIT2 &y $2 ] EQU2 [ LIT2 &color $1 -Screen/pixel ] DEO - AND ?&end - STH2kr DUP2 ADD2 DUP2 ,&dy LDR2 lts2 ?&skipy - STH2r ,&dy LDR2 ADD2 STH2 ,&x2 LDR2 [ LIT2 &sx $2 ] ADD2 ,&x2 STR2 - &skipy ( -- ) - ,&dx LDR2 gts2 ?&while - STH2r ,&dx LDR2 ADD2 STH2 ,&y2 LDR2 [ LIT2 &sy $2 ] ADD2 ,&y2 STR2 - !&while - &end POP2r JMP2r - -@abs2 ( a* -- f ) - DUP2 #0f SFT2 EQU ?{ #0000 SWP2 SUB2 } - JMP2r - -@lts2 ( a* b* -- f ) - #8000 STH2k ADD2 SWP2 STH2r ADD2 GTH2 JMP2r - -@gts2 ( a* b* -- f ) - #8000 STH2k ADD2 SWP2 STH2r ADD2 LTH2 JMP2r - -@ ( -- ) - #0000 DUP2 .Screen/x DEO2 - .Screen/y DEO2 - #80 .Screen/pixel DEO - JMP2r - -@fill-icn [ ffff ffff ffff ffff ] - -@pointer-icn [ 80c0 e0f0 f8e0 1000 ] - -@mouse-icn [ - 000d 1212 1212 121d 00b0 4848 4848 48b8 - 1010 1010 1008 0700 0808 0808 0810 e000 ] - -@button-icn [ - 000c 1e1e 1e1e 1e0c 0000 0000 0000 0000 - 0001 0303 0303 0301 0080 c0c0 c0c0 c080 - 0000 0000 0000 0000 0030 7878 7878 7830 ] - -( -@|memory ) - -@stroke - - diff --git a/projects/examples/devices/screen.auto.tal b/projects/examples/devices/screen.auto.tal deleted file mode 100644 index 34f4b2e..0000000 --- a/projects/examples/devices/screen.auto.tal +++ /dev/null @@ -1,152 +0,0 @@ -( All five portraits should look right ) - -|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 - -|0100 - ( | size ) - #00a0 .Screen/width DEO2 - #0020 .Screen/height DEO2 - ( | theme ) - #05ae .System/r DEO2 - #0a9f .System/g DEO2 - #097f .System/b DEO2 - ( | normal horizontal ) - #0000 .Screen/x DEO2 - #0000 .Screen/y DEO2 - [ LIT2 35 -Screen/auto ] DEO - ;img-hor .Screen/addr DEO2 - #85 - ( | normal vertical ) - #0020 .Screen/x DEO2 - #0000 .Screen/y DEO2 - [ LIT2 36 -Screen/auto ] DEO - ;img-ver .Screen/addr DEO2 - #85 - ( | flipped horizontal ) - #0058 .Screen/x DEO2 - #0000 .Screen/y DEO2 - [ LIT2 36 -Screen/auto ] DEO - ;img-x-flipped .Screen/addr DEO2 - #95 - ( | flipped vertical ) - #0060 .Screen/x DEO2 - #0018 .Screen/y DEO2 - [ LIT2 36 -Screen/auto ] DEO - ;img-y-flipped .Screen/addr DEO2 - #a5 - ( | flipped horizontal/vertical ) - #0098 .Screen/x DEO2 - #0018 .Screen/y DEO2 - [ LIT2 36 -Screen/auto ] DEO - ;img-xy-flipped .Screen/addr DEO2 - #b5 - BRK - -@ ( color -- ) - .Screen/sprite DEOk DEOk DEOk DEO - JMP2r - -@draw-fast ( w h addr* color -- ) - ,&color STR - .Screen/addr DEO2 - SWP #01 SUB #40 SFT #06 ORA .Screen/auto DEO - #00 SWP SUB - × ( -- ) - [ LIT2 &color $1 -Screen/sprite ] DEO - INC DUP ?× - POP JMP2r - -( -@|assets ) - -@img-ver [ - 0000 0008 0404 0501 ffff fff7 fbfa f9f9 - 0000 1000 21ff ffff ffff efde 21ff ffff - 2020 0060 f8ff fffc dfdf 9f67 f8ff fffc - 0703 2110 0888 c851 e7fb ddee 76b6 d64d - 0307 0617 172f 080c fbf7 f6e5 e7cf e8ec - ffef 1fff ff1f 0f37 f7ef 1fff 8f07 0733 - fbff ffff fcf8 f3f7 fbf7 fff8 f0f0 f1f1 - d3d7 c783 0100 0040 8bc7 d79b 1d3e 3e5e - 0e06 0301 0101 0505 eef6 fbfd fdfd f9f9 - 7bfb 3fff ffff ffff 3b3b 3fff ffff ffff - f7f7 f7ff fff7 fffb f3ff fff3 fbff ffe3 - c0e0 e0e4 e5e3 c7cf feee eeea e9eb f7cf - 3800 0103 c7ff ffff c6fe fd3b c7ff ffff - ff7f 3f0f a0b8 bebf ff7f 3f5f b1bf bfbf - dfbf fefd fb07 0fdf c387 fefd fb07 efdf - bf7f ffff ffff ffff bf7f ffff ffff ffff ] - -@img-hor [ - 0000 0008 0404 0501 ffff fff7 fbfa f9f9 - 0307 0617 172f 080c fbf7 f6e5 e7cf e8ec - 0e06 0301 0101 0505 eef6 fbfd fdfd f9f9 - 3800 0103 c7ff ffff c6fe fd3b c7ff ffff - 0000 1000 21ff ffff ffff efde 21ff ffff - ffef 1fff ff1f 0f37 f7ef 1fff 8f07 0733 - 7bfb 3fff ffff ffff 3b3b 3fff ffff ffff - ff7f 3f0f a0b8 bebf ff7f 3f5f b1bf bfbf - 2020 0060 f8ff fffc dfdf 9f67 f8ff fffc - fbff ffff fcf8 f3f7 fbf7 fff8 f0f0 f1f1 - f7f7 f7ff fff7 fffb f3ff fff3 fbff ffe3 - dfbf fefd fb07 0fdf c387 fefd fb07 efdf - 0703 2110 0888 c851 e7fb ddee 76b6 d64d - d3d7 c783 0100 0040 8bc7 d79b 1d3e 3e5e - c0e0 e0e4 e5e3 c7cf feee eeea e9eb f7cf - bf7f ffff ffff ffff bf7f ffff ffff ffff ] - -@img-x-flipped [ - e0c0 8408 1011 138a e7df bb77 6e6d 6bb2 - 0404 0006 1fff ff3f fbfb f9e6 1fff ff3f - 0000 0800 84ff ffff ffff f77b 84ff ffff - 0000 0010 2020 a080 ffff ffef df5f 9f9f - cbeb e3c1 8000 0002 d1e3 ebd9 b87c 7c7a - dfff ffff 3f1f cfef dfef ff1f 0f0f 8f8f - fff7 f8ff fff8 f0ec eff7 f8ff f1e0 e0cc - c0e0 60e8 e8f4 1030 dfef 6fa7 e7f3 1737 - 0307 0727 a7c7 e3f3 7f77 7757 97d7 eff3 - efef efff ffef ffdf cfff ffcf dfff ffc7 - dedf fcff ffff ffff dcdc fcff ffff ffff - 7060 c080 8080 a0a0 776f dfbf bfbf 9f9f - fdfe ffff ffff ffff fdfe ffff ffff ffff - fbfd 7fbf dfe0 f0fb c3e1 7fbf dfe0 f7fb - fffe fcf0 051d 7dfd fffe fcfa 8dfd fdfd - 1c00 80c0 e3ff ffff 637f bfdc e3ff ffff ] - -@img-y-flipped [ - ffff ffc7 0301 0038 ffff ffc7 3bfd fec6 - bfbe b8a0 0f3f 7fff bfbf bfb1 5f3f 7fff - df0f 07fb fdfe bfdf dfef 07fb fdfe 87c3 - ffff ffff ffff 7fbf ffff ffff ffff 7fbf - 0505 0101 0103 060e f9f9 fdfd fdfb f6ee - ffff ffff ff3f fb7b ffff ffff ff3f 3b3b - fbff f7ff fff7 f7f7 e3ff fffb f3ff fff3 - cfc7 e3e5 e4e0 e0c0 cff7 ebe9 eaee eefe - 0c08 2f17 1706 0703 ece8 cfe7 e5f6 f7fb - 370f 1fff ff1f efff 3307 078f ff1f eff7 - f7f3 f8fc ffff fffb f1f1 f0f0 f8ff f7fb - 4000 0001 83c7 d7d3 5e3e 3e1d 9bd7 c78b - 0105 0404 0800 0000 f9f9 fafb f7ff ffff - ffff ff21 0010 0000 ffff ff21 deef ffff - fcff fff8 6000 2020 fcff fff8 679f dfdf - 51c8 8808 1021 0307 4dd6 b676 eedd fbe7 ] - -@img-xy-flipped [ - ffff ffff ffff fefd ffff ffff ffff fefd - fbf0 e0df bf7f fdfb fbf7 e0df bf7f e1c3 - fd7d 1d05 f0fc feff fdfd fd8d fafc feff - ffff ffe3 c080 001c ffff ffe3 dcbf 7f63 - f3e3 c7a7 2707 0703 f3ef d797 5777 777f - dfff efff ffef efef c7ff ffdf cfff ffcf - ffff ffff fffc dfde ffff ffff fffc dcdc - a0a0 8080 80c0 6070 9f9f bfbf bfdf 6f77 - 0200 0080 c1e3 ebcb 7a7c 7cb8 d9eb e3d1 - efcf 1f3f ffff ffdf 8f8f 0f0f 1fff efdf - ecf0 f8ff fff8 f7ff cce0 e0f1 fff8 f7ef - 3010 f4e8 e860 e0c0 3717 f3e7 a76f efdf - 8a13 1110 0884 c0e0 b26b 6d6e 77bb dfe7 - 3fff ff1f 0600 0404 3fff ff1f e6f9 fbfb - ffff ff84 0008 0000 ffff ff84 7bf7 ffff - 80a0 2020 1000 0000 9f9f 5fdf efff ffff ] - diff --git a/projects/examples/devices/screen.blending.tal b/projects/examples/devices/screen.blending.tal deleted file mode 100644 index 76e5ebe..0000000 --- a/projects/examples/devices/screen.blending.tal +++ /dev/null @@ -1,94 +0,0 @@ -( screen blending modes ) - -|00 @System &catch $2 &expansion $2 &pad $2 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 - -|0100 - -@on-reset ( -> ) - ( | theme ) - #f07f .System/r DEO2 - #f0d6 .System/g DEO2 - #f0b2 .System/b DEO2 - ( | size ) - #0100 .Screen/width DEO2 - #010c .Screen/height DEO2 - ( | background ) - #02 - #0080 .Screen/x DEO2 - #0000 .Screen/y DEO2 - #03 - ( | 1bpp ) - #1000 - &l1bg ( -- ) - #00 OVR #03 AND #50 SFT2 #0008 ADD2 .Screen/x DEO2 - #00 OVR #02 SFT #50 SFT2 #0008 ADD2 .Screen/y DEO2 - DUP - INC GTHk ?&l1bg - POP2 - #1000 - &l1fg ( -- ) - #00 OVR #03 AND #50 SFT2 #0088 ADD2 .Screen/x DEO2 - #00 OVR #02 SFT #50 SFT2 #0008 ADD2 .Screen/y DEO2 - DUP #40 ORA - INC GTHk ?&l1fg - POP2 - ( | 2bpp ) - #1000 - &l2bg ( -- ) - #00 OVR #03 AND #50 SFT2 #0008 ADD2 .Screen/x DEO2 - #00 OVR #02 SFT #50 SFT2 #0088 ADD2 .Screen/y DEO2 - DUP #80 ORA - INC GTHk ?&l2bg - POP2 - #1000 - &l2fg ( -- ) - #00 OVR #03 AND #50 SFT2 #0088 ADD2 .Screen/x DEO2 - #00 OVR #02 SFT #50 SFT2 #0088 ADD2 .Screen/y DEO2 - DUP #c0 ORA - INC GTHk ?&l2fg - POP2 - BRK - -@ ( color -- ) - ,&color STR - #f2 .Screen/auto DEO - ;check-icn .Screen/addr DEO2 - #2200 - × ( -- ) - [ LIT &color $1 ] .Screen/sprite DEO - INC GTHk ?× - POP2 - JMP2r - -@ ( color -- ) - #01 .Screen/auto DEO - ;circle-chr .Screen/addr DEO2 - DUP .Screen/sprite DEO - DUP #10 ORA .Screen/sprite DEO - .Screen/y DEI2k #0008 ADD2 ROT DEO2 - DUP #20 ORA .Screen/sprite DEO - DUP #30 ORA .Screen/sprite DEO - -@ ( color -- ) - .Screen/y DEI2k #000c ADD2 ROT DEO2 - #00 SWP #30 SFT ;font-icn ADD2 .Screen/addr DEO2 - #09 .Screen/sprite DEO - JMP2r - -@check-icn [ 0306 0c18 3060 c081 ] - -@circle-chr [ - 071f 3c70 60e3 c7c7 0000 030f 1f1f 3f3f ] - -@font-icn ( 0-f ) - [ - 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 ] - diff --git a/projects/examples/devices/screen.bounds.tal b/projects/examples/devices/screen.bounds.tal deleted file mode 100644 index dd8dacb..0000000 --- a/projects/examples/devices/screen.bounds.tal +++ /dev/null @@ -1,141 +0,0 @@ -|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2 - -|0100 - -@on-reset ( -> ) - #375e .System/r DEO2 - #286c .System/g DEO2 - #2358 .System/b DEO2 - ;on-mouse .Mouse/vector DEO2 - - BRK - -@on-mouse ( -> ) - ( | clear background ) - #0000 DUP2 .Screen/x DEO2 - .Screen/y DEO2 - #80 .Screen/pixel DEO - - ( | cursor ) - #41 ;cursor-icn - ( | draw portrait ) - .Screen/x DEI2k #0008 ADD2 ROT DEO2 - .Screen/y DEI2k #0020 SUB2 ROT DEO2 - [ LIT2 36 -Screen/auto ] DEO - #81 - .Screen/x DEI2k #0010 SUB2 ROT DEO2 - .Screen/y DEI2k #0020 SUB2 ROT DEO2 - #91 - .Screen/x DEI2k #0000 SUB2 ROT DEO2 - .Screen/y DEI2k #0020 ADD2 ROT DEO2 - #b1 - .Screen/x DEI2k #0010 ADD2 ROT DEO2 - .Screen/y DEI2k #0020 ADD2 ROT DEO2 - #a1 - ( - .Screen/y DEI2k #0060 SUB2 ROT DEO2 - ) - BRK - -@ ( color -- ) - ;portrait-chr .Screen/addr DEO2 - .Screen/sprite DEOk DEOk DEOk DEO - JMP2r - -@ ( -- ) - ;box-icn .Screen/addr DEO2 - #05 .Screen/sprite DEOk DEOk DEOk DEO - JMP2r - -@ ( color -- ) - #01 .Screen/auto DEO - ;circle-chr .Screen/addr DEO2 - DUP .Screen/sprite DEO - DUP #10 ORA .Screen/sprite DEO - .Screen/y DEI2k #0008 ADD2 ROT DEO2 - DUP #20 ORA .Screen/sprite DEO - #30 ORA .Screen/sprite DEO - JMP2r - -@ ( -- ) - #0000 DUP2 .Screen/x DEO2 .Screen/y DEO2 - #f2 .Screen/auto DEO - ;guide-icn .Screen/addr DEO2 - #1000 - &l ( -- ) - #01 .Screen/sprite DEO - INC GTHk ?&l - POP2 - ( | circles ) - #0010 DUP2 .Screen/x DEO2 .Screen/y DEO2 - #02 - .Screen/y DEI2k #0008 ADD2 ROT DEO2 - #82 - .Screen/y DEI2k #0008 ADD2 ROT DEO2 - #05 - .Screen/y DEI2k #0008 ADD2 ROT DEO2 - #85 - .Screen/y DEI2k #0008 ADD2 ROT DEO2 - #03 - .Screen/y DEI2k #0008 ADD2 ROT DEO2 - #83 - .Screen/y DEI2k #0008 ADD2 ROT DEO2 - #0a - .Screen/y DEI2k #0008 ADD2 ROT DEO2 - #8a - JMP2r - -@ ( color addr* -- ) - [ LIT2 00 -Screen/auto ] DEO - ;fill-icn .Screen/addr DEO2 - #40 - .Mouse/x DEI2 ,/x STR2 - .Mouse/y DEI2 ,/y STR2 - .Screen/addr DEO2 - -@ ( color -- ) - [ LIT2 &x $2 ] .Screen/x DEO2 - [ LIT2 &y $2 ] .Screen/y DEO2 - .Screen/sprite DEO - JMP2r - -@guide-icn [ 0101 0101 0101 01ff ] - -@fill-icn [ ffff ffff ffff ffff ] - -@cursor-icn [ 80c0 e0f0 f8e0 1000 ] - -@portrait-chr [ - 070f 1e1d 1b3b 3b3b f0e0 c0c0 d08b 8080 - f76f cf9f 9f5f 5f5f 0000 0007 1c40 4040 - fffb f975 7576 7667 0000 3164 0406 0607 - efef efef eddd 9e1e 0060 8000 0000 0000 - 3b2b 280d 0105 0506 8080 8081 e1f1 f1f0 - 5f6c 639b 0f27 77ab 4060 639b 0f27 67ab - 0dc8 b0e5 cded fdfc 0dc8 b0e4 ccec fcfc - 5e1e 1c9c 9d1d 5d59 4000 0080 8000 4040 - 0607 0707 070e 0e0e f0f0 f0f0 f0e0 e0e0 - fb73 7fb7 bbbf bfdd f373 7b37 3b3f 3f1c - ffff ffff ffff ffff ffff ffff ffff ff7f - dba7 97f7 f7ed dd9d c080 90f0 f0e0 c080 - 1e0e 0000 0000 0000 c0c0 f0ff ffff ffff - ee03 0000 0000 0000 0e12 fcff ffff ffff - fffc f30f 1f1f 1f3f 9f3c f30f dfdf dfbf - 3c80 8080 80c0 c0e0 0003 3fbf bfbf dfef ] - -@box-icn [ - 001f 2050 4844 4241 00ff 0000 0000 0000 - 00ff 0000 0000 0000 00f8 040a 1222 4282 - 4040 4040 4040 4040 8040 2010 0804 0201 - 0102 0408 1020 4080 0202 0202 0202 0202 - 4040 4040 4040 4040 0102 0408 1020 4080 - 8040 2010 0804 0201 0202 0202 0202 0202 - 4142 4448 5020 1f00 0000 0000 0000 ff00 - 0000 0000 0000 ff00 8242 2212 0a04 f800 ] - -@circle-chr [ - 071f 3c70 60e3 c7c7 0000 030f 1f1f 3f3f ] - - diff --git a/projects/examples/devices/screen.pixel.tal b/projects/examples/devices/screen.pixel.tal deleted file mode 100644 index 2c7c09c..0000000 --- a/projects/examples/devices/screen.pixel.tal +++ /dev/null @@ -1,96 +0,0 @@ -( Screen.pixel: test rom for screen pixel drawing ) - -|00 @System/vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen/vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 - -|000 - - @center &x $2 &y $2 - -|100 - -@on-reset ( -> ) - ( | theme ) - #f07f .System/r DEO2 - #f0d6 .System/g DEO2 - #f0b2 .System/b DEO2 - ( | resize ) - #00c8 DUP2 .Screen/width DEO2 - .Screen/height DEO2 - ( | find screen center ) - .Screen/width DEI2 #01 SFT2 .center/x STZ2 - .Screen/height DEI2 #01 SFT2 .center/y STZ2 - ( | draw ) - - - - - BRK - -@ ( -- ) - .center/x LDZ2 .Screen/x DEO2 - .center/y LDZ2 .Screen/y DEO2 - ( | 4-way backgrounds ) - #0400 - &>l - DUP DUP #40 SFT #80 ADD ORA .Screen/pixel DEO - INC GTHk ?&>l - POP2 JMP2r - -@ ( -- ) - .center/x LDZ2 #01 SFT2 .Screen/x DEO2 - .center/y LDZ2 #01 SFT2 .Screen/y DEO2 - #b0 .Screen/pixel DEO - .center/x LDZ2 #01 SFT2 #0003 MUL2 .Screen/x DEO2 - .center/y LDZ2 #01 SFT2 .Screen/y DEO2 - #a1 .Screen/pixel DEO - .center/x LDZ2 #01 SFT2 #0003 MUL2 .Screen/x DEO2 - .center/y LDZ2 #01 SFT2 #0003 MUL2 .Screen/y DEO2 - #83 .Screen/pixel DEO - .center/x LDZ2 #01 SFT2 .Screen/x DEO2 - .center/y LDZ2 #01 SFT2 #0003 MUL2 .Screen/y DEO2 - #92 .Screen/pixel DEO - JMP2r - -@ ( -- ) - .center/x LDZ2 #02 SFT2 .Screen/x DEO2 - .center/y LDZ2 #02 SFT2 .Screen/y DEO2 - #f1 .Screen/pixel DEO - .center/x LDZ2 #02 SFT2 #0007 MUL2 .Screen/x DEO2 - .center/y LDZ2 #02 SFT2 .Screen/y DEO2 - #e3 .Screen/pixel DEO - ( clear ) #e0 .Screen/pixel DEO - .center/x LDZ2 #02 SFT2 #0007 MUL2 .Screen/x DEO2 - .center/y LDZ2 #02 SFT2 #0007 MUL2 .Screen/y DEO2 - #c2 .Screen/pixel DEO - .center/x LDZ2 #02 SFT2 .Screen/x DEO2 - .center/y LDZ2 #02 SFT2 #0007 MUL2 .Screen/y DEO2 - #d0 .Screen/pixel DEO - JMP2r - -@ ( -- ) - ( | bottom-left, background ) - .center/x LDZ2 #0010 SUB2 .Screen/x DEO2 - .center/y LDZ2 .Screen/y DEO2 - ( auto-x ) #01 .Screen/auto DEO - #00 - &>bl - #00 OVR EQU OVR #0f AND ORA ?{ - .center/x LDZ2 #0010 SUB2 .Screen/x DEO2 - .Screen/y DEI2k INC2 ROT DEO2 } - DUP #04 SFT OVR #0f AND LTH INC .Screen/pixel DEO - INC DUP ?&>bl - POP - ( | bottom-right, foreground ) - .center/x LDZ2 .Screen/x DEO2 - .center/y LDZ2 #0010 SUB2 .Screen/y DEO2 - ( auto-y ) #02 .Screen/auto DEO - #00 - &>br - #00 OVR EQU OVR #0f AND ORA ?{ - .center/y LDZ2 #0010 SUB2 .Screen/y DEO2 - .Screen/x DEI2k INC2 ROT DEO2 } - DUP #04 SFT OVR #0f AND GTH INC #40 ORA .Screen/pixel DEO - INC DUP ?&>br - POP JMP2r - diff --git a/projects/examples/devices/screen.tal b/projects/examples/devices/screen.tal deleted file mode 100644 index 27ee332..0000000 --- a/projects/examples/devices/screen.tal +++ /dev/null @@ -1,217 +0,0 @@ -( Screen: - Draws a table of all possible sprite arrangements. ) - -|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 - -|0000 - - @center &x $2 &y $2 - -|0100 ( -> ) - - ( vector ) - ;on-frame .Screen/vector DEO2 - ( theme ) - #f07f .System/r DEO2 - #f0e0 .System/g DEO2 - #f0c0 .System/b DEO2 - ( gba screen size 00f0 x 00a0 ) - ( nds screen size 0100 x 00c0 ) - #0100 .Screen/width DEO2 - #00b0 .Screen/height DEO2 - ( find screen center ) - .Screen/width DEI2 #01 SFT2 .center/x STZ2 - .Screen/height DEI2 #01 SFT2 .center/y STZ2 - ( draw ) - draw-size - draw-sprites - draw-1bpp - draw-2bpp - -BRK - -( -@|vectors ) - -@on-frame ( -> ) - - ( scroll background ) - [ LIT2 &f $2 ] INC2k ,&f STR2 - #01 SFT2 - #001f AND2 - #0040 SUB2 - DUP2 .Screen/x DEO2 - .Screen/y DEO2 - ;patt-icn draw-fill - - .center/x LDZ2 #0070 SUB2 .Screen/x DEO2 - .center/y LDZ2 #0048 SUB2 .Screen/y DEO2 - ;anim-chr ,&f LDR2 #00ff AND2 #02 SFT #07 AND #40 SFT ADD2 .Screen/addr DEO2 - #8f .Screen/sprite DEO - - draw-size - draw-sprites - draw-1bpp - draw-2bpp - -BRK - -( -@|drawing ) - -@draw-sprites ( -- ) - - ( horizontal ) - .center/x LDZ2 #0060 SUB2 .Screen/x DEO2 - .center/y LDZ2 #0048 SUB2 .Screen/y DEO2 - ;font-icn .Screen/addr DEO2 - #f6 .Screen/auto DEO - #05 .Screen/sprite DEO - ( vertical ) - .center/x LDZ2 #0070 SUB2 .Screen/x DEO2 - .center/y LDZ2 #0038 SUB2 .Screen/y DEO2 - ;font-icn .Screen/addr DEO2 - #f5 .Screen/auto DEO - #05 .Screen/sprite DEO - ( table ) - #00 .Screen/auto DEO - ;preview-chr .Screen/addr DEO2 - #00 - &loop - ( move ) #00 OVR #0f AND #30 SFT - .center/x LDZ2 #0060 SUB2 ADD2 .Screen/x DEO2 - ( move ) #00 OVR #f0 AND #01 SFT - .center/y LDZ2 #0038 SUB2 ADD2 .Screen/y DEO2 - ( draw ) DUP .Screen/sprite DEO - INC DUP ?&loop - POP - -JMP2r - -@draw-1bpp ( -- ) - - #1000 - &loop - ( color ) STHk - ( y ) #00 OVR #42 SFT2 - .center/y LDZ2 #0038 SUB2 ADD2 STH2 - ( x ) #00 OVR #03 AND #40 SFT2 #0040 ADD2 - .center/x LDZ2 #0010 SUB2 ADD2 - STH2r STHr #00 draw-circle - INC GTHk ?&loop - POP2 - -JMP2r - -@draw-2bpp ( -- ) - - #1000 - &loop - ( color ) STHk - ( y ) #00 OVR #42 SFT2 - .center/y LDZ2 #0008 ADD2 ADD2 STH2 - ( x ) #00 OVR #03 AND #40 SFT2 #0040 ADD2 - .center/x LDZ2 #0010 SUB2 ADD2 - STH2r STHr #80 draw-circle - INC GTHk ?&loop - POP2 - -JMP2r - -@draw-circle ( x* y* color depth -- ) - - ADD STH - ;preview-chr .Screen/addr DEO2 - .Screen/y DEO2 - .Screen/x DEO2 - #01 .Screen/auto DEO - STHr .Screen/sprite DEOk - #02 .Screen/auto DEO - SWP #10 ADD SWP DEOk - .Screen/x DEI2k #0008 SUB2 ROT DEO2 - #01 .Screen/auto DEO - SWP #10 ADD SWP DEOk - SWP #10 ADD SWP DEO - -JMP2r - -@draw-fill ( patt* color -- ) - - .Screen/addr DEO2 - [ LIT2 01 -Screen/auto ] DEO - .Screen/x DEI2 ,&anchor STR2 - .Screen/width DEI2 #03 SFT2 NIP #08 ADD ,&x STR - .Screen/height DEI2 #03 SFT2 NIP #08 ADD #00 - &h - DUP #02 SFT STH - [ LIT &x $1 ] #00 - &w - DUP #02 SFT STHkr ADD #01 AND .Screen/sprite DEO - INC GTHk ?&w - .Screen/y DEI2k #0008 ADD2 ROT DEO2 - [ LIT2 &anchor $2 ] .Screen/x DEO2 - POP2 POPr - INC GTHk ?&h - POP2 - -JMP2r - -@draw-size ( -- ) - - #01 .Screen/auto DEO - .center/x LDZ2 #0030 ADD2 .Screen/x DEO2 - .center/y LDZ2 #0048 SUB2 .Screen/y DEO2 - .Screen/width DEI2 draw-dec - ;x-icn .Screen/addr DEO2 - #01 .Screen/sprite DEO - .Screen/height DEI2 - -@draw-dec ( short* -- ) - - #00 ,&z STR - #2710 draw-dec/parse - #03e8 draw-dec/parse - #0064 draw-dec/parse - #000a draw-dec/parse - NIP - &emit - DUP [ LIT &z $1 ] EQU ?&skip - #ff ,&z STR #00 OVR #30 SFT ;font-icn ADD2 .Screen/addr DEO2 - #01 .Screen/sprite DEO - &skip - POP - -JMP2r - &parse DIV2k DUP ,&emit JSR MUL2 SUB2 JMP2r - -( -@|assets ) - -@patt-icn [ - aa55 aa55 aa55 aa55 ] -@x-icn [ - 0000 0018 1800 0000 ] -@preview-chr [ - 0f38 675f dfbf bfbf 0007 1820 2344 4848 ] -@font-icn ( 0-f ) [ - 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 [ -@anim-chr [ - 0000 0018 1800 0000 c381 0000 0000 81c3 - 0000 183c 3c18 0000 0000 0000 0000 0000 - 0018 3c7e 7e3c 1800 0000 0000 0000 0000 - 3c7e ffe7 e7ff 7e3c 0000 0018 1800 0000 - ffff e7c3 c3e7 ffff 0000 183c 3c18 0000 - ffe7 c381 81c3 e7ff 0018 3c7e 7e3c 1800 - c381 0000 0000 81c3 3c7e ffe7 e7ff 7e3c - 0000 0000 0000 0000 ffff e7c3 c3e7 ffff - 0000 0000 0000 0000 ffe7 c381 81c3 e7ff ] - diff --git a/projects/examples/devices/system.expansion.tal b/projects/examples/devices/system.expansion.tal deleted file mode 100644 index 8094214..0000000 --- a/projects/examples/devices/system.expansion.tal +++ /dev/null @@ -1,56 +0,0 @@ -|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 -|100 - -@on-reset ( -> ) - ;buf - #2018 DEO - ;buf - #0a18 DEO - ( | copy left ) - ;buf #0006 ADD2 ;mmu-cpyl/a STA2 - ;buf #0003 ADD2 ;mmu-cpyl/b STA2 - ;mmu-cpyl .System/expansion DEO2 - ;buf - #2018 DEO - ;res1 - #0a18 DEO - ( | copy right ) - ;buf #0003 ADD2 ;mmu-cpyr/a STA2 - ;buf #0009 ADD2 ;mmu-cpyr/b STA2 - ;mmu-cpyr .System/expansion DEO2 - ;buf - #2018 DEO - ;res2 - #0a18 DEO - ( | copy left ) - ;buf #0009 ADD2 ;mmu-cpyl/a STA2 - ;buf #0006 ADD2 ;mmu-cpyl/b STA2 - ;mmu-cpyl .System/expansion DEO2 - ;buf - #2018 DEO - ;res3 - #0a18 DEO - ( | memset ) - ;buf #0003 ADD2 ;mmu-fill/a STA2 - ;mmu-fill .System/expansion DEO2 - ;buf - #2018 DEO - ;res4 - #0a18 DEO - BRK - -@ ( str* -- ) - LDAk #18 DEO - INC2 LDAk ? - POP2 JMP2r - -@buf [ "......[hello]..... $1 ] -@res1 [ "...[hello]lo]..... $1 ] -@res2 [ "...[hello[hello].. $1 ] -@res3 [ "...[he[hello]lo].. $1 ] -@res4 [ "...-------------.. $1 ] - -@mmu-fill [ 00 000d 0000 &a $2 2d ] -@mmu-cpyl [ 01 0007 0000 &a $2 0000 &b $2 ] -@mmu-cpyr [ 02 0007 0000 &a $2 0000 &b $2 ] - diff --git a/projects/examples/exercises/ack.tal b/projects/examples/exercises/ack.tal deleted file mode 100644 index 4d288e7..0000000 --- a/projects/examples/exercises/ack.tal +++ /dev/null @@ -1,6 +0,0 @@ -#02 #02 ack BRK - -@ack ( m n -- r ) - OVR ?{ NIP INC JMP2r } - DUP ?{ INC SUB #01 !ack } - #0101 SUB2 OVR INC SWP ack !ack diff --git a/projects/examples/exercises/brainfuck.tal b/projects/examples/exercises/brainfuck.tal deleted file mode 100644 index 4e4fa74..0000000 --- a/projects/examples/exercises/brainfuck.tal +++ /dev/null @@ -1,56 +0,0 @@ -( usage: cat program.bf | uxncli brainfuck.rom ) - -|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1 - -|0100 - -@on-reset ( -> ) - ;on-console .Console/vector DEO2 - BRK - -@on-console ( -> ) - .Console/read DEI DUP #20 GTH ?{ - POP - #0000 .Console/vector DEO2 - #010f DEO - BRK } - [ LIT2 &ptr =program ] INC2k ,&ptr STR2 - STA - BRK - -@ ( -- ) - [ LIT2r =on-console/ptr ] LDA2r ;program - &while ( -- ) - LDAk [ LIT "+ ] NEQ ?{ LDAkr STHr INC STH2kr STA } - LDAk [ LIT "- ] NEQ ?{ LDAkr STHr #01 SUB STH2kr STA } - LDAk [ LIT "> ] NEQ ?{ INC2r } - LDAk [ LIT "< ] NEQ ?{ [ LIT2r 0001 ] SUB2r } - LDAk [ LIT ". ] NEQ ?{ LDAkr [ LITr 18 ] DEOr } - LDAk [ LIT "[ ] NEQ ?{ goto-next } - LDAk [ LIT "] ] NEQ ?{ goto-back } - INC2 LDAk ?&while - POP2 POP2r JMP2r - -@goto-next ( `mem* prg* -- ) - OVR2r LDAr STHr ?{ JMP2r } - [ LITr 00 ] INC2 - &loop ( -- ) - LDAk [ LIT "[ ] NEQ ?{ INCr } - LDAk [ LIT "] ] NEQ ?{ - STHkr ?{ POPr JMP2r } - [ LITr 01 ] SUBr } - INC2 !&loop - -@goto-back ( `mem* prg* -- ) - OVR2r LDAr STHr ?{ JMP2r } - [ LITr 00 ] #0001 SUB2 - &loop ( -- ) - LDAk [ LIT "] ] NEQ ?{ INCr } - LDAk [ LIT "[ ] NEQ ?{ - STHkr ?{ POPr JMP2r } - [ LITr 01 ] SUBr } - #0001 SUB2 !&loop - -@program - - diff --git a/projects/examples/exercises/fib.tal b/projects/examples/exercises/fib.tal deleted file mode 100644 index 17eb261..0000000 --- a/projects/examples/exercises/fib.tal +++ /dev/null @@ -1,47 +0,0 @@ -( Fibonacci: Numbers made of the two numbers before it ) - -|100 - -@on-reset ( -> ) - #0019 #0001 - &>l ( -- ) - ( index ) DUP2 - #2018 DEO - ( recursive ) DUP2 fib - #2018 DEO - ( tail-recursive ) DUP2 #0000 #0001 ROT2 fibrec - ( lb ) #0a18 DEO - POP2 POP2 INC2 GTH2k ?&>l - POP2 POP2 - ( end ) #800f DEO - BRK - -( -@|recursive ) - -@fib ( num* -- numfib* ) - #0001 GTH2k ?{ POP2 JMP2r } - SUB2k fib STH2 - INC2 SUB2 fib STH2r ADD2 JMP2r - -( -@|tail-recursive ) - -@fibrec ( a* b* num* -- a* b* numfib* ) - #0001 NEQ2k ?{ POP2 POP2 DUP2 JMP2r } - SUB2 STH2 - SWP2 OVR2 ADD2 STH2r !fibrec - -( -@|stdlib ) - -@ ( short* -- ) - [ LIT2r ff00 ] - &>read ( -- ) - #000a DIV2k STH2k MUL2 SUB2 STH2r INCr ORAk ?&>read - POP2 - &>write ( -- ) - NIP #30 ADD #18 DEO - OVRr ADDr STHkr ?&>write - POP2r JMP2r - diff --git a/projects/examples/exercises/fizzbuzz.tal b/projects/examples/exercises/fizzbuzz.tal deleted file mode 100644 index 704fecd..0000000 --- a/projects/examples/exercises/fizzbuzz.tal +++ /dev/null @@ -1,20 +0,0 @@ -( Print the first 30 numbers using the following rules: - | If n is divisible by 3, print "fizz" - | If n is divisible by 5, print "buzz" - | If n is divisible by both, print "fizzbuzz" - | Else, print the number ) - -@fizzbuzz ( -> ) - #1e00 - &>loop ( length i -- ) - DUP fizz OVR buzz ORA ?{ DUP } - #0a18 DEO - INC GTHk ?&>loop - POP2 BRK - -@fizz ( n -- ) #03 DIVk MUL SUB ?{ #01 ;Dict/fizz ! } #00 JMP2r -@buzz ( n -- ) #05 DIVk MUL SUB ?{ #01 ;Dict/buzz ! } #00 JMP2r -@ ( n -- ) DUP #0a DIV /d #0a DIVk MUL SUB &d #30 ADD #18 DEO JMP2r -@ ( s* -- ) LDAk #18 DEO INC2 LDAk ? POP2 JMP2r -@Dict &fizz "Fizz $1 &buzz "Buzz $1 - diff --git a/projects/examples/exercises/hello.bf b/projects/examples/exercises/hello.bf deleted file mode 100644 index 7f5b94d..0000000 --- a/projects/examples/exercises/hello.bf +++ /dev/null @@ -1,2 +0,0 @@ ->++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.>>++++++[<+++++++>-]<++.------------.>++++++[<+++++++++>-]<+.<.+++.------.--------.>>>++++[<++++++++>-]<+. - diff --git a/projects/examples/exercises/primes.tal b/projects/examples/exercises/primes.tal deleted file mode 100644 index 3910102..0000000 --- a/projects/examples/exercises/primes.tal +++ /dev/null @@ -1,36 +0,0 @@ -( Primes: - An integer greater than one is called a prime number - if its only positive divisors are one and itself. ) - -|0100 ( -> ) @reset - - #0000 INC2k - &loop - DUP2 not-prime ?&skip - DUP2 print/short #2018 DEO - &skip - INC2 NEQ2k ?&loop - POP2 POP2 - ( halt ) #010f DEO - -BRK - -@not-prime ( number* -- flag ) - - DUP2 ,&t STR2 - ( range ) #01 SFT2 #0002 LTH2k ?&fail - &loop - [ LIT2 &t $2 ] OVR2 ( mod2 ) DIV2k MUL2 SUB2 ORA ?&continue - &fail POP2 POP2 #01 JMP2r &continue - INC2 GTH2k ?&loop - POP2 POP2 #00 - -JMP2r - -@print ( short* -- ) - - &short ( short* -- ) SWP print/byte - &byte ( byte -- ) DUP #04 SFT print/char - &char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO - -JMP2r diff --git a/projects/examples/exercises/quine.tal b/projects/examples/exercises/quine.tal deleted file mode 100644 index 0e701c0..0000000 --- a/projects/examples/exercises/quine.tal +++ /dev/null @@ -1 +0,0 @@ -a001 38a0 0100 b460 0011 a020 1817 2121 aa20 fff2 2222 a080 0f17 0004 6000 0006 8004 1f60 0000 800f 1c06 8009 0a80 271a 1880 3018 8018 176c diff --git a/projects/examples/exercises/sierpinski.tal b/projects/examples/exercises/sierpinski.tal deleted file mode 100644 index a3330dd..0000000 --- a/projects/examples/exercises/sierpinski.tal +++ /dev/null @@ -1,17 +0,0 @@ -( uxncli sierpinski.rom ) - -@sierpinski ( -> ) - ( mask ) [ LIT2r 0a18 ] [ LIT2r 2018 ] - ( size ) [ LIT2 &size 1001 ] SUB - &>ver ( -- ) - DUP INCk - &>pad ( length -- ) - DEOkr - #01 SUB DUP ?&>pad - &>fill ( length i -- ) - ANDk DUP2r ?{ POP2r ORA2kr } DEOr DEOkr - INC ADDk ,&size LDR LTH ?&>fill - POP2 OVR2r DEOr - #01 SUB INCk ?&>ver - POP POP2r POP2r BRK - diff --git a/projects/examples/exercises/subleq.tal b/projects/examples/exercises/subleq.tal deleted file mode 100644 index 25c3f89..0000000 --- a/projects/examples/exercises/subleq.tal +++ /dev/null @@ -1,41 +0,0 @@ -( Subleq: The subleq instruction subtracts the contents at address a from the contents at address b, stores the result at address b, and then, if the result is not positive, jumps to address c. If the result is positive, execution proceeds to the next instruction in sequence. ) - -|0100 - -@on-reset ( -> ) - #0000 - &while ( -- ) - eval DUP2 #8000 LTH2 ?&while - POP2 - ( halt ) #010f DEO - BRK - -@eval ( ip* -- ip* ) - DUP2 get ,&a STR2 - INC2 DUP2 get ,&b STR2 - INC2 DUP2 get ,&c STR2 - INC2 - ( | I/O ) - [ LIT2 &a $2 ] #ffff EQU2 ?&input - [ LIT2 &b $2 ] #ffff EQU2 ?&output - ( | SUBLEQ ) - ( sub ) ,&b LDR2 get ,&a LDR2 get SUB2 DUP2 - ( write ) ,&b LDR2 DUP2 ADD2 ;program ADD2 STA2 - ( leq ) #0001 SUB2 #8000 LTH2 ?&end - POP2 [ LIT2 &c $2 ] &end JMP2r - &input ( -- ) - ( TODO ) JMP2r - &output ( -- ) - ,&a LDR2 get NIP #18 DEO - JMP2r - -@get ( a* -- b* ) - DUP2 ADD2 ;program ADD2 LDA2 JMP2r - -@program ( hello world ) - [ - 000f 0011 ffff 0011 ffff ffff 0010 0001 - ffff 0010 0003 ffff 000f 000f 0000 0000 - ffff 0048 0065 006c 006c 006f 002c 0020 - 0077 006f 0072 006c 0064 0021 000a 0000 ] - diff --git a/projects/examples/exercises/tak.tal b/projects/examples/exercises/tak.tal deleted file mode 100644 index 6a903f3..0000000 --- a/projects/examples/exercises/tak.tal +++ /dev/null @@ -1,12 +0,0 @@ -@on-reset ( -> ) - #0b #14 #18 tak - #010e DEO - BRK - -@tak ( z y x -- res ) - LTHk ?{ POP2 JMP2r } - ROT ROTk ROTk - ( x-1 ) #01 SUB tak STH - ( y-1 ) #01 SUB tak STH - ( z-1 ) #01 SUB tak STHr STHr !tak - diff --git a/projects/examples/gui/button.tal b/projects/examples/gui/button.tal deleted file mode 100644 index a1156b5..0000000 --- a/projects/examples/gui/button.tal +++ /dev/null @@ -1,166 +0,0 @@ -( a simple button ) - -|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 &pad $4 &scrolly &scrolly-hb $1 &scrolly-lb $1 - -|100 - -@on-reset ( -> ) - ;meta #06 DEO2 - ( | theme ) - #5c0f DUP2 .System/r DEO2 - DUP2 .System/g DEO2 - .System/b DEO2 - ( | size ) - #0058 DUP2 .Screen/width DEO2 - .Screen/height DEO2 - ( >> ) - -@on-mouse ( -> ) - focus/ - BRK - -@meta $1 - ( name ) "Button 0a - ( desc ) "A 20 "Simple 20 "Button 0a - ( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a - ( date ) "15 20 "Jan 20 "2025 $2 - -( -@|focus ) - -@focus/ ( -- ) - cursor/ - .Mouse/x DEI2 .Mouse/y DEI2 - ( test button ) button/is-within ?{ ;on-mouse !focus/ } - ;button/on-mouse - ( >> ) - -@focus/ ( vector* -- ) - DUP2 [ LIT2 &last $2 ] NEQ2 ?{ POP2 JMP2r } - DUP2 .Mouse/vector DEO2 - ,&last STR2 !button/ - -( -@|button ) - -@button/on-mouse ( -> ) - focus/ - .Mouse/state DEI ?{ BRK } - / - BRK - -@button/on-mouse-lock ( -> ) - cursor/ - BRK - -@button/on-frame ( -> ) - [ LIT &timer $1 ] INCk ,&timer STR - ?{ / } - BRK - -@button/ ( -- ) - ;&on-frame .Screen/vector DEO2 - ;&on-mouse-lock focus/ - [ LIT2 e8 _&timer ] STR - ( emit ) [ LIT2 "! 18 ] DEO - JMP2r - -@button/ ( -- ) - #0000 .Screen/vector DEO2 - focus/ - [ LIT2 00 -Mouse/state ] DEO - JMP2r - -@button/ ( -- ) - .Mouse/vector DEI2 - ( | handlers ) - DUP2 ;&on-mouse-lock NEQ2 ?{ POP2 ;&down-chr !/ } - DUP2 ;&on-mouse NEQ2 ?{ POP2 ;&hover-chr !/ } - POP2 ;&up-chr - ( >> ) - -@button/ ( addr* -- ) - [ LIT2 26 -Screen/auto ] DEO - #0020 DUP2 .Screen/x DEO2 - .Screen/y DEO2 - .Screen/addr DEO2 - [ LIT2 81 -Screen/sprite ] DEOk DEOk DEO - JMP2r - -@button/is-within ( x* y* -- f ) - #0020 SUB2 #0018 LTH2 STH - #0020 SUB2 #0018 LTH2 STHr AND JMP2r - -( -@|cursor ) - -@cursor/ ( -- ) - ( | clear ) - ;fill-icn .Screen/addr DEO2 - #40 / - ( | paint ) - #ca ;&sprite-chr .Mouse/state DEI ?{ #0040 ADD2 } - .Screen/addr DEO2 - .Mouse/x DEI2 #0004 SUB2 ,&x STR2 - .Mouse/y DEI2 #0005 SUB2 ,&y STR2 - ( >> ) - -@cursor/ ( color -- ) - [ LIT2 16 -Screen/auto ] DEO - [ LIT2 &x $2 ] .Screen/x DEO2 - [ LIT2 &y $2 ] .Screen/y DEO2 - .Screen/sprite DEOk DEO - JMP2r - -( -@|assets ) - -@cursor/sprite-chr [ - 0000 0000 0000 0817 0000 0000 0000 0008 - 0000 0000 0000 00c0 0000 0000 0000 0000 - 1010 2010 1008 0700 0f0f 1f0f 0f07 0000 - 2010 1010 2020 c000 c0e0 e0e0 c0c0 0000 - 0000 0000 0814 1417 0000 0000 0008 0808 - 0000 0000 0000 00c0 0000 0000 0000 0000 - 1010 2010 1008 0700 0f0f 1f0f 0f07 0000 - 2010 1010 2020 c000 c0e0 e0e0 c0c0 0000 ] - -@button/up-chr [ - 0000 1f3f 3f3f 3f3f 001f 3f7f 7f7f 7f7f - 0000 ffff ffff ffff 00ff ffff ffff ffff - 0000 f8fc fcfc fcfc 00f8 fcfe fefe fefe - 3f3f 3f3f 3f3f 3f3f 7f7f 7f7f 7f7f 7f7f - e7e7 e781 c3e7 ffff ffff ffff ffff ffff - fcfc fcfc fcfc fcfc fefe fefe fefe fefe - 3f3f 3f3f 3f1f 0000 7f7f 7f5f 4020 1f00 - ffff ffff ffff 0000 ffff ffff 0000 ff00 - fcfc fcfc fcf8 0000 fefe fefa 0204 f800 ] - -@button/hover-chr [ - 0000 001f 3f3f 3f3f 0000 1f3f 7f7f 7f7f - 0000 00ff ffff ffff 0000 ffff ffff ffff - 0000 00f8 fcfc fcfc 0000 f8fc fefe fefe - 3f3f 3f3f 3f3f 3f3f 7f7f 7f7f 7f7f 7f7f - ffe7 e7e7 81c3 e7ff ffff ffff ffff ffff - fcfc fcfc fcfc fcfc fefe fefe fefe fefe - 3f3f 3f3f 3f1f 0000 7f7f 7f7f 5f20 1f00 - ffff ffff ffff 0000 ffff ffff ff00 ff00 - fcfc fcfc fcf8 0000 fefe fefe fa04 f800 ] - -@button/down-chr [ - 0000 001f 3f3f 3f3f 0000 1f20 5f7f 7f7f - 0000 00ff ffff ffff 0000 ff00 ffff ffff - 0000 00f8 fcfc fcfc 0000 f804 fafe fefe - 3f3f 3f3f 3f3f 3f3f 7f7f 7f7f 7f7f 7f7f - ffff ffff ffff ffff ffff e7e7 e781 c3e7 - fcfc fcfc fcfc fcfc fefe fefe fefe fefe - 3f3f 3f3f 3f1f 0000 7f7f 7f7f 7f3f 1f00 - ffff ffff ffff 0000 ffff ffff ffff ff00 - fcfc fcfc fcf8 0000 fefe fefe fefc f800 ] - -@fill-icn [ - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff ] - diff --git a/projects/examples/gui/hover.tal b/projects/examples/gui/hover.tal deleted file mode 100644 index 2c2621a..0000000 --- a/projects/examples/gui/hover.tal +++ /dev/null @@ -1,119 +0,0 @@ -( GUI Hover ) - -|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] -|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] -|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ] - -( variables ) - -|0000 - -@color $1 -@pointer [ &x $2 &y $2 &sprite $2 ] -@r1 [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] -@r2 [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] -@r3 [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] - -( program ) - -|0100 - - ( theme ) - #0f0f .System/r DEO2 - #0fff .System/g DEO2 - #0ff0 .System/b DEO2 - - ( vectors ) ;on-mouse .Mouse/vector DEO2 - - #0020 #0030 #0060 #0060 .r1/y2 STZ2 .r1/x2 STZ2 .r1/y1 STZ2 .r1/x1 STZ2 - #0058 #0050 #0090 #0080 .r2/y2 STZ2 .r2/x2 STZ2 .r2/y1 STZ2 .r2/x1 STZ2 - #0048 #0048 #0080 #0098 .r3/y2 STZ2 .r3/x2 STZ2 .r3/y1 STZ2 .r3/x1 STZ2 - -( no BRK, run through to on-mouse ) - -@on-mouse - - ;pointer_icn .pointer/sprite STZ2 - - #01 .color STZ - .Mouse/x DEI2 .Mouse/y DEI2 .r1 ;within-rect JSR2 #00 EQU ,&draw1 JCN - #02 .color STZ - ;hand_icn .pointer/sprite STZ2 - &draw1 - .r1/x1 LDZ2 .r1/y1 LDZ2 .r1/x2 LDZ2 .r1/y2 LDZ2 .color LDZ ;line-rect JSR2 - - #01 .color STZ - .Mouse/x DEI2 .Mouse/y DEI2 .r2 ;within-rect JSR2 #00 EQU ,&draw2 JCN - #03 .color STZ - ;hand_icn .pointer/sprite STZ2 - &draw2 - .r2/x1 LDZ2 .r2/y1 LDZ2 .r2/x2 LDZ2 .r2/y2 LDZ2 .color LDZ ;line-rect JSR2 - - #01 .color STZ - .Mouse/x DEI2 .Mouse/y DEI2 .r3 ;within-rect JSR2 #00 EQU ,&draw3 JCN - #02 .color STZ - ;hand_icn .pointer/sprite STZ2 - &draw3 - .r3/x1 LDZ2 .r3/y1 LDZ2 .r3/x2 LDZ2 .r3/y2 LDZ2 .color LDZ ;line-rect JSR2 - - ( clear last cursor ) - .pointer/x LDZ2 .Screen/x DEO2 - .pointer/y LDZ2 .Screen/y DEO2 - #40 .Screen/sprite DEO - - ( record pointer positions ) - .Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 - .Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 - .pointer/sprite LDZ2 .Screen/addr DEO2 - - ( draw new cursor ) - #41 .Screen/sprite DEO - -BRK - -@within-rect ( x* y* rect -- flag ) - - STH - ( y < rect.y1 ) DUP2 STHkr INC INC LDZ2 LTH2 ,&skip JCN - ( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN - SWP2 - ( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN - ( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN - POP2 POP2 POPr - #01 -JMP2r - &skip - POP2 POP2 POPr - #00 - -JMP2r - -@line-rect ( x1* y1* x2* y2* color -- ) - - STH - DUP2 ,&ver-y2 STR2 ,&hor-y2 STR2 - DUP2 ,&ver-x2 STR2 ,&hor-x2 STR2 - DUP2 ,&ver-y1 STR2 ,&hor-y1 STR2 - DUP2 ,&ver-x1 STR2 ,&hor-x1 STR2 - ( horizontal ) - [ LIT2 &hor-x2 $2 ] INC2 [ LIT2 &hor-x1 $2 ] - &hor - DUP2 .Screen/x DEO2 - [ LIT2 &hor-y1 $2 ] .Screen/y DEO2 STHkr .Screen/pixel DEOk - [ LIT2 &hor-y2 $2 ] .Screen/y DEO2 DEO - INC2 GTH2k ,&hor JCN - POP2 POP2 - ( vertical ) - [ LIT2 &ver-y2 $2 ] [ LIT2 &ver-y1 $2 ] - &ver - DUP2 .Screen/y DEO2 - [ LIT2 &ver-x1 $2 ] .Screen/x DEO2 STHkr .Screen/pixel DEOk - [ LIT2 &ver-x2 $2 ] .Screen/x DEO2 DEO - INC2 GTH2k ,&ver JCN - POP2 POP2 - POPr - -JMP2r - -@pointer_icn [ 80c0 e0f0 f8e0 1000 ] -@hand_icn [ 4040 4070 f8f8 f870 ] diff --git a/projects/examples/gui/label.tal b/projects/examples/gui/label.tal deleted file mode 100644 index 2b8c870..0000000 --- a/projects/examples/gui/label.tal +++ /dev/null @@ -1,466 +0,0 @@ -( GUI Labels ) - -|00 @System/vector $2 &pad $6 &r $2 &g $2 &b $2 -|20 @Screen/vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 - -|000 - - @center &x $2 &y $2 - -|100 - -@on-reset ( -> ) - ( | theme ) - #f0df .System/r DEO2 - #f0df .System/g DEO2 - #f0df .System/b DEO2 - ( | find screen center ) - .Screen/width DEI2 #01 SFT2 .center/x STZ2 - .Screen/height DEI2 #01 SFT2 .center/y STZ2 - ( | dashed line ) - [ LIT2 02 -Screen/auto ] DEO - #0000 .Screen/y DEO2 - .center/x LDZ2 .Screen/x DEO2 - #0000 .Screen/height DEI2 SUB2 - &>ver - DUP #01 AND INC INC .Screen/pixel DEO - INC2 ORAk ?&>ver - POP2 - ( | left ) - .center/x LDZ2 .Screen/x DEO2 - .center/y LDZ2 #0018 SUB2 .Screen/y DEO2 - ;left-txt uf2/ - ( | center ) - .center/x LDZ2 .Screen/x DEO2 - .center/y LDZ2 .Screen/y DEO2 - ;center-txt uf2/ - ( | right ) - .center/x LDZ2 .Screen/x DEO2 - .center/y LDZ2 #0018 ADD2 .Screen/y DEO2 - ;right-txt uf2/ - BRK - -@uf2/get-width ( text* -- width* ) - LIT2r 0000 - &>scan - LDAk #0000 ROT ;&widths ADD2 LDA STH2 - ADD2r INC2 LDAk ?&>scan - POP2 STH2r JMP2r - -@uf2/ ( text* -- ) - DUP2 /get-width #01 SFT2 STH2 - .Screen/x DEI2k STH2r SUB2 ROT DEO2 !/ - -@uf2/ ( text* -- ) - DUP2 /get-width STH2 - .Screen/x DEI2k STH2r SUB2 ROT DEO2 - ( >> ) - -@uf2/ ( text* -- ) - [ LIT2 15 -Screen/auto ] DEO - [ LIT2r 05 -Screen/sprite ] - &>while - LDAk DUP ?{ POP POP2 POP2r JMP2r } - #0000 ROT #20 SUB - ( addr ) DUP2 #50 SFT2 ;&glyphs ADD2 .Screen/addr DEO2 - ( move ) ;&widths ADD2 LDA .Screen/x DEI2 ADD2 - ( draw ) [ DEOkr DEOkr ] .Screen/x DEO2 - INC2 !&>while - -@left-txt "Left 20 "Aligned 20 "Label $1 - -@center-txt "Center 20 "Aligned 20 "Label $1 - -@right-txt "Right 20 "Aligned 20 "Label $1 - -@uf2/font ( venice14 ) - &widths [ - 0505 0809 080c 0d05 0707 0a09 0609 0608 - 0808 0808 0908 0808 0808 0505 0708 0709 - 000d 0a08 0b0a 090a 0c08 070c 090e 0c09 - 0a09 0c08 090b 0a0d 0d0a 0906 0806 0809 - 0509 0807 0a07 0708 0906 0609 050f 0a08 - 0908 0707 060a 090e 0a09 0807 0507 0800 - 0d0d 080a 0c09 0b09 0909 0909 0907 0707 - 0707 0606 0606 0a08 0808 0808 0a0a 0a0a - 0000 0000 0000 000a 0000 0005 0000 1009 - 0000 0000 0000 0000 0000 0000 0000 0c08 - 0905 0000 0000 000a 0a00 080d 0d09 0e0c - 090c 0808 0505 0000 0907 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 ] - &glyphs ( starting at #20 ) - [ - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 3030 3030 3030 3000 3030 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 2424 2400 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 1212 7f24 24fe 4848 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 1038 5450 7038 1c14 5438 1000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 3748 494b 360d 1a32 6241 0000 0000 - 0000 c0c0 8000 0080 4040 4080 0000 0000 - 0000 1c22 261c 1835 6343 463c 0000 0000 - 0000 0000 0000 e090 1020 8060 0000 0000 - 0000 2020 2000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0008 1030 2060 6060 6020 3010 0800 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0020 1018 080c 0c0c 0c08 1810 2000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0012 0c3f 0c12 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0008 0808 7f08 0808 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 3030 1020 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 7f00 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 3030 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0206 040c 0818 1030 2060 4000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 3c66 6666 6666 6666 663c 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0818 3818 1818 1818 183c 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 3c46 8606 0c18 3060 c2fc 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 7e8c 1830 7c06 4686 8c78 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 040c 1c2c 4c8d fe0c 0c1e 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 7c62 6078 0c06 0606 4c38 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 1c22 606c 7666 6666 663c 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 7e86 060c 0c18 1830 3030 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 3c66 6666 3c66 6666 663c 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 3c66 6666 666e 3606 4438 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0030 3000 0000 3030 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0030 3000 0000 3030 1020 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0c18 3060 3018 0c00 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 7e00 7e00 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 6030 180c 1830 6000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 3c46 0606 0c18 1000 1010 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0001 0200 0001 0306 7f98 30e0 0000 0000 - 00c0 6060 e0e0 6060 e060 6038 0000 0000 - 0010 7eb3 b333 3e31 3131 31ff 0000 0000 - 0000 0000 0000 0080 8080 8000 0000 0000 - 0000 7cc2 c2c4 c0c0 c0c2 c478 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0010 7fb1 b030 3030 3030 30ff 0000 0000 - 0000 0080 c0c0 c0c0 c0c0 8000 0000 0000 - 0010 7fb0 b030 3e30 3030 30ff 0000 0000 - 0000 8080 0000 0000 0040 8000 0000 0000 - 0010 7fb0 b030 3e30 3030 30e0 0000 0000 - 0000 8080 0000 0000 0000 0000 0000 0000 - 0000 3f61 c2c0 cfc3 c3c7 cb73 0000 0000 - 0000 0000 0000 0000 0040 8000 0000 0000 - 0000 71b1 b131 7fb1 3131 31e1 0000 0000 - 00e0 8080 8080 8080 8090 a0c0 0000 0000 - 0000 7898 9818 1818 1819 1a1c 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 7898 9818 1818 1818 1818 1810 20c0 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 70b1 b336 3c38 3c36 33e1 0000 0000 - 0000 c080 0000 0000 0010 20c0 0000 0000 - 0000 3860 6060 6060 6060 61fe 0000 0000 - 0000 0000 0000 0000 0080 0000 0000 0000 - 0000 70b8 bd2e 2420 2020 20c0 0000 0000 - 0000 70e0 6060 6060 6064 6870 0000 0000 - 0000 70b8 bc2e 2723 2120 20c0 0000 0000 - 0000 6040 4040 40c0 c0c0 4040 0000 0000 - 0000 3c46 c3c3 c3c3 c3c2 4438 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 7fb1 b131 313f 3030 30e0 0000 0000 - 0000 0080 8080 8000 0000 0000 0000 0000 - 0000 3c46 c3c3 c3c3 c3d3 4a3c 0402 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0010 7fb1 b131 313f 3633 31e0 0000 0000 - 0000 0080 8080 8000 0000 90e0 0000 0000 - 0000 7cc2 e470 381c 4e86 c67c 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 7f8c 8c0c 0c0c 0c0c 0c38 0000 0000 - 0000 8000 0000 0000 0000 0000 0000 0000 - 0000 61e1 6161 6161 6365 6931 0000 0000 - 0000 8080 8080 8080 80a0 c080 0000 0000 - 0000 61e3 6161 6163 666c 7870 0000 0000 - 0000 0080 8080 8000 0000 0000 0000 0000 - 0000 60e0 6060 6266 6e76 6747 0000 0000 - 0000 2070 3030 3030 60c0 8000 0000 0000 - 0000 60b0 980d 0707 0d18 3060 0000 0000 - 0000 3060 c080 0000 80c8 6830 0000 0000 - 0000 61e1 6161 6161 6163 6539 0101 021c - 0000 8080 8080 8080 8080 8080 8000 0000 - 0000 7f83 860c 1830 60c0 c1fe 0000 0000 - 0000 0000 0000 0000 0080 0000 0000 0000 - 0078 6060 6060 6060 6060 6060 7800 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 4060 2030 1018 080c 0406 0200 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0078 1818 1818 1818 1818 1818 7800 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0010 2844 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 00ff 0000 0000 - 0000 0000 0000 0000 0000 0080 0000 0000 - 0040 2010 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 007e c6c6 c6ce d766 0000 0000 - 0000 0000 0000 0000 0080 0000 0000 0000 - 0070 c0c0 c0dc e6c6 c6c6 ccf8 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 007c c4c0 c0c4 c870 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0003 0606 067e c6c6 c6ce d667 0000 0000 - 0080 0000 0000 0000 0040 8000 0000 0000 - 0000 0000 007c c4c8 d0e2 c478 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 001c 3030 3078 3030 3030 3030 3030 20c0 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 007e c6c6 c6ce d666 0604 0830 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0070 c0c0 c0ce d6e6 c6c6 c7c6 0000 0000 - 0000 0000 0000 0000 0080 0000 0000 0000 - 0000 2040 0060 e060 6064 6870 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 1020 0030 70b0 3030 3030 3020 4080 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0070 c0c0 c0d8 e4c4 f8d8 cdc6 0000 0000 - 0000 0000 0000 0000 0080 0000 0000 0000 - 0070 c0c0 c0c0 c0c0 c0c8 d0e0 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0067 eb73 6363 6363 0000 0000 - 0000 0000 0038 5898 181a 1c18 0000 0000 - 0000 0000 0067 eb73 6363 6363 0000 0000 - 0000 0000 0000 0000 0040 8000 0000 0000 - 0000 0000 007c c6c6 c6c6 cc78 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 006e f363 6363 667c 6060 60c0 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 007e c6c6 c6ce d666 0606 0706 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 006c f060 6060 7060 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0078 c4c0 780c 8c78 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0020 60f8 6060 6064 6870 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0063 e363 6367 6b33 0000 0000 - 0000 0000 0000 0000 0040 8000 0000 0000 - 0000 0000 0042 e763 6264 6870 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0042 e763 676b 7363 0000 0000 - 0000 0000 0010 3818 1020 4080 0000 0000 - 0000 0000 0061 b21c 0c16 2341 0000 0000 - 0000 0000 0000 0000 0000 4080 0000 0000 - 0000 0000 0063 e363 6367 6b33 0302 0438 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 007e 860c 1830 61fe 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 1830 3030 3060 3030 3030 3018 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 2020 2020 2020 2020 2020 2020 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 3018 1818 180c 1818 1818 1830 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 4c00 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0001 0200 0001 0306 7f98 30e0 0000 0000 - 00c0 6060 e0e0 6060 e060 6038 0000 0000 - 0001 0200 0001 0306 7f98 30e0 0000 0000 - c0c0 6060 e0e0 6060 e060 6038 0000 0000 - 0000 7cc2 c2c4 c0c0 c0c2 c478 1010 2000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0010 7fb0 b030 3e30 3030 30ff 0000 0000 - 0000 8080 0000 0000 0040 8000 0000 0000 - 1300 70b8 bc2e 2723 2120 20c0 0000 0000 - 0000 6040 4040 40c0 c0c0 4040 0000 0000 - 0000 3c46 c3c3 c3c3 c3c2 4438 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 61e1 6161 6161 6365 6931 0000 0000 - 0000 8080 8080 8080 80a0 c080 0000 0000 - 0008 1000 007e c6c6 c6ce d766 0000 0000 - 0000 0000 0000 0000 0080 0000 0000 0000 - 0010 0800 007e c6c6 c6ce d766 0000 0000 - 0000 0000 0000 0000 0080 0000 0000 0000 - 1028 4400 007e c6c6 c6ce d766 0000 0000 - 0000 0000 0000 0000 0080 0000 0000 0000 - 0000 2400 007e c6c6 c6ce d766 0000 0000 - 0000 0000 0000 0000 0080 0000 0000 0000 - 0032 4c00 007e c6c6 c6ce d766 0000 0000 - 0000 0000 0000 0000 0080 0000 0000 0000 - 1824 2418 007e c6c6 c6ce d766 0000 0000 - 0000 0000 0000 0000 0080 0000 0000 0000 - 0000 0000 007c c4c0 c0c4 c870 1010 2000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0008 1000 007c c4c8 d0e2 c478 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0020 1000 007c c4c8 d0e2 c478 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 1028 4400 007c c4c8 d0e2 c478 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 4800 007c c4c8 d0e2 c478 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0020 4000 0060 e060 6064 6870 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0040 2000 0060 e060 6064 6870 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 2050 8800 0060 e060 6064 6870 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 9000 0060 e060 6064 6870 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0019 2600 0067 eb73 6363 6363 0000 0000 - 0000 0000 0000 0000 0040 8000 0000 0000 - 0008 1000 007c c6c6 c6c6 cc78 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0020 1000 007c c6c6 c6c6 cc78 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 1028 4400 007c c6c6 c6c6 cc78 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 2400 007c c6c6 c6c6 cc78 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0032 4c00 007c c6c6 c6c6 cc78 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0008 1000 0063 e363 6367 6b33 0000 0000 - 0000 0000 0000 0000 0040 8000 0000 0000 - 0010 0800 0063 e363 6367 6b33 0000 0000 - 0000 0000 0000 0000 0040 8000 0000 0000 - 0814 2200 0063 e363 6367 6b33 0000 0000 - 0000 0000 0000 0000 0040 8000 0000 0000 - 0000 2400 0063 e363 6367 6b33 0000 0000 - 0000 0000 0000 0000 0040 8000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 1e33 3333 3631 3131 33e6 0000 0000 - 0000 0000 0000 0000 8080 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0010 2040 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0001 0200 0001 0306 7f98 30e1 0000 0000 - 00c0 7f61 e0e0 7c60 e060 61fe 0000 0000 - 0000 3d42 c7cb cbd3 d3e2 44b8 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 007d c6c6 c6cf d663 0000 0000 - 0000 0000 00e0 2040 8010 20c0 0000 0000 - 0000 0000 007c c6ce d6e6 cc78 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0808 0008 1830 6060 623c 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 6060 0060 6060 6060 6060 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0009 1224 4824 1209 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0024 1209 0409 1224 0000 0000 - 0000 0000 0000 0000 8000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0001 0200 0001 0306 7f98 30e0 0000 0000 - 00c0 6060 e0e0 6060 e060 6038 0000 0000 - 0001 0200 0001 0306 7f98 30e0 0000 0000 - 00c0 6060 e0e0 6060 e060 6038 0000 0000 - 4c00 3c46 c3c3 c3c3 c3c2 4438 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 3f47 c3c3 c3c3 c3c3 473b 0000 0000 - 0000 f808 0000 e000 0004 08f0 0000 0000 - 0000 0000 007d c6c6 c6c7 ce79 0000 0000 - 0000 0000 00e0 2040 8010 20c0 0000 0000 - 0000 0000 0000 7f00 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 7f00 0000 0000 0000 0000 - 0000 0000 0000 e000 0000 0000 0000 0000 - 0000 2448 6c6c 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 3636 1224 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 2040 6060 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 3030 1020 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 2400 0063 e363 6367 6b33 0302 0438 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0070 98ce 6438 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 ] - diff --git a/projects/examples/gui/monospace.tal b/projects/examples/gui/monospace.tal deleted file mode 100644 index 6515433..0000000 --- a/projects/examples/gui/monospace.tal +++ /dev/null @@ -1,148 +0,0 @@ -( GUI Monospace ) - -|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 - -( variables ) - -|0000 - -( program ) - -|0100 - - ( theme ) - #f05d .System/r DEO2 - #f0cd .System/g DEO2 - #f0ad .System/b DEO2 - - ( draw hello world ) - #0010 .Screen/x DEO2 - #0010 .Screen/y DEO2 - ;hello-txt #01 ;draw-uf1 JSR2 - - ( draw long text ) - #0010 .Screen/x DEO2 - #0030 .Screen/y DEO2 - ;long-txt #02 ;draw-uf1-linebreaks JSR2 - -BRK - -@draw-uf1 ( string* color -- ) - - #01 .Screen/auto DEO - STH - &while - ( get sprite ) LDAk #20 SUB #00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2 - ( draw ) STHkr .Screen/sprite DEO - INC2 LDAk ,&while JCN - POPr - POP2 - -JMP2r - -@draw-uf1-linebreaks ( string* color -- ) - - .Screen/x DEI2 ,&anchor STR2 - #01 .Screen/auto DEO - STH - &while - LDAk #0a NEQ ,&no-lb JCN - ( rewind ) LIT2 &anchor $2 .Screen/x DEO2 - ( skip line ) .Screen/y DEI2k #0008 ADD2 ROT DEO2 - ,&end JMP - &no-lb - ( get sprite ) LDAk #20 SUB #00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2 - ( draw ) STHkr .Screen/sprite DEO - &end - INC2 LDAk ,&while JCN - POPr - POP2 - -JMP2r - -@hello-txt "Hello 20 "Uxn! $1 - -@long-txt - 5275 7374 6963 2043 6f6d 7075 7469 6e67 - 2072 6566 6572 7320 746f 2074 6865 2063 - 6f6e 7374 7275 6374 696f 6e20 0a6f 6620 - 6361 6c63 756c 6174 696f 6e20 6d61 6368 - 696e 6573 2075 7369 6e67 2070 7265 2d69 - 6e64 7573 7472 6961 6c20 0a6f 7220 6576 - 656e 2070 7265 2d68 6973 746f 7269 6320 - 7465 6368 6e6f 6c6f 6779 2e20 0a0a 4974 - 2072 6576 6561 6c73 2061 2068 6973 746f - 7279 206f 6620 636f 6d70 7574 696e 6720 - 6173 2074 6865 200a 7061 7374 696d 6520 - 6f66 2064 696c 6574 7461 6e74 6573 2c20 - 616d 6174 6575 7220 7363 6965 6e74 6973 - 7473 0a61 6e64 2074 6162 756c 6174 6f72 - 7320 7768 6f20 636f 6e73 7472 7563 7420 - 6d61 6368 696e 6573 2074 6f20 0a6d 616e - 6970 756c 6174 6520 6162 7374 7261 6374 - 2073 796d 626f 6c73 2077 6974 6820 6e6f - 2070 7261 6374 6963 616c 200a 6170 706c - 6963 6174 696f 6e2e 2041 7320 7468 6573 - 6520 6d61 6368 696e 6573 2061 7265 2067 - 656e 6572 616c 6c79 200a 6c65 7373 2065 - 6666 6963 6965 6e74 2074 6861 6e20 636f - 6e76 656e 7469 6f6e 616c 2070 656e 6369 - 6c20 616e 6420 0a70 6170 6572 2063 6f6d - 7075 7461 7469 6f6e 2c20 7468 6579 2061 - 6c6c 7564 6520 746f 2061 206d 6f72 6520 - 0a65 7069 6375 7265 616e 2070 7261 6374 - 6963 6520 6f66 2063 6f6d 7075 7469 6e67 - 2066 6f72 2070 6c65 6173 7572 6520 0a72 - 6174 6865 7220 7468 616e 2070 726f 6475 - 6374 696f 6e2e - -@font ( bbcmicro ) - 0000 0000 0000 0000 1818 1818 1800 1800 - 6c6c 6c00 0000 0000 3636 7f36 7f36 3600 - 0c3f 683e 0b7e 1800 6066 0c18 3066 0600 - 386c 6c38 6d66 3b00 0c18 3000 0000 0000 - 0c18 3030 3018 0c00 3018 0c0c 0c18 3000 - 0018 7e3c 7e18 0000 0018 187e 1818 0000 - 0000 0000 0018 1830 0000 007e 0000 0000 - 0000 0000 0018 1800 0006 0c18 3060 0000 - 3c66 6e7e 7666 3c00 1838 1818 1818 7e00 - 3c66 060c 1830 7e00 3c66 061c 0666 3c00 - 0c1c 3c6c 7e0c 0c00 7e60 7c06 0666 3c00 - 1c30 607c 6666 3c00 7e06 0c18 3030 3000 - 3c66 663c 6666 3c00 3c66 663e 060c 3800 - 0000 1818 0018 1800 0000 1818 0018 1830 - 0c18 3060 3018 0c00 0000 7e00 7e00 0000 - 3018 0c06 0c18 3000 3c66 0c18 1800 1800 - 3c66 6e6a 6e60 3c00 3c66 667e 6666 6600 - 7c66 667c 6666 7c00 3c66 6060 6066 3c00 - 786c 6666 666c 7800 7e60 607c 6060 7e00 - 7e60 607c 6060 6000 3c66 606e 6666 3c00 - 6666 667e 6666 6600 7e18 1818 1818 7e00 - 3e0c 0c0c 0c6c 3800 666c 7870 786c 6600 - 6060 6060 6060 7e00 6377 7f6b 6b63 6300 - 6666 767e 6e66 6600 3c66 6666 6666 3c00 - 7c66 667c 6060 6000 3c66 6666 6a6c 3600 - 7c66 667c 6c66 6600 3c66 603c 0666 3c00 - 7e18 1818 1818 1800 6666 6666 6666 3c00 - 6666 6666 663c 1800 6363 6b6b 7f77 6300 - 6666 3c18 3c66 6600 6666 663c 1818 1800 - 7e06 0c18 3060 7e00 7c60 6060 6060 7c00 - 0060 3018 0c06 0000 3e06 0606 0606 3e00 - 183c 6642 0000 0000 0000 0000 0000 00ff - 1c36 307c 3030 7e00 0000 3c06 3e66 3e00 - 6060 7c66 6666 7c00 0000 3c66 6066 3c00 - 0606 3e66 6666 3e00 0000 3c66 7e60 3c00 - 1c30 307c 3030 3000 0000 3e66 663e 063c - 6060 7c66 6666 6600 1800 3818 1818 3c00 - 1800 3818 1818 1870 6060 666c 786c 6600 - 3818 1818 1818 3c00 0000 367f 6b6b 6300 - 0000 7c66 6666 6600 0000 3c66 6666 3c00 - 0000 7c66 667c 6060 0000 3e66 663e 0607 - 0000 6c76 6060 6000 0000 3e60 3c06 7c00 - 3030 7c30 3030 1c00 0000 6666 6666 3e00 - 0000 6666 663c 1800 0000 636b 6b7f 3600 - 0000 663c 183c 6600 0000 6666 663e 063c - 0000 7e0c 1830 7e00 0c18 1870 1818 0c00 - 1818 1800 1818 1800 3018 180e 1818 3000 - 316b 4600 0000 0000 ffff ffff ffff ffff diff --git a/projects/examples/gui/picture.tal b/projects/examples/gui/picture.tal deleted file mode 100644 index 3bb7deb..0000000 --- a/projects/examples/gui/picture.tal +++ /dev/null @@ -1,449 +0,0 @@ -( GUI Picture ) - -|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 - -|0100 - - ( theme ) - #f0f7 .System/r DEO2 - #f00e .System/g DEO2 - #f00c .System/b DEO2 - - #0010 - DUP2 .Screen/x DEO2 - .Screen/y DEO2 - ;akane20x10 #20 #10 #01 draw-icn - - #0100 .Screen/x DEO2 - #0028 .Screen/y DEO2 - #1010 ;dafu10x10 #0a draw-fast - -BRK - -@draw-icn ( addr* width height color -- ) - - #05 .Screen/auto DEO - ,&color STR - ,&height STR - ,&width STR - .Screen/addr DEO2 - .Screen/x DEI2 - ,&x STR2 - [ LIT2 00 &height $1 ] SUB - &ver - [ LIT2 &x $2 ] .Screen/x DEO2 - [ LIT2 00 &width $1 ] SUB - &hor - [ LIT &color $1 ] .Screen/sprite DEO - INC DUP ?&hor - POP - .Screen/y DEI2k #0008 ADD2 ROT DEO2 - INC DUP ?&ver - POP - #00 .Screen/auto DEO - -JMP2r - -( makes use of the auto byte ) - -@draw-fast ( w h addr* color -- ) - - ,&color STR - .Screen/addr DEO2 - SWP #01 SUB #40 SFT #06 ORA .Screen/auto DEO - #00 SWP SUB - &loop - [ LIT2 &color $1 -Screen/sprite ] DEO - INC DUP ?&loop - POP - -JMP2r - -@akane20x10 - 0000 0000 0000 0000 2b41 2341 2b41 2341 - 8881 8081 8880 8080 0a00 2000 8800 2000 - 8004 2004 8804 2a04 0000 0000 8000 0000 - 0307 0f0f 0f1f 1f5f ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff fff7 ffff efdf - fbf7 efd7 efdf af5f fffd fbfd fbf5 ebd7 - eaf5 ead5 ead5 aa55 ab55 ab55 ab57 ab57 - fbf7 ebd7 ebd7 ab57 ffff ffff ffff fbf7 - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff fefc - 80c0 8000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 2a54 2a54 2a54 2a54 - 8800 2200 8800 2200 8800 2200 8800 2200 - 0000 0000 0000 0000 2b41 2341 2b41 2341 - 8880 8080 8880 a080 8800 2000 8800 2000 - 8a05 2a05 8f0f 2a15 aa55 aafd ffff aa45 - bf7f ff7f ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff fefd ffff ffff ffff be7c - ffff ffff 8a00 0200 befd fafd fe1f 2307 - bf5f bf7d bad5 eaf5 ead5 aa55 aa55 aa55 - aa55 aa55 aa55 aa55 aa55 aa55 aa55 ab57 - af57 af7f ffc5 a307 fbf7 ff9f 1f1f 8f9f - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff fefd faf5 eaff ff5f - 0055 aa55 aaff ffff 0055 aa55 aaff ffff - 0055 aadf aaff ffff aa55 aad5 aaff ffff - 8840 aa77 aaff ffff 8800 aaff aaff ffff - 0000 0000 0000 0000 2b41 2341 2b41 2241 - 8800 a000 8800 a004 8804 2004 8000 2240 - 8810 0810 a010 2010 0200 0000 0000 0000 - bf3f 3f1f 0f07 0303 ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffd7 ab55 - faf5 faf5 eaf5 eaf5 f870 e240 8840 8240 - 8800 2200 8841 233f 8f1f 3f7f ffff ffff - fadd eac1 e2c1 c2c1 aa55 aa55 aa55 aa55 - aa55 aa55 aa54 a040 ae54 a854 a855 2f07 - 8f1f 1f3f bfff ffff 8f87 8f85 8205 2a05 - ffdf af5f bf7f bf77 ffff ffff ffff ffff - fefd f8c0 80c0 80c0 aa55 2a15 0a15 0a15 - ab55 8000 8000 8000 fe55 0200 0800 2200 - aa55 2200 8800 2200 eb77 2a54 2a54 2a54 - ff55 2000 8800 2000 ff55 0000 0000 2000 - 0000 0000 0000 0000 2a41 2241 2b41 2341 - 8804 a004 8004 a004 0840 aa40 8850 8210 - a010 2040 a040 2040 0000 0000 0000 0000 - 0301 0000 0000 0000 ffff ff7f 7f3f 3b07 - ffff ffff ffff ffff ffff ffff ffff ffff - feff fefd fefd fefd aa55 aa55 aa55 aa55 - eaf5 fafd fafd fefd 8840 a250 a854 aa54 - bf1f 2f07 8800 8055 ffff fefc e800 0a54 - 8201 2000 8000 8010 aa54 2800 0000 0000 - 0000 0000 0000 0000 0301 0000 0000 0200 - fefc fa70 8801 aa50 8a05 0a05 0201 0303 - ef57 af5f af5f bf7f ffff ffff ffff ffff - c0c0 a2c0 8880 a280 0a15 0a15 8a15 0a15 - 0000 0000 8000 2000 0800 0200 0800 2000 - 0800 2200 8800 0000 2a54 2a55 2a55 2a57 - 8800 2000 a0ff ffff 8000 2000 a8ff ffff - 0000 0000 0000 0001 ab41 a341 ab5f ffff - 8004 a804 8eff ffff 8010 a200 a0c0 e2c1 - 8040 80c0 80c0 8000 0000 0000 0000 0000 - 0000 0000 0000 0000 0301 0101 0000 0000 - ffff ffff ff7f 1f0f ffff ffff ffff ffff - fefd feff feff ffff aa55 aa55 aa55 aad5 - feff feff fe7f fe7f aa54 aa55 aa55 aa54 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0800 0000 0000 0000 0000 0000 0000 0000 - 0000 0001 0205 0a05 8040 2040 e070 e040 - 0000 0000 0000 0000 0307 0307 0707 0f07 - ffff ffff ffff ffff ffff fefc fefc fcfc - 8207 3f7f 7f7f 7f7f 8aff ffff ffff ffff - 08c0 faf8 fcfc feff 8800 2000 8800 2000 - 0000 2000 0000 0000 2b57 2f57 2b55 2a54 - ffff ffff ffff ffff ffff ffff ffff ffff - 0b03 0307 0707 0f1f ffff ffff ffff ffff - ffff ffff ffff ffff e0f1 f9f1 faf3 faf7 - 8000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0707 0301 0000 0000 ffff ffff ff7f 3f1f - ffff ffff ffff ffff eaf5 fafd feff ffff - fe7d be7f be7d ffff aa54 aa54 aa54 aad5 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0201 0000 0000 0001 e040 0000 0000 0040 - 0000 0000 0000 0000 0f07 0f07 0f0f 0f1f - ffff ffff fffe fcfc f8f0 c280 0800 2200 - be7f 3e15 8a01 2205 ff5f af55 ab55 ab55 - feff ffff ffff bf7f 8000 2000 8800 a201 - 8800 2000 0000 00f7 2854 2854 2854 28f4 - ff7f bf57 af5f 2f57 ffff ffff ffff ffff - 0f1f 0f07 0707 0707 ffff ffff ffff ffff - ffff ffff fefd faf5 e2c4 8604 8844 a854 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0f03 0100 0000 0000 - ffff ff7f 0f07 0a05 ffff ffff ffff ff7f - ffff ffff ffff ffff eaf5 fafd feff ffff - 8000 8040 a0d0 e8d4 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0200 0000 0000 0000 8000 0000 0000 0000 - 0000 0000 0001 0305 0f1f 3f7c f8f0 8201 - e8c4 2a11 a840 a200 8800 2200 2005 2000 - 8215 2e57 2a55 aa55 aa55 aa55 aa55 3a15 - fe7c f8f0 e840 a250 0307 2f1f 8f1f 2f0f - ffff ffff ffff ffff f8fc fefc feff fef0 - ab57 2b15 0a55 0a01 ffff feff ea55 8040 - 0301 0005 aa10 0805 ffff ff5f aa05 2000 - eaf5 ead5 aa55 aa41 8810 b810 2070 2040 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0204 0a10 - 0000 0000 a805 2200 0000 0000 0040 2805 - 0a05 0a10 2a41 a200 af57 a840 8844 0a10 - ffff ff7f 8f01 2004 ffff ffff ffff ff7f - aed5 aad5 aad5 aad5 80c0 a85d ab55 aa55 - 0000 0000 a054 aa55 0000 0000 0000 a055 - 0000 0000 0000 0045 0000 0071 fa7c faf0 - 0810 a240 0800 2001 0a04 0254 a850 8200 - 0800 2200 8800 2200 8800 2200 8804 2a00 - 8a05 2201 8a01 2001 a8d0 a0c4 8a54 a040 - 2801 2000 8800 0250 8f01 8240 a011 2211 - af55 a040 8051 a815 e0c0 c240 8800 a200 - 0840 2200 aa10 2214 2a05 2000 8800 2200 - 8a00 2000 8000 2200 2a00 2200 8800 2200 - a214 2301 8000 2210 e040 80c0 6070 2010 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0001 0204 0814 2840 a200 8800 2200 - 8800 2200 8800 2200 8b10 2240 0800 a200 - a855 2200 8800 2200 2040 a240 a810 2a04 - 8810 2200 0845 a800 bf7f 3a11 3805 2301 - aa55 aa55 aa55 aa55 aa55 aa55 aa55 aa55 - aa55 aa55 aa55 aa55 aa55 aa55 aa75 fa7f - ef75 bb5d bb5f bb5f f8f8 fafc f8fc fcfc - 8800 2201 8801 2201 0800 2200 0801 2204 - 8800 2200 0850 2800 8010 0240 a810 2210 - 8a01 2000 8800 2200 0800 a200 8800 2240 - a840 2200 a800 2200 8801 2a04 8805 2204 - 8add aa45 8a14 2015 8800 a200 8800 a280 - 8804 2804 8004 2204 8800 2200 8800 2200 - 8800 0200 8840 0240 8800 2200 8800 2001 - 8800 0240 8800 2200 b010 1810 b810 1810 - 0000 0000 0000 0000 0000 0000 0000 0001 - 0810 2240 8800 a200 8800 2200 8800 2201 - 8801 2241 8a00 a204 8800 2200 8800 2200 - 8800 2200 8800 2200 8a00 2201 8800 2200 - 8a01 2200 0800 a200 0a05 aa75 aa05 2201 - aa55 aa55 aa55 aa55 aa55 aa55 aa55 aa55 - aa55 aa55 aa55 aa55 bf7f bf5f af47 8301 - bbd7 fbf1 f8fd feff fefc fefc fefe fefe - 8801 2241 2a05 2200 0040 8200 8800 0200 - 0000 a204 a840 2200 0a50 8200 8800 2200 - a010 2200 8801 2200 8800 2200 2800 a240 - a800 2205 8205 2205 8a04 2254 a855 ab55 - 3e15 2a75 ead5 aa55 82d5 ea75 aa75 aa75 - a85c aa50 a850 aa50 8800 2200 8800 2200 - 0800 a200 8800 a200 8a01 2000 8801 2001 - 0800 2200 8800 2200 8810 2810 8814 2804 - 0000 0000 0000 0000 0204 0004 0810 0210 - 8800 2200 8800 2200 8801 2001 8801 2200 - 0804 2a00 0810 a200 8800 2200 8800 2200 - 8800 2200 8800 2200 8800 2200 8801 2200 - 0840 0240 a800 a210 8800 2200 8800 2200 - 2a14 2200 8800 2200 aa00 8040 a804 2200 - a800 0000 0000 8050 0000 0000 0000 0001 - ff7f 3f1f 3f71 8200 feff feff ffff ff7f - 8800 2200 88f0 fafc a804 2200 aa11 0210 - 8800 2200 0800 a200 8800 2200 8800 2200 - 8800 2200 8800 2200 0840 2240 a800 221f - 8a01 2205 8205 befd a850 a854 a855 a955 - ff7f ffdd badd ba5d eaf5 ea75 ea75 ead5 - a850 aa50 a850 a250 8800 2a04 8a00 2200 - 0800 0250 0800 0254 8011 2200 8800 2201 - 0800 2055 aa55 aad5 8810 2040 a040 a040 - 0000 0000 0000 0200 2800 2240 0840 0240 - 8800 2200 8800 2200 8800 2200 8800 2200 - 8800 2200 8800 2200 8800 2200 8800 2200 - 8800 2200 8800 2200 8800 2200 8800 2200 - 0850 2210 881c 2804 8800 2200 8800 2200 - 8800 2200 8800 2200 8800 2200 8800 2200 - 8a05 2200 8004 0f1f 0244 a818 9810 b2f0 - 8800 2200 8800 2200 bf1f 2f1f 8f0f 2f07 - feff ffff ffff ffff 0090 e2f0 e0f0 f8fc - 8840 2200 a800 2210 8800 2200 8800 2200 - 8800 2200 8800 2200 9f1f 2f0f 8f07 2305 - fefd fefd fefd fefd ab51 aa57 aa57 ae55 - ba5d ba55 aa55 aa55 ead5 ead5 aad5 aad5 - a857 bf7f ff7f ffff afff ffff ffff ffff - 80f5 ffff ffff ffff 8855 faf0 f8f8 f8fd - aad5 aa55 2a55 2a55 a075 aa40 a040 a055 - 0850 aa01 0201 0055 0840 8240 2800 2270 - 8800 2200 8800 2200 8800 2200 8800 2200 - 8800 2200 8800 2200 8800 2200 8800 2200 - 8800 2200 8800 2200 8800 2200 8800 2200 - 8a01 2001 8800 2200 8800 a2c0 a850 2834 - 8800 2200 8800 2200 8800 2200 8800 2200 - bf7f ff7f ff7f 7f7f e8f0 e2f0 f0f0 fafc - 8800 2200 8800 2200 8f0f 2f1f 9f1f 3f7f - ffff ffff fffd fefd fcfd fef5 aa55 ab57 - 0050 e0f1 fafd eed5 0874 ae57 af5f be5d - 8800 22c0 b85c aa5c 8a04 2200 8800 2200 - fe7d 3e3d be1d 2e05 ae55 ae55 ae7d ee5d - ab55 ab55 ab57 aa57 aa55 ab55 ab57 ab57 - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff fefc - ead5 eaf5 eaf5 aa15 bf5f bf5f bf5d aa51 - feff ffff ff75 aa40 e8f0 eae4 e064 a210 - 8800 2200 8800 2200 8800 2200 8800 2200 - 8800 2200 8800 2200 8800 2200 8800 2201 - 8800 2005 8810 2200 8800 8200 8800 2200 - 8800 2200 8800 2200 ba14 2a05 8607 2301 - 0800 2210 0804 a200 8800 2201 8a04 2850 - 7f7f ff7f 3f1f 3f1f fcfe ffff ffff f8fc - 8801 8fff ffff fe7d ffff ffff ebd7 af57 - feff ead7 abd5 aa55 ab55 aa55 ab75 faf5 - aed7 aa57 fa50 a0c1 be5f fa50 0000 0255 - b878 f87c 2f17 aa40 8800 2200 8840 2010 - 8a05 2a05 0a1d 0a1d ae5d ae5d ae5d ee5d - aa55 ae55 aa5d ba55 af5f ab5f bb77 ab77 - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff fefc fefc fefc feff - 0a15 0a05 0a05 0255 a850 a850 a850 a854 - 8040 0000 0800 0814 2211 2010 2010 2210 - 8800 2200 0800 2200 8800 2200 8800 2200 - 8800 2200 8800 2200 8a04 2a10 a840 0200 - 0800 2200 8800 2015 8800 2200 8800 a800 - 8800 2200 8800 2240 8801 2201 8801 2001 - 88c0 aad5 aad5 aa55 2000 ba55 aa55 aa57 - 8f1f af5f afff bf7f fafd fcfc faf5 faff - 3a55 0e07 0301 80c0 aa55 eaf5 fbff ff7f - aa55 ab7f ffff ffff fb75 f8f0 e0c0 80c0 - 8a14 0800 0000 0000 aa00 0000 0000 0000 - 0004 0201 0001 0001 2010 2040 8880 a001 - 3e15 2040 e0f4 feff ef55 0000 0000 80d0 - fa55 0a15 0a15 0a15 bf77 a347 a347 83c7 - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - feff feff ffff aad5 af57 af57 ab57 ab55 - ffff ffff ffff aa55 e8f0 e2e0 e8e0 a240 - 8800 2200 8800 2200 8800 2200 8800 2200 - 8801 2204 8000 2810 0800 2204 8810 2240 - 2040 2200 8800 2200 8800 2200 8800 2200 - 8000 2a04 8a00 2211 8a07 2e0d 8a1d 3a7d - aa55 aa55 aa55 aa55 ae55 af57 ab55 abff - ffff ffff ffff ffff ffff ffff ffff ffff - e0c0 e0f0 f8f0 f8f0 3f1f 0f07 0301 0001 - ffff ffff fefe fefc 8000 8000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0001 0001 0000 0000 8303 8343 8343 8343 - ffff ffff ffff ffff faff ffff ffff fbf7 - bafd ffff bfdf ff5f ef7f ffff af5f af5f - ffff ffff ffff ffff ffff ffff ffff ffff - -@dafu10x10 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0001 0000 0000 010f 7fff - 0000 002f ffff ffff 0000 00fd ffff ffff - 0000 0000 e0fc ffff 0000 0000 0000 00e0 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0107 071f - 071f 3fff fffc f3cf ffff f8c7 3fff ffff - e82f fbfb fbfb fbfb 02ff ffff ffff ffff - bf41 feff ffff ffff fcff 1fe3 fcff ffff - 00d0 fcff 7fd2 ffff 0000 00c0 f0f8 5efe - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0103 0f1f 3f7e 5f7e f9f3 cf9f 7fff - 3f7f ffff ffff ffff ffff ffff ffff ffff - f9fb fbf9 fdf9 fdfd ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff feff fefe - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0001 002f 1f1f 1f1f - e907 ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff - fdfd fdfd fcff fd45 ffff ffff ffff ed37 - ffff ffff ffff b76c ffff ffff ffff ff0b - ffff ffff ffff ffff fefc fcfc f8fc f8f8 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 1f1f 1f0f 0f07 0703 - ffff ffff ffff ffff ffff ffff fffe fdf5 - ffff fceb 8fbf 7fff f48b 7fff ffff ffff - bffe fefa f8fc fdff ffff 7f3f 3f7f bfff - ffff ffff ffff ffff f8ff ffff ffff ffff - 7fd7 ffff ffff ffff f0f0 f0e0 e0e0 e0e0 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0301 0100 0000 0000 - ffff fffc 7d33 3f1f ef9f 7fff ffff ffff - ffff ffff ffff f4cb ffff ffff e807 ffff - ffff ffa0 00c0 0197 ffff 5007 1f03 5eff - ffff a5ff ff6d bfff ffff 4de8 ff7f 6fff - ffff ffbf a7fe fefe f0e0 f0e0 f0e0 b0d0 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 1f0f 0f0f 0f0e 0e12 fefa f5cf bfff ffff - 3fff ffff ffff ffff ffff ffff ffff ffff - f8e0 e0c0 e040 c040 7f7f 5f2f 7b1b 0f0f - ffff ffff ffff ffff ffff ffff ffff ffff - ffff fcfd fbf5 f9d4 50f0 f0e0 f0f0 e060 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 1a1a 150f 0d07 1100 7fff ffff fdff ffe1 - ffff ffff baff ff55 ffff ffaa fdff fe00 - c040 d708 f0eb a800 0fa6 7f2f 3fd0 021a - d7bf fff7 086a b8b0 feff e914 a000 0000 - ab20 e078 0000 0000 e0c0 d6e1 4084 0204 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0402 010a 0200 0000 7876 39b0 5078 9018 - 0892 71a9 2112 1210 aa00 ff01 7692 0000 - a01e 3628 8488 4484 a5a0 0000 0080 8000 - 2003 070d 3815 0260 feff 7b69 9e60 0000 - 90e0 8080 0000 0000 c004 8020 8890 8888 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0300 0000 0000 0000 2848 8008 4428 0c04 - 1211 1201 1d14 2a29 1200 0016 dd55 22a9 - 4084 44ca 8a0d 5800 0000 0800 a02e d105 - 1000 0000 0080 6a11 0000 0000 0000 8865 - 0100 0100 0101 005e 2080 2040 4000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0600 0a05 0303 0300 - 50a0 8040 8000 8000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - ad00 0000 0000 0000 510a 0000 0000 0000 - 2214 0002 0200 0406 0000 0000 0000 0080 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 0000 0021 010f 0407 0812 2e5c de3e - 4000 c060 f0f0 f878 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 502d 0200 157f - 0040 a000 0000 e0f8 0000 0000 0000 0000 - 060f 0f1f 1737 336b a01c e3f0 feff ffff - 0000 407a 05c0 f0fc 0000 0000 807c 0300 - 0000 0000 0000 a05a 0000 0000 0000 0004 - 0000 0000 0000 030c 0001 0514 53a7 0f3f - 265c 5df9 f3e7 c7cf fbfd fbfb fbfb fbfb - 7c7e 7fbf bfff bfff 0000 0090 c0e0 f0f8 - 0101 0101 0001 0020 7fc8 ff1b c6f0 7f78 - fc5c ec08 b858 30e0 0108 0001 0103 0707 - 6b5b dbdf bbbf bb7f ffff ffff ffff ffff - fefe fcfc f9f3 f3f7 6079 fffe fcfc f9f3 - 0540 823f 7fff ffff d02c 03f8 feff ffff - 3040 800e 3f7f ffff 7f7f 7fff 7f7f 7f7f - 9fdf 9f9f df9f 9fdf fbfb fbf3 fbfb fbfb - efff fff7 fffd ffff fefe ffff ffff ff7f - 0000 80e0 f0fc ffff 1f02 0000 0001 01e1 - c000 00a8 b050 590b 0f1f 1e7d 7dff ffff - 7f7f ffff ffff ffff ffff ffff ffff ffff - e7ef cfdf 9f3f 7f3f f3e7 efcf dfbf bf3f - ffff ffff ffff ffff fffe fcf8 f0f0 e0c0 - ffff ffff ffff ffff bfbf bfbf dfdf dfcf - 9fcf 9fcf dfcf dfcf f7fb fbf7 fbfb fbfb - ffff ffff ffff ffff ffd7 f7fd feff ffff - ffff ffff 7f9e e8e0 ffff fff5 8000 0001 - 4f47 66a4 7056 4b43 fffe 8001 015f ffff - ffbf 1f7f ffff ffff fefe fcfe fdf9 fbfb - 7fff feff fefe fcfe 7f7f 7f7f ffff ffff - ffff fffe fefc f8f8 8183 070f 1f3f 3f7f - ffff ffff 7f3f 9f8f efef eff7 f7f7 f7f7 - dfcf efdf cfff cfef fbfb fbf9 fdfd fbfc - ffff fffe f4c0 8000 fffc e080 0000 0000 - 8000 0000 0000 0000 0506 0802 0300 0000 - 4925 2365 a2b2 1191 ffff ffff ff05 0000 - ffff ffff ff7f 0307 fbfb ffff ffff ffff - fcfd fcfe fdfd fdfd ffff ffff ffff ffff - f0e0 e1c3 8387 0f1f ffff ffff ffff fffe diff --git a/projects/examples/gui/shapes.tal b/projects/examples/gui/shapes.tal deleted file mode 100644 index d8abe84..0000000 --- a/projects/examples/gui/shapes.tal +++ /dev/null @@ -1,203 +0,0 @@ -( GUI Shapes ) - -%ABS2 { DUP2 #0f SFT2 EQU #05 JCN #0000 SWP2 SUB2 } -%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 } -%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 } -%WIDTH { #0100 } %HEIGHT { #00a0 } - -( devices ) - -|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] -|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] - -( variables ) - -|0000 - -( draw requirements ) -@color [ &byte $1 ] - -@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] -@line [ &x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2 &dx $2 &dy $2 &e1 $2 &e2 $2 ] -@circle [ &xc $2 &yc $2 &x $2 &y $2 &r $2 &d $2 ] - -( program ) - -|0100 - - ( theme ) - #f0ff .System/r DEO2 - #f03c .System/g DEO2 - #f03f .System/b DEO2 - - ( background ) ;checker-icn #03 ;cover-pattern JSR2 - - .Screen/width DEI2 #01 SFT2 WIDTH #01 SFT2 SUB2 #0008 ADD2 - .Screen/height DEI2 #01 SFT2 HEIGHT #01 SFT2 SUB2 #0008 ADD2 - WIDTH HEIGHT - STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2 #02 ;fill-rect JSR2 - - .Screen/width DEI2 #01 SFT2 WIDTH #01 SFT2 SUB2 - .Screen/height DEI2 #01 SFT2 HEIGHT #01 SFT2 SUB2 - WIDTH HEIGHT - STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2 #01 ;fill-rect JSR2 - - .Screen/width DEI2 #01 SFT2 WIDTH #01 SFT2 SUB2 #0008 ADD2 - .Screen/height DEI2 #01 SFT2 HEIGHT #01 SFT2 SUB2 #0008 ADD2 - WIDTH #0010 SUB2 HEIGHT #0010 SUB2 - STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2 #03 ;line-rect JSR2 - - .Screen/width DEI2 #01 SFT2 .Screen/height DEI2 #01 SFT2 WIDTH #02 SFT2 #02 ;draw-circle JSR2 - - #0010 #0030 #0068 #02 ;line-hor JSR2 - #0020 #0058 #0078 #02 ;line-ver JSR2 - -BRK - -@line-slow ( x1 y1 x2 y2 color -- ) - - ( load ) .color STZ #0001 SUB2 .line/y0 STZ2 #0001 SUB2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2 - .line/x0 LDZ2 .line/x LDZ2 SUB2 ABS2 .line/dx STZ2 - .line/y0 LDZ2 .line/y LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2 - #ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 #10 SFT2 ADD2 .line/sx STZ2 - #ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 #10 SFT2 ADD2 .line/sy STZ2 - .line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2 - &loop - .line/x LDZ2 .Screen/x DEO2 .line/y LDZ2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO - .line/x LDZ2 .line/x0 LDZ2 EQU2 .line/y LDZ2 .line/y0 LDZ2 EQU2 AND ,&end JCN - .line/e1 LDZ2 #10 SFT2 .line/e2 STZ2 - .line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN - .line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2 - .line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2 - &skipy - .line/e2 LDZ2 .line/dx LDZ2 GTS2 ,&skipx JCN - .line/e1 LDZ2 .line/dx LDZ2 ADD2 .line/e1 STZ2 - .line/y LDZ2 .line/sy LDZ2 ADD2 .line/y STZ2 - &skipx - ;&loop JMP2 - - &end - -JMP2r - -@line-rect ( x1* y1* x2* y2* color -- ) - - STH - DUP2 ,&ver-y2 STR2 ,&hor-y2 STR2 - DUP2 ,&ver-x2 STR2 ,&hor-x2 STR2 - DUP2 ,&ver-y1 STR2 ,&hor-y1 STR2 - DUP2 ,&ver-x1 STR2 ,&hor-x1 STR2 - ( horizontal ) - [ LIT2 &hor-x2 $2 ] INC2 [ LIT2 &hor-x1 $2 ] - &hor - DUP2 .Screen/x DEO2 - [ LIT2 &hor-y1 $2 ] .Screen/y DEO2 STHkr .Screen/pixel DEOk - [ LIT2 &hor-y2 $2 ] .Screen/y DEO2 DEO - INC2 GTH2k ,&hor JCN - POP2 POP2 - ( vertical ) - [ LIT2 &ver-y2 $2 ] [ LIT2 &ver-y1 $2 ] - &ver - DUP2 .Screen/y DEO2 - [ LIT2 &ver-x1 $2 ] .Screen/x DEO2 STHkr .Screen/pixel DEOk - [ LIT2 &ver-x2 $2 ] .Screen/x DEO2 DEO - INC2 GTH2k ,&ver JCN - POP2 POP2 - POPr - -JMP2r - -@fill-rect ( x1* y1* x2* y2* color -- ) - - ,&color STR - ( x1 x2 y1 y2 ) ROT2 - &ver - ( save ) DUP2 .Screen/y DEO2 - STH2 STH2 OVR2 OVR2 SWP2 - &hor - ( save ) DUP2 .Screen/x DEO2 - ( draw ) ,&color LDR .Screen/pixel DEO - ( incr ) INC2 - OVR2 OVR2 GTS2 ,&hor JCN - POP2 POP2 STH2r STH2r - ( incr ) INC2 - OVR2 OVR2 GTS2 ,&ver JCN - POP2 POP2 POP2 POP2 - -JMP2r - &color $1 - -@draw-circle ( xc yc r color -- ) - - ( load ) .color STZ .circle/r STZ2 .circle/yc STZ2 .circle/xc STZ2 - #0000 .circle/x STZ2 .circle/r LDZ2 .circle/y STZ2 - .circle/r LDZ2 #10 SFT2 .circle/d STZ2 - ( draw ) ;&seg JSR2 - &loop - ( incr ) .circle/x LDZ2 INC2 .circle/x STZ2 - .circle/d LDZ2 #0001 LTS2 ,&else JCN - ( decr ) .circle/y LDZ2 #0001 SUB2 .circle/y STZ2 - .circle/x LDZ2 .circle/y LDZ2 SUB2 #20 SFT2 .circle/d LDZ2 ADD2 .circle/d STZ2 - ;&end JMP2 - &else - .circle/x LDZ2 #20 SFT2 .circle/d LDZ2 ADD2 .circle/d STZ2 - &end - ( draw ) ;&seg JSR2 - .circle/y LDZ2 .circle/x LDZ2 #0001 SUB2 GTS2 ,&loop JCN - JMP2r - &seg - .circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO - .circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO - .circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO - .circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO - .circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO - .circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO - .circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO - .circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO - -JMP2r - -@cover-pattern ( addr* color -- ) - - ( load ) STH .Screen/addr DEO2 - .Screen/height DEI2 #0000 - &ver - ( save ) DUP2 .Screen/y DEO2 - .Screen/width DEI2 #0000 - &hor - ( save ) DUP2 .Screen/x DEO2 - ( draw ) STHkr .Screen/sprite DEO - #0008 ADD2 GTH2k ,&hor JCN - POP2 POP2 - #0008 ADD2 GTH2k ,&ver JCN - POP2 POP2 - POPr - -JMP2r - -@line-hor ( x0* x1* y* color -- ) - - STH .Screen/y DEO2 - SWP2 - &loop - ( save ) DUP2 .Screen/x DEO2 - ( draw ) STHkr .Screen/pixel DEO - INC2 GTH2k ,&loop JCN - POP2 POP2 POPr - -JMP2r - -@line-ver ( x* y0* y1* color -- ) - - STH ROT2 .Screen/x DEO2 - SWP2 - &loop - ( save ) DUP2 .Screen/y DEO2 - ( draw ) STHkr .Screen/pixel DEO - INC2 GTH2k ,&loop JCN - POP2 POP2 POPr - -JMP2r - -@checker-icn - f0f0 f0f0 0f0f 0f0f diff --git a/projects/examples/gui/terminal.tal b/projects/examples/gui/terminal.tal deleted file mode 100644 index 7ed2bdb..0000000 --- a/projects/examples/gui/terminal.tal +++ /dev/null @@ -1,250 +0,0 @@ -( GUI Terminal ) - -( devices ) - -|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|80 @Controller [ &vector $2 &button $1 &key $1 ] - -( variables ) - -|0000 - -@buffer $80 - -( init ) - -|0100 ( -> ) - - ( theme ) - #0f0f .System/r DEO2 - #0ff0 .System/g DEO2 - #0fff .System/b DEO2 - - ( vectors ) - ;on-button .Controller/vector DEO2 - - ( AUTO-Y-ADDR ) - #06 .Screen/auto DEO - - #01 ;draw-input JSR2 - -BRK - -@on-button ( -> ) - - .Controller/key DEI - DUP ,&no-null JCN - POP BRK - &no-null - DUP #0d NEQ ,&no-enter JCN - #00 ;draw-input JSR2 - ;validate JSR2 - ;buffer #0080 ;mclr JSR2 - #01 ;draw-input JSR2 - &no-enter - DUP #08 NEQ ,&no-backspace JCN - #00 ;draw-input JSR2 - ;buffer ;spop JSR2 - #01 ;draw-input JSR2 - &no-backspace - DUP STHk #1f GTH STHr #7b LTH #0101 NEQ2 ,&no-valid JCN - ;buffer ;slen JSR2 #007f GTH2 ,&no-valid JCN - STHk ;buffer STHr ;sput JSR2 - #01 ;draw-input JSR2 - &no-valid - POP - -BRK - -@validate ( -- ) - - #0010 .Screen/x DEO2 - .Screen/height DEI2 #0040 SUB2 .Screen/y DEO2 - - ( clear ) - #8000 - &loop - #30 #00 ;draw-char JSR2 - INC GTHk ,&loop JCN - POP2 - #0010 .Screen/x DEO2 - - ( respond ) - ;strings/you-said #02 ;draw-str JSR2 - LIT 22 #02 ;draw-char JSR2 - ;buffer #03 ;draw-str JSR2 - LIT 22 #02 ;draw-char JSR2 - LIT ". #02 ;draw-char JSR2 - -JMP2r - -@draw-input ( color -- ) - - STH - #0010 .Screen/x DEO2 - .Screen/height DEI2 #0020 SUB2 .Screen/y DEO2 - - ( marker ) LIT "> #03 ;draw-char JSR2 - - ;buffer STHr ;draw-str JSR2 - -JMP2r - -@draw-str ( str* color -- ) - - STH - &while - LDAk STHkr ,draw-char JSR - INC2 LDAk ,&while JCN - POP2 - POPr - -JMP2r - -@draw-char ( char color -- ) - - SWP - [ #20 SUB #00 SWP #40 SFT2 ;font ADD2 ] .Screen/addr DEO2 - .Screen/sprite DEOk DEO - .Screen/y DEI2 #0010 SUB2 .Screen/y DEO2 - .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 - -JMP2r - -( utils ) - -@slen ( str* -- len* ) - - DUP2 ,scap JSR SWP2 SUB2 - -JMP2r - -@scap ( str* -- str-end* ) - - ( clamp ) LDAk #00 NEQ JMP JMP2r - &while INC2 LDAk ,&while JCN - -JMP2r - -@sput ( str* char -- ) - - ROT ROT ,scap JSR STA - -JMP2r - -@spop ( str* -- ) - - ( clamp ) LDAk #00 NEQ JMP JMP2r - #00 ROT ROT ,scap JSR #0001 SUB2 STA - -JMP2r - -@mclr ( addr* len* -- ) - - OVR2 ADD2 SWP2 - &loop - STH2k #00 STH2r STA - INC2 GTH2k ,&loop JCN - POP2 POP2 - -JMP2r - -@strings - &you-said "You 20 "said 20 $1 - -@font ( terminus01x02 ) - 0000 0000 0000 0000 0000 0000 0000 0000 - 0000 183c 3c3c 1818 1800 1818 0000 0000 - 0066 6666 2400 0000 0000 0000 0000 0000 - 0000 006c 6cfe 6c6c 6cfe 6c6c 0000 0000 - 1818 7cc6 c2c0 7c06 0686 c67c 1818 0000 - 0000 0000 c2c6 0c18 3060 c686 0000 0000 - 0000 386c 6c38 76dc cccc cc76 0000 0000 - 0030 3030 6000 0000 0000 0000 0000 0000 - 0000 0c18 3030 3030 3030 180c 0000 0000 - 0000 3018 0c0c 0c0c 0c0c 1830 0000 0000 - 0000 0000 0066 3cff 3c66 0000 0000 0000 - 0000 0000 0018 187e 1818 0000 0000 0000 - 0000 0000 0000 0000 0018 1818 3000 0000 - 0000 0000 0000 00fe 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 1818 0000 0000 - 0000 0000 0206 0c18 3060 c080 0000 0000 - 0000 386c c6c6 d6d6 c6c6 6c38 0000 0000 - 0000 1838 7818 1818 1818 187e 0000 0000 - 0000 7cc6 060c 1830 60c0 c6fe 0000 0000 - 0000 7cc6 0606 3c06 0606 c67c 0000 0000 - 0000 0c1c 3c6c ccfe 0c0c 0c1e 0000 0000 - 0000 fec0 c0c0 fc06 0606 c67c 0000 0000 - 0000 3860 c0c0 fcc6 c6c6 c67c 0000 0000 - 0000 fec6 0606 0c18 3030 3030 0000 0000 - 0000 7cc6 c6c6 7cc6 c6c6 c67c 0000 0000 - 0000 7cc6 c6c6 7e06 0606 0c78 0000 0000 - 0000 0000 1818 0000 0018 1800 0000 0000 - 0000 0000 1818 0000 0018 1830 0000 0000 - 0000 0006 0c18 3060 3018 0c06 0000 0000 - 0000 0000 007e 0000 7e00 0000 0000 0000 - 0000 0060 3018 0c06 0c18 3060 0000 0000 - 0000 7cc6 c60c 1818 1800 1818 0000 0000 - 0000 007c c6c6 dede dedc c07c 0000 0000 - 0000 1038 6cc6 c6fe c6c6 c6c6 0000 0000 - 0000 fc66 6666 7c66 6666 66fc 0000 0000 - 0000 3c66 c2c0 c0c0 c0c2 663c 0000 0000 - 0000 f86c 6666 6666 6666 6cf8 0000 0000 - 0000 fe66 6268 7868 6062 66fe 0000 0000 - 0000 fe66 6268 7868 6060 60f0 0000 0000 - 0000 3c66 c2c0 c0de c6c6 663a 0000 0000 - 0000 c6c6 c6c6 fec6 c6c6 c6c6 0000 0000 - 0000 3c18 1818 1818 1818 183c 0000 0000 - 0000 1e0c 0c0c 0c0c cccc cc78 0000 0000 - 0000 e666 666c 7878 6c66 66e6 0000 0000 - 0000 f060 6060 6060 6062 66fe 0000 0000 - 0000 c6ee fefe d6c6 c6c6 c6c6 0000 0000 - 0000 c6e6 f6fe dece c6c6 c6c6 0000 0000 - 0000 7cc6 c6c6 c6c6 c6c6 c67c 0000 0000 - 0000 fc66 6666 7c60 6060 60f0 0000 0000 - 0000 7cc6 c6c6 c6c6 c6d6 de7c 0c0e 0000 - 0000 fc66 6666 7c6c 6666 66e6 0000 0000 - 0000 7cc6 c660 380c 06c6 c67c 0000 0000 - 0000 7e7e 5a18 1818 1818 183c 0000 0000 - 0000 c6c6 c6c6 c6c6 c6c6 c67c 0000 0000 - 0000 c6c6 c6c6 c6c6 c66c 3810 0000 0000 - 0000 c6c6 c6c6 d6d6 d6fe ee6c 0000 0000 - 0000 c6c6 6c7c 3838 7c6c c6c6 0000 0000 - 0000 6666 6666 3c18 1818 183c 0000 0000 - 0000 fec6 860c 1830 60c2 c6fe 0000 0000 - 0000 3c30 3030 3030 3030 303c 0000 0000 - 0000 0080 c0e0 7038 1c0e 0602 0000 0000 - 0000 3c0c 0c0c 0c0c 0c0c 0c3c 0000 0000 - 1038 6cc6 0000 0000 0000 0000 0000 0000 - 0000 0000 0000 0000 0000 0000 00ff 0000 - 3030 1800 0000 0000 0000 0000 0000 0000 - 0000 0000 0078 0c7c cccc cc76 0000 0000 - 0000 e060 6078 6c66 6666 667c 0000 0000 - 0000 0000 007c c6c0 c0c0 c67c 0000 0000 - 0000 1c0c 0c3c 6ccc cccc cc76 0000 0000 - 0000 0000 007c c6fe c0c0 c67c 0000 0000 - 0000 386c 6460 f060 6060 60f0 0000 0000 - 0000 0000 0076 cccc cccc cc7c 0ccc 7800 - 0000 e060 606c 7666 6666 66e6 0000 0000 - 0000 1818 0038 1818 1818 183c 0000 0000 - 0000 0606 000e 0606 0606 0606 6666 3c00 - 0000 e060 6066 6c78 786c 66e6 0000 0000 - 0000 3818 1818 1818 1818 183c 0000 0000 - 0000 0000 00ec fed6 d6d6 d6c6 0000 0000 - 0000 0000 00dc 6666 6666 6666 0000 0000 - 0000 0000 007c c6c6 c6c6 c67c 0000 0000 - 0000 0000 00dc 6666 6666 667c 6060 f000 - 0000 0000 0076 cccc cccc cc7c 0c0c 1e00 - 0000 0000 00dc 7666 6060 60f0 0000 0000 - 0000 0000 007c c660 380c c67c 0000 0000 - 0000 1030 30fc 3030 3030 361c 0000 0000 - 0000 0000 00cc cccc cccc cc76 0000 0000 - 0000 0000 0066 6666 6666 3c18 0000 0000 - 0000 0000 00c6 c6d6 d6d6 fe6c 0000 0000 - 0000 0000 00c6 6c38 3838 6cc6 0000 0000 - 0000 0000 00c6 c6c6 c6c6 c67e 060c f800 - 0000 0000 00fe cc18 3060 c6fe 0000 0000 - 0000 0e18 1818 7018 1818 180e 0000 0000 - 0000 1818 1818 0018 1818 1818 0000 0000 - 0000 7018 1818 0e18 1818 1870 0000 0000 diff --git a/projects/examples/gui/timer.tal b/projects/examples/gui/timer.tal deleted file mode 100644 index 3c387f2..0000000 --- a/projects/examples/gui/timer.tal +++ /dev/null @@ -1,83 +0,0 @@ -( uxnemu timer.rom ) - -|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|80 @Controller &vector $2 &button $1 &key $1 -|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 -|100 - -@on-reset ( -> ) - ;on-control .Controller/vector DEO2 - #0080 DUP2 .Screen/width DEO2 - .Screen/height DEO2 - #f074 DUP2 .System/r DEO2 - DUP2 .System/g DEO2 - .System/b DEO2 - Timer/start BRK - -@on-control ( -> ) - .Controller/button DEI - ( A ) DUP #01 NEQ ?{ Timer/pause } - ( B ) DUP #02 NEQ ?{ Timer/start } - POP BRK - -( -@|Objects ) - -@Timer ( * ) - &on-frame ( -> ) - [ LIT &paused $1 ] ?{ - [ LIT2 3c &frame 00 ] INCk ,&frame STR - EQU ?&on-second } - BRK - &on-second ( -> ) - [ LIT2 00 _&frame ] STR - [ LIT2 ff &time $1 ] ADD DUP ?{ /end } - ,&time STR - / BRK - &start ( -- ) - [ LIT2 0f _&time ] STR - [ LIT2 00 _&paused ] STR - [ LIT2 0f _&frame ] STR - ;&on-frame .Screen/vector DEO2 - !& - &pause ( -- ) - [ LIT2 00 _&paused ] LDR EQU - ( ) INCk - ,&paused STR - !& - &end ( -- ) - #0000 .Screen/vector DEO2 - #06 - !& - & ( -- ) - ,&time LDR ! - -( -@|drawing ) - -@ ( color -- ) - ;/color STA - JMP2r - -@ ( dec -- ) - #0010 DUP2 .Screen/x DEO2 - .Screen/y DEO2 - [ LIT2 01 -Screen/auto ] DEO - DUP - ( x0 ) #0a DIV - ( 0x ) #0a DIVk MUL SUB - ( >> ) - -@ ( num -- ) - #00 SWP #30 SFT2 ;numbers-icns ADD2 .Screen/addr DEO2 - [ LIT2 &color 01 -Screen/sprite ] DEO - JMP2r - -@numbers-icns [ - 38c6 c6c6 c6c6 c638 8c78 1818 1818 187e - 3c4e 860e 1c38 72fe 807e 0c10 7c0e 8e7c - 0e1c 1c3c 6cff 0c1e c6f8 40c0 fc0e ce7c - 3ac4 c0c0 fcce ce7c 807e 3e0c 1830 60c0 - 807c cece 7cce ce7c 807c cece 7c18 3060 ] - diff --git a/projects/software/clock.tal b/projects/software/clock.tal deleted file mode 100644 index 179c869..0000000 --- a/projects/software/clock.tal +++ /dev/null @@ -1,323 +0,0 @@ -( simple graphical clock ) - -|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] -|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ] -|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] -|c0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ] - -|0000 - -@last - &day $1 &sec $1 -@center - &x $2 &y $2 -@date - &x $2 &y $2 -@time - &x $2 &y $2 -@needles - &hx $2 &hy $2 - &mx $2 &my $2 - &sx $2 &sy $2 - &zx $2 &zy $2 -@buf - &d $3 &h $2 &s1 $1 &m $2 &s2 $1 &s $3 -@line - &x $2 &y $2 &dx $2 &dy $2 &e1 $2 - -|0100 ( -> ) - - ( theme ) - #0ff8 .System/r DEO2 - #0f08 .System/g DEO2 - #0f08 .System/b DEO2 - ( resize ) - #00d0 .Screen/width DEO2 - #0120 .Screen/height DEO2 - ( vectors ) - ;on-frame .Screen/vector DEO2 - ( center ) - .Screen/width DEI2 #01 SFT2 - DUP2 .center/x STZ2 - DUP2 #0028 SUB2 .date/x STZ2 - #0020 SUB2 .time/x STZ2 - .Screen/height DEI2 #01 SFT2 - DUP2 .center/y STZ2 - DUP2 #0078 SUB2 .date/y STZ2 - #006c ADD2 .time/y STZ2 - ;draw-watchface JSR2 - ( time buffer ) - LIT ": - DUP .buf/s1 STZ - .buf/s2 STZ - -( continue ) - -@on-frame ( -> ) - - ( once per second ) - .DateTime/second DEI - DUP .last/sec LDZ EQU ,&same-sec JCN - ( make time ) - .DateTime/hour DEI .buf/h ;decimal JSR2 - .DateTime/minute DEI .buf/m ;decimal JSR2 - DUP .buf/s ;decimal JSR2 - ( draw label ) - .time/x LDZ2 .Screen/x DEO2 - .time/y LDZ2 .Screen/y DEO2 - ;buf/h ;draw-text JSR2 - ( draw needles ) - #00 ;draw-needles JSR2 - ;make-needles JSR2 - #01 ;draw-needles JSR2 - DUP .last/sec STZ - &same-sec - POP - - ( once per day ) - .DateTime/day DEI - DUP .last/day LDZ EQU ,&same-day JCN - ( make date ) - DUP .buf/d ;decimal JSR2 - ( draw label ) - .date/x LDZ2 .Screen/x DEO2 - .date/y LDZ2 .Screen/y DEO2 - [ #00 .DateTime/dotw DEI #20 SFT ] ;week-txt ADD2 ;draw-text JSR2 - [ #00 .DateTime/month DEI #20 SFT ] ;month-txt ADD2 ;draw-text JSR2 - ;buf/d ;draw-text JSR2 - DUP .last/day STZ - &same-day - POP - -BRK - -@draw-needles ( draw -- ) - - STH - .center/x LDZ2 .center/y LDZ2 - OVR2 OVR2 - .needles/mx LDZ2 .needles/my LDZ2 #01 STHkr MUL - ;draw-line JSR2 - OVR2 OVR2 - .needles/hx LDZ2 .needles/hy LDZ2 #01 STHkr MUL - ;draw-line JSR2 - .needles/sx LDZ2 .needles/sy LDZ2 - .needles/zx LDZ2 .needles/zy LDZ2 #02 STHr MUL - ;draw-line JSR2 - - ( middle ) - #0001 SUB2 .Screen/y DEO2 - #0001 SUB2 .Screen/x DEO2 - ;middle-icn .Screen/addr DEO2 - #0a .Screen/sprite DEO - -JMP2r - -@draw-text ( addr* -- ) - - ( auto addr ) #15 .Screen/auto DEO - &while - LDAk - DUP ;is-lc JSR2 ,&lc JCN - DUP ;is-uc JSR2 ,&uc JCN - DUP ;is-num JSR2 ,&num JCN - DUP LIT "/ EQU ,&slash JCN - DUP LIT ": EQU ,&colon JCN - POP ;font/blank - &end - .Screen/addr DEO2 - #03 .Screen/sprite DEO - INC2 LDAk ,&while JCN - POP2 - #00 .Screen/sprite DEO - ( auto none ) #00 .Screen/auto DEO - -JMP2r - &lc #61 SUB #00 SWP #40 SFT2 ;font/lc ADD2 ,&end JMP - &uc #41 SUB #00 SWP #40 SFT2 ;font/uc ADD2 ,&end JMP - &num #30 SUB #00 SWP #40 SFT2 ;font/num ADD2 ,&end JMP - &slash POP ;font/slash ,&end JMP - &colon POP ;font/colon ,&end JMP - -@draw-line ( x1* y1* x2* y2* color -- ) - - ( load ) STH ,&y STR2 ,&x STR2 .line/y STZ2 .line/x STZ2 - ,&x LDR2 .line/x LDZ2 SUB2 ;abs2 JSR2 .line/dx STZ2 - #0000 ,&y LDR2 .line/y LDZ2 SUB2 ;abs2 JSR2 SUB2 .line/dy STZ2 - #ffff #00 .line/x LDZ2 ,&x LDR2 ;lts2 JSR2 DUP2 ADD2 ADD2 ,&sx STR2 - #ffff #00 .line/y LDZ2 ,&y LDR2 ;lts2 JSR2 DUP2 ADD2 ADD2 ,&sy STR2 - .line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2 - &loop - .line/x LDZ2 DUP2 .Screen/x DEO2 [ LIT2 &x $2 ] EQU2 - .line/y LDZ2 DUP2 .Screen/y DEO2 [ LIT2 &y $2 ] EQU2 - STHkr .Screen/pixel DEO - AND ,&end JCN - .line/e1 LDZ2 DUP2 ADD2 DUP2 - .line/dy LDZ2 ;lts2 JSR2 ,&skipy JCN - .line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2 - .line/x LDZ2 [ LIT2 &sx $2 ] ADD2 .line/x STZ2 - &skipy - .line/dx LDZ2 ;gts2 JSR2 ,&skipx JCN - .line/e1 LDZ2 .line/dx LDZ2 ADD2 .line/e1 STZ2 - .line/y LDZ2 [ LIT2 &sy $2 ] ADD2 .line/y STZ2 - &skipx - ,&loop JMP - &end - POPr - -JMP2r - -@draw-watchface ( -- ) - - #3c00 - &loop - ( dots ) - #00 OVRk ADD2 ;table ADD2 LDA2 - #0018 ;circle JSR2 - .Screen/x DEO2 .Screen/y DEO2 #01 .Screen/pixel DEO - ( markers ) - DUP #05 ;mod JSR2 ,&no-marker JCN - #00 OVRk ADD2 ;table ADD2 LDA2 - STH2k #0018 ;circle JSR2 SWP2 - STH2r #001c ;circle JSR2 SWP2 - #01 ;draw-line JSR2 - &no-marker - INC GTHk ;&loop JCN2 - POP2 - -JMP2r - -@make-needles ( -- ) - - [ #00 .DateTime/second DEI #1e ADD #3c ;mod JSR2 ] DUP2 ADD2 ;table ADD2 LDA2 - #00a0 ,circle JSR .needles/zx STZ2 .needles/zy STZ2 - [ #00 .DateTime/second DEI ] DUP2 ADD2 ;table ADD2 LDA2 - #0020 ,circle JSR .needles/sx STZ2 .needles/sy STZ2 - [ #00 .DateTime/minute DEI ] DUP2 ADD2 ;table ADD2 LDA2 - #0022 ,circle JSR .needles/mx STZ2 .needles/my STZ2 - [ #00 .DateTime/hour DEI #0c ;mod JSR2 #20 SFTk NIP ADD ] - ( minute offset ) [ #00 .DateTime/minute DEI #0f DIV ADD2 ] DUP2 ADD2 ;table ADD2 LDA2 - #002a ,circle JSR .needles/hx STZ2 .needles/hy STZ2 - -JMP2r - -@circle ( cx cy radius* -- y* x* ) - - STH2 SWP - #00 SWP #40 SFT2 STH2kr DIV2 .center/x LDZ2 ADD2 #0800 STH2kr DIV2 SUB2 - STH2 SWP2r - #00 SWP #40 SFT2 STH2kr DIV2 .center/y LDZ2 ADD2 #0800 STH2kr DIV2 SUB2 - POP2r STH2r - -JMP2r - -@decimal ( value* zp-label -- ) - - STH - DUP #0a DIV #30 ADD STHkr STZ - #0a ;mod JSR2 #30 ADD STHr INC STZ - -JMP2r - -@mod DIVk MUL SUB JMP2r -@abs2 DUP2 #0f SFT2 EQU #05 JCN #0000 SWP2 SUB2 JMP2r -@lts2 #8000 STH2k ADD2 SWP2 STH2r ADD2 GTH2 JMP2r -@gts2 #8000 STH2k ADD2 SWP2 STH2r ADD2 LTH2 JMP2r -@is-uc DUP #40 GTH SWP #5b LTH AND JMP2r -@is-lc DUP #60 GTH SWP #7b LTH AND JMP2r -@is-num DUP #2f GTH SWP #3a LTH AND JMP2r - -@week-txt - "Sun $1 "Mon $1 "Tue $1 "Wed $1 "Thu $1 "Fri $1 - "Sat $1 - -@month-txt - "Jan $1 "Feb $1 "Mar $1 "Apr $1 "May $1 "Jun $1 - "Jul $1 "Aug $1 "Sep $1 "Oct $1 "Nov $1 "Dec $1 - -@table ( 60 positions on a circle ) - 8000 8d00 9a02 a706 b40b c011 cb18 d520 - df2a e734 ee40 f44b f958 fd65 ff72 ff80 - ff8d fd9a f9a7 f4b4 eec0 e7cb dfd5 d5df - cbe7 c0ee b4f4 a7f9 9afd 8dff 80ff 72ff - 65fd 58f9 4bf4 40ee 34e7 2adf 20d5 18cb - 11c0 0bb4 06a7 029a 008d 0080 0072 0265 - 0658 0b4b 113f 1834 202a 2a20 3418 3f11 - 4b0b 5806 6502 7200 - -@middle-icn - 40e0 4000 0000 0000 - -@font - &num - 0018 2442 4242 4242 4242 4242 4224 1800 - 0008 1828 0808 0808 0808 0808 0808 1c00 - 0018 2442 4202 0202 0408 1020 4040 7e00 - 0018 2442 0202 0438 0402 0202 0204 7800 - 000c 0c14 1414 2424 2444 447e 0404 0e00 - 007e 4040 4040 5864 4202 0202 0204 7800 - 000c 1020 4040 5864 4242 4242 4224 1800 - 007e 4202 0204 0404 0808 0810 1010 1000 - 0018 2442 4242 2418 2442 4242 4224 1800 - 0018 2442 4242 4242 261a 0202 0408 3000 - &uc - 0010 1028 2844 4444 8282 fe82 8282 0000 - 00f8 4442 4242 4478 4442 4242 44f8 0000 - 003c 4282 8280 8080 8080 8282 423c 0000 - 00f8 4442 4242 4242 4242 4242 44f8 0000 - 00fc 4240 4040 4878 4840 4040 42fc 0000 - 80fe 4240 4040 447c 4440 4040 40e0 0000 - 003a 4682 8080 8e82 8282 8282 463a 0000 - 00ee 4444 4444 447c 4444 4444 44ee 0000 - 0038 1010 1010 1010 1010 1010 1038 0000 - 000e 0404 0404 0404 0404 4444 2810 0000 - 00ee 4448 4850 5060 5050 4848 44ee 0000 - 00e0 4040 4040 4040 4040 4040 42fe 0000 - 0082 c6c6 c6aa aaaa 9292 9282 8282 0000 - 00e2 4262 6262 5252 4a4a 4646 42e2 0000 - 0038 4482 8282 8282 8282 8282 4438 0000 - 00f8 4442 4242 4244 7840 4040 40f0 0000 - 0038 4482 8282 8282 8282 829a 643a 0000 - 00f8 4442 4242 4478 4844 4442 42e2 0000 - 0010 2844 4440 2010 0804 4444 2810 0000 - 00fe 9210 1010 1010 1010 1010 1038 0000 - 00ee 4444 4444 4444 4444 4444 4438 0000 - 0082 8282 8282 8244 4444 2828 1010 0000 - 0082 8292 9292 9292 92ba aa44 4444 0000 - 0042 4242 2424 1818 1824 2442 4242 0000 - 0082 8282 4444 2828 1010 1010 1038 0000 - 007e 4204 0408 0810 1020 2040 427e 0000 - &lc - 0000 0000 0030 0808 3848 4848 4834 0000 - 0060 2020 202c 3222 2222 2222 322c 0000 - 0000 0000 001c 2240 4040 4040 221c 0000 - 000c 0404 0434 4c44 4444 4444 4c36 0000 - 0000 0000 0018 2424 3c20 2020 2418 0000 - 000c 1210 1038 1010 1010 1010 1038 0000 - 0000 0000 0034 4a48 4830 4038 4444 4438 - 00c0 4040 4058 6444 4444 4444 44ee 0000 - 0010 0000 0030 1010 1010 1010 1038 0000 - 0008 0000 0018 0808 0808 0808 0808 2810 - 0060 2020 2022 2224 2438 2424 2272 0000 - 0030 1010 1010 1010 1010 1010 1038 0000 - 0000 0000 00a4 da92 9292 9292 9292 0000 - 0000 0000 00d8 6444 4444 4444 44ee 0000 - 0000 0000 0038 4482 8282 8282 4438 0000 - 0000 0000 00d8 6442 4242 4242 6458 40e0 - 0000 0000 0034 4c84 8484 8484 4c34 040e - 0000 0000 0068 3420 2020 2020 2070 0000 - 0000 0000 0018 2424 1008 0424 2418 0000 - 0010 1010 107c 1010 1010 1010 1408 0000 - 0000 0000 00cc 4444 4444 4444 4c36 0000 - 0000 0000 00ee 4444 4428 2828 1010 0000 - 0000 0000 0092 9292 9292 92aa 4444 0000 - 0000 0000 00ee 4428 1010 1028 44ee 0000 - 0000 0000 00ee 4444 4448 2828 1010 2040 - 0000 0000 007c 4408 0810 2020 447c 0000 - &colon - 0000 0000 0010 1000 0000 0000 1010 0000 - &slash - 0202 0404 0808 1010 2020 4040 8080 0000 - &blank - 0000 0000 0000 0000 0000 0000 0000 0000 - diff --git a/projects/software/piano.tal b/projects/software/piano.tal deleted file mode 100644 index 8b23cbb..0000000 --- a/projects/software/piano.tal +++ /dev/null @@ -1,552 +0,0 @@ -( Piano: - Play notes with the keyboard or the controller ) - -|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 -|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 -|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 -|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 -|40 @Audio1 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 -|80 @Controller &vector $2 &button $1 &key $1 -|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2 - -|0000 - - @octave $1 - @center &x $2 &y $2 - @adsr-view &x1 $2 &y1 $2 &x2 $2 &y2 $2 - @wave-view &x1 $2 &y1 $2 &x2 $2 &y2 $2 - @octave-view &x1 $2 &y1 $2 &x2 $2 &y2 $2 - -|0100 ( -> ) - - ( theme ) - #0fe3 .System/r DEO2 - #0fc3 .System/g DEO2 - #0f23 .System/b DEO2 - ( resize ) - #0180 .Screen/width DEO2 - #00e0 .Screen/height DEO2 - ( find center ) - .Screen/width DEI2 #01 SFT2 - DUP2 .center/x STZ2 - #0080 SUB2 - DUP2 .octave-view/x1 STZ2 - #0050 ADD2 .octave-view/x2 STZ2 - .Screen/height DEI2 #01 SFT2 #0010 ADD2 - DUP2 .center/y STZ2 - #0010 ADD2 - DUP2 .octave-view/y1 STZ2 - #0018 ADD2 .octave-view/y2 STZ2 - ( place adsr ) - .center/x LDZ2 #0020 SUB2 .adsr-view/x1 STZ2 - .center/y LDZ2 #0010 ADD2 .adsr-view/y1 STZ2 - .adsr-view/x1 LDZ2 #00a0 ADD2 .adsr-view/x2 STZ2 - .adsr-view/y1 LDZ2 #0018 ADD2 .adsr-view/y2 STZ2 - ( place waveform ) - .center/x LDZ2 #0080 SUB2 .wave-view/x1 STZ2 - .center/y LDZ2 #0040 SUB2 .wave-view/y1 STZ2 - .wave-view/x1 LDZ2 #0100 ADD2 .wave-view/x2 STZ2 - .wave-view/y1 LDZ2 #0040 ADD2 .wave-view/y2 STZ2 - ( setup synth ) - #041c set-env - #dd set-vol - ;sin-pcm .Audio0/addr DEO2 - ;sin-pcm .Audio1/addr DEO2 - #0100 - DUP2 .Audio0/length DEO2 - .Audio1/length DEO2 - ( inital drawing ) - draw-octave - draw-adsr - draw-wave - ( unlock ) - ;on-frame .Screen/vector DEO2 - ;on-control .Controller/vector DEO2 - ;on-mouse .Mouse/vector DEO2 - ;on-message .Console/vector DEO2 - -BRK - -( -@|vectors ) - -@on-frame ( -> ) - - .Mouse/state DEI ?&skip-sft - [ LIT2 00 &soft $1 ] EQUk ?&no-soft - soften - DUP #01 SUB ,&soft STR - &no-soft - POP2 - &skip-sft - - [ LIT &last $1 ] .Audio0/output DEI NEQk ?&changed - POP2 BRK - &changed - ,&last STR POP - - ( redraw ) - [ LIT2 00 -Screen/auto ] DEO - .adsr-view/y2 LDZ2 #0020 SUB2 .Screen/y DEO2 - #1000 - &loop - .adsr-view/x2 LDZ2 #003a SUB2 .Screen/x DEO2 - #10 OVR SUB .Audio0/output DEI - DUP2 #0f AND LTH .Screen/pixel DEO - .Screen/x DEI2k INC2 INC2 ROT DEO2 - #04 SFT LTH .Screen/pixel DEO - .Screen/y DEI2k INC2 INC2 ROT DEO2 - INC GTHk ?&loop - POP2 - -BRK - -@on-control ( -> ) - - .Controller/key DEI - ( octave ) - [ LIT "a ] NEQk NIP ?&no-c #30 .octave LDZ #0c MUL ADD play &no-c - [ LIT "w ] NEQk NIP ?&no-c# #31 .octave LDZ #0c MUL ADD play &no-c# - [ LIT "s ] NEQk NIP ?&no-d #32 .octave LDZ #0c MUL ADD play &no-d - [ LIT "e ] NEQk NIP ?&no-d# #33 .octave LDZ #0c MUL ADD play &no-d# - [ LIT "d ] NEQk NIP ?&no-e #34 .octave LDZ #0c MUL ADD play &no-e - [ LIT "f ] NEQk NIP ?&no-f #35 .octave LDZ #0c MUL ADD play &no-f - [ LIT "t ] NEQk NIP ?&no-f# #36 .octave LDZ #0c MUL ADD play &no-f# - [ LIT "g ] NEQk NIP ?&no-g #37 .octave LDZ #0c MUL ADD play &no-g - [ LIT "y ] NEQk NIP ?&no-g# #38 .octave LDZ #0c MUL ADD play &no-g# - [ LIT "h ] NEQk NIP ?&no-a #39 .octave LDZ #0c MUL ADD play &no-a - [ LIT "u ] NEQk NIP ?&no-a# #3a .octave LDZ #0c MUL ADD play &no-a# - [ LIT "j ] NEQk NIP ?&no-b #3b .octave LDZ #0c MUL ADD play &no-b - [ LIT "k ] NEQk NIP ?&no-c2 #3c .octave LDZ #0c MUL ADD play &no-c2 - ( controls ) - [ LIT "z ] NEQk NIP ?&no-dec .octave LDZk #01 SUB SWP STZ &no-dec - [ LIT "x ] NEQk NIP ?&no-inc .octave LDZk INC SWP STZ &no-inc - [ #1b ] NEQk NIP ?&no-esc #010f DEO &no-esc - POP - - ( release ) - #00 .Controller/key DEO - - .Controller/button DEI - [ #11 ] NEQk NIP ?&cu #3c play &cu - [ #21 ] NEQk NIP ?&cd #3d play &cd - [ #41 ] NEQk NIP ?&cl #3e play &cl - [ #81 ] NEQk NIP ?&cr #3f play &cr - [ #12 ] NEQk NIP ?&au #40 play &au - [ #22 ] NEQk NIP ?&ad #41 play &ad - [ #42 ] NEQk NIP ?&al #42 play &al - [ #82 ] NEQk NIP ?&ar #43 play &ar - [ #14 ] NEQk NIP ?&su #44 play &su - [ #24 ] NEQk NIP ?&sd #45 play &sd - [ #44 ] NEQk NIP ?&sl #46 play &sl - [ #84 ] NEQk NIP ?&sr #47 play &sr - POP - - draw-octave - -BRK - -@on-message ( -> ) - - .Console/read DEI play - draw-octave - -BRK - -@on-mouse ( -> ) - - #00 .Mouse/state DEI NEQ #41 ADD ;cursor-icn update-cursor - - .Mouse/state DEI ?on-mouse-touch - -BRK - -@on-mouse-touch ( -> ) - - .Mouse/x DEI2 .Mouse/y DEI2 .wave-view within-rect - ?on-touch-wave-view - .Mouse/x DEI2 .Mouse/y DEI2 .adsr-view within-rect - ?on-touch-knobs-view - .Mouse/x DEI2 .Mouse/y DEI2 .octave-view within-rect - ?on-touch-octave-view - -BRK - -@on-touch-wave-view ( -> ) - - .Mouse/state DEI #01 GTH ?&paint - .Mouse/x DEI2 .wave-view/x1 LDZ2 SUB2 - ( min ) #0010 GTH2k [ JMP SWP2 POP2 ] set-length - -BRK - -&paint ( -> ) - - .Mouse/y DEI2 .wave-view/y1 LDZ2 SUB2 #20 SFT2 NIP - .Mouse/x DEI2 .wave-view/x1 LDZ2 SUB2 ;sin-pcm ADD2 STA - draw-wave - #10 ;on-frame/soft STA - -BRK - -@on-touch-octave-view ( -> ) - - .Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 NIP #09 NEQ ?&no-mod - .Mouse/y DEI2 .octave-view/y1 LDZ2 SUB2 #03 SFT2 NIP - [ #00 ] NEQk NIP ?&no-incr - .octave LDZ #03 EQU ?&no-incr - .octave LDZ INC .octave STZ &no-incr - [ #02 ] NEQk NIP ?&no-decr - .octave LDZ #ff EQU ?&no-decr - .octave LDZ #01 SUB .octave STZ &no-decr - POP - ( release ) #00 .Mouse/state DEO - draw-octave - BRK - &no-mod - - .Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 NIP #06 GTH ?&no-key - .Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 ;notes-lut ADD2 LDA .octave LDZ #0c MUL ADD play - ( release ) #00 .Mouse/state DEO - draw-octave - &no-key - -BRK - -@on-touch-knobs-view ( -> ) - - .Mouse/x DEI2 .adsr-view/x1 LDZ2 SUB2 #03 SFT2 NIP #03 DIV - .Mouse/y DEI2 .adsr-view/y1 LDZ2 SUB2 NIP - OVR #04 LTH ?on-touch-adsr - OVR #04 GTH ?on-touch-vol - POP2 - -BRK - -@on-touch-adsr ( knob value -> ) - - STH2 - ( mask ) #ffff #000f #03 OVRr STHr SUB #60 SFT SFT2 EOR2 - .Audio0/adsr DEI2 AND2 - ( value ) #000f STHr OVR LTHk [ JMP SWP POP ] SUB - ( shift ) #03 STHr SUB #60 SFT SFT2 ORA2 - set-env - -BRK - -@on-touch-vol ( knob value -> ) - - SWP #03 SUB INC INC SWP STH2 - ( mask ) #0f OVRr STHr #60 SFT SFT - .Audio0/volume DEI AND - ( value ) #0f STHr OVR LTHk [ JMP SWP POP ] SUB - ( shift ) #01 STHr SUB #60 SFT SFT ORA - set-vol - -BRK - -( -@|core ) - -@play ( pitch -- ) - - DUP #0c DIVk MUL SUB ;draw-octave/last STA - DUP .Audio0/pitch DEO - #0c SUB .Audio1/pitch DEO - -JMP2r - -@set-length ( length* -- ) - - DUP2 .Audio0/length DEO2 - .Audio1/length DEO2 - -!draw-wave - -@set-vol ( vol -- ) - - DUP .Audio0/volume DEO - .Audio1/volume DEO - -!draw-adsr - -@set-env ( adsr* -- ) - - DUP2 .Audio0/adsr DEO2 - .Audio1/adsr DEO2 - -!draw-adsr - -@soften ( -- ) - - #0100 #0000 - &l - DUP2 ;sin-pcm ADD2 get-average SWP2 STA POP - INC2 GTH2k ?&l - POP2 POP2 - draw-wave - -JMP2r - -@get-average ( addr* -- addr* average* ) - - [ LIT2r 0000 ] - DUP2 #0001 SUB2 DUP2 #0002 ADD2 SWP2 - &l - LDAk LITr 00 STH ADD2r - INC2 GTH2k ?&l - POP2 POP2 - LDAk #00 SWP DUP2 DUP2 STH2r - #01 SFT2 ADD2 ADD2 ADD2 #02 SFT2 - -JMP2r - -( -@|drawing ) - -@update-cursor ( color addr* -- ) - - [ LIT2 00 -Screen/auto ] DEO - .Screen/addr DEO2 - #40 draw-cursor - .Mouse/x DEI2 ,draw-cursor/x STR2 - .Mouse/y DEI2 ,draw-cursor/y STR2 - -@draw-cursor ( color -- ) - - [ LIT2 &x $2 ] .Screen/x DEO2 - [ LIT2 &y $2 ] .Screen/y DEO2 - .Screen/sprite DEO - -JMP2r - -@draw-octave ( -- ) - - ( arrows ) - [ LIT2 02 -Screen/auto ] DEO - .octave-view/x1 LDZ2 #0048 ADD2 .Screen/x DEO2 - .octave-view/y1 LDZ2 .Screen/y DEO2 - ;arrow-icns .Screen/addr DEO2 - [ LIT2 01 -Screen/sprite ] DEO - ;font-hex .octave LDZ #03 ADD #00 SWP #30 SFT2 ADD2 .Screen/addr DEO2 - [ LIT2 02 -Screen/sprite ] DEO - ;arrow-icns/down .Screen/addr DEO2 - [ LIT2 01 -Screen/sprite ] DEO - ( octave ) - .octave-view/x1 LDZ2 .Screen/x DEO2 - .octave-view/y1 LDZ2 .Screen/y DEO2 - [ LIT2 06 -Screen/auto ] DEO - [ LITr &last ff ] - ;keys-left-icns STHkr #00 EQU INC draw-key - ;keys-middle-icns STHkr #02 EQU INC draw-key - ;keys-right-icns STHkr #04 EQU INC draw-key - ;keys-left-icns STHkr #05 EQU INC draw-key - ;keys-middle-icns STHkr #07 EQU INC draw-key - ;keys-middle-icns STHkr #09 EQU INC draw-key - ;keys-right-icns STHr #0b EQU INC - -( >> ) - -@draw-key ( addr* color -- ) - - STH - .Screen/addr DEO2 - .Screen/y DEI2 - STHr .Screen/sprite DEOk DEOk DEO - .Screen/x DEI2k #0008 ADD2 ROT DEO2 - .Screen/y DEO2 - -JMP2r - -@draw-adsr ( -- ) - - ( adsr ) - .adsr-view/x1 LDZ2 .adsr-view/y1 LDZ2 - .Audio0/adsr DEI #04 SFT draw-knob - .adsr-view/x1 LDZ2 #0018 ADD2 .adsr-view/y1 LDZ2 - .Audio0/adsr DEI #0f AND draw-knob - .adsr-view/x1 LDZ2 #0030 ADD2 .adsr-view/y1 LDZ2 - .Audio0/adsr INC DEI #04 SFT draw-knob - .adsr-view/x1 LDZ2 #0048 ADD2 .adsr-view/y1 LDZ2 - .Audio0/adsr INC DEI #0f AND draw-knob - ( volume ) - .adsr-view/x2 LDZ2 #0028 SUB2 .adsr-view/y1 LDZ2 - .Audio0/volume DEI #04 SFT draw-knob - .adsr-view/x2 LDZ2 #0010 SUB2 .adsr-view/y1 LDZ2 - .Audio0/volume DEI #0f AND - -!draw-knob - -@draw-wave ( -- ) - - ( background ) - .wave-view/x1 LDZ2 .Screen/x DEO2 - .wave-view/y1 LDZ2 .Screen/y DEO2 - ;fill-icn .Screen/addr DEO2 - [ LIT2 75 -Screen/auto ] DEO - #e0 &lbg - ;dotted-icn .Screen/addr DEO2 - [ LIT2 0c -Screen/sprite ] DEO - INC DUP ?&lbg - POP - .wave-view/x1 LDZ2 .Screen/x DEO2 - ( waveform ) - [ LIT2 01 -Screen/auto ] DEO - ;sin-pcm/end ;sin-pcm - &loop - DUP2 ;sin-pcm SUB2 .Audio0/length DEI2 DIV2k MUL2 SUB2 ;sin-pcm ADD2 LDA - #00 SWP #02 SFT2 .wave-view/y1 LDZ2 ADD2 .Screen/y DEO2 - ( draw ) DUP2 ;sin-pcm SUB2 NIP .Audio0/length DEI2 NIP #01 SUB GTH INC .Screen/pixel DEO - INC2 GTH2k ?&loop - POP2 POP2 - ( length line ) - .wave-view/x1 LDZ2 .Audio0/length DEI2 #0001 SUB2 ADD2 .Screen/x DEO2 - .wave-view/y1 LDZ2 .Screen/y DEO2 - ;line-icn .Screen/addr DEO2 - [ LIT2 71 -Screen/auto ] DEO - [ LIT2 05 -Screen/sprite ] DEO - ( range ) - [ LIT2 01 -Screen/auto ] DEO - .wave-view/x1 LDZ2 .Screen/x DEO2 - .wave-view/y1 LDZ2 #0018 SUB2 .Screen/y DEO2 - .Audio0/length DEI2 - -!draw-short - -@draw-knob ( x* y* value -- ) - - STH - OVR2 OVR2 .Screen/y DEO2 .Screen/x DEO2 - ( circle ) - ;knob-icns .Screen/addr DEO2 - [ LIT2 16 -Screen/auto ] DEO - [ LIT2 01 -Screen/sprite ] DEOk DEO - ( value ) - #0010 ADD2 .Screen/y DEO2 - #0004 ADD2 .Screen/x DEO2 - ;font-hex #00 STHkr #30 SFT ADD2 .Screen/addr DEO2 - [ LIT2 00 -Screen/auto ] DEO - [ LIT2 01 -Screen/sprite ] DEO - ( marker ) - .Screen/x DEI2 #0004 SUB2 #0000 STHkr ;knob-offsetx ADD2 LDA ADD2 .Screen/x DEO2 - .Screen/y DEI2 #0010 SUB2 #0000 STHr ;knob-offsety ADD2 LDA ADD2 .Screen/y DEO2 - ;knob-icns/index .Screen/addr DEO2 - [ LIT2 05 -Screen/sprite ] DEO - -JMP2r - -@draw-short ( short* -- ) - - SWP draw-byte - -@draw-byte ( byte -- ) - - DUP #04 SFT draw-hex #0f AND - -@draw-hex ( char -- ) - - #00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 - [ LIT2 02 -Screen/sprite ] DEO - -JMP2r - -@within-rect ( x* y* rect -- flag ) - - STH - ( y < rect.y1 ) DUP2 STHkr INC INC LDZ2 LTH2 ?&skip - ( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ?&skip - SWP2 - ( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ?&skip - ( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ?&skip - POP2 POP2 POPr - #01 -JMP2r - &skip - POP2 POP2 POPr - #00 - -JMP2r - -@phex ( short* -- ) SWP phex/b &b DUP #04 SFT phex/c &c #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO JMP2r - -( -@|assets ) - -@notes-lut [ - 30 32 34 35 37 39 3b 3c ] - -@dotted-icn [ - 0000 0000 0000 0000 - 0000 0000 0000 0000 - 0000 0000 0000 0000 - 0000 0000 0000 0000 - aa00 0000 0000 0000 - 0000 0000 0000 0000 - 0000 0000 0000 0000 - 0000 0000 0000 0000 ] -@line-icn [ - 8080 8080 8080 8080 - ] -@fill-icn [ - ffff ffff ffff ffff ] -@cursor-icn [ - 80c0 e0f0 f8e0 1000 ] -@arrow-icns [ - 0010 387c fe10 1000 -&down - 0010 1010 fe7c 3810 ] -@keys-left-icns [ - 7c7c 7c7c 7c7c 7c7c - 7c7c 7c7c 7c7c 7e7f - 7f7f 7f7f 7f7f 3e00 ] -@keys-middle-icns [ - 1c1c 1c1c 1c1c 1c1c - 1c1c 1c1c 1c1c 3e7f - 7f7f 7f7f 7f7f 3e00 ] -@keys-right-icns [ - 1f1f 1f1f 1f1f 1f1f - 1f1f 1f1f 1f1f 3f7f - 7f7f 7f7f 7f7f 3e00 ] -@knob-icns [ - 0003 0c10 2020 4040 - 00c0 3008 0404 0202 - 4040 2020 100c 0300 - 0202 0404 0830 c000 - &index - 0000 183c 3c18 0000 ] -@knob-offsetx [ - 01 00 00 00 00 01 02 03 - 05 06 07 08 08 08 08 07 ] -@knob-offsety [ - 07 06 05 03 02 01 00 00 - 00 00 01 02 03 05 06 07 ] -@font-hex [ - 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 ] - -( pad ) [ 8080 8080 ] -@sin-pcm [ - 8083 8689 8c8f 9295 989b 9ea1 a4a7 aaad - b0b3 b6b9 bbbe c1c3 c6c9 cbce d0d2 d5d7 - d9db dee0 e2e4 e6e7 e9eb ecee f0f1 f2f4 - f5f6 f7f8 f9fa fbfb fcfd fdfe fefe fefe - fffe fefe fefe fdfd fcfb fbfa f9f8 f7f6 - f5f4 f2f1 f0ee eceb e9e7 e6e4 e2e0 dedb - d9d7 d5d2 d0ce cbc9 c6c3 c1be bbb9 b6b3 - b0ad aaa7 a4a1 9e9b 9895 928f 8c89 8683 - 807d 7a77 7471 6e6b 6865 625f 5c59 5653 - 504d 4a47 4542 3f3d 3a37 3532 302e 2b29 - 2725 2220 1e1c 1a19 1715 1412 100f 0e0c - 0b0a 0908 0706 0505 0403 0302 0202 0202 - 0102 0202 0202 0303 0405 0506 0708 090a - 0b0c 0e0f 1012 1415 1719 1a1c 1e20 2225 - 2729 2b2e 3032 3537 3a3d 3f42 4547 4a4d - 5053 5659 5c5f 6265 686b 6e71 7477 7a7d ] - &end -( pad ) [ 8080 8080 ] \ No newline at end of file diff --git a/projects/sounds/bdr1.pcm b/sounds/bdr1.pcm similarity index 100% rename from projects/sounds/bdr1.pcm rename to sounds/bdr1.pcm diff --git a/projects/sounds/bdr2.pcm b/sounds/bdr2.pcm similarity index 100% rename from projects/sounds/bdr2.pcm rename to sounds/bdr2.pcm diff --git a/projects/sounds/chat.pcm b/sounds/chat.pcm similarity index 100% rename from projects/sounds/chat.pcm rename to sounds/chat.pcm diff --git a/projects/sounds/cym1.pcm b/sounds/cym1.pcm similarity index 100% rename from projects/sounds/cym1.pcm rename to sounds/cym1.pcm diff --git a/projects/sounds/hhat.pcm b/sounds/hhat.pcm similarity index 100% rename from projects/sounds/hhat.pcm rename to sounds/hhat.pcm diff --git a/projects/sounds/kck1.pcm b/sounds/kck1.pcm similarity index 100% rename from projects/sounds/kck1.pcm rename to sounds/kck1.pcm diff --git a/projects/sounds/kck2.pcm b/sounds/kck2.pcm similarity index 100% rename from projects/sounds/kck2.pcm rename to sounds/kck2.pcm diff --git a/projects/sounds/ohat.pcm b/sounds/ohat.pcm similarity index 100% rename from projects/sounds/ohat.pcm rename to sounds/ohat.pcm diff --git a/projects/sounds/pad1.pcm b/sounds/pad1.pcm similarity index 100% rename from projects/sounds/pad1.pcm rename to sounds/pad1.pcm diff --git a/projects/sounds/pad2.pcm b/sounds/pad2.pcm similarity index 100% rename from projects/sounds/pad2.pcm rename to sounds/pad2.pcm diff --git a/projects/sounds/piano.pcm b/sounds/piano.pcm similarity index 100% rename from projects/sounds/piano.pcm rename to sounds/piano.pcm diff --git a/projects/sounds/ride.pcm b/sounds/ride.pcm similarity index 100% rename from projects/sounds/ride.pcm rename to sounds/ride.pcm diff --git a/projects/sounds/saw.pcm b/sounds/saw.pcm similarity index 100% rename from projects/sounds/saw.pcm rename to sounds/saw.pcm diff --git a/projects/sounds/sid1.pcm b/sounds/sid1.pcm similarity index 100% rename from projects/sounds/sid1.pcm rename to sounds/sid1.pcm diff --git a/projects/sounds/sid2.pcm b/sounds/sid2.pcm similarity index 100% rename from projects/sounds/sid2.pcm rename to sounds/sid2.pcm diff --git a/projects/sounds/sin.pcm b/sounds/sin.pcm similarity index 100% rename from projects/sounds/sin.pcm rename to sounds/sin.pcm diff --git a/projects/sounds/snr1.pcm b/sounds/snr1.pcm similarity index 100% rename from projects/sounds/snr1.pcm rename to sounds/snr1.pcm diff --git a/projects/sounds/snr2.pcm b/sounds/snr2.pcm similarity index 100% rename from projects/sounds/snr2.pcm rename to sounds/snr2.pcm diff --git a/projects/sounds/sqr.pcm b/sounds/sqr.pcm similarity index 100% rename from projects/sounds/sqr.pcm rename to sounds/sqr.pcm diff --git a/projects/sounds/sub1.pcm b/sounds/sub1.pcm similarity index 100% rename from projects/sounds/sub1.pcm rename to sounds/sub1.pcm diff --git a/projects/sounds/syn1.pcm b/sounds/syn1.pcm similarity index 100% rename from projects/sounds/syn1.pcm rename to sounds/syn1.pcm diff --git a/projects/sounds/syn2.pcm b/sounds/syn2.pcm similarity index 100% rename from projects/sounds/syn2.pcm rename to sounds/syn2.pcm diff --git a/projects/sounds/tri.pcm b/sounds/tri.pcm similarity index 100% rename from projects/sounds/tri.pcm rename to sounds/tri.pcm diff --git a/projects/sounds/violin.pcm b/sounds/violin.pcm similarity index 100% rename from projects/sounds/violin.pcm rename to sounds/violin.pcm diff --git a/src/devices/audio.c b/src/devices/audio.c deleted file mode 100644 index 9425278..0000000 --- a/src/devices/audio.c +++ /dev/null @@ -1,125 +0,0 @@ -#include "../uxn.h" -#include "audio.h" - -/* -Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -#define NOTE_PERIOD (SAMPLE_FREQUENCY * 0x4000 / 11025) -#define ADSR_STEP (SAMPLE_FREQUENCY / 0xf) - -typedef struct { - Uint8 *addr; - Uint32 count, advance, period, age, a, d, s, r; - Uint16 i, len; - Sint8 volume[2]; - Uint8 pitch, repeat; -} UxnAudio; - -/* clang-format off */ - -static Uint32 advances[12] = { - 0x80000, 0x879c8, 0x8facd, 0x9837f, 0xa1451, 0xaadc1, - 0xb504f, 0xbfc88, 0xcb2ff, 0xd7450, 0xe411f, 0xf1a1c -}; - -static UxnAudio uxn_audio[POLYPHONY]; - -/* clang-format on */ - -static Sint32 -envelope(UxnAudio *c, Uint32 age) -{ - if(!c->r) return 0x0888; - if(age < c->a) return 0x0888 * age / c->a; - if(age < c->d) return 0x0444 * (2 * c->d - c->a - age) / (c->d - c->a); - if(age < c->s) return 0x0444; - if(age < c->r) return 0x0444 * (c->r - age) / (c->r - c->s); - c->advance = 0; - return 0x0000; -} - -int -audio_render(int instance, Sint16 *sample, Sint16 *end) -{ - UxnAudio *c = &uxn_audio[instance]; - Sint32 s; - if(!c->advance || !c->period) return 0; - while(sample < end) { - c->count += c->advance; - c->i += c->count / c->period; - c->count %= c->period; - if(c->i >= c->len) { - if(!c->repeat) { - c->advance = 0; - break; - } - c->i %= c->len; - } - s = (Sint8)(c->addr[c->i] + 0x80) * envelope(c, c->age++); - *sample++ += s * c->volume[0] / 0x180; - *sample++ += s * c->volume[1] / 0x180; - } - if(!c->advance) audio_finished_handler(instance); - return 1; -} - -void -audio_start(int instance, Uint8 *d) -{ - UxnAudio *c = &uxn_audio[instance]; - Uint8 pitch = d[0xf] & 0x7f; - Uint16 addr = PEEK2(d + 0xc); - Uint16 adsr = PEEK2(d + 0x8); - c->len = PEEK2(d + 0xa); - if(c->len > 0x10000 - addr) - c->len = 0x10000 - addr; - c->addr = &uxn.ram[addr]; - c->volume[0] = d[0xe] >> 4; - c->volume[1] = d[0xe] & 0xf; - c->repeat = !(d[0xf] & 0x80); - if(pitch < 108 && c->len) - c->advance = advances[pitch % 12] >> (8 - pitch / 12); - else { - c->advance = 0; - return; - } - c->a = ADSR_STEP * (adsr >> 12); - c->d = ADSR_STEP * (adsr >> 8 & 0xf) + c->a; - c->s = ADSR_STEP * (adsr >> 4 & 0xf) + c->d; - c->r = ADSR_STEP * (adsr >> 0 & 0xf) + c->s; - c->age = 0; - c->i = 0; - if(c->len <= 0x100) /* single cycle mode */ - c->period = NOTE_PERIOD * 337 / 2 / c->len; - else /* sample repeat mode */ - c->period = NOTE_PERIOD; -} - -Uint8 -audio_get_vu(int instance) -{ - int i; - UxnAudio *c = &uxn_audio[instance]; - Sint32 sum[2] = {0, 0}; - if(!c->advance || !c->period) return 0; - for(i = 0; i < 2; i++) { - if(!c->volume[i]) continue; - sum[i] = 1 + envelope(c, c->age) * c->volume[i] / 0x800; - if(sum[i] > 0xf) sum[i] = 0xf; - } - return (sum[0] << 4) | sum[1]; -} - -Uint16 -audio_get_position(int instance) -{ - return uxn_audio[instance].i; -} diff --git a/src/devices/audio.h b/src/devices/audio.h deleted file mode 100644 index f95e295..0000000 --- a/src/devices/audio.h +++ /dev/null @@ -1,22 +0,0 @@ -/* -Copyright (c) 2021 Devine Lu Linvega -Copyright (c) 2021 Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -typedef signed int Sint32; - -#define SAMPLE_FREQUENCY 44100 -#define POLYPHONY 4 - -Uint8 audio_get_vu(int instance); -Uint16 audio_get_position(int instance); -int audio_render(int instance, Sint16 *sample, Sint16 *end); -void audio_start(int instance, Uint8 *d); -void audio_finished_handler(int instance); diff --git a/src/devices/console.c b/src/devices/console.c deleted file mode 100644 index 68a19cb..0000000 --- a/src/devices/console.c +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include - -#include "../uxn.h" -#include "console.h" - -/* -Copyright (c) 2022-2025 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -/* console registers */ - -int -console_input(int c, int type) -{ - if(c == EOF) c = 0, type = 4; - uxn.dev[0x12] = c, uxn.dev[0x17] = type; - uxn_eval(console_vector); - return type != 4; -} - -void -console_arguments(int i, int argc, char **argv) -{ - for(; i < argc; i++) { - char *p = argv[i]; - while(*p) - console_input(*p++, CONSOLE_ARG); - console_input('\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA); - } -} - -void -console_deo(Uint8 addr) -{ - FILE *fd; - switch(addr) { - case 0x11: console_vector = PEEK2(&uxn.dev[0x10]); return; - case 0x18: fd = stdout, fputc(uxn.dev[0x18], fd), fflush(fd); break; - case 0x19: fd = stderr, fputc(uxn.dev[0x19], fd), fflush(fd); break; - } -} diff --git a/src/devices/console.h b/src/devices/console.h deleted file mode 100644 index ba7b64b..0000000 --- a/src/devices/console.h +++ /dev/null @@ -1,22 +0,0 @@ -/* -Copyright (c) 2021 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -#define CONSOLE_STD 0x1 -#define CONSOLE_ARG 0x2 -#define CONSOLE_EOA 0x3 -#define CONSOLE_END 0x4 - -int console_input(int c, int type); -void console_arguments(int i, int argc, char **argv); -Uint8 console_dei(Uint8 addr); -void console_deo(Uint8 addr); - -extern int console_vector; diff --git a/src/devices/controller.c b/src/devices/controller.c deleted file mode 100644 index 0578576..0000000 --- a/src/devices/controller.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "../uxn.h" -#include "controller.h" - -/* -Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -static int controller_vector; - -void -controller_down(Uint8 mask) -{ - if(mask) { - uxn.dev[0x82] |= mask; - uxn_eval(controller_vector); - } -} - -void -controller_up(Uint8 mask) -{ - if(mask) { - uxn.dev[0x82] &= (~mask); - uxn_eval(controller_vector); - } -} - -void -controller_key(Uint8 key) -{ - if(key) { - uxn.dev[0x83] = key; - uxn_eval(controller_vector); - uxn.dev[0x83] = 0; - } -} - -void -controller_deo(Uint8 addr) -{ - switch(addr) { - case 0x81: controller_vector = PEEK2(&uxn.dev[0x80]); break; - } -} diff --git a/src/devices/controller.h b/src/devices/controller.h deleted file mode 100644 index 4a8ef24..0000000 --- a/src/devices/controller.h +++ /dev/null @@ -1,16 +0,0 @@ -/* -Copyright (c) 2021 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -void controller_down(Uint8 mask); -void controller_up(Uint8 mask); -void controller_key(Uint8 key); - -void controller_deo(Uint8 addr); diff --git a/src/devices/datetime.c b/src/devices/datetime.c deleted file mode 100644 index ec1d415..0000000 --- a/src/devices/datetime.c +++ /dev/null @@ -1,39 +0,0 @@ -#include - -#include "../uxn.h" -#include "datetime.h" - -/* -Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -Uint8 -datetime_dei(Uint8 addr) -{ - time_t seconds = time(NULL); - struct tm zt = {0}; - struct tm *t = localtime(&seconds); - if(t == NULL) - t = &zt; - switch(addr) { - case 0xc0: return (t->tm_year + 1900) >> 8; - case 0xc1: return (t->tm_year + 1900); - case 0xc2: return t->tm_mon; - case 0xc3: return t->tm_mday; - case 0xc4: return t->tm_hour; - case 0xc5: return t->tm_min; - case 0xc6: return t->tm_sec; - case 0xc7: return t->tm_wday; - case 0xc8: return t->tm_yday >> 8; - case 0xc9: return t->tm_yday; - case 0xca: return t->tm_isdst; - default: return uxn.dev[addr]; - } -} diff --git a/src/devices/datetime.h b/src/devices/datetime.h deleted file mode 100644 index 315389b..0000000 --- a/src/devices/datetime.h +++ /dev/null @@ -1,12 +0,0 @@ -/* -Copyright (c) 2021 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -Uint8 datetime_dei(Uint8 addr); diff --git a/src/devices/file.c b/src/devices/file.c deleted file mode 100644 index 2c01b8a..0000000 --- a/src/devices/file.c +++ /dev/null @@ -1,386 +0,0 @@ -#define _XOPEN_SOURCE 500 -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 -#include -#include -#define realpath(s, dummy) lrealpath(s) -#define DIR_SEP_CHAR '\\' -#define DIR_SEP_STR "\\" -#define pathcmp(path1, path2, length) strncasecmp(path1, path2, length) /* strncasecmp provided by libiberty */ -#define notdriveroot(file_name) (file_name[0] != DIR_SEP_CHAR && ((strlen(file_name) > 2 && file_name[1] != ':') || strlen(file_name) <= 2)) -#define mkdir(file_name) (_mkdir(file_name) == 0) -#else -#define DIR_SEP_CHAR '/' -#define DIR_SEP_STR "/" -#define pathcmp(path1, path2, length) strncmp(path1, path2, length) -#define notdriveroot(file_name) (file_name[0] != DIR_SEP_CHAR) -#define mkdir(file_name) (mkdir(file_name, 0755) == 0) -#endif - -#ifndef PATH_MAX -#define PATH_MAX 4096 -#endif - -#include "../uxn.h" -#include "file.h" - -/* -Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -typedef struct { - FILE *f; - DIR *dir; - char current_filename[4096]; - struct dirent *de; - enum { IDLE, - FILE_READ, - FILE_WRITE, - DIR_READ, - DIR_WRITE - } state; - int outside_sandbox; -} UxnFile; - -static UxnFile uxn_file[POLYFILEY]; - -static void -reset(UxnFile *c) -{ - if(c->f != NULL) { - fclose(c->f); - c->f = NULL; - } - if(c->dir != NULL) { - closedir(c->dir); - c->dir = NULL; - } - c->de = NULL; - c->state = IDLE; - c->outside_sandbox = 0; -} - -static Uint16 -get_entry(char *p, Uint16 len, const char *pathname, const char *basename, int fail_nonzero) -{ - struct stat st; - if(len < strlen(basename) + 8) - return 0; - if(stat(pathname, &st)) - return fail_nonzero ? snprintf(p, len, "!!!! %s\n", basename) : 0; - else if(S_ISDIR(st.st_mode)) - return snprintf(p, len, "---- %s/\n", basename); - else if(st.st_size < 0x10000) - return snprintf(p, len, "%04x %s\n", (unsigned int)st.st_size, basename); - else - return snprintf(p, len, "???? %s\n", basename); -} - -static Uint16 -file_read_dir(UxnFile *c, char *dest, Uint16 len) -{ - static char pathname[4352]; - char *p = dest; - if(c->de == NULL) c->de = readdir(c->dir); - for(; c->de != NULL; c->de = readdir(c->dir)) { - Uint16 n; - if(c->de->d_name[0] == '.' && c->de->d_name[1] == '\0') - continue; - if(strcmp(c->de->d_name, "..") == 0) { - /* hide "sandbox/.." */ - char cwd[PATH_MAX] = {'\0'}, *t; - /* Note there's [currently] no way of chdir()ing from uxn, so $PWD - * is always the sandbox top level. */ - getcwd(cwd, sizeof(cwd)); - /* We already checked that c->current_filename exists so don't need a wrapper. */ - t = realpath(c->current_filename, NULL); - if(strcmp(cwd, t) == 0) { - free(t); - continue; - } - free(t); - } - if(strlen(c->current_filename) + 1 + strlen(c->de->d_name) < sizeof(pathname)) - snprintf(pathname, sizeof(pathname), "%s/%s", c->current_filename, c->de->d_name); - else - pathname[0] = '\0'; - n = get_entry(p, len, pathname, c->de->d_name, 1); - if(!n) break; - p += n; - len -= n; - } - return p - dest; -} - -static char * -retry_realpath(const char *file_name) -{ - char *r, p[PATH_MAX] = {'\0'}, *x; - int fnlen; - if(file_name == NULL) { - errno = EINVAL; - return NULL; - } else if((fnlen = strlen(file_name)) >= PATH_MAX) { - errno = ENAMETOOLONG; - return NULL; - } - if(notdriveroot(file_name)) { - getcwd(p, sizeof(p)); - if(strlen(p) + strlen(DIR_SEP_STR) + fnlen >= PATH_MAX) { - errno = ENAMETOOLONG; - return NULL; - } - strcat(p, DIR_SEP_STR); - } - strcat(p, file_name); - while((r = realpath(p, NULL)) == NULL) { - if(errno != ENOENT) - return NULL; - x = strrchr(p, DIR_SEP_CHAR); - if(x) - *x = '\0'; - else - return NULL; - } - return r; -} - -static void -file_check_sandbox(UxnFile *c) -{ - char *x, *rp, cwd[PATH_MAX] = {'\0'}; - x = getcwd(cwd, sizeof(cwd)); - rp = retry_realpath(c->current_filename); - if(rp == NULL || (x && pathcmp(cwd, rp, strlen(cwd)) != 0)) { - c->outside_sandbox = 1; - fprintf(stderr, "file warning: blocked attempt to access %s outside of sandbox\n", c->current_filename); - } - free(rp); -} - -static Uint16 -file_init(UxnFile *c, char *filename, size_t max_len, int override_sandbox) -{ - char *p = c->current_filename; - size_t len = sizeof(c->current_filename); - reset(c); - if(len > max_len) len = max_len; - while(len) { - if((*p++ = *filename++) == '\0') { - if(!override_sandbox) /* override sandbox for loading roms */ - file_check_sandbox(c); - return 0; - } - len--; - } - c->current_filename[0] = '\0'; - return 0; -} - -static Uint16 -file_read(UxnFile *c, void *dest, int len) -{ - if(c->outside_sandbox) return 0; - if(c->state != FILE_READ && c->state != DIR_READ) { - reset(c); - if((c->dir = opendir(c->current_filename)) != NULL) - c->state = DIR_READ; - else if((c->f = fopen(c->current_filename, "rb")) != NULL) - c->state = FILE_READ; - } - if(c->state == FILE_READ) - return fread(dest, 1, len, c->f); - if(c->state == DIR_READ) - return file_read_dir(c, dest, len); - return 0; -} - -static int -is_dir_path(char *p) -{ - char c; - int saw_slash = 0; - while((c = *p++)) - saw_slash = c == DIR_SEP_CHAR; - return saw_slash; -} - -int -dir_exists(char *p) -{ - struct stat st; - return stat(p, &st) == 0 && S_ISDIR(st.st_mode); -} - -int -ensure_parent_dirs(char *p) -{ - int ok = 1; - char c, *s = p; - for(; ok && (c = *p); p++) { - if(c == DIR_SEP_CHAR) { - *p = '\0'; - ok = dir_exists(s) || mkdir(s); - *p = c; - } - } - return ok; -} - -static Uint16 -file_write(UxnFile *c, void *src, Uint16 len, Uint8 flags) -{ - Uint16 ret = 0; - if(c->outside_sandbox) return 0; - ensure_parent_dirs(c->current_filename); - if(c->state != FILE_WRITE && c->state != DIR_WRITE) { - reset(c); - if(is_dir_path(c->current_filename)) - c->state = DIR_WRITE; - else if((c->f = fopen(c->current_filename, (flags & 0x01) ? "ab" : "wb")) != NULL) - c->state = FILE_WRITE; - } - if(c->state == FILE_WRITE) { - if((ret = fwrite(src, 1, len, c->f)) > 0 && fflush(c->f) != 0) - ret = 0; - } - if(c->state == DIR_WRITE) { - ret = dir_exists(c->current_filename); - } - return ret; -} - -static Uint16 -stat_fill(Uint8 *dest, Uint16 len, char c) -{ - Uint16 i; - for(i = 0; i < len; i++) - *(dest++) = c; - return len; -} - -static Uint16 -stat_size(Uint8 *dest, Uint16 len, off_t size) -{ - Uint16 i; - dest += len - 1; - for(i = 0; i < len; i++) { - char c = '0' + (Uint8)(size & 0xf); - if(c > '9') c += 39; - *(dest--) = c; - size = size >> 4; - } - return size == 0 ? len : stat_fill(dest, len, '?'); -} - -static Uint16 -file_stat(UxnFile *c, void *dest, Uint16 len) -{ - struct stat st; - if(c->outside_sandbox) - return 0; - else if(stat(c->current_filename, &st)) - return stat_fill(dest, len, '!'); - else if(S_ISDIR(st.st_mode)) - return stat_fill(dest, len, '-'); - else - return stat_size(dest, len, st.st_size); -} - -static Uint16 -file_delete(UxnFile *c) -{ - return c->outside_sandbox ? 0 : unlink(c->current_filename); -} - -/* IO */ - -void -file_deo(Uint8 port) -{ - Uint16 addr, len, res; - switch(port) { - case 0xa5: - addr = PEEK2(&uxn.dev[0xa4]); - len = PEEK2(&uxn.dev[0xaa]); - if(len > 0x10000 - addr) - len = 0x10000 - addr; - res = file_stat(&uxn_file[0], &uxn.ram[addr], len); - POKE2(&uxn.dev[0xa2], res); - break; - case 0xa6: - res = file_delete(&uxn_file[0]); - POKE2(&uxn.dev[0xa2], res); - break; - case 0xa9: - addr = PEEK2(&uxn.dev[0xa8]); - res = file_init(&uxn_file[0], (char *)&uxn.ram[addr], 0x10000 - addr, 0); - POKE2(&uxn.dev[0xa2], res); - break; - case 0xad: - addr = PEEK2(&uxn.dev[0xac]); - len = PEEK2(&uxn.dev[0xaa]); - if(len > 0x10000 - addr) - len = 0x10000 - addr; - res = file_read(&uxn_file[0], &uxn.ram[addr], len); - POKE2(&uxn.dev[0xa2], res); - break; - case 0xaf: - addr = PEEK2(&uxn.dev[0xae]); - len = PEEK2(&uxn.dev[0xaa]); - if(len > 0x10000 - addr) - len = 0x10000 - addr; - res = file_write(&uxn_file[0], &uxn.ram[addr], len, uxn.dev[0xa7]); - POKE2(&uxn.dev[0xa2], res); - break; - /* File 2 */ - case 0xb5: - addr = PEEK2(&uxn.dev[0xb4]); - len = PEEK2(&uxn.dev[0xba]); - if(len > 0x10000 - addr) - len = 0x10000 - addr; - res = file_stat(&uxn_file[1], &uxn.ram[addr], len); - POKE2(&uxn.dev[0xb2], res); - break; - case 0xb6: - res = file_delete(&uxn_file[1]); - POKE2(&uxn.dev[0xb2], res); - break; - case 0xb9: - addr = PEEK2(&uxn.dev[0xb8]); - res = file_init(&uxn_file[1], (char *)&uxn.ram[addr], 0x10000 - addr, 0); - POKE2(&uxn.dev[0xb2], res); - break; - case 0xbd: - addr = PEEK2(&uxn.dev[0xbc]); - len = PEEK2(&uxn.dev[0xba]); - if(len > 0x10000 - addr) - len = 0x10000 - addr; - res = file_read(&uxn_file[1], &uxn.ram[addr], len); - POKE2(&uxn.dev[0xb2], res); - break; - case 0xbf: - addr = PEEK2(&uxn.dev[0xbe]); - len = PEEK2(&uxn.dev[0xba]); - if(len > 0x10000 - addr) - len = 0x10000 - addr; - res = file_write(&uxn_file[1], &uxn.ram[addr], len, uxn.dev[0xb7]); - POKE2(&uxn.dev[0xb2], res); - break; - } -} diff --git a/src/devices/file.h b/src/devices/file.h deleted file mode 100644 index 55b4a23..0000000 --- a/src/devices/file.h +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright (c) 2021 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -#define POLYFILEY 2 -#define DEV_FILE0 0xa - -void file_deo(Uint8 port); diff --git a/src/devices/mouse.c b/src/devices/mouse.c deleted file mode 100644 index 0f9ed2d..0000000 --- a/src/devices/mouse.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "../uxn.h" -#include "mouse.h" -#include - -/* -Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -static int mouse_vector; - -void -mouse_down(Uint8 mask) -{ - uxn.dev[0x96] |= mask; - uxn_eval(mouse_vector); -} - -void -mouse_up(Uint8 mask) -{ - uxn.dev[0x96] &= (~mask); - uxn_eval(mouse_vector); -} - -void -mouse_pos(Uint16 x, Uint16 y) -{ - uxn.dev[0x92] = x >> 8, uxn.dev[0x93] = x; - uxn.dev[0x94] = y >> 8, uxn.dev[0x95] = y; - uxn_eval(mouse_vector); -} - -void -mouse_scroll(Uint16 x, Uint16 y) -{ - uxn.dev[0x9a] = x >> 8, uxn.dev[0x9b] = x; - uxn.dev[0x9c] = -y >> 8, uxn.dev[0x9d] = -y; - uxn_eval(mouse_vector); - uxn.dev[0x9a] = 0, uxn.dev[0x9b] = 0; - uxn.dev[0x9c] = 0, uxn.dev[0x9d] = 0; -} - -void -mouse_deo(Uint8 addr) -{ - switch(addr) { - case 0x91: mouse_vector = PEEK2(&uxn.dev[0x90]); break; - } -} diff --git a/src/devices/mouse.h b/src/devices/mouse.h deleted file mode 100644 index 33cda24..0000000 --- a/src/devices/mouse.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright (c) 2021 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -void mouse_down(Uint8 mask); -void mouse_up(Uint8 mask); -void mouse_pos(Uint16 x, Uint16 y); -void mouse_scroll(Uint16 x, Uint16 y); - -void mouse_deo(Uint8 addr); diff --git a/src/devices/screen.c b/src/devices/screen.c deleted file mode 100644 index bc6b2dd..0000000 --- a/src/devices/screen.c +++ /dev/null @@ -1,241 +0,0 @@ -#include - -#include "../uxn.h" -#include "screen.h" - -/* -Copyright (c) 2021-2025 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -UxnScreen uxn_screen; - -#define MAR(x) (x + 0x8) -#define MAR2(x) (x + 0x10) - -/* c = !ch ? (color % 5 ? color >> 2 : 0) : color % 4 + ch == 1 ? 0 : (ch - 2 + (color & 3)) % 3 + 1; */ - -static Uint8 blending[4][16] = { - {0, 0, 0, 0, 1, 0, 1, 1, 2, 2, 0, 2, 3, 3, 3, 0}, - {0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3}, - {1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1}, - {2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2}}; - -int -screen_changed(void) -{ - clamp(uxn_screen.x1, 0, uxn_screen.width); - clamp(uxn_screen.y1, 0, uxn_screen.height); - clamp(uxn_screen.x2, 0, uxn_screen.width); - clamp(uxn_screen.y2, 0, uxn_screen.height); - return uxn_screen.x2 > uxn_screen.x1 && - uxn_screen.y2 > uxn_screen.y1; -} - -static void -screen_change(int x1, int y1, int x2, int y2) -{ - if(x1 < uxn_screen.x1) uxn_screen.x1 = x1; - if(y1 < uxn_screen.y1) uxn_screen.y1 = y1; - if(x2 > uxn_screen.x2) uxn_screen.x2 = x2; - if(y2 > uxn_screen.y2) uxn_screen.y2 = y2; -} - -void -screen_palette(void) -{ - int i, shift; - unsigned long colors[4]; - for(i = 0, shift = 4; i < 4; ++i, shift ^= 4) { - Uint8 - r = (uxn.dev[0x8 + i / 2] >> shift) & 0xf, - g = (uxn.dev[0xa + i / 2] >> shift) & 0xf, - b = (uxn.dev[0xc + i / 2] >> shift) & 0xf; - colors[i] = 0x0f000000 | r << 16 | g << 8 | b; - colors[i] |= colors[i] << 4; - } - for(i = 0; i < 16; i++) - uxn_screen.palette[i] = colors[(i >> 2) ? (i >> 2) : (i & 3)]; - screen_change(0, 0, uxn_screen.width, uxn_screen.height); -} - -void -screen_resize(Uint16 width, Uint16 height, int scale) -{ - Uint32 *pixels; - clamp(width, 8, 0x800); - clamp(height, 8, 0x800); - clamp(scale, 1, 3); - /* on rescale */ - pixels = realloc(uxn_screen.pixels, width * height * sizeof(Uint32) * scale * scale); - if(!pixels) return; - uxn_screen.pixels = pixels; - uxn_screen.scale = scale; - /* on resize */ - if(uxn_screen.width != width || uxn_screen.height != height) { - int i, length = MAR2(width) * MAR2(height); - Uint8 *bg = realloc(uxn_screen.bg, length), *fg = realloc(uxn_screen.fg, length); - if(!bg || !fg) return; - uxn_screen.bg = bg, uxn_screen.fg = fg; - uxn_screen.width = width, uxn_screen.height = height; - for(i = 0; i < length; i++) - uxn_screen.bg[i] = uxn_screen.fg[i] = 0; - } - screen_change(0, 0, width, height); - emu_resize(width, height); -} - -void -screen_redraw(void) -{ - int i, x, y, k, l; - for(y = uxn_screen.y1; y < uxn_screen.y2; y++) { - int ys = y * uxn_screen.scale; - for(x = uxn_screen.x1, i = MAR(x) + MAR(y) * MAR2(uxn_screen.width); x < uxn_screen.x2; x++, i++) { - int c = uxn_screen.palette[uxn_screen.fg[i] << 2 | uxn_screen.bg[i]]; - for(k = 0; k < uxn_screen.scale; k++) { - int oo = ((ys + k) * uxn_screen.width + x) * uxn_screen.scale; - for(l = 0; l < uxn_screen.scale; l++) - uxn_screen.pixels[oo + l] = c; - } - } - } - uxn_screen.x1 = uxn_screen.y1 = 9999; - uxn_screen.x2 = uxn_screen.y2 = 0; -} - -/* screen registers */ - -static int rX, rY, rA, rMX, rMY, rMA, rML, rDX, rDY; - -Uint8 -screen_dei(Uint8 addr) -{ - switch(addr) { - case 0x22: return uxn_screen.width >> 8; - case 0x23: return uxn_screen.width; - case 0x24: return uxn_screen.height >> 8; - case 0x25: return uxn_screen.height; - case 0x28: return rX >> 8; - case 0x29: return rX; - case 0x2a: return rY >> 8; - case 0x2b: return rY; - case 0x2c: return rA >> 8; - case 0x2d: return rA; - default: return uxn.dev[addr]; - } -} - -void -screen_deo(Uint8 addr) -{ - switch(addr) { - case 0x21: uxn_screen.vector = PEEK2(&uxn.dev[0x20]); return; - case 0x23: screen_resize(PEEK2(&uxn.dev[0x22]), uxn_screen.height, uxn_screen.scale); return; - case 0x25: screen_resize(uxn_screen.width, PEEK2(&uxn.dev[0x24]), uxn_screen.scale); return; - case 0x26: rMX = uxn.dev[0x26] & 0x1, rMY = uxn.dev[0x26] & 0x2, rMA = uxn.dev[0x26] & 0x4, rML = uxn.dev[0x26] >> 4, rDX = rMX << 3, rDY = rMY << 2; return; - case 0x28: - case 0x29: rX = (uxn.dev[0x28] << 8) | uxn.dev[0x29], rX = twos(rX); return; - case 0x2a: - case 0x2b: rY = (uxn.dev[0x2a] << 8) | uxn.dev[0x2b], rY = twos(rY); return; - case 0x2c: - case 0x2d: rA = (uxn.dev[0x2c] << 8) | uxn.dev[0x2d]; return; - case 0x2e: { - int ctrl = uxn.dev[0x2e]; - int color = ctrl & 0x3; - int len = MAR2(uxn_screen.width); - Uint8 *layer = ctrl & 0x40 ? uxn_screen.fg : uxn_screen.bg; - /* fill mode */ - if(ctrl & 0x80) { - int x1, y1, x2, y2, ax, bx, ay, by, hor, ver; - if(ctrl & 0x10) - x1 = 0, x2 = rX; - else - x1 = rX, x2 = uxn_screen.width; - if(ctrl & 0x20) - y1 = 0, y2 = rY; - else - y1 = rY, y2 = uxn_screen.height; - screen_change(x1, y1, x2, y2); - x1 = MAR(x1), y1 = MAR(y1); - hor = MAR(x2) - x1, ver = MAR(y2) - y1; - for(ay = y1 * len, by = ay + ver * len; ay < by; ay += len) - for(ax = ay + x1, bx = ax + hor; ax < bx; ax++) - layer[ax] = color; - } - /* pixel mode */ - else { - if(rX >= 0 && rY >= 0 && rX < len && rY < uxn_screen.height) - layer[MAR(rX) + MAR(rY) * len] = color; - screen_change(rX, rY, rX + 1, rY + 1); - if(rMX) rX++; - if(rMY) rY++; - } - return; - } - case 0x2f: { - int ctrl = uxn.dev[0x2f]; - int blend = ctrl & 0xf, opaque = blend % 5; - int fx = ctrl & 0x10 ? -1 : 1, fy = ctrl & 0x20 ? -1 : 1; - int qfx = fx > 0 ? 7 : 0, qfy = fy < 0 ? 7 : 0; - int dxy = fy * rDX, dyx = fx * rDY; - int wmar = MAR(uxn_screen.width), wmar2 = MAR2(uxn_screen.width); - int hmar2 = MAR2(uxn_screen.height); - int i, x1, x2, y1, y2, ax, ay, qx, qy, x = rX, y = rY; - Uint8 *layer = ctrl & 0x40 ? uxn_screen.fg : uxn_screen.bg; - if(ctrl & 0x80) { - int addr_incr = rMA << 2; - for(i = 0; i <= rML; i++, x += dyx, y += dxy, rA += addr_incr) { - Uint16 xmar = MAR(x), ymar = MAR(y); - Uint16 xmar2 = MAR2(x), ymar2 = MAR2(y); - if(xmar < wmar && ymar2 < hmar2) { - Uint8 *sprite = &uxn.ram[rA]; - int by = ymar2 * wmar2; - for(ay = ymar * wmar2, qy = qfy; ay < by; ay += wmar2, qy += fy) { - int ch1 = sprite[qy], ch2 = sprite[qy + 8] << 1, bx = xmar2 + ay; - for(ax = xmar + ay, qx = qfx; ax < bx; ax++, qx -= fx) { - int color = ((ch1 >> qx) & 1) | ((ch2 >> qx) & 2); - if(opaque || color) layer[ax] = blending[color][blend]; - } - } - } - } - } else { - int addr_incr = rMA << 1; - for(i = 0; i <= rML; i++, x += dyx, y += dxy, rA += addr_incr) { - Uint16 xmar = MAR(x), ymar = MAR(y); - Uint16 xmar2 = MAR2(x), ymar2 = MAR2(y); - if(xmar < wmar && ymar2 < hmar2) { - Uint8 *sprite = &uxn.ram[rA]; - int by = ymar2 * wmar2; - for(ay = ymar * wmar2, qy = qfy; ay < by; ay += wmar2, qy += fy) { - int ch1 = sprite[qy], bx = xmar2 + ay; - for(ax = xmar + ay, qx = qfx; ax < bx; ax++, qx -= fx) { - int color = (ch1 >> qx) & 1; - if(opaque || color) layer[ax] = blending[color][blend]; - } - } - } - } - } - if(fx < 0) - x1 = x, x2 = rX; - else - x1 = rX, x2 = x; - if(fy < 0) - y1 = y, y2 = rY; - else - y1 = rY, y2 = y; - screen_change(x1 - 8, y1 - 8, x2 + 8, y2 + 8); - if(rMX) rX += rDX * fx; - if(rMY) rY += rDY * fy; - return; - } - } -} diff --git a/src/devices/screen.h b/src/devices/screen.h deleted file mode 100644 index 129d318..0000000 --- a/src/devices/screen.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright (c) 2021-2025 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -typedef struct UxnScreen { - int width, height, vector, x1, y1, x2, y2, scale; - Uint32 palette[16], *pixels; - Uint8 *fg, *bg; -} UxnScreen; - -extern UxnScreen uxn_screen; -extern int emu_resize(int width, int height); -int screen_changed(void); -void screen_palette(void); -void screen_resize(Uint16 width, Uint16 height, int scale); -void screen_redraw(void); - -Uint8 screen_dei(Uint8 addr); -void screen_deo(Uint8 addr); - -/* clang-format off */ - -#define clamp(v,a,b) { if(v < a) v = a; else if(v >= b) v = b; } -#define twos(v) (v & 0x8000 ? (int)v - 0x10000 : (int)v) - -/* clang-format on */ diff --git a/src/devices/system.c b/src/devices/system.c deleted file mode 100644 index 3d99dc8..0000000 --- a/src/devices/system.c +++ /dev/null @@ -1,160 +0,0 @@ -#include -#include - -#include "../uxn.h" -#include "system.h" - -/* -Copyright (c) 2022-2025 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -char *boot_path; -Uint16 metadata_addr; - -#define METADATA_LEN 256 -/* allocate one more to ensure a null terminator */ -char metadata_buffer[METADATA_LEN + 1]; - -static void -system_print(char *name, Stack *s) -{ - Uint8 i; - fprintf(stderr, "%s ", name); - for(i = s->ptr - 8; i != (Uint8)(s->ptr); i++) - fprintf(stderr, "%02x%c", s->dat[i], i == 0xff ? '|' : ' '); - fprintf(stderr, "<%02x\n", s->ptr); -} - -static int -system_load(Uint8 *ram, char *rom_path) -{ - FILE *f = fopen(rom_path, "rb"); - if(f) { - int i = 0, l = fread(ram, PAGE_SIZE - PAGE_PROGRAM, 1, f); - while(l && ++i < BANKS) - l = fread(ram + PAGE_SIZE * i - PAGE_PROGRAM, PAGE_SIZE, 1, f); - fclose(f); - } - return !!f; -} - -int -system_error(char *msg, const char *err) -{ - fprintf(stderr, "%s: %s\n", msg, err), fflush(stderr); - return 0; -} - -int -system_boot(Uint8 *ram, char *rom_path, int has_args) -{ - uxn.ram = ram; - boot_path = rom_path; - uxn.dev[0x17] = has_args; - if(ram && system_load(uxn.ram + PAGE_PROGRAM, rom_path)) - return uxn_eval(PAGE_PROGRAM); - return 0; -} - -int -system_reboot(int soft) -{ - int i; - for(i = 0x0; i < 0x100; i++) uxn.dev[i] = 0; - for(i = soft ? 0x100 : 0; i < PAGE_SIZE; i++) uxn.ram[i] = 0; - uxn.wst.ptr = uxn.rst.ptr = 0; - return system_boot(uxn.ram, boot_path, 0); -} - -static void -system_expansion(const Uint16 exp) -{ - Uint8 *aptr = uxn.ram + exp; - unsigned short length = PEEK2(aptr + 1), limit; - unsigned int bank = PEEK2(aptr + 3) * 0x10000; - unsigned int addr = PEEK2(aptr + 5); - if(uxn.ram[exp] == 0x0) { - unsigned int dst_value = uxn.ram[exp + 7]; - unsigned short a = addr; - if(bank < BANKS_CAP) - for(limit = a + length; a != limit; a++) - uxn.ram[bank + a] = dst_value; - } else if(uxn.ram[exp] == 0x1) { - unsigned int dst_bank = PEEK2(aptr + 7) * 0x10000; - unsigned int dst_addr = PEEK2(aptr + 9); - unsigned short a = addr, c = dst_addr; - if(bank < BANKS_CAP && dst_bank < BANKS_CAP) - for(limit = a + length; a != limit; c++, a++) - uxn.ram[dst_bank + c] = uxn.ram[bank + a]; - } else if(uxn.ram[exp] == 0x2) { - unsigned int dst_bank = PEEK2(aptr + 7) * 0x10000; - unsigned int dst_addr = PEEK2(aptr + 9); - unsigned short a = addr + length - 1, c = dst_addr + length - 1; - if(bank < BANKS_CAP && dst_bank < BANKS_CAP) - for(limit = addr - 1; a != limit; a--, c--) - uxn.ram[dst_bank + c] = uxn.ram[bank + a]; - } else - fprintf(stderr, "Unknown command: %s\n", &uxn.ram[exp]); -} - -char * -metadata_read_name(void) -{ - int i; - for(i = 0; i < METADATA_LEN + 1; i++) - metadata_buffer[i] = 0; - if(metadata_addr == 0) - return metadata_buffer; - if(uxn.ram[metadata_addr] != 0x00) - return metadata_buffer; - for(i = 1; i < METADATA_LEN; i++) { - char c = uxn.ram[metadata_addr + i]; - if(c == 0x00 || c == 0x0a) - break; - metadata_buffer[i - 1] = c; - } - return metadata_buffer; -} - -/* IO */ - -Uint8 -system_dei(Uint8 addr) -{ - switch(addr) { - case 0x4: return uxn.wst.ptr; - case 0x5: return uxn.rst.ptr; - default: return uxn.dev[addr]; - } -} - -void -system_deo(Uint8 port) -{ - switch(port) { - case 0x3: { - system_expansion(PEEK2(uxn.dev + 2)); - break; - } - case 0x4: - uxn.wst.ptr = uxn.dev[4]; - break; - case 0x5: - uxn.rst.ptr = uxn.dev[5]; - break; - case 0x7: - metadata_addr = PEEK2(&uxn.dev[0x6]); - break; - case 0xe: - system_print("WST", &uxn.wst); - system_print("RST", &uxn.rst); - break; - } -} diff --git a/src/devices/system.h b/src/devices/system.h deleted file mode 100644 index d77cf0b..0000000 --- a/src/devices/system.h +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright (c) 2022-2025 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -#define BANKS 0x10 -#define BANKS_CAP BANKS * 0x10000 - -int system_error(char *msg, const char *err); -int system_boot(Uint8 *ram, char *rom_path, int has_args); -int system_reboot(int soft); -char *metadata_read_name(void); - -Uint8 system_dei(Uint8 addr); -void system_deo(Uint8 addr); diff --git a/src/uxn.c b/src/uxn.c deleted file mode 100644 index fb0f2a9..0000000 --- a/src/uxn.c +++ /dev/null @@ -1,94 +0,0 @@ -#include "uxn.h" - -/* -Copyright (u) 2022-2024 Devine Lu Linvega, Andrew Alderwick, Andrew Richards - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -#define OPC(opc, init, body) {\ - case 0x00|opc: {const int _2=0,_r=0;init body;} break;\ - case 0x20|opc: {const int _2=1,_r=0;init body;} break;\ - case 0x40|opc: {const int _2=0,_r=1;init body;} break;\ - case 0x60|opc: {const int _2=1,_r=1;init body;} break;\ - case 0x80|opc: {const int _2=0,_r=0,k=uxn.wst.ptr;init uxn.wst.ptr=k;body;} break;\ - case 0xa0|opc: {const int _2=1,_r=0,k=uxn.wst.ptr;init uxn.wst.ptr=k;body;} break;\ - case 0xc0|opc: {const int _2=0,_r=1,k=uxn.rst.ptr;init uxn.rst.ptr=k;body;} break;\ - case 0xe0|opc: {const int _2=1,_r=1,k=uxn.rst.ptr;init uxn.rst.ptr=k;body;} break;\ -} - -/* Microcode */ - -#define JMI a = uxn.ram[pc] << 8 | uxn.ram[pc + 1], pc += a + 2; -#define REM if(_r) uxn.rst.ptr -= 1 + _2; else uxn.wst.ptr -= 1 + _2; -#define INC(s) uxn.s.dat[uxn.s.ptr++] -#define DEC(s) uxn.s.dat[--uxn.s.ptr] -#define JMP(x) { if(_2) pc = x; else pc += (Sint8)x; } -#define PO1(o) { o = _r ? DEC(rst) : DEC(wst);} -#define PO2(o) { if(_r) o = DEC(rst), o |= DEC(rst) << 8; else o = DEC(wst), o |= DEC(wst) << 8; } -#define POx(o) { if(_2) PO2(o) else PO1(o) } -#define PU1(i) { if(_r) INC(rst) = i; else INC(wst) = i; } -#define RP1(i) { if(_r) INC(wst) = i; else INC(rst) = i; } -#define PUx(i) { if(_2) { c = (i); PU1(c >> 8) PU1(c) } else PU1(i) } -#define GET(o) { if(_2) PO1(o[1]) PO1(o[0]) } -#define PUT(i) { PU1(i[0]) if(_2) PU1(i[1]) } -#define DEI(i,o) o[0] = emu_dei(i); if(_2) o[1] = emu_dei(i + 1); PUT(o) -#define DEO(i,j) emu_deo(i, j[0]); if(_2) emu_deo(i + 1, j[1]); -#define PEK(i,o,m) o[0] = uxn.ram[i]; if(_2) o[1] = uxn.ram[(i + 1) & m]; PUT(o) -#define POK(i,j,m) uxn.ram[i] = j[0]; if(_2) uxn.ram[(i + 1) & m] = j[1]; - -int -uxn_eval(Uint16 pc) -{ - unsigned int a, b, c, x[2], y[2], z[2], step; - if(!pc || uxn.dev[0x0f]) return 0; - for(step = STEP_MAX; step; step--) { - switch(uxn.ram[pc++]) { - /* BRK */ case 0x00: return 1; - /* JCI */ case 0x20: if(DEC(wst)) { JMI break; } pc += 2; break; - /* JMI */ case 0x40: JMI break; - /* JSI */ case 0x60: c = pc + 2; INC(rst) = c >> 8; INC(rst) = c; JMI break; - /* LI2 */ case 0xa0: INC(wst) = uxn.ram[pc++]; /* fall-through */ - /* LIT */ case 0x80: INC(wst) = uxn.ram[pc++]; break; - /* L2r */ case 0xe0: INC(rst) = uxn.ram[pc++]; /* fall-through */ - /* LIr */ case 0xc0: INC(rst) = uxn.ram[pc++]; break; - /* INC */ OPC(0x01,POx(a),PUx(a + 1)) - /* POP */ OPC(0x02,REM ,{}) - /* NIP */ OPC(0x03,GET(x) REM ,PUT(x)) - /* SWP */ OPC(0x04,GET(x) GET(y),PUT(x) PUT(y)) - /* ROT */ OPC(0x05,GET(x) GET(y) GET(z),PUT(y) PUT(x) PUT(z)) - /* DUP */ OPC(0x06,GET(x),PUT(x) PUT(x)) - /* OVR */ OPC(0x07,GET(x) GET(y),PUT(y) PUT(x) PUT(y)) - /* EQU */ OPC(0x08,POx(a) POx(b),PU1(b == a)) - /* NEQ */ OPC(0x09,POx(a) POx(b),PU1(b != a)) - /* GTH */ OPC(0x0a,POx(a) POx(b),PU1(b > a)) - /* LTH */ OPC(0x0b,POx(a) POx(b),PU1(b < a)) - /* JMP */ OPC(0x0c,POx(a),JMP(a)) - /* JCN */ OPC(0x0d,POx(a) PO1(b),if(b) JMP(a)) - /* JSR */ OPC(0x0e,POx(a),RP1(pc >> 8) RP1(pc) JMP(a)) - /* STH */ OPC(0x0f,GET(x),RP1(x[0]) if(_2) RP1(x[1])) - /* LDZ */ OPC(0x10,PO1(a),PEK(a, x, 0xff)) - /* STZ */ OPC(0x11,PO1(a) GET(y),POK(a, y, 0xff)) - /* LDR */ OPC(0x12,PO1(a),PEK(pc + (Sint8)a, x, 0xffff)) - /* STR */ OPC(0x13,PO1(a) GET(y),POK(pc + (Sint8)a, y, 0xffff)) - /* LDA */ OPC(0x14,PO2(a),PEK(a, x, 0xffff)) - /* STA */ OPC(0x15,PO2(a) GET(y),POK(a, y, 0xffff)) - /* DEI */ OPC(0x16,PO1(a),DEI(a, x)) - /* DEO */ OPC(0x17,PO1(a) GET(y),DEO(a, y)) - /* ADD */ OPC(0x18,POx(a) POx(b),PUx(b + a)) - /* SUB */ OPC(0x19,POx(a) POx(b),PUx(b - a)) - /* MUL */ OPC(0x1a,POx(a) POx(b),PUx(b * a)) - /* DIV */ OPC(0x1b,POx(a) POx(b),PUx(a ? b / a : 0)) - /* AND */ OPC(0x1c,POx(a) POx(b),PUx(b & a)) - /* ORA */ OPC(0x1d,POx(a) POx(b),PUx(b | a)) - /* EOR */ OPC(0x1e,POx(a) POx(b),PUx(b ^ a)) - /* SFT */ OPC(0x1f,PO1(a) POx(b),PUx(b >> (a & 0xf) << (a >> 4))) - } - } - return 0; -} diff --git a/src/uxn.h b/src/uxn.h deleted file mode 100644 index 1b7e660..0000000 --- a/src/uxn.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright (c) 2021 Devine Lu Linvega - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -/* clang-format off */ - -#define PEEK2(d) (*(d) << 8 | (d)[1]) -#define POKE2(d, v) { *(d) = (v) >> 8; (d)[1] = (v); } - -/* clang-format on */ - -#define STEP_MAX 0x80000000 -#define PAGE_PROGRAM 0x0100 -#define PAGE_SIZE 0x10000 - -typedef unsigned char Uint8; -typedef signed char Sint8; -typedef unsigned short Uint16; -typedef signed short Sint16; -typedef unsigned int Uint32; - -typedef struct { - Uint8 dat[0x100], ptr; -} Stack; - -typedef struct Uxn { - Uint8 *ram, dev[0x100]; - Stack wst, rst; -} Uxn; - -extern Uint8 emu_dei(Uint8 addr); -extern void emu_deo( Uint8 addr, Uint8 value); -extern Uxn uxn; - -int uxn_eval(Uint16 pc); diff --git a/src/uxncli.c b/src/uxncli.c deleted file mode 100644 index 2699efe..0000000 --- a/src/uxncli.c +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include - -#include "uxn.h" -#include "devices/system.h" -#include "devices/console.h" -#include "devices/file.h" -#include "devices/datetime.h" - -/* -Copyright (c) 2021-2025 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -Uxn uxn; -int console_vector; - -Uint8 -emu_dei(Uint8 addr) -{ - switch(addr & 0xf0) { - case 0x00: return system_dei(addr); - case 0xc0: return datetime_dei(addr); - } - return uxn.dev[addr]; -} - -void -emu_deo(Uint8 addr, Uint8 value) -{ - uxn.dev[addr] = value; - switch(addr & 0xf0) { - case 0x00: system_deo(addr); break; - case 0x10: console_deo(addr); break; - case 0xa0: file_deo(addr); break; - case 0xb0: file_deo(addr); break; - } -} - -int -main(int argc, char **argv) -{ - int i = 1; - if(argc == 2 && argv[1][0] == '-' && argv[1][1] == 'v') - return !fprintf(stdout, "Uxn(cli) - Varvara Emulator, 30 Jun 2025.\n"); - else if(argc == 1) - return !fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]); - else if(!system_boot((Uint8 *)calloc(PAGE_SIZE * BANKS, sizeof(Uint8)), argv[i++], argc > 2)) - return !fprintf(stdout, "Could not load %s.\n", argv[i - 1]); - if(console_vector) { - console_arguments(i, argc, argv); - while(!uxn.dev[0x0f] && console_input(fgetc(stdin), 0x1)); - } - return uxn.dev[0x0f] & 0x7f; -} diff --git a/src/uxnemu.c b/src/uxnemu.c deleted file mode 100644 index 7e91254..0000000 --- a/src/uxnemu.c +++ /dev/null @@ -1,500 +0,0 @@ -#include -#include -#include - -#include "uxn.h" - -#pragma GCC diagnostic push -#pragma clang diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#pragma clang diagnostic ignored "-Wtypedef-redefinition" -#include -#include "devices/system.h" -#include "devices/console.h" -#include "devices/screen.h" -#include "devices/audio.h" -#include "devices/file.h" -#include "devices/controller.h" -#include "devices/mouse.h" -#include "devices/datetime.h" -#if defined(_WIN32) && defined(_WIN32_WINNT) && _WIN32_WINNT > 0x0602 -#include -#elif defined(_WIN32) -#include -#include -#endif -#ifndef __plan9__ -#define USED(x) (void)(x) -#endif -#pragma GCC diagnostic pop -#pragma clang diagnostic pop - -/* -Copyright (c) 2021-2025 Devine Lu Linvega, Andrew Alderwick - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE. -*/ - -#define WIDTH 64 * 8 -#define HEIGHT 40 * 8 - -Uxn uxn; -int console_vector; - -static SDL_Window *emu_window; -static SDL_Texture *emu_texture; -static SDL_Renderer *emu_renderer; -static SDL_Rect emu_viewport; -static SDL_AudioDeviceID audio_id; -static SDL_Thread *stdin_thread; - -/* devices */ - -static int window_created, fullscreen, borderless; -static Uint32 stdin_event, audio0_event, zoom = 1; - -static Uint8 -audio_dei(int instance, Uint8 *d, Uint8 port) -{ - if(!audio_id) return d[port]; - switch(port) { - case 0x4: return audio_get_vu(instance); - case 0x2: POKE2(d + 0x2, audio_get_position(instance)); /* fall through */ - default: return d[port]; - } -} - -static void -audio_deo(int instance, Uint8 *d, Uint8 port) -{ - if(!audio_id) return; - if(port == 0xf) { - SDL_LockAudioDevice(audio_id); - audio_start(instance, d); - SDL_UnlockAudioDevice(audio_id); - SDL_PauseAudioDevice(audio_id, 0); - } -} - -Uint8 -emu_dei(Uint8 addr) -{ - Uint8 p = addr & 0x0f, d = addr & 0xf0; - switch(d) { - case 0x00: return system_dei(addr); - case 0x20: return screen_dei(addr); - case 0x30: return audio_dei(0, &uxn.dev[d], p); - case 0x40: return audio_dei(1, &uxn.dev[d], p); - case 0x50: return audio_dei(2, &uxn.dev[d], p); - case 0x60: return audio_dei(3, &uxn.dev[d], p); - case 0xc0: return datetime_dei(addr); - } - return uxn.dev[addr]; -} - -void -emu_deo(Uint8 addr, Uint8 value) -{ - Uint8 p = addr & 0x0f, d = addr & 0xf0; - uxn.dev[addr] = value; - switch(d) { - case 0x00: - system_deo(addr); - if(p > 0x7 && p < 0xe) screen_palette(); - break; - case 0x10: console_deo(addr); break; - case 0x20: screen_deo(addr); break; - case 0x30: audio_deo(0, &uxn.dev[d], p); break; - case 0x40: audio_deo(1, &uxn.dev[d], p); break; - case 0x50: audio_deo(2, &uxn.dev[d], p); break; - case 0x60: audio_deo(3, &uxn.dev[d], p); break; - case 0x80: controller_deo(addr); break; - case 0x90: mouse_deo(addr); break; - case 0xa0: file_deo(addr); break; - case 0xb0: file_deo(addr); break; - } -} - -/* Handlers */ - -static void -audio_callback(void *u, Uint8 *stream, int len) -{ - int instance, running = 0; - Sint16 *samples = (Sint16 *)stream; - USED(u); - SDL_memset(stream, 0, len); - for(instance = 0; instance < POLYPHONY; instance++) - running += audio_render(instance, samples, samples + len / 2); - if(!running) - SDL_PauseAudioDevice(audio_id, 1); -} - -void -audio_finished_handler(int instance) -{ - SDL_Event event; - event.type = audio0_event + instance; - SDL_PushEvent(&event); -} - -static int -stdin_handler(void *p) -{ - SDL_Event event; - USED(p); - event.type = stdin_event; - event.cbutton.state = CONSOLE_STD; - while(read(0, &event.cbutton.button, 1) > 0) { - while(SDL_PushEvent(&event) < 0) - SDL_Delay(25); /* slow down - the queue is most likely full */ - } - /* EOF */ - event.cbutton.button = 0x00; - event.cbutton.state = CONSOLE_END; - while(SDL_PushEvent(&event) < 0) - SDL_Delay(25); - return 0; -} - -static void -set_window_size(SDL_Window *window, int w, int h) -{ - SDL_Point win_old; - SDL_GetWindowSize(window, &win_old.x, &win_old.y); - if(w == win_old.x && h == win_old.y) return; - SDL_RenderClear(emu_renderer); - SDL_SetWindowSize(window, w, h); - screen_resize(uxn_screen.width, uxn_screen.height, 1); -} - -static void -set_zoom(Uint8 z, int win) -{ - if(z < 1) return; - if(win) - set_window_size(emu_window, uxn_screen.width * z, uxn_screen.height * z); - zoom = z; -} - -static void -set_fullscreen(int value, int win) -{ - Uint32 flags = 0; /* windowed mode; SDL2 has no constant for this */ - fullscreen = value; - if(fullscreen) - flags = SDL_WINDOW_FULLSCREEN_DESKTOP; - if(win) - SDL_SetWindowFullscreen(emu_window, flags); -} - -static void -set_borderless(int value) -{ - if(fullscreen) return; - borderless = value; - SDL_SetWindowBordered(emu_window, !value); -} - -/* emulator primitives */ - -int -emu_resize(int width, int height) -{ - if(!window_created) - return 0; - if(emu_texture != NULL) - SDL_DestroyTexture(emu_texture); - SDL_RenderSetLogicalSize(emu_renderer, width, height); - emu_texture = SDL_CreateTexture(emu_renderer, SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_STATIC, width, height); - if(emu_texture == NULL || SDL_SetTextureBlendMode(emu_texture, SDL_BLENDMODE_NONE)) - return system_error("SDL_SetTextureBlendMode", SDL_GetError()); - if(SDL_UpdateTexture(emu_texture, NULL, uxn_screen.pixels, sizeof(Uint32)) != 0) - return system_error("SDL_UpdateTexture", SDL_GetError()); - emu_viewport.x = 0; - emu_viewport.y = 0; - emu_viewport.w = uxn_screen.width; - emu_viewport.h = uxn_screen.height; - set_window_size(emu_window, width * zoom, height * zoom); - return 1; -} - -static void -emu_redraw(void) -{ - if(SDL_UpdateTexture(emu_texture, NULL, uxn_screen.pixels, uxn_screen.width * sizeof(Uint32)) != 0) - system_error("SDL_UpdateTexture", SDL_GetError()); - SDL_RenderClear(emu_renderer); - SDL_RenderCopy(emu_renderer, emu_texture, NULL, &emu_viewport); - SDL_RenderPresent(emu_renderer); -} - -static void -emu_init_audio(void) -{ - SDL_AudioSpec as; - SDL_zero(as); - as.freq = SAMPLE_FREQUENCY; - as.format = AUDIO_S16SYS; - as.channels = 2; - as.callback = audio_callback; - as.samples = 512; - as.userdata = NULL; - audio_id = SDL_OpenAudioDevice(NULL, 0, &as, NULL, 0); - if(!audio_id) - system_error("sdl_audio", SDL_GetError()); - audio0_event = SDL_RegisterEvents(POLYPHONY); - SDL_PauseAudioDevice(audio_id, 1); -} - -static int -emu_init(void) -{ - if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0) - return system_error("sdl", SDL_GetError()); - emu_init_audio(); - if(SDL_NumJoysticks() > 0 && SDL_JoystickOpen(0) == NULL) - system_error("sdl_joystick", SDL_GetError()); - stdin_event = SDL_RegisterEvents(1); - SDL_DetachThread(stdin_thread = SDL_CreateThread(stdin_handler, "stdin", NULL)); - SDL_StartTextInput(); - SDL_ShowCursor(SDL_DISABLE); - SDL_EventState(SDL_DROPFILE, SDL_ENABLE); - SDL_SetRenderDrawColor(emu_renderer, 0x00, 0x00, 0x00, 0xff); - screen_resize(WIDTH, HEIGHT, 1); - return 1; -} - -static void -emu_restart(int soft) -{ - screen_resize(WIDTH, HEIGHT, uxn_screen.scale); - system_reboot(soft); - SDL_SetWindowTitle(emu_window, "Varvara"); -} - -static Uint8 -get_button(SDL_Event *event) -{ - switch(event->key.keysym.sym) { - case SDLK_LCTRL: return 0x01; - case SDLK_LALT: return 0x02; - case SDLK_LSHIFT: return 0x04; - case SDLK_HOME: return 0x08; - case SDLK_UP: return 0x10; - case SDLK_DOWN: return 0x20; - case SDLK_LEFT: return 0x40; - case SDLK_RIGHT: return 0x80; - } - return 0x00; -} - -static Uint8 -get_button_joystick(SDL_Event *event) -{ - return 0x01 << (event->jbutton.button & 0x3); -} - -static Uint8 -get_vector_joystick(SDL_Event *event) -{ - if(event->jaxis.value < -3200) - return 1; - if(event->jaxis.value > 3200) - return 2; - return 0; -} - -static Uint8 -get_key(SDL_Event *event) -{ - int sym = event->key.keysym.sym; - SDL_Keymod mods = SDL_GetModState(); - if(sym < 0x20 || sym == SDLK_DELETE) - return sym; - if(mods & KMOD_CTRL) { - if(sym < SDLK_a) - return sym; - else if(sym <= SDLK_z) - return sym - (mods & KMOD_SHIFT) * 0x20; - } - return 0x00; -} - -static int -handle_events(void) -{ - SDL_Event event; - while(SDL_PollEvent(&event)) { - /* Window */ - if(event.type == SDL_QUIT) - return 0; - else if(event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_EXPOSED) - emu_redraw(); - /* Mouse */ - else if(event.type == SDL_MOUSEMOTION) - mouse_pos(event.motion.x, event.motion.y); - else if(event.type == SDL_MOUSEBUTTONUP) - mouse_up(SDL_BUTTON(event.button.button)); - else if(event.type == SDL_MOUSEBUTTONDOWN) - mouse_down(SDL_BUTTON(event.button.button)); - else if(event.type == SDL_MOUSEWHEEL) - mouse_scroll(event.wheel.x, event.wheel.y); - /* Audio */ - else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) { - Uint8 *port_value = &uxn.dev[0x30 + 0x10 * (event.type - audio0_event)]; - uxn_eval(port_value[0] << 8 | port_value[1]); - } - /* Controller */ - else if(event.type == SDL_TEXTINPUT) { - char *c; - for(c = event.text.text; *c; c++) - controller_key(*c); - } else if(event.type == SDL_KEYDOWN) { - int ksym; - if(get_key(&event)) - controller_key(get_key(&event)); - else if(get_button(&event)) - controller_down(get_button(&event)); - else if(event.key.keysym.sym == SDLK_F1) - set_zoom(zoom == 3 ? 1 : zoom + 1, 1); - else if(event.key.keysym.sym == SDLK_F2) - emu_deo(0xe, 0x1); - else if(event.key.keysym.sym == SDLK_F3) - uxn.dev[0x0f] = 0xff; - else if(event.key.keysym.sym == SDLK_F4) - emu_restart(0); - else if(event.key.keysym.sym == SDLK_F5) - emu_restart(1); - else if(event.key.keysym.sym == SDLK_F11) - set_fullscreen(!fullscreen, 1); - else if(event.key.keysym.sym == SDLK_F12) - set_borderless(!borderless); - ksym = event.key.keysym.sym; - if(SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_KEYUP, SDL_KEYUP) == 1 && ksym == event.key.keysym.sym) - return 1; - } else if(event.type == SDL_KEYUP) - controller_up(get_button(&event)); - else if(event.type == SDL_JOYAXISMOTION) { - Uint8 vec = get_vector_joystick(&event); - if(!vec) - controller_up((3 << (!event.jaxis.axis * 2)) << 4); - else - controller_down((1 << ((vec + !event.jaxis.axis * 2) - 1)) << 4); - } else if(event.type == SDL_JOYBUTTONDOWN) - controller_down(get_button_joystick(&event)); - else if(event.type == SDL_JOYBUTTONUP) - controller_up(get_button_joystick(&event)); - else if(event.type == SDL_JOYHATMOTION) { - /* NOTE: Assuming there is only one joyhat in the controller */ - switch(event.jhat.value) { - case SDL_HAT_UP: controller_down(0x10); break; - case SDL_HAT_DOWN: controller_down(0x20); break; - case SDL_HAT_LEFT: controller_down(0x40); break; - case SDL_HAT_RIGHT: controller_down(0x80); break; - case SDL_HAT_LEFTDOWN: controller_down(0x40 | 0x20); break; - case SDL_HAT_LEFTUP: controller_down(0x40 | 0x10); break; - case SDL_HAT_RIGHTDOWN: controller_down(0x80 | 0x20); break; - case SDL_HAT_RIGHTUP: controller_down(0x80 | 0x10); break; - case SDL_HAT_CENTERED: controller_up(0x10 | 0x20 | 0x40 | 0x80); break; - } - } - /* Console */ - else if(event.type == stdin_event) - console_input(event.cbutton.button, event.cbutton.state); - } - return 1; -} - -static int -emu_run(void) -{ - Uint64 next_refresh = 0; - Uint64 perf_freq = SDL_GetPerformanceFrequency(); - Uint64 frame_interval = perf_freq / 60; - Uint64 ms_interval = perf_freq / 1000; - Uint32 window_flags = SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI; - char *rom_name = metadata_read_name(); - window_created = 0; - if(fullscreen) - window_flags = window_flags | SDL_WINDOW_FULLSCREEN_DESKTOP; - emu_window = SDL_CreateWindow(rom_name, - SDL_WINDOWPOS_UNDEFINED, - SDL_WINDOWPOS_UNDEFINED, - uxn_screen.width * zoom, - uxn_screen.height * zoom, - window_flags); - if(emu_window == NULL) - return system_error("sdl_window", SDL_GetError()); - window_created = 1; - emu_renderer = SDL_CreateRenderer(emu_window, -1, SDL_RENDERER_ACCELERATED); - if(emu_renderer == NULL) - return system_error("sdl_renderer", SDL_GetError()); - emu_resize(uxn_screen.width, uxn_screen.height); - /* game loop */ - for(;;) { - Uint64 now = SDL_GetPerformanceCounter(); - /* .System/halt */ - if(uxn.dev[0x0f]) - return system_error("Run", "Ended."); - if(!handle_events()) - return 0; - if(now >= next_refresh) { - next_refresh = now + frame_interval; - uxn_eval(uxn_screen.vector); - if(uxn_screen.x2 && uxn_screen.y2 && screen_changed()) - screen_redraw(), emu_redraw(); - } - if(uxn_screen.vector) { - now = SDL_GetPerformanceCounter(); - if(now < next_refresh) { - Uint64 delay_ms = (next_refresh - now) / ms_interval; - if (delay_ms > 0) SDL_Delay(delay_ms); - } - } else - SDL_WaitEvent(NULL); - } -} - -int -main(int argc, char **argv) -{ - int i = 1; - char *rom_path; - /* flags */ - if(argc > 1 && argv[i][0] == '-') { - if(!strcmp(argv[i], "-v")) - return system_error("Uxn(gui) - Varvara Emulator", "12 Jul 2025."); - else if(!strcmp(argv[i], "-2x")) - set_zoom(2, 0); - else if(!strcmp(argv[i], "-3x")) - set_zoom(3, 0); - else if(strcmp(argv[i], "-f") == 0) - set_fullscreen(1, 0); - i++; - } - /* init */ - rom_path = i == argc ? "boot.rom" : argv[i++]; - if(!emu_init()) - return system_error("Init", "Failed to initialize varvara."); - if(!system_boot((Uint8 *)calloc(PAGE_SIZE * BANKS + 1, sizeof(Uint8)), rom_path, argc > i)) - return system_error("usage:", "uxnemu [-v | -f | -2x | -3x] file.rom [args...]"); - /* start */ - console_arguments(i, argc, argv); - emu_run(); - /* end */ - SDL_CloseAudioDevice(audio_id); -#ifdef _WIN32 -#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" - TerminateThread((HANDLE)SDL_GetThreadID(stdin_thread), 0); -#elif !defined(__APPLE__) - close(0); /* make stdin thread exit */ -#endif - SDL_Quit(); - return uxn.dev[0x0f] & 0x7f; -}