Moved games to their own repo

This commit is contained in:
Devine Lu Linvega 2023-06-11 20:42:00 -07:00
parent d05426e2ea
commit e96dc56ce1
20 changed files with 0 additions and 3318 deletions

View File

@ -1,25 +0,0 @@
#!/bin/sh -e
ID="dads"
ASM="uxncli $HOME/roms/drifblim.rom"
EMU="uxnemu"
LIN="uxncli $HOME/roms/uxnlin.rom"
SRC="${ID}.tal"
DST="${ID}.rom"
CPY="$HOME/roms"
ARG=""
if [[ "$*" == *"--lint"* ]]
then
$LIN $SRC
fi
$ASM $SRC $DST
if [[ "$*" == *"--save"* ]]
then
cp $DST $CPY
fi
$EMU $DST $ARG

View File

@ -1,349 +0,0 @@
( uxnemu life.rom )
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &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
|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
|0100 ( -> )
( theme )
#970f .System/r DEO2
#7d0f .System/g DEO2
#8c0f .System/b DEO2
( resize )
#0070 .Screen/width DEO2
#0088 .Screen/height DEO2
( vectors )
;on-mouse .Mouse/vector DEO2
draw-border
draw-blocks
BRK
(
@|vectors )
@on-mouse ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;cursor-icn update-cursor
.Mouse/state DEI ?&on-touch
BRK
&on-touch ( -> )
.Mouse/x DEI2 #0008 SUB2 NIP #18 DIV
.Mouse/y DEI2 #0008 SUB2 NIP #18 DIV
;try-move ;try-move/cc .Mouse/state DEI #01 GTH [ JMP SWP2 POP2 ] JSR2
#00 .Mouse/state DEO
BRK
(
@|core )
@pick ( x y -- <block>* )
( clamp )
DUP #04 GTH ?&bounds
OVR #03 GTH ?&bounds
,&t STR2
#0900
&l
#00 OVR #0006 MUL2 ;game ADD2 [ LIT2 &t $2 ] is-at ?&found
INC GTHk ?&l
POP2
#ffff
JMP2r
&bounds ( bounds* -- 0* )
POP2 #0000
JMP2r
&found ( bounds* -- block* )
NIP #00 SWP #0006 MUL2 ;game ADD2
JMP2r
@is-at ( block* x y -- f )
OVR2 LDA2 STH2
SWP2 INC2 INC2 LDA2 SUB2
STHr LTH
SWP STHr LTH AND
JMP2r
@try-move ( x y -- )
pick
DUP2 #ffff EQU2 ?&blank
DUP2 #0000 EQU2 ?&blank
( up ) #00ff OVR2 OVR2 can-move ?&move POP2
( down ) #0100 OVR2 OVR2 can-move ?&move POP2
( left ) #ff00 OVR2 OVR2 can-move ?&move POP2
( right ) #0001 OVR2 OVR2 can-move ?&move POP2
POP2
JMP2r
&cc ( x y -- )
pick
DUP2 #ffff EQU2 ?&blank
DUP2 #0000 EQU2 ?&blank
( right ) #0001 OVR2 OVR2 can-move ?&move POP2
( left ) #ff00 OVR2 OVR2 can-move ?&move POP2
( down ) #0100 OVR2 OVR2 can-move ?&move POP2
( up ) #00ff OVR2 OVR2 can-move ?&move POP2
POP2
JMP2r
&move ( block* xy -- )
SWP2 STH2k clear-block
INC2r INC2r
SWP
LDAkr STHr ADD STH2kr STA INC2r
LDAkr STHr ADD STH2r STA
!draw-blocks
&blank ( block* -- )
POP2
JMP2r
@can-move ( block* x y -- f )
OVR2 ,&self STR2
OVR2 STH2 INC2r INC2r LDA2r
STHr ADD ,&offy STR
STHr ADD ,&offx STR
LDA2
,&height STR
,&width STR
[ LIT2 &height $1 00 ]
&v
STHk
[ LIT2 &width $1 00 ]
&h
DUP [ LIT &offx $1 ] ADD
STHkr [ LIT &offy $1 ] ADD
pick
DUP2 #ffff EQU2 ?&blank
DUP2 [ LIT2 &self $2 ] EQU2 ?&blank
POP2 POP2 POP2 POPr #00 JMP2r
&blank
POP2
INC GTHk ?&h
POP2 POPr
INC GTHk ?&v
POP2
#01
JMP2r
(
@|drawing )
@draw-blocks ( -- )
#0900
&l
#00 OVR draw-block
INC GTHk ?&l
POP2
JMP2r
@clear-block ( id* -- )
#00 ;draw-times/color STA
INC2 INC2 LDA2k to-screen
INC2 INC2 LDA2 JSR2
#81 ;draw-times/color STA
JMP2r
@draw-block ( id* -- )
#0006 MUL2 ;game ADD2
INC2 INC2 LDA2k to-screen
INC2 INC2 LDA2
JMP2
@to-screen ( x y -- )
#00 SWP #0018 MUL2 #0008 ADD2 .Screen/y DEO2
#00 SWP #0018 MUL2 #0008 ADD2 .Screen/x DEO2
JMP2r
@draw-a ( -- ) ;blocks-chr/a .Screen/addr DEO2 #56 .Screen/auto DEO #06 !draw-times
@draw-x ( -- ) ;blocks-chr/x !draw-11
@draw-w ( -- ) ;blocks-chr/w
@draw-11 ( addr* -- ) .Screen/addr DEO2 #26 .Screen/auto DEO #03 !draw-times
@draw-c ( -- ) ;blocks-chr/c !draw-21
@draw-v ( -- ) ;blocks-chr/v !draw-21
@draw-z ( -- ) ;blocks-chr/z !draw-21
@draw-b ( -- ) ;blocks-chr/b
@draw-21 ( addr* -- ) .Screen/addr DEO2 #56 .Screen/auto DEO #03 !draw-times
@draw-y ( -- ) ;blocks-chr/y !draw-12
@draw-d ( -- ) ;blocks-chr/d
@draw-12 ( addr* -- ) .Screen/addr DEO2 #26 .Screen/auto DEO #06 ( >> )
@draw-times ( times -- )
#00 SWP SUB
&l
[ LIT &color 81 ] .Screen/sprite DEO
INC DUP ?&l
POP
JMP2r
@draw-border ( -- )
( top corners )
#00 .Screen/auto DEO
#0000 .Screen/y DEO2
#0000 .Screen/x DEO2
;frame-chr/tl .Screen/addr DEO2
#81 .Screen/sprite DEO
#0068 .Screen/x DEO2
;frame-chr/tr .Screen/addr DEO2
#81 .Screen/sprite DEO
( bottom corners )
#0080 .Screen/y DEO2
#0000 .Screen/x DEO2
;frame-chr/bl .Screen/addr DEO2
#81 .Screen/sprite DEO
#0068 .Screen/x DEO2
;frame-chr/br .Screen/addr DEO2
#81 .Screen/sprite DEO
( hor lengths )
#b2 .Screen/auto DEO
#0008 .Screen/x DEO2
#0000 .Screen/y DEO2
;frame-chr/tc .Screen/addr DEO2
#81 .Screen/sprite DEO
#0080 .Screen/y DEO2
;frame-chr/bc .Screen/addr DEO2
#81 .Screen/sprite DEO
( ver lengths )
#e1 .Screen/auto DEO
#0000 .Screen/x DEO2
#0008 .Screen/y DEO2
;frame-chr/ml .Screen/addr DEO2
#81 .Screen/sprite DEO
#0068 .Screen/x DEO2
;frame-chr/mr .Screen/addr DEO2
#81 .Screen/sprite DEO
JMP2r
@update-cursor ( color addr* -- )
[ LIT2 00 -Screen/auto ] DEO
#40 draw-cursor
.Mouse/x DEI2 ,draw-cursor/x STR2
.Mouse/y DEI2 ,draw-cursor/y STR2
.Screen/addr DEO2
@draw-cursor ( color -- )
[ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 &y $2 ] .Screen/y DEO2
.Screen/sprite DEO
JMP2r
(
@|state )
@game ( size, pos ) [
&a 0202 0000 =draw-a
&b 0201 0200 =draw-b
&v 0201 0201 =draw-v
&w 0101 0002 =draw-w
&x 0101 0102 =draw-x
&d 0102 0003 =draw-d
&y 0102 0103 =draw-y
&z 0201 0203 =draw-z
&c 0201 0204 =draw-c ]
(
@|assets )
@cursor-icn
[ 80c0 e0f0 f8e0 1000 ]
@frame-chr
&tl [ 0000 0000 0101 0000 0000 001f 1f1f 1f1e ]
&tc [ 0000 0000 8383 0000 0000 00ff ffff ff00 ]
&tr [ 0000 0000 0000 0030 0000 00f8 f8f8 f878 ]
&ml [ 0c0c 0000 0000 000c 1e1e 1e1e 1e1e 1e1e ]
&mr [ 3000 0000 0000 3030 7878 7878 7878 7878 ]
&bl [ 0c00 0000 0000 0000 1e1f 1f1f 1f00 0000 ]
&bc [ 0000 c1c1 0000 0000 00ff ffff ff00 0000 ]
&br [ 0000 8080 0000 0000 78f8 f8f8 f800 0000 ]
@blocks-chr
&a [
003f 7b77 6f5c 7b7b 3f7f ffff ffff ffff 00df bb77 eedd 7b77 dfff ffff ffff ffff
00ff bb77 eedd bb77 ffff ffff ffff ffff 00ff bb77 eedd bbf7 ffff ffff ffff ffff
00ff bb77 eedd bb77 ffff ffff ffff ffff 00fc be76 eede ba76 fcfe ffff ffff ffff
6b58 7b7b 7b5b 3b7f ffff ffff ffff ffff 6e5d 7b77 6e5d 7bf7 ffff ffff ffff ffff
eedd bb77 eedd bb77 ffff ffff ffff ffff fefd bb77 eedd bb77 ffff ffff ffff ffff
eedd bb77 eedd bb77 ffff ffff ffff ffff eede ba76 eedc ba76 ffff ffff fffe ffff
6e5d 7b77 6e5d 7b77 ffff ffff ffff ffff eefd bb77 eedd bb77 ffff ffff ffff ffff
eedd bb77 eedd bb77 ffff ffff ffff ffff eedd bb77 eedd bb7f ffff ffff ffff ffff
eedf bb77 eedd bb77 ffff ffff ffff ffff eede ba76 eede ba76 ffff ffff ffff ffff
6e5d 7b77 6e5d 7b77 ffff ffff ffff ffff eedd bb77 eedf bb77 ffff ffff ffff ffff
eedd bb77 eedd bb77 ffff ffff ffff ffff eedd bb77 eedd bb77 ffff ffff ffff ffff
eedd bb77 eedd bb77 ffff ffff ffff ffff eede ba76 eede ba76 ffff ffff ffff ffff
6e5d 7b77 6e5d 3b77 ffff ffff ffff 7fff eedd bb77 eedd bb77 ffff ffff ffff ffff
eedd bb77 eedd bb77 ffff ffff ffff ffff eedd bb77 eedd bb77 ffff ffff ffff ffff
eedd bb77 fedd bb77 ffff ffff ffff ffff eede ba76 eede ba76 ffff ffff ffff ffff
6e5d 7b77 6e7d 3f00 ffff ffff ffff 7f3f eedd bb77 eedd ff00 ffff ffff ffff ffff
eedd bb77 eedd ff00 ffff ffff ffff ffff eedd bb77 eedd ff00 ffff ffff ffff ffff
eedd bb77 eedd bf00 ffff ffff ffff ffbf eede ba76 eede fc00 ffff ffff ffff fefc ]
&b [
003f 7d6e 777b 5d6e 3f7f ffff ffff ffff 00ff ddee 77bb ddee ffff ffff ffff ffff
00fb ddee 77bb ddee fbff ffff ffff ffff 00ff ddee 7fbb ddee ffff ffff ffff ffff
00ff ddee 77ba deee ffff ffff ffff ffff 00fc defe f63a dede fcfe ffff ffff ffff
777b 5d6e 777b 5d6e ffff ffff ffff ffff 77bf dfee 77bb ddee ffff ffff ffff ffff
77bb ddee 77bb ddee ffff ffff ffff ffff 77bb ddee 77bb ddee ffff ffff ffff ffff
76fa deee 76fa deef ffff ffff ffff ffff d63a dede d6da 3cfe ffff ffff ffff feff
777b 5f6e 777b 3f00 ffff ffff ffff 7f3f 77fb ddee 77bb ff00 ffff ffff ffff ffff
77bb ddee 77bb ff00 ffff ffff ffff ffff 77bb ddee 77bb fd00 ffff ffff ffff fffd
77bb ddee 77bb ff00 ffff ffff ffff ffff 76ba deee 76be fc00 ffff ffff ffff fefc ]
&v [
003f 7b77 6e5d 7b77 3f7f ffff ffff ffff 00fd bb77 eedd bb77 fdff ffff ffff ffff
00ff bb77 eedd bb77 ffff ffff ffff ffff 00ff bb77 eedd bb77 ffff ffff ffff ffff
00ff bb77 eedd bb77 ffff ffff ffff ffff 00fc be76 eedc ba76 fcfe ffff fffe ffff
6e5d 7b77 6f5d 7b77 ffff ffff ffff ffff eedd bb77 eedd bb77 ffff ffff ffff ffff
eedd fb77 eedd bb77 ffff ffff ffff ffff eedf bf77 eedd bb77 ffff ffff ffff ffff
eedd bb77 eedd bb77 ffff ffff ffff ffff eede ba76 eede faf6 ffff ffff ffff ffff
6e5d 7b77 6e7d 3f00 ffff ffff ffff 7f3f eedd bb77 eedd bf00 ffff ffff ffff ffbf
eedd bb77 eedd ff00 ffff ffff ffff ffff eedd bb77 eedd ff00 ffff ffff ffff ffff
eedd bb77 eedd ff00 ffff ffff ffff ffff eede ba76 eede fc00 ffff ffff ffff fefc ]
&w [
003f 7b77 6e5d 7b77 3f7f ffff ffff ffff 00fd bb77 eedd bf77 fdff ffff ffff ffff
00fc be76 eede ba76 fcfe ffff ffff ffff 6e5d 7b77 6e5d 3b77 ffff ffff ffff 7fff
eedd bb77 dead db77 ffff ffff ffff ffff eede ba76 eede ba76 ffff ffff ffff ffff
6e5d 7b77 6e7d 3f00 ffff ffff ffff 7f3f eedd bb77 eedd ff00 ffff ffff ffff ffff
eede ba76 eede bc00 ffff ffff ffff febc ]
&x [
003f 7d6e 777b 5d6e 3f7f ffff ffff ffff 00ff ddee 77bb ddee ffff ffff ffff ffff
00fc deee 76ba deee fcfe ffff ffff ffff 777b 5d6e 7f7b 5d6e ffff ffff ffff ffff
77bb ddef 77bb ddee ffff ffff ffff ffff 76ba deee 76ba dcee ffff ffff ffff feff
777b 5d6e 777b 3f00 ffff ffff ffff 7f3f 77bb ddee 77bb ff00 ffff ffff ffff ffff
f6ba deee 76be fc00 ffff ffff ffff fefc ]
&d [
003f 7d6e 777b 5d6e 3f7f ffff ffff ffff 00ff ddee 77bb ddee ffff ffff ffff ffff
00fc deee 76ba deee fcfe ffff ffff ffff 777b 5d6e 777b 5d6e ffff ffff ffff ffff
77bb fdee 77bb ddfe ffff ffff ffff ffff 76ba deee 76ba deee ffff ffff ffff ffff
777b 5d6e 777b 5d6e ffff ffff ffff ffff 77bb ddee 77fb ddee ffff ffff ffff ffff
76ba deee 76ba deee ffff ffff ffff ffff 777b 5d6e 777b 5d6e ffff ffff ffff ffff
77bb ddee 77bb ddee ffff ffff ffff ffff 76ba deee 76ba deee ffff ffff ffff ffff
7778 5b6b 7b7b 5b6b ffff ffff ffff ffff f7fb 5d6e 777b 5f6e ffff ffff ffff ffff
76ba deee 76ba defe ffff ffff ffff ffff 7b7b 586f 777b 3f00 ffff ffff ffff 7f3f
777b ddee 77bb fd00 ffff ffff ffff fffd 76ba deee 76be fc00 ffff ffff ffff fefc ]
&y [
003f 7b77 6e5d 7b77 3f7f ffff ffff ffff 00ff bb77 eedd bf77 ffff ffff ffff ffff
00dc be76 eede ba76 dcfe ffff ffff ffff 6e5d 7b77 6e5d 7b77 ffff ffff ffff ffff
eefd bb77 eedd bb77 ffff ffff ffff ffff eede ba76 eede ba76 ffff ffff ffff ffff
6e5d 7b77 6e5d 7b77 ffff ffff ffff ffff eedd bb77 eedd bb77 ffff ffff ffff ffff
eede ba76 eede ba76 ffff ffff ffff ffff 6e5d 7b77 6e5d 7b77 ffff ffff ffff ffff
eedd bb77 eedd bb77 ffff ffff ffff ffff eede ba76 eede ba76 ffff ffff ffff ffff
6e5d 7b77 6e5d 7b77 ffff ffff ffff ffff fedf bbff eedd bb77 ffff ffff ffff ffff
eede fa76 eede ba76 ffff ffff ffff ffff 6e5d 7b77 6e7d 3f00 ffff ffff ffff 7f3f
eedd bb77 eedd ff00 ffff ffff ffff ffff fefe ba76 eede fc00 ffff ffff ffff fefc ]
&z [
003f 7d6e 777b 5f6e 3f7f ffff ffff ffff 00ff ddee 77bb ddee ffff ffff ffff ffff
00ff ddee 77bb ddee ffff ffff ffff ffff 00ff ddee 77bb ddee ffff ffff ffff ffff
00bf ddee 77bb dfee bfff ffff ffff ffff 00fc deee 76ba deee fcfe ffff ffff ffff
777b 5d6e 777b 5d6e ffff ffff ffff ffff 77bb ddee 77bb ddee ffff ffff ffff ffff
77bb ddee 77bb dfee ffff ffff ffff ffff 77bb ddee 77bb ddee ffff ffff ffff ffff
77bb ddee 77bb dfee ffff ffff ffff ffff 76ba deee 76ba deee ffff ffff ffff ffff
777b 5d6e 777b 3f00 ffff ffff ffff 7f3f 77bb ddee 77bb ff00 ffff ffff ffff ffff
77bb ddee 77bb ff00 ffff ffff ffff ffff 77bb ddee 77bb ff00 ffff ffff ffff ffff
77bb ddee 77bb ff00 ffff ffff ffff ffff 76ba deee 76be fc00 ffff ffff ffff fefc ]
&c [
003f 7b77 6e5d 7b77 3f7f ffff ffff ffff 00df bb77 eedd bf77 dfff ffff ffff ffff
00ff bb77 eedd bb77 ffff ffff ffff ffff 00ff bb77 eedd bf77 ffff ffff ffff ffff
00ff bb77 eedd bb77 ffff ffff ffff ffff 00fc be76 eede ba76 fcfe ffff ffff ffff
6e5d 7b77 6e5d 7b77 ffff ffff ffff ffff fedd bb77 eedd bb77 ffff ffff ffff ffff
eedd bb77 eedd bb77 ffff ffff ffff ffff fedd bb77 eedd bf77 ffff ffff ffff ffff
efdf ba76 eede ba76 ffff ffff ffff ffff fe3e dad6 fefc faf6 ffff ffff fffe ffff
6e5d 7b77 6e7d 3f00 ffff ffff ffff 7f3f eedd bb77 eedd fb00 ffff ffff ffff fffb
eedd bb77 eedd ff00 ffff ffff ffff ffff eedd bb77 eedd ff00 ffff ffff ffff ffff
eede bb77 eedd ff00 ffff ffff ffff ffff dede 3af6 eede fc00 ffff ffff ffff fefc ]

Binary file not shown.

View File

@ -1,25 +0,0 @@
#!/bin/sh -e
ID="inle"
ASM="uxnasm"
EMU="uxnemu"
LIN="uxncli $HOME/roms/uxnlin.rom"
SRC="${ID}.tal"
DST="${ID}.rom"
CPY="$HOME/roms"
ARG=""
if [[ "$*" == *"--lint"* ]]
then
$LIN $SRC
fi
$ASM $SRC $DST
if [[ "$*" == *"--save"* ]]
then
cp $DST $CPY
fi
$EMU $DST $ARG

View File

@ -1,49 +0,0 @@
@font ( block8 )
0000 0000 0000 0000 1010 1010 1000 1000
2828 0000 0000 0000 44fe 4444 44fe 4400
107e 807c 02fc 1000 0044 0810 2044 0000
7884 8864 9a84 7a00 1020 0000 0000 0000
2040 4040 4040 2000 0804 0404 0404 0800
0044 2810 2844 0000 0010 107c 1010 0000
0000 0000 0010 2000 0000 007c 0000 0000
0000 0000 0000 1000 0204 0810 2040 8000
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
0000 1000 1000 0000 0000 1000 1010 2000
0008 1020 1008 0000 0000 7c00 7c00 0000
0010 0804 0810 0000 7c82 820c 1000 1000
7c82 92aa aa92 6400 7c82 82fe 8282 8200
fc82 82fc 8282 fc00 7c82 8080 8082 7c00
fc82 8282 8282 fc00 fe80 80f0 8080 fe00
fe80 80f0 8080 8000 7c82 808e 8282 7c00
8282 82fe 8282 8200 3810 1010 1010 3800
0602 0202 0282 7c00 8284 88f0 8884 8200
8080 8080 8080 fe00 c6aa 9292 9292 9200
c2a2 a292 8a8a 8600 7c82 8282 8282 7c00
fc82 82fc 8080 8000 7c82 8282 8a84 7a00
fc82 82fc 8282 8200 7c82 807c 0282 7c00
fe10 1010 1010 1000 8282 8282 8286 7a00
8282 8282 4428 1000 9292 9292 92aa c600
8244 2810 2844 8200 8282 4428 1010 1000
fe02 0c10 6080 fe00 6040 4040 4040 6000
8040 2010 0804 0200 0c04 0404 0404 0c00
1028 0000 0000 0000 0000 0000 0000 fe00
1008 0000 0000 0000 0000 7c02 7e82 7e00
0000 fc82 fc82 fc00 0000 7c82 8082 7c00
0000 0202 7e82 7e00 0000 7c82 fc80 7e00
0000 7c82 e080 8000 0000 7c82 7e02 fc00
0000 8080 fc82 8200 0000 1000 1010 1000
0000 fe02 0282 7c00 0000 8284 f884 8200
0000 8080 8080 7e00 0000 6c92 9292 9200
0000 bcc2 8282 8200 0000 7c82 8282 7c00
0000 fc82 fc80 8000 0000 7c82 7e02 0200
0000 bcc2 8080 8000 0000 7e80 7c02 fc00
0000 fe10 1010 1000 0000 8282 8282 7c00
0000 8282 4428 1000 0000 9292 9292 6c00
0000 8244 3844 8200 0000 8282 7e02 7c00
0000 fe02 7c80 fe00 2040 4080 4040 2000
1010 1010 1010 1000 0804 0402 0404 0800
0000 0032 4c00 0000 0000 0000 0000 0000

Binary file not shown.

View File

@ -1,910 +0,0 @@
( Inle )
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|10 @Console &vector $2 &read $1 &pad $5 &write $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 &chord $1
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
%LEAK { #010e DEO }
( TODOs
- flip player2 sprite
- Erase stroke after shot
- score
- moving
- damage )
( structs )
%/x { }
%/y { INC INC }
%/force { #04 ADD }
%/angle { #06 ADD }
|0000 ( zeropage )
@stage
&w $1 &h $1 &id $2
@game
&turn $1 &timer $1
@wind
&rate $2 &force $2
@player1
&x $2 &y $2
&force $2 &angle $1 &name $2
@player2
&x $2 &y $2
&force $2 &angle $1 &name $2
@clouds
&ax $2 &ay $2 &bx $2 &by $2 &cx $2 &cy $2
@bullet
&x $2 &y $2
&vx $2 &vy $2
&alive $1 &age $2
@line
&x $2 &y $2 &dx $2 &dy $2 &e1 $2
|0100 ( -> )
( theme )
#0a6f .System/r DEO2
#05cf .System/g DEO2
#0caf .System/b DEO2
( vectors )
;on-control .Controller/vector DEO2
;on-frame .Screen/vector DEO2
( random )
;prng-init JSR2
( get stage )
.Screen/width DEI2 #03 SFT2 NIP .stage/w STZ
.Screen/height DEI2 #03 SFT2 NIP .stage/h STZ
( terrain )
;start-game JSR2
LEAK
BRK
@on-control ( -> )
;get-player JSR2
.Controller/button DEI
[ #01 ] NEQk NIP ,&no-a JCN OVR ;fire JSR2 &no-a
[ #10 ] NEQk NIP ,&no-u JCN OVR ;incr-angle JSR2 &no-u
[ #20 ] NEQk NIP ,&no-d JCN OVR ;decr-angle JSR2 &no-d
[ #40 ] NEQk NIP ,&no-l JCN OVR ;decr-force JSR2 &no-l
[ #80 ] NEQk NIP ,&no-r JCN OVR ;incr-force JSR2 &no-r
POP2
LEAK
BRK
@on-frame ( -> )
( handle bullet )
.bullet/alive LDZ #01 NEQ ,&no-bullet JCN
;update-bullet JSR2
&no-bullet
( animation )
.game/timer LDZ #07 AND ,&skip JCN
;get-player JSR2 #03 ;draw-arrow JSR2
#01 ;draw-flag JSR2
&skip
.game/timer LDZk INC SWP STZ
LEAK
BRK
@start-game ( -- )
;set-terrain JSR2
;set-wind JSR2
;place-players JSR2
;place-clouds JSR2
;prng JSR2 .stage/id STZ2
( drawing )
#02 ;draw-stage JSR2
( name player )
;prng JSR2 .player1/name STZ2
;prng JSR2 .player2/name STZ2
( default force )
#0004 DUP2 .player1/force STZ2 .player2/force STZ2
( initial drawing )
.player1 ;draw-player JSR2
.player2 ;draw-player JSR2
.player1 ;select-player JSR2
;next-turn JSR2
;next-turn JSR2
JMP2r
@set-wind ( -- )
#0001 #0000 [ ;prng JSR2 NIP #01 AND JMP ] SWP2 SUB2 .wind/force STZ2
;prng JSR2 #0003 AND2 .wind/rate STZ2
JMP2r
@select-player ( player -- )
( nothing yet ) POP
JMP2r
@next-turn ( -- )
( stop all bullets )
#00 .bullet/alive STZ
( clear )
;get-player JSR2
DUP #00 ;draw-arrow JSR2
DUP #00 ;draw-force JSR2
#40 ;draw-crosshair JSR2
#00 ;draw-clouds JSR2
#00 ;draw-flag JSR2
( move clouds )
.clouds/ax LDZ2k #0008 ADD2 ROT STZ2
.clouds/bx LDZ2k #0004 ADD2 ROT STZ2
.clouds/cx LDZ2k INC2 INC2 ROT STZ2
( draw )
#02 ;draw-stage JSR2
( inc ) .game/turn LDZk INC SWP STZ
( flip wind )
.game/turn LDZ #07 AND ,&no-wind JCN
;set-wind JSR2
&no-wind
( draw )
.player1 ;draw-name JSR2
.player2 ;draw-name JSR2
.player1 ;draw-player JSR2
.player2 ;draw-player JSR2
;get-player JSR2
DUP #00 ;draw-arrow JSR2
DUP #01 ;draw-force JSR2
#4a ;draw-crosshair JSR2
JMP2r
@get-player ( -- player )
.player2 .player1 .game/turn LDZ [ #01 AND JMP SWP POP ]
JMP2r
@get-other ( -- player )
.player1 .player2 .game/turn LDZ [ #01 AND JMP SWP POP ]
JMP2r
@place-players ( -- )
( player1 )
#0008
DUP ;create-platform JSR2 STH
INC2 #40 SFT2 .player1/x STZ2
#00 STHr #40 SFT2 #0008 SUB2 .player1/y STZ2
( player2 )
.Screen/width DEI2 #03 SFT2 #0008 SUB2
DUP ;create-platform JSR2 STH
INC2 #40 SFT2 .player2/x STZ2
#00 STHr #40 SFT2 #0008 SUB2 .player2/y STZ2
JMP2r
@place-clouds ( -- )
;prng JSR2 ADD .stage/w LDZ ( mod ) DIVk MUL SUB #00 SWP #40 SFT2 .clouds/ax STZ2
#0030 .clouds/ay STZ2
;prng JSR2 ADD .stage/w LDZ ( mod ) DIVk MUL SUB #00 SWP #40 SFT2 .clouds/bx STZ2
#0060 .clouds/by STZ2
;prng JSR2 ADD .stage/w LDZ ( mod ) DIVk MUL SUB #00 SWP #40 SFT2 .clouds/cx STZ2
#0090 .clouds/cy STZ2
JMP2r
( terrain )
@set-terrain ( -- )
.stage/w LDZ INC INC #00
&loop
( height/2 ) .stage/h LDZ #01 SFT
( rand ) ;prng JSR2 #0a SFT2 NIP ADD #01 SFT
( store ) OVR #00 SWP ;terrain ADD2 STA
INC GTHk ,&loop JCN
POP2
( soften )
#0800
&loop-soften
,soften JSR
INC GTHk ,&loop-soften JCN
POP2
JMP2r
@soften ( -- )
.stage/w LDZ #00
&loop2
( a ) #00 OVR ;terrain ADD2 LDA STH
( b ) #00 OVR INC ;terrain ADD2 LDA STH
( c ) #00 OVR INC INC ;terrain ADD2 LDA STH
#00 STHr #00 STHr ADD2 #00 STHr ADD2 #0003 DIV2 NIP
( store ) OVR #00 SWP ;terrain ADD2 STA
INC GTHk ,&loop2 JCN
POP2
JMP2r
@create-platform ( x -- height )
#01 SUB
#00 SWP ;terrain ADD2 DUP2
( average ) LDAk STH INC2 LDAk STH INC2 ADDr LDAk STH INC2 ADDr LDA STH ADDr
LITr 04 DIVr
( flatten ) STHkr ROT ROT STAk INC2 STAk INC2 STAk INC2 STA
STHr
JMP2r
.bullet/age LDZ2 .wind/rate LDZ2 INC2 #30 SFT2 ( mod2 ) DIV2k MUL2 SUB2 ORA ,&no-wind JCN
.bullet/vx LDZ2 .wind/force LDZ2 ADD2 .bullet/vx STZ2
&no-wind
@update-bullet ( -- )
( undraw )
#40 ;draw-bullet JSR2
;collide-bounds JSR2 ;&hit-bound JCN2
;collide-ground JSR2 ;&hit-ground JCN2
;collide-clouds JSR2 ;&hit-cloud JCN2
;collide-other JSR2 ;&hit-other JCN2
;collide-self JSR2 ;&hit-self JCN2
( origin )
.bullet/x LDZ2 ,&x STR2
.bullet/y LDZ2 ,&y STR2
( update bullet )
.bullet/x LDZ2 .bullet/vx LDZ2 ADD2 .bullet/x STZ2
.bullet/y LDZ2 .bullet/vy LDZ2 SUB2 .bullet/y STZ2
( apply wind )
( apply gravity )
.bullet/vy LDZ2
#0001 SUB2 .bullet/vy STZ2
( line )
.bullet/y LDZ2 #8000 GTH2 ,&offscreen JCN
,&y LDR2 #8000 GTH2 ,&offscreen JCN
.bullet/x LDZ2 #8000 GTH2 ,&offscreen JCN
,&x LDR2 #8000 GTH2 ,&offscreen JCN
[ LIT2 &x $2 ] #01 SFT2 [ LIT2 &y $2 ] #01 SFT2
.bullet/x LDZ2 #01 SFT2 .bullet/y LDZ2 #01 SFT2 #01 ;draw-line JSR2
&offscreen
.bullet/age LDZ2k INC2 ROT STZ2
#43 ;draw-bullet JSR2
JMP2r
&hit-bound
;next-turn JSR2
JMP2r
&hit-ground
#00 ;draw-stage JSR2
.bullet/x LDZ2 #04 SFT2 ;terrain ADD2 STH2k LDA INC STH2r STA
;next-turn JSR2
JMP2r
&hit-cloud
;next-turn JSR2
JMP2r
&hit-other
#aaaa ;print JSR2 #0a18 DEO
;next-turn JSR2
JMP2r
&hit-self
;next-turn JSR2
JMP2r
@collide-ground ( -- hit )
.bullet/y LDZ2 #8000 GTH2 ,&offscreen JCN
( x ) .bullet/x LDZ2 #04 SFT2 ;terrain ADD2 LDA
#00 SWP #40 SFT2 .bullet/y LDZ2 LTH2 JMP2r
&offscreen
#00
JMP2r
@collide-bounds ( -- hit )
.bullet/x LDZ2 .Screen/width DEI2 #10 SFT2 GTH2
JMP2r
( TODO )
.bullet/y LDZ2 .Screen/height DEI2 #10 SFT2 GTH2
.bullet/x LDZ2 .Screen/width DEI2 #10 SFT2 GTH2
ORA
JMP2r
@collide-clouds ( -- hit )
#00
JMP2r
@collide-self ( -- hit )
.bullet/age LDZ2 #0020 GTH2 ,&continue JCN
#00 JMP2r
&continue
.bullet/x LDZ2
DUP2 ;get-player JSR2 /x LDZ2 #0008 SUB2 LTH2 ,&miss JCN
DUP2 ;get-player JSR2 /x LDZ2 #0010 ADD2 GTH2 ,&miss JCN
POP2
.bullet/y LDZ2
DUP2 ;get-player JSR2 /y LDZ2 #0020 SUB2 LTH2 ,&miss JCN
DUP2 ;get-player JSR2 /y LDZ2 #0008 ADD2 GTH2 ,&miss JCN
POP2
#01
JMP2r
&miss POP2 #00 JMP2r
@collide-other ( -- hit )
.bullet/x LDZ2
DUP2 ;get-other JSR2 /x LDZ2 #0008 SUB2 LTH2 ,&miss JCN
DUP2 ;get-other JSR2 /x LDZ2 #0010 ADD2 GTH2 ,&miss JCN
POP2
.bullet/y LDZ2
DUP2 ;get-other JSR2 /y LDZ2 #0020 SUB2 LTH2 ,&miss JCN
DUP2 ;get-other JSR2 /y LDZ2 #0008 ADD2 GTH2 ,&miss JCN
POP2
#01
( TODO: set sprite state )
#aaaa ;print JSR2 #0a18 DEO
JMP2r
&miss POP2 #00 JMP2r
@incr-angle ( player -- )
DUP /angle LDZ #14 EQU ,&skip JCN
DUP #40 ;draw-crosshair JSR2
DUP /angle LDZk INC SWP STZ
DUP ;draw-player JSR2
DUP #43 ;draw-crosshair JSR2
&skip
POP
JMP2r
@decr-angle ( player -- )
DUP /angle LDZ #01 LTH ,&skip JCN
DUP #40 ;draw-crosshair JSR2
DUP /angle LDZk #01 SUB SWP STZ
DUP ;draw-player JSR2
DUP #43 ;draw-crosshair JSR2
&skip
POP
JMP2r
@incr-force ( player -- )
DUP /force LDZ2 #0007 GTH2 ,&skip JCN
DUP /force LDZ2k INC2 ROT STZ2
DUP #01 ;draw-force JSR2
&skip
POP
JMP2r
@decr-force ( player -- )
DUP /force LDZ2 #0001 LTH2 ,&skip JCN
DUP /force LDZ2k #0001 SUB2 ROT STZ2
DUP #01 ;draw-force JSR2
&skip
POP
JMP2r
@fire ( player -- )
STH
#00 STHkr /angle LDZ
DUP2
( y )
( add force ) DUP2 STHkr /force LDZ2 MUL2 #02 SFT2 ADD2 .bullet/vy STZ2
( x ) ( range ) #0014 SWP2 SUB2 STHkr /y LDZ2 #0014 SUB2 .bullet/y STZ2
( add force ) DUP2 STHkr /force LDZ2 MUL2 #02 SFT2 ADD2
( player2 flip-x ) STHkr .player2 NEQ ,&left JCN #0000 SWP2 SUB2 &left .bullet/vx STZ2
STHr /x LDZ2 .bullet/x STZ2
#01 .bullet/alive STZ
#0000 .bullet/age STZ2
JMP2r
( drawing )
@draw-stage ( color -- )
STH
#35 .Screen/auto DEO
( x ) #0000 .Screen/x DEO2
.stage/w LDZ #00
&loop
;stage-icns .Screen/addr DEO2
( y ) #00 OVR ;terrain ADD2 LDA #01 SUB #00 SWP #30 SFT2 .Screen/y DEO2
STHkr .Screen/sprite DEO
INC GTHk ,&loop JCN
POP2
STHkr ;draw-doodads JSR2
STHkr ;draw-clouds JSR2
STHkr ;draw-ramps JSR2
STHr #00 NEQ ;draw-flag JSR2
JMP2r
@draw-doodads ( color -- )
STH
#00 .Screen/auto DEO
.stage/w LDZ #00
&loop
( x ) #00 OVR #30 SFT2 .Screen/x DEO2
( y ) #00 OVR ;terrain ADD2 LDA #02 SUB #00 SWP #30 SFT2 .Screen/y DEO2
( doodads )
#00 OVR .stage/id LDZ2 ADD2 #0003 AND2 #40 SFT2 ;doodad-icns ADD2 .Screen/addr DEO2
STHkr #00 NEQ #85 MUL .Screen/sprite DEO
#05 ADD GTHk ,&loop JCN
POP2
POPr
JMP2r
@draw-ramps ( color -- )
STH
#00 .Screen/auto DEO
.stage/w LDZ #00
&loop
( x ) #00 OVR #30 SFT2 .Screen/x DEO2
( y ) #00 OVR ;terrain ADD2 LDA #02 SUB #00 SWP #30 SFT2 .Screen/y DEO2
( up )
#00 OVR ;terrain ADD2 LDA2
EQUk ,&no-up-ramp JCN
LTHk ,&no-up-ramp JCN
;ramp-icns .Screen/addr DEO2
STHkr #01 MUL .Screen/sprite DEO
&no-up-ramp
POP2
( down )
#00 OVR #01 SUB ;terrain ADD2 LDA2
EQUk ,&no-down-ramp JCN
GTHk ,&no-down-ramp JCN
;ramp-icns/down .Screen/addr DEO2
STHkr #01 MUL .Screen/sprite DEO
&no-down-ramp
POP2
INC GTHk ,&loop JCN
POP2
POPr
JMP2r
@draw-clouds ( color -- )
#16 .Screen/auto DEO
;cloud-icns/a .Screen/addr DEO2
#81 SWP #00 NEQ MUL .Screen/sprite
.clouds/ax LDZ2 #01 SFT2 .Screen/x DEO2
.clouds/ay LDZ2 #01 SFT2 .Screen/y DEO2
DEOk
.clouds/bx LDZ2 #01 SFT2 .Screen/x DEO2
.clouds/by LDZ2 #01 SFT2 .Screen/y DEO2
;cloud-icns/b .Screen/addr DEO2
DEOk
.clouds/cx LDZ2 #01 SFT2 .Screen/x DEO2
.clouds/cy LDZ2 #01 SFT2 .Screen/y DEO2
;cloud-icns/c .Screen/addr DEO2
DEO
JMP2r
@draw-force ( player mask -- )
STH
INCk INC LDZ2 #01 SFT2 #0028 SUB2 .Screen/y DEO2
( bg )
LDZ2k #01 SFT2 #0012 SUB2 .Screen/x DEO2
#10 #05 STHkr MUL ;draw-bar JSR2
( fg )
LDZ2k #01 SFT2 #0012 SUB2 .Screen/x DEO2
#04 ADD LDZ2 NIP #10 SFT #0f STHr MUL ;draw-bar JSR2
JMP2r
@draw-bar ( size color -- )
STH
#00 .Screen/auto DEO
;progress-icns/fill .Screen/addr DEO2
#00
&loop
STHkr .Screen/sprite DEO
.Screen/x DEI2k INC2 INC2 ROT DEO2
INC GTHk ,&loop JCN
POP2
POPr
JMP2r
@draw-crosshair ( player color -- )
STH
DUP ,&player STR
#00 .Screen/auto DEO
DUP /x LDZ2 #01 SFT2 #0020 SUB2 ,&offset-x STR2
/y LDZ2 #01 SFT2 #0028 SUB2 ,&offset-y STR2
#4000
&loop
#00 OVR #10 SFT2 ;sin-tbl ADD2
DUP2 LDA #00 SWP #02 SFT2 [ LIT2 &offset-x $2 ] ADD2 .Screen/x DEO2
INC2 LDA #00 SWP #02 SFT2 [ LIT2 &offset-y $2 ] ADD2 .Screen/y DEO2
DUP #03 AND ,&odd JCN
STHkr .Screen/pixel DEO
&odd
( selected )
DUP [ LIT &player $1 ] ;get-marker JSR2 NEQ ,&no-sel JCN
.Screen/x DEI2k #0003 SUB2 ROT DEO2
.Screen/y DEI2k #0003 SUB2 ROT DEO2
;crosshair-icn .Screen/addr DEO2
STHkr .Screen/sprite DEO
&no-sel
INC GTHk ,&loop JCN
POP2
POPr
JMP2r
@get-marker ( player -- marker )
DUP .player2 EQU ,&player2 JCN
#14 SWP /angle LDZ SUB JMP2r
&player2
/angle LDZ #2c ADD #3f AND
JMP2r
@draw-flag ( mask -- )
STH
( direction )
.wind/force LDZ2 #8000 LTH2 STH
( x )
.Screen/width DEI2 #0006 SUB2
( flip-x ) #00 STHkr #000c MUL2 ADD2
#01 SFT2 .Screen/x DEO2
( y )
#00 .stage/w LDZ INC #01 SFT ;terrain ADD2 LDA
#00 SWP #0004 SUB2 #30 SFT2 .Screen/y DEO2
( top )
#02 .Screen/auto DEO
;flag/top
( rate ) .wind/rate LDZ2 #0030 MUL2 ADD2
( animate ) #00 [ LIT &f $1 ] #40 SFT2 ADD2
.Screen/addr DEO2
#81 ( flipx ) STHr #40 SFT ORA STHr MUL .Screen/sprite
DEOk
( pole )
;flag/pole .Screen/addr DEO2
DEOk DEO
( animate )
,&f LDR INC #03 ( mod ) DIVk MUL SUB ,&f STR
JMP2r
@draw-arrow ( player color -- )
STH
#00 .Screen/auto DEO
( x ) LDZ2k #01 SFT2 #0004 SUB2 .Screen/x DEO2
( y ) INC INC LDZ2 #0040 SUB2
( y+blink ) #00 .game/timer LDZ #0f AND #02 SFT2 ADD2
#01 SFT2 .Screen/y DEO2
;arrow-icn .Screen/addr DEO2
STHr .Screen/sprite DEO
JMP2r
@draw-bullet ( color -- )
#00 .Screen/auto DEO
.bullet/x LDZ2 #0006 SUB2 #01 SFT2 .Screen/x DEO2
.bullet/y LDZ2 #0006 SUB2 #01 SFT2 .Screen/y DEO2
;bullet-icn .Screen/addr DEO2
.Screen/sprite DEO
JMP2r
@draw-player ( player -- )
DUP .player2 EQU ;draw-player2 JCN2
STHk
LDZ2k #01 SFT2 #0008 SUB2 .Screen/x DEO2
INC INC LDZ2 #0028 SUB2 #01 SFT2 .Screen/y DEO2
#16 .Screen/auto DEO
;player1-icns/ears .Screen/addr DEO2
#85 .Screen/sprite DEOk
;player1-icns/eye [ #00 STHr #06 ADD LDZ #03 SFT ] #50 SFT2 ADD2 .Screen/addr DEO2
DEOk
;player1-icns/body .Screen/addr DEO2
DEO
JMP2r
@draw-player2 ( player -- )
STHk
LDZ2k #01 SFT2 #0008 SUB2 .Screen/x DEO2
INC INC LDZ2 #0028 SUB2 #01 SFT2 .Screen/y DEO2
#16 .Screen/auto DEO
;player2-icns/ears .Screen/addr DEO2
#85 .Screen/sprite DEOk
;player2-icns/eye [ #00 STHr #06 ADD LDZ #03 SFT ] #50 SFT2 ADD2 .Screen/addr DEO2
DEOk
;player2-icns/body .Screen/addr DEO2
DEO
JMP2r
@draw-name ( player -- )
DUP /x LDZ2 #01 SFT2 #0020 SUB2 .Screen/x DEO2
DUP /y LDZ2 #0068 SUB2 #01 SFT2 .Screen/y DEO2
( to /name ) #07 ADD
LDZk #0f AND #00 SWP #0005 MUL2 ;names/first ADD2 #05 ;draw-label JSR2
INC LDZ #0f AND #00 SWP #0006 MUL2 ;names/last ADD2 #05 ;draw-label JSR2
JMP2r
@draw-label ( str* color -- )
STH
#01 .Screen/auto DEO
&while
LDAk #20 SUB #00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2
STHkr .Screen/sprite DEO
INC2 LDAk ,&while JCN
POP2
POPr
JMP2r
@text "buckthorn $1
@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 #10 SFT2 ADD2 ,&sx STR2
#ffff #00 .line/y LDZ2 ,&y LDR2 ;lts2 JSR2 #10 SFT2 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 #10 SFT2 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
@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
( library )
@prng-init ( -- )
( seed )
#00 .DateTime/second DEI
#00 .DateTime/minute DEI #60 SFT2 EOR2
#00 .DateTime/hour DEI #c0 SFT2 EOR2 ,prng/x STR2
#00 .DateTime/hour DEI #04 SFT2
#00 .DateTime/day DEI #10 SFT2 EOR2
#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
@print ( 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
@progress-icns
3f40 8080 8080 403f
ff00 0000 0000 00ff
fc02 0101 0101 02fc
&fill
0000 183c 3c18 0000
@crosshair-icn
0010 106c 1010 0000
@arrow-icn
0018 18ff 7e3c 1800
@bullet-icn
0000 183c 3c18 0000
@flag
&pole
0101 0101 0001 0001 0101 0101 0101 0101
&top
( high )
0101 3fff 3f07 0101 0101 0000 0000 0101
01f9 3f3f 1f07 0101 0101 0000 0000 0101
0181 ffff 7f07 0101 0101 0000 0000 0101
( med )
0101 0307 070f 3f79 0101 0000 0000 0101
0101 0307 0f3f 7d41 0101 0000 0000 0101
0101 0307 4f7f 3d01 0101 0000 0000 0101
( low )
0101 0303 0303 0707 0101 0000 0000 0000
0101 0103 0707 0703 0101 0000 0000 0000
0101 0103 0307 0703 0101 0000 0000 0000
( none )
0101 0303 0303 0707 0101 0000 0000 0000
0101 0103 0707 0703 0101 0000 0000 0000
0101 0103 0307 0703 0101 0000 0000 0000
@cloud-icns
&a
0000 0c1e 1e0f 0500 0000 1c3e 3e3f ff7f
0004 0200 c0e0 50a0 0004 0e04 c0e0 f0e0
&b
0000 081c 1400 0000 0000 193d 7f3f 0000
0070 f8f8 54a0 0000 00f0 f8f8 fcf0 0000
&c
0000 402e 0f00 0000 0000 40ee 5f0e 0000
0000 0000 0000 0000 0000 0000 0000 0000
@doodad-icns
0000 0000 2054 2a04 0000 0000 2074 2e24
0000 0000 40a2 552a 0000 0000 40e2 577a
0000 0000 0000 0000 0000 0000 0000 0424
0000 0000 0000 0000 0000 0000 0000 0008
@ramp-icns
0000 0000 0000 0001
&down
0000 0000 0000 0080
@stage-icns
ffff ffff ffff ffff
ffff aa55 aa55 aa55
aa55 aa55 8800 2200
0000 0000 0000 0000
&up
0103 070f 1f3f 7fff
ffff fefd faf5 ead5
aa55 aa55 a850 a240
8800 2200 8800 0000
&down
0000 0000 0000 0000
80c0 e0f0 f8fc feff
ffff bf5f af57 ab55
aa55 aa55 0a05 2201
8800 2200 8800 0000
@player1-icns
&ears
( 0 )
0002 0e0e 0606 1f3f 0c0c 0000 0000 0000
0020 e0e0 6000 fcfe c0c0 0000 0000 0000
( 1 )
0000 020e 0e06 1f3f 000c 0c00 0000 0000
0000 20e0 6000 fcfe 00c0 c000 0000 0000
( 2 )
0000 041c 0e06 1f3f 0019 1900 0000 0000
0000 40e0 6000 fcfe 0080 8000 0000 0000
&eye
( 0 )
7f7f 7f7f 7f3f 1f07 0103 0707 0703 0000
ffc7 8383 c7ff fef8 f0f8 fcfc fcf8 0000
( 1 )
7f7f 7f7f 7f3f 1f07 0103 0707 0703 0000
8f07 078f ffff fef8 f0f8 fcfc fcf8 0000
( 2 )
7f7e 7e7f 7f3f 1f07 0103 0707 0703 0000
1f0f 0f1f ffff fef8 f0f8 fcfc fcf8 0000
&body
5f3f 3f1f 1200 0000 4101 0000 0000 0000
e0e0 e040 4000 0000 e0e0 e000 0000 0000
@player2-icns
&ears
( 0 )
0003 030c 0e00 1f3f 0000 0403 0000 0000
008e 8e30 7860 f0f8 0000 100c 0000 0000
( 1 )
0000 0303 0c00 1f3f 0000 0004 0300 0000
0000 8e8e 3078 f0f8 0000 0010 0c00 0000
( 2 )
0000 0101 0600 1f3f 0000 0002 0100 0000
0000 c7c7 1878 f0f8 0000 0008 8600 0000
&eye
( 0 )
7fe3 d1c1 e3ff 7f1f 0f1f 3f3f 3f1f 0000
fcfe fefe fefe fcf0 80c0 e0e0 e0c0 0000
( 1 )
71e8 e0f1 ffff 7f1f 0f1f 3f3f 3f1f 0000
fcfe fefe fefe fcf0 80c0 e0e0 e0c0 0000
( 2 )
78f4 f0f8 ffff 7f1f 0f1f 3f3f 3f1f 0000
fc7e 7efe fefe fcf0 80c0 e0e0 e0c0 0000
&body
0707 0702 0200 0000 0707 0700 0000 0000
f0f8 fefe b000 0000 8080 0606 0000 0000
@platform-icns
0000 0000 0000 0000 0f3f 3f7f 7f7f 7f7f
0000 0000 0000 0000 ffff ffff ffff ffff
0000 0000 0000 0000 ffff ffff ffff ffff
0000 0000 0000 0000 f0fc fcfe fefe fefe
0000 0000 0000 0000 7f7f 7778 7050 2000
0000 0000 0000 0000 ffff ffff 3e1c 0000
0000 0000 0000 0000 ffff ff3f 1303 0100
0000 0000 0000 0000 fefe fefe eeca 0400
@sin-tbl
8000 8c00 9802 a505 b009 bc0f c715 d11d
da25 e22e ea38 f043 f64f fa5a fd67 ff73
ff80 ff8c fd98 faa5 f6b0 f0bc eac7 e2d1
dada d1e2 c7ea bcf0 b0f6 a5fa 98fd 8cff
80ff 73ff 67fd 5afa 4ff6 43f0 38ea 2ee2
25da 1dd1 15c7 0fbc 09b0 05a5 0298 008c
0080 0073 0267 055a 094f 0f43 1538 1d2e
2525 2e1d 3815 430f 4f09 5a05 6702 7300
~names.tal
~font.tal
@terrain

View File

@ -1,11 +0,0 @@
@names
&first
"Blue $1 "Fern $1 "Leaf $1 "Corn $1
"Pine $1 "Snow $1 "Seed $1 "Fuzz $1
"Rain $1 "Buck $1 "Rose $1 "Sage $1
"Worm $1 "Haze $1 "Hawk $1 "Bell $1
&last
"stack $1 "marsh $1 "clove $1 "thorn $1
"patch $1 "grass $1 "shade $1 "berry $1
"woods $1 "stone $1 "cedar $1 "brush $1
"storm $1 "cloud $1 "mound $1 "beans $1

Binary file not shown.

View File

@ -1,25 +0,0 @@
#!/bin/sh -e
ID="lander"
ASM="uxncli $HOME/roms/drifblim.rom"
EMU="uxnemu"
LIN="uxncli $HOME/roms/uxnlin.rom"
SRC="${ID}.tal"
DST="${ID}.rom"
CPY="$HOME/roms"
ARG=""
if [[ "$*" == *"--lint"* ]]
then
$LIN $SRC
fi
$ASM $SRC $DST
if [[ "$*" == *"--save"* ]]
then
cp $DST $CPY
fi
$EMU $DST $ARG

View File

@ -1,342 +0,0 @@
( uxnemu lander.rom )
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &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
|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
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
|0000
@pos &x $2 &y $2
@force &x $2 &y $2
@angle $2
@stage
&w $1 &h $1 &id $2
|0100 ( -> )
( theme )
#0ff0 .System/r DEO2
#0f0f .System/g DEO2
#0f0f .System/b DEO2
( resize )
#0260 .Screen/width DEO2
#01a0 .Screen/height DEO2
( vectors )
;on-frame .Screen/vector DEO2
;on-control .Controller/vector DEO2
prng-init
( get stage )
.Screen/width DEI2 #03 SFT2 NIP .stage/w STZ
.Screen/height DEI2 #03 SFT2 NIP .stage/h STZ
#0100 .pos/x STZ2
#00a0 .pos/y STZ2
set-terrain
draw-stage
( draw platform )
#04 create-platform #01 SUB #00 SWP #30 SFT2 STH2
#0004 #30 SFT2
STH2kr
#0005 #30 SFT2
STH2r
#43 draw-line
redraw
BRK
(
@|vectors )
@on-frame ( -> )
[ LIT &f $1 ] INCk ,&f STR
#01 AND ?&no-read
.Controller/button DEI
DUP #10 AND #00 EQU ?&no-u
.angle LDZ2 thruster
&no-u
DUP #20 AND #00 EQU ?&no-d
#0010 .force/y STZ2
&no-d
DUP #40 AND #00 EQU ?&no-l
.angle LDZ2 #0001 SUB2 #001f AND2 .angle STZ2
&no-l
DUP #80 AND #00 EQU ?&no-r
.angle LDZ2 INC2 #001f AND2 .angle STZ2
&no-r
POP
&no-read
apply-force
( .force/y LDZ2 phex #0a18 DEO )
redraw
BRK
@on-control ( -> )
BRK
(
@|core )
@thruster ( angle* -- )
#10 SFT2 ;circle-tbl ADD2 LDA2 POP
( make short )
#80 SUB
DUP #80 AND #00 NEQ STH #ff00 STHr [ JMP SWP POP ] SWP
reduce3 .force/x LDZ2 ADD2 .force/x STZ2
.angle LDZ2 #0020 ADD2 #001f AND2 #10 SFT2 ;circle-tbl ADD2 LDA2 NIP
( make short )
#80 ADD
DUP #80 AND #00 NEQ STH #ff00 STHr [ JMP SWP POP ] SWP
reduce3
.force/y LDZ2 ADD2 .force/y STZ2
#08 ;draw-lander/plume STA
JMP2r
@apply-force ( -- )
[ LIT &f $1 ] INCk ,&f STR
#03 AND ?&skip
.force/y LDZ2 INC2 .force/y STZ2
;draw-lander/plume LDA #00 EQU ?&skip
;draw-lander/plume LDA #01 SUB ;draw-lander/plume STA
&skip
.force/y LDZ2 reduce .pos/y LDZ2 ADD2 .pos/y STZ2
.force/x LDZ2 reduce .pos/x LDZ2 ADD2 .pos/x STZ2
JMP2r
@reduce ( force* -- )
DUP2 #8000 AND2 ORA ?&neg
#01 SFT2
JMP2r
&neg abs2 #01 SFT2 #0000 SWP2 SUB2 JMP2r
@reduce3 ( force* -- )
DUP2 #8000 AND2 ORA ?&neg
#05 SFT2
JMP2r
&neg abs2 #05 SFT2 #0000 SWP2 SUB2 JMP2r
(
@|terrain )
@set-terrain ( -- )
.stage/w LDZ INC INC #00
&loop
( height/2 ) .stage/h LDZ #01 SFT
( rand ) prng #0260 DIV2 NIP ADD #01 SFT
( v offset ) #00 ADD
( store ) OVR #00 SWP ;terrain ADD2 STA
INC GTHk ,&loop JCN
POP2
( soften )
#0800
&loop-soften
soften
INC GTHk ?&loop-soften
POP2
JMP2r
@soften ( -- )
.stage/w LDZ INC #00
&loop2
( a ) #00 OVR ;terrain ADD2 LDA STH
( b ) #00 OVR INC ;terrain ADD2 LDA STH
( c ) #00 OVR INC INC ;terrain ADD2 LDA STH
#00 STHr #00 STHr ADD2 #00 STHr ADD2 #0003 DIV2 NIP
( store ) OVR #00 SWP ;terrain ADD2 STA
INC GTHk ,&loop2 JCN
POP2
JMP2r
@create-platform ( x -- height )
#01 SUB
#00 SWP ;terrain ADD2 DUP2
( average ) LDAk STH INC2 LDAk STH INC2 ADDr LDAk STH INC2 ADDr LDA STH ADDr
LITr 04 DIVr
( flatten ) STHkr ROT ROT STAk INC2 STAk INC2 STAk INC2 STA
STHr
JMP2r
(
@|drawing )
@redraw ( -- )
#0000
DUP2 .Screen/x DEO2
.Screen/y DEO2
[ LIT2 80 -Screen/pixel ] DEO
@draw-lander ( -- )
( base )
#0c06 get-pt #1406 get-pt #01 draw-line
#0d08 get-pt #1308 get-pt #01 draw-line
#0c06 get-pt #0d08 get-pt #01 draw-line
#1406 get-pt #1308 get-pt #01 draw-line
( legs )
#0d08 get-pt #0d0c get-pt #01 draw-line
#1308 get-pt #130c get-pt #01 draw-line
#0d0c get-pt #0e0f get-pt #01 draw-line
#130c get-pt #120f get-pt #01 draw-line
( plume )
[ LIT2r &plume $1 09 ] ADDr
#0e08 get-pt #1208 get-pt #02 draw-line
#0e08 get-pt #10 STHkr get-pt #02 draw-line
#1208 get-pt #10 STHr get-pt #02 draw-line
( face )
#26 .Screen/auto DEO
;face-icn .Screen/addr DEO2
#0014 .pos/x LDZ2 ADD2 .Screen/x DEO2
#0014 .pos/y LDZ2 ADD2 .Screen/y DEO2
#05 .Screen/sprite DEOk DEOk DEO
#00 .Screen/auto DEO
JMP2r
@draw-stage ( color -- )
( x ) #0000 .Screen/x DEO2
.stage/w LDZ #00
&loop
STHk
( a )
#00 OVR #30 SFT2
#00 STHr ;terrain ADD2 STH2k LDA #01 SUB #00 SWP #30 SFT2
( b )
OVR2 #0008 ADD2
STH2r INC2 LDA #01 SUB #00 SWP #30 SFT2
#41 draw-line
INC GTHk ?&loop
POP2
JMP2r
@get-pt ( id rad -- x* y* )
#00 SWP STH2
.angle LDZ2 #001f AND2 NIP ADD
#1f AND DUP ADD
#00 SWP ;circle-tbl ADD2 LDA2
#00 SWP STH2kr MUL2 #04 SFT2
( center ) #0080 STH2kr #30 SFT2 SUB2 ADD2 #02 SFT2
( pos ) .pos/y LDZ2 ADD2 #03ff AND2
ROT
#00 SWP STH2kr MUL2 #04 SFT2
( center ) #0080 STH2kr #30 SFT2 SUB2 ADD2 #02 SFT2
( pos ) .pos/x LDZ2 ADD2 #03ff AND2
SWP2
POP2r
JMP2r
@draw-line ( 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
(
@|prng )
@prng-init ( -- )
( seed )
#00 .DateTime/second DEI
#00 .DateTime/minute DEI #60 SFT2 EOR2
#00 .DateTime/hour DEI #c0 SFT2 EOR2 ,prng/x STR2
#00 .DateTime/hour DEI #04 SFT2
#00 .DateTime/day DEI #10 SFT2 EOR2
#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
(
@|stdlib )
@abs2 DUP2 #0f SFT2 EQU ?&end #0000 SWP2 SUB2 &end JMP2r
@lts2 #8000 STH2k ADD2 SWP2 STH2r ADD2 GTH2 JMP2r
@gts2 #8000 STH2k ADD2 SWP2 STH2r ADD2 LTH2 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
@face-icn [
0000 0000 0102 0408 0000 007e 8100 3cc3
0000 0000 8040 2010 0911 1212 1212 1109
0000 0042 0042 3c00 9088 4848 4848 8890
0804 0201 0000 0000 c33c 0081 7e00 0000
1020 4080 0000 0000 ]
@circle-tbl [
8000 9802 b009 c715 da25 ea38 f64f fd67
ff80 fd98 f6b0 eac7 dada c7ea b0f6 98fd
80ff 67fd 4ff6 38ea 25da 15c7 09b0 0298
0080 0267 094f 1538 2525 3815 4f09 6702 ]
@terrain

Binary file not shown.

View File

@ -1,32 +0,0 @@
#!/bin/sh -e
ASM="uxncli $HOME/roms/drifblim.rom"
EMU="uxnemu"
LIN="uxncli $HOME/roms/uxnlin.rom"
SRC="life.tal"
DST="life.rom"
CPY="$HOME/roms"
ARG=""
echo ">> Cleaning"
if [[ "$*" == *"--lint"* ]]
then
echo ">> Linting $SRC"
$LIN $SRC
fi
echo ">> Assembling $SRC"
$ASM $SRC $DST
if [[ "$*" == *"--save"* ]]
then
echo ">> Saving $DST"
cp $DST $CPY
fi
echo ">> Running $DST"
$EMU $DST $ARG

View File

@ -1,291 +0,0 @@
( uxnemu life.rom )
( Game Of Life:
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 &wst $1 &rst $1 &pad $4 &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
|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
|0000
@world &frame $1 &count $2
@anchor &x $2 &y $2 &x2 $2 &y2 $2
@pointer &x $2 &y $2
|0100 ( -> )
( 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 set-cell
#0704 set-cell
#0504 set-cell
#0705 set-cell
#0605 set-cell
( 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 ( -> )
.Mouse/state DEI #00 EQU #01 JCN [ BRK ]
#0000 .world/count STZ2
.world/frame LDZ INC
DUP .world/frame STZ
#03 AND #00 EQU #01 JCN [ BRK ]
run
&paused
BRK
@on-mouse ( -> )
( 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
( on touch in rect )
.Mouse/state DEI #00 NEQ #01 JCN [ BRK ]
.Mouse/x DEI2 .Mouse/y DEI2 .anchor within-rect [ JMP BRK ]
( paint )
.Mouse/x DEI2 .anchor/x LDZ2 SUB2 #01 SFT NIP
.Mouse/y DEI2 .anchor/y LDZ2 SUB2 #01 SFT NIP
set-cell
( draw )
draw-grid
BRK
@on-control ( -> )
( toggle play )
.Controller/key DEI #20 NEQ ?&no-toggle
;on-frame
.Screen/vector DEI2 ;on-frame/paused EQU2 ?&swap
POP2 ;on-frame/paused
&swap
.Screen/vector DEO2
&no-toggle
( clear on home )
.Controller/button DEI #08 NEQ ?&no-reset
;bank1 #0400 mclr
&no-reset
BRK
(
@|core )
@run ( -- )
( clear buffer )
;bank2 #1000 mclr
( run grid )
#4000
&ver
STHk
#4000
&hor
DUP STHkr run-cell
INC GTHk ?&hor
POP2
POPr
INC GTHk ?&ver
POP2
( move buffer )
;bank2 ;bank1 #1000 mcpy
( draw )
!draw-grid
@run-cell ( x y -- )
( x y ) DUP2k
( neighbours ) get-neighbours
( state ) ROT ROT get-cell
#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
( x ) ROT #3f AND #00 SWP ADD2
;bank1 ADD2
JMP2r
@set-cell ( x y -- )
STH2 #01 STH2r get-index STA
JMP2r
@get-cell ( x y -- cell )
get-index LDA
JMP2r
@get-neighbours ( x y -- neighbours )
,&origin STR2
LITr 00
#0800
&loop
#00 OVRk ADD2 ;&mask ADD2 LDA2 [ LIT2 &origin $2 ]
ROT ADD STH ADD STHr get-cell STH ADDr
INC GTHk ?&loop
POP2
STHr
JMP2r
&mask [ ffff 00ff 01ff ff00 0100 ff01 0001 0101 ]
(
@|drawing )
@draw-grid ( -- )
( draw cell count )
.anchor/x LDZ2 .Screen/x DEO2
.anchor/y2 LDZ2 #0008 ADD2 .Screen/y DEO2
#01 .Screen/auto DEO
.world/count LDZ2 draw-short
#00 .Screen/auto DEO
#4000
&ver
#00 OVRk ADD2 .anchor/y LDZ2 ADD2 .Screen/y DEO2
STHk
#4000
&hor
#00 OVRk ADD2 .anchor/x LDZ2 ADD2 .Screen/x DEO2
DUP STHkr get-cell INC .Screen/pixel DEO
INC GTHk ?&hor
POP2
POPr
INC GTHk ?&ver
POP2
JMP2r
@draw-short ( short* -- )
SWP draw-byte
@draw-byte ( byte color -- )
DUP #04 SFT draw-hex #0f AND
@draw-hex ( char color -- )
#00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
[ LIT2 03 -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
(
@|stdlib )
@mclr ( addr* len* -- )
OVR2 ADD2 SWP2
&loop
STH2k #00 STH2r STA
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 )
@cursor [
80c0 e0f0 f8e0 1000 ]
@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 ]
@bank1 $1000 @bank2

View File

@ -1,25 +0,0 @@
#!/bin/sh -e
ASM="uxncli $HOME/roms/drifblim.rom"
EMU="uxnemu"
LIN="uxncli $HOME/roms/uxnlin.rom"
SRC="minesweeper.tal"
DST="minesweeper.rom"
CPY="$HOME/roms"
ARG=""
if [[ "$*" == *"--lint"* ]]
then
$LIN $SRC
fi
$ASM $SRC $DST
if [[ "$*" == *"--save"* ]]
then
cp $DST $CPY
fi
$EMU $DST $ARG

View File

@ -1,708 +0,0 @@
( minesweeper )
|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
|80 @Controller &vector $2 &button $1 &key $1 &func $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|0000
@game &started $1 &timer $2 &dead $1
@pointer &x $2 &y $2
@grid &x $2 &y $2 &x2 $2 &y2 $2
( program )
|0100 ( -> )
( theme )
#cf80 .System/r DEO2
#cf80 .System/g DEO2
#cf80 .System/b DEO2
( DOS resolution )
#00a0 .Screen/width DEO2
#00d0 .Screen/height DEO2
prng-init
load-theme
( place grid )
#0010 DUP2 .grid/x STZ2 #007f ADD2 .grid/x2 STZ2
#0040 DUP2 .grid/y STZ2 #007f ADD2 .grid/y2 STZ2
( draw frames )
#0008 DUP2 #1004 draw-frame
#0008 #0038 #1010 draw-frame
draw-grid
draw-progress
draw-status
draw-timer
( vectors )
;on-mouse .Mouse/vector DEO2
;on-frame .Screen/vector DEO2
;on-button .Controller/vector DEO2
BRK
@on-frame ( -> )
.game/started LDZ #00 NEQ [ JMP BRK ]
[ LIT &f $1 ] #3c NEQ ,&no-second JCN
#00 ,&f STR
.game/timer LDZ2k INC2 ROT STZ2
draw-timer
&no-second
,&f LDR INC ,&f STR
BRK
@on-button ( -> )
.game/dead LDZ #00 EQU ,&alive JCN
reset
&alive
BRK
@on-mouse ( -> )
( clear last cursor )
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
#40 .Screen/sprite DEO
;pointer-icn .Screen/addr DEO2
( draw new cursor )
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
#43 .Mouse/state DEI #00 NEQ DUP ADD SUB .Screen/sprite DEO
.Mouse/state DEI #00 NEQ [ JMP BRK ]
.Mouse/x DEI2 .Mouse/y DEI2
OVR2 OVR2 .grid within-rect ;touch-grid JCN2
POP2 POP2
.game/dead LDZ #00 EQU ,&alive JCN
reset
&alive
#00 .Mouse/state DEO
BRK
@touch-grid ( x* y* -> )
.grid/y LDZ2 SUB2 #04 SFT2 NIP STH
.grid/x LDZ2 SUB2 #04 SFT2 NIP STHr
( skip on death )
.game/dead LDZ ,&skip JCN
.Mouse/state DEI #01 GTH ,touch-grid-flag JCN
DUP2 reveal
&skip
POP2
#00 .Mouse/state DEO
BRK
@touch-grid-flag ( x y -> )
( unset )
DUP2 #30 SFT ADD #00 SWP ;world/flags ADD2 LDA #00 EQU ,&add-flag JCN
#00 ,&set-flag JSR BRK
&add-flag
( add flag if have flags left )
count-flags ,&has-flags JCN
POP2 BRK
&has-flags
( can set )
#01 ,&set-flag JSR
( test victory )
count-left ,&no-victory JCN
victory
&no-victory
BRK
&set-flag ( x y value -- )
STH
#30 SFT ADD #00 SWP ;world/flags ADD2 STHr ROT ROT STA
draw-progress
draw-grid
#00 .Mouse/state DEO
JMP2r
(
@|core )
@reset ( -- )
#0000 .game/timer STZ2
#00 .game/started STZ
#00 .game/dead STZ
;world #0100 mclr
draw-status
draw-progress
draw-timer
draw-grid
JMP2r
@explode ( -- )
#01 .game/dead STZ
#00 .game/started STZ
draw-status
draw-grid
JMP2r
@victory ( -- )
#02 .game/dead STZ
#00 .game/started STZ
draw-status
draw-grid
JMP2r
@start ( x y -- )
#01 .game/started STZ
prng-init
#1000
&while
#01 prng #003f AND2 ;world ADD2 STA
INC GTHk ,&while JCN
POP2
( remove mine on first click )
#00 ROT ROT #30 SFT ADD #00 SWP ;world/mines ADD2 STA
update-values
JMP2r
@reveal ( x y -- )
( start on idle )
.game/started LDZ ,&started JCN
DUP2 start
&started
( ignore already revealed )
DUP2 get-revealed #00 EQU ,&unrevealed JCN
POP2 JMP2r
&unrevealed
( ignore flagged )
DUP2 #30 SFT ADD #00 SWP ;world/flags ADD2 LDA #00 EQU ,&unflagged JCN
POP2 JMP2r
&unflagged
( test if killing )
DUP2 get-mine #00 EQU ,&survive JCN
POP2 explode JMP2r
&survive
open
draw-grid
draw-progress
JMP2r
@open ( x y -- )
DUP2 set-revealed
STH2
#0800
&loop
#00 OVRk ADD2 ;neighbors ADD2 LDA2
STH2kr ROT ADD ROT ROT ADD SWP
DUP2 get-revealed ,&continue JCN
DUP2 get-value ,&continue JCN
DUP2 open-zone
&continue
POP2
INC GTHk ,&loop JCN
POP2
POP2r
JMP2r
@open-zone ( x y -- )
STH2
#0800
&loop
#00 OVRk ADD2 ;neighbors ADD2 LDA2
STH2kr ROT ADD ROT ROT ADD SWP
set-revealed
INC GTHk ,&loop JCN
POP2
STH2r open
JMP2r
@get-value ( x y -- value )
OVR #08 LTH ,&in-x JCN POP2 #ff JMP2r &in-x
DUP #08 LTH ,&in-y JCN POP2 #ff JMP2r &in-y
#30 SFT ADD #00 SWP
DUP2 ;world/mines ADD2 LDA #00 EQU ,&no-mine JCN
POP2 #ff JMP2r
&no-mine
;world/values ADD2 LDA
JMP2r
@get-revealed ( x y -- value )
OVR #08 LTH ,&in-x JCN POP2 #ff JMP2r &in-x
DUP #08 LTH ,&in-y JCN POP2 #ff JMP2r &in-y
#30 SFT ADD #00 SWP ;world/revealed ADD2 LDA
JMP2r
@set-revealed ( x y -- )
OVR #08 LTH ,&in-x JCN POP2 JMP2r &in-x
DUP #08 LTH ,&in-y JCN POP2 JMP2r &in-y
#30 SFT ADD #00 SWP ;world/revealed ADD2 #01 ROT ROT STA
JMP2r
@update-values ( -- )
#0800
&ver
STHk
#0800
&hor
DUP STHkr ,count-mines-neighbors JSR
OVR STHkr #30 SFT ADD #00 SWP ;world/values ADD2 STA
INC GTHk ,&hor JCN
POP2
POPr
#0010 .Screen/x DEO2
.Screen/y DEI2k #0010 ADD2 ROT DEO2
INC GTHk ,&ver JCN
POP2
JMP2r
@count-mines-neighbors ( x y -- count )
,&origin STR2
LITr 00
#0800
&loop
( load neighbor ) #00 OVRk ADD2 ;neighbors ADD2 LDA2
( add positions ) [ LIT2 &origin $2 ] ROT ADD ROT ROT ADD SWP
( incr counter ) ,get-mine JSR STH ADDr
INC GTHk ,&loop JCN
POP2
STHr
JMP2r
@get-mine ( x y -- flag )
OVR #08 LTH ,&in-x JCN POP2 #00 JMP2r &in-x
DUP #08 LTH ,&in-y JCN POP2 #00 JMP2r &in-y
#30 SFT ADD #00 SWP ;world/mines ADD2 LDA
JMP2r
@count-flags ( -- flags )
LITr 00
#4000
&loop
#00 OVR ;world/mines ADD2 LDA STH ADDr
#00 OVR ;world/flags ADD2 LDA STH SUBr
INC GTHk ,&loop JCN
POP2
STHr
JMP2r
@count-left ( -- mines )
LITr 00
#4000
&loop
#00 OVR ;world/mines ADD2 LDA STH
#00 OVR ;world/flags ADD2 LDA STH LIT2r 0100 EQU2r ADDr
INC GTHk ,&loop JCN
POP2
STHr
JMP2r
( drawing )
@draw-frame ( x* y* w h -- )
DUP ,&h2 STR ,&h1 STR
DUP ,&w2 STR ,&w1 STR
DUP2 .Screen/y DEO2
OVR2 .Screen/x DEO2
#01 .Screen/auto DEO
;frame-chrs/tl .Screen/addr DEO2
#81 .Screen/sprite DEO
;frame-chrs/tc .Screen/addr DEO2
[ LIT &w1 $1 ] ,&repeat JSR
#02 .Screen/auto DEO
;frame-chrs/tr .Screen/addr DEO2
#81 .Screen/sprite DEO
;frame-chrs/mr .Screen/addr DEO2
[ LIT &h1 $1 ] ,&repeat JSR
( left )
#0008 ADD2 .Screen/y DEO2
.Screen/x DEO2
;frame-chrs/ml .Screen/addr DEO2
[ LIT &h2 $1 ] ,&repeat JSR
#01 .Screen/auto DEO
;frame-chrs/bl .Screen/addr DEO2
#81 .Screen/sprite DEO
;frame-chrs/bc .Screen/addr DEO2
[ LIT &w2 $1 ] ,&repeat JSR
;frame-chrs/br .Screen/addr DEO2
#81 .Screen/sprite DEO
JMP2r
&repeat
#00 &repeat-loop #81 .Screen/sprite DEO INC GTHk ,&repeat-loop JCN POP2
JMP2r
@draw-grid ( -- )
#05 .Screen/auto DEO
#0010 .Screen/x DEO2
#0040 .Screen/y DEO2
#0800
&ver
STHk
#0800
&hor
#00 OVR STHkr #30 SFT ADD ,get-tile JSR #81 draw-tile
INC GTHk ,&hor JCN
POP2
POPr
#0010 .Screen/x DEO2
.Screen/y DEI2k #0010 ADD2 ROT DEO2
INC GTHk ,&ver JCN
POP2
#00 .Screen/auto DEO
JMP2r
@get-tile ( id* -- sprite* )
( mine )
.game/dead LDZ #00 EQU ,&alive JCN
DUP2 ;world ADD2 LDA #00 EQU ,&no-mine JCN
POP2 ;tile-chrs/mine JMP2r
&no-mine
&alive
( flag )
DUP2 ;world/flags ADD2 LDA #00 EQU ,&no-flag JCN
POP2 ;tile-chrs/flagged JMP2r
&no-flag
( revealed )
DUP2 ;world/revealed ADD2 LDA ,&no-seen JCN
POP2 ;tile-chrs/untouched JMP2r
&no-seen
( digits )
;world/values ADD2 LDA #00 SWP #60 SFT2 ;tile-chrs/digits ADD2
JMP2r
@draw-tile ( addr* color -- )
STH
.Screen/addr DEO2
STHkr .Screen/sprite DEOk DEO
.Screen/x DEI2k #0010 SUB2 ROT DEO2
.Screen/y DEI2k #0008 ADD2 ROT DEO2
STHr .Screen/sprite DEOk DEO
.Screen/y DEI2k #0008 SUB2 ROT DEO2
JMP2r
@draw-status ( -- )
#05 .Screen/auto DEO
#0048 .Screen/x DEO2
#0018 .Screen/y DEO2
;status-chrs/alive #00 .game/dead LDZ #60 SFT2 ADD2 #81 ,draw-tile JSR
#00 .Screen/auto DEO
JMP2r
@draw-progress ( -- )
#0018 .Screen/x DEO2
#0018 .Screen/y DEO2
#00 count-flags ,draw-display JSR
JMP2r
@draw-timer ( -- )
#0058 .Screen/x DEO2
#0018 .Screen/y DEO2
.game/timer LDZ2 ,draw-display JSR
JMP2r
@draw-display ( value* -- )
#05 .Screen/auto DEO
DUP2 #0064 DIV2 NIP ,draw-display-char JSR
DUP2 #000a DIV2 NIP ,draw-display-char JSR
NIP
@draw-display-char ( addr* color -- )
#0a ( MOD ) DIVk MUL SUB #00 SWP #60 SFT2 ;digits-chrs ADD2 #85 draw-tile
JMP2r
( stdlib )
@mclr ( addr* len* -- )
OVR2 ADD2 SWP2
&loop
STH2k #00 STH2r STA
INC2 GTH2k ,&loop JCN
POP2 POP2
JMP2r
@prng-init ( -- )
( seed )
#00 .DateTime/second DEI
#00 .DateTime/minute DEI #60 SFT2 EOR2
#00 .DateTime/hour DEI #c0 SFT2 EOR2 ,prng/x STR2
#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 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
@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
( theme )
@load-theme ( -- )
;&path .File/name DEO2
#0002 .File/length DEO2
;&r .File/read DEO2
;&g .File/read DEO2
;&b .File/read DEO2
.File/success DEI2 ORA #01 JCN JMP2r
LIT2 &r $2 .System/r DEO2
LIT2 &g $2 .System/g DEO2
LIT2 &b $2 .System/b DEO2
JMP2r
&path ".theme $1
(
@|assets )
@neighbors
ffff 00ff 01ff
ff00 0100
ff01 0001 0101
@pointer-icn
80c0 e0f0 f8e0 1000
@tile-chrs
&untouched
ffff c0c0 c0c0 c0c0 0000 0000 0000 0000
fefc 0000 0000 0000 0001 0303 0303 0303
c0c0 c0c0 c0c0 8000 0000 0000 0000 3f7f
0000 0000 0000 0000 0303 0303 0303 ffff
&mine
0001 0117 0f1f 1f7f 0001 0117 0b15 1b7f
0000 00d0 e0f0 f0fc 0100 01d0 e1f0 f1fc
1f1f 0f17 0101 0000 1f1f 0f17 0101 00aa
f0f0 e0d0 0000 0000 f1f0 e1d0 0100 01ab
&flagged
ffff c0c0 c1c1 c1c1 0000 0000 0103 0703
fefc 0000 0000 0000 0001 0303 0303 0303
c1c0 c7cf c0c0 8000 0101 070f 0000 3f7f
0000 c0e0 0000 0000 0303 c3e3 0303 ffff
&digits
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0100 0100 0100 0100
0000 0000 0000 0000 0000 0000 0000 00aa
0000 0000 0000 0000 0100 0100 0100 01ab
( 1 )
0000 0003 0301 0101 0000 0003 0301 0101
0000 0080 8080 8080 0100 0180 8180 8180
0101 0101 0100 0000 0101 0101 0100 00aa
8080 8080 8000 0000 8180 8180 8100 01ab
( 2 )
0000 001f 1f00 000f 0000 001f 1f00 000f
0000 00f0 f818 18f8 0100 01f0 f918 19f8
1f18 181f 1f00 0000 1f18 181f 1f00 00aa
f000 00f8 f800 0000 f100 01f8 f900 01ab
( 3 )
0000 001f 1f00 001f 0000 001f 1f00 001f
0000 00f0 f818 18f0 0100 01f0 f918 19f0
1f00 001f 1f00 0000 1f00 001f 1f00 00aa
f018 18f8 f000 0000 f118 19f8 f100 01ab
( 4 )
0000 0018 1818 181f 0000 0018 1818 181f
0000 0018 1818 18f8 0100 0118 1918 19f8
0f00 0000 0000 0000 0f00 0000 0000 00aa
f818 1818 1800 0000 f918 1918 1900 01ab
( 5 )
0000 001f 1f18 181f 0000 001f 1f18 181f
0000 00f8 f800 00f0 0100 01f8 f900 01f0
0f00 001f 1f00 0000 0f00 001f 1f00 00aa
f818 18f8 f000 0000 f918 19f8 f100 01ab
( 6 )
0000 000f 1f18 181f 0000 000f 1f18 181f
0000 00f8 f800 00f0 0100 01f8 f900 01f0
1f18 181f 0f00 0000 1f18 181f 0f00 00aa
f818 18f8 f000 0000 f918 19f8 f100 01ab
( 7 )
0000 001f 1f00 0000 0000 001f 1f00 0000
0000 00f0 f818 1838 0100 01f0 f918 1938
0000 0000 0000 0000 0000 0000 0000 00aa
3818 1818 1800 0000 3918 1918 1900 01ab
( 8 )
0000 000f 1f18 180f 0000 000f 1f18 180f
0000 00f0 f818 18f0 0100 01f0 f918 19f0
0f18 181f 0f00 0000 0f18 181f 0f00 00aa
f018 18f8 f000 0000 f118 19f8 f100 01ab
@frame-chrs
&tl 0000 0000 0000 0000 0000 0000 0000 0303
&tc 0000 0000 0000 0000 0000 0000 0000 ffff
&tr 0000 0000 0000 0040 0000 0000 0000 8000
&ml 0000 0000 0000 0000 0303 0303 0303 0303
&mr c0c0 c0c0 c0c0 c0c0 0000 0000 0000 0000
&bl 0001 0000 0000 0000 0200 0000 0000 0000
&bc ffff 0000 0000 0000 0000 0000 0000 0000
&br c0c0 0000 0000 0000 0000 0000 0000 0000
@status-chrs
&alive
0007 1f3f 3f7f 7f7f 0007 1820 2040 4044
00e0 f8fc fcfe fefe 00e0 1804 0402 0222
7f7f 7f3f 3f1f 0700 4048 4720 2018 0700
fefe fefc fcf8 e000 0212 e204 0418 e000
&dead
0007 1f3f 3f7f 7f7f 0007 1820 2040 4a44
00e0 f8fc fcfe fefe 00e0 1804 0402 5222
7f7f 7f3f 3f1f 0700 4a40 4728 2018 0700
fefe fefc fcf8 e000 5202 e214 0418 e000
&victory
0007 1f3f 3f7f 7f7f 0007 1820 2040 444a
00e0 f8fc fcfe fefe 00e0 1804 0402 2252
7f7f 7f3f 3f1f 0700 4040 4221 2018 0700
fefe fefc fcf8 e000 0202 4284 0418 e000
@digits-chrs
( 0 )
ffff ffff ffff ffe0 ffc0 a09f 9f9f 9fbf
ffff ffff ffff ff07 ff03 05f9 f9f9 f9fd
f0ff ffff ffff ffff 9f9f 9f9f 9fa0 c0ff
0fff ffff ffff ffff f9f9 f9f9 f905 03ff
( 1 )
ffc0 a09f 9f9f 9fa0 ffff ffff ffff ffff
ff03 07ff ffff ff07 ffff fdf9 f9f9 f9fd
909f 9f9f 9fa0 c0ff ffff ffff ffff ffff
0fff ffff ff07 03ff f9f9 f9f9 f9fd ffff
( 2 )
ffff bf9f 9f9f 9fbf ffc0 e0ff ffff ffe0
ffff ffff ffff ffff ff03 05f9 f9f9 f905
ffff ffff ffff ffff 909f 9f9f 9fa0 c0ff
f9f9 f9f9 f9fd ffff 0fff ffff ff07 03ff
( 3 )
ffff bf9f 9f9f 9fbf ffc0 e0ff ffff ffe0
ffff ffff ffff ffff ff03 05f9 f9f9 f905
9f9f 9f9f 9fbf ffff f0ff ffff ffe0 c0ff
ffff ffff ffff ffff 09f9 f9f9 f905 03ff
( 4 )
ffc0 e0ff ffff ffff ffff bf9f 9f9f 9fa0
ff03 07ff ffff ffff ffff fdf9 f9f9 f905
9f9f 9f9f 9fa0 c0ff f0ff ffff ffff ffff
ffff ffff ff07 03ff 09f9 f9f9 f9fd ffff
( 5 )
ffff ffff ffff ffff ffc0 a09f 9f9f 9fa0
ffff fdf9 f9f9 f9fd ff03 07ff ffff ff07
9f9f 9f9f 9fbf ffff f0ff ffff ffe0 c0ff
ffff ffff ffff ffff 09f9 f9f9 f905 03ff
( 6 )
ffc0 e0ff ffff ffff ffff bf9f 9f9f 9fa0
ff03 05f9 f9f9 f9fd ffff ffff ffff ff07
ffff ffff ffff ffff 909f 9f9f 9fa0 c0ff
ffff ffff ffff ffff 09f9 f9f9 f905 03ff
( 7 )
ffff bf9f 9f9f 9fa0 ffc0 e0ff ffff ffff
ffff ffff ffff ff07 ff03 05f9 f9f9 f9fd
909f 9f9f 9fa0 c0ff ffff ffff ffff ffff
0fff ffff ff07 03ff f9f9 f9f9 f9fd ffff
( 8 )
ffff ffff ffff ffff ffc0 a09f 9f9f 9fa0
ffff ffff ffff ffff ff03 05f9 f9f9 f905
ffff ffff ffff ffff 909f 9f9f 9fa0 c0ff
ffff ffff ffff ffff 09f9 f9f9 f905 03ff
( 9 )
ffff ffff ffff ffff ffc0 a09f 9f9f 9fa0
ffff ffff ffff ffff ff03 05f9 f9f9 f905
9f9f 9f9f 9fa0 c0ff f0ff ffff ffff ffff
ffff ffff ff07 03ff 09f9 f9f9 f9fd ffff
@world
&mines $40
&revealed $40
&values $40
&flags $40

View File

@ -1,26 +0,0 @@
#!/bin/sh -e
ID="sand"
ASM="uxncli $HOME/roms/drifblim.rom"
EMU="uxnemu"
LIN="uxncli $HOME/roms/uxnlin.rom"
SRC="${ID}.tal"
DST="${ID}.rom"
CPY="$HOME/roms"
ARG=""
if [[ "$*" == *"--lint"* ]]
then
$LIN $SRC
fi
$ASM $SRC $DST
if [[ "$*" == *"--save"* ]]
then
cp $DST $CPY
fi
$EMU $DST $ARG

View File

@ -1,214 +0,0 @@
( usage: uxnemu sand.rom
mouse1 water
mouse2 sand
mouse3 rock )
|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
|80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2
|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
|0100
(
@|vectors )
@on-reset
( theme )
#07cf .System/r DEO2
#0caf .System/g DEO2
#0faf .System/b DEO2
#0100 .Screen/width DEO2
#0100 .Screen/height DEO2
;on-frame .Screen/vector DEO2
;on-mouse .Mouse/vector DEO2
prng-init
#010e DEO
BRK
@on-frame ( -> )
eval
redraw
BRK
@on-mouse ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;cursor-icn update-cursor
( read mouse state )
.Mouse/state DEI ?&on-touch BRK
&on-touch ( -> )
( A mouse button was pressed )
.Mouse/state DEI DUP #04 EQU SUB
.Mouse/y DEI2 NIP
.Mouse/x DEI2 NIP
set-cell
BRK
(
@|core )
@eval-sand ( y x cell -- y x )
POP
OVR #ff EQU ?eval/resume
( south )
SWPk INC SWP STH2k get-cell #01 GTH ?&has-s
DUP2 STH2r swap-cells !eval/resume
&has-s
POP2r
( south sides )
SWPk INC SWP #01ff prng ADD #01 AND [ JMP SWP POP ] ADD STH2k get-cell #01 GTH ?&has-s2
DUP2 STH2r swap-cells !eval/resume
&has-s2
POP2r
!eval/resume
@eval-water ( y x cell -- y x )
POP
OVR #ff EQU ?eval/resume
( south )
SWPk INC SWP STH2k get-cell ?&has-s
DUP2 STH2r swap-cells !eval/resume
&has-s
POP2r
( south sides )
DUP2 #01ff prng ADD #01 AND [ JMP SWP POP ] ADD STH2k get-cell ?&has-s2
DUP2 STH2r swap-cells !eval/resume
&has-s2
POP2r
!eval/resume
@eval-rock ( y x cell -- y x )
POP
OVR #ff EQU ?eval/resume
( south )
SWPk INC SWP STH2k get-cell #01 GTH ?&has-s
DUP2 STH2r swap-cells !eval/resume
&has-s
POP2r
!eval/resume
@eval ( -- )
#ffff
&l
DUP2 get-cell
DUP #01 EQU ?eval-water
DUP #02 EQU ?eval-sand
DUP #03 EQU ?eval-rock
POP
&resume
#0001 SUB2 ORAk ?&l
POP2
@redraw ( -- )
#0000
&l
DUP2 #00ff AND2 .Screen/x DEO2
DUP2 #0100 DIV2 .Screen/y DEO2
DUP2 get-cell .Screen/pixel DEO
INC2 ORAk ?&l
POP2
JMP2r
@swap-cells ( a* b* -- )
#02 SFT2 ;world ADD2 SWP2
#02 SFT2 ;world ADD2 mswap
JMP2r
@set-cell ( type y x -- )
#02 SFT2 ;world ADD2 STA
JMP2r
@get-cell ( y x -- type )
#02 SFT2 ;world ADD2 LDA
JMP2r
(
@|drawing )
@update-cursor ( color addr* -- )
[ LIT2 00 -Screen/auto ] DEO
#40 draw-cursor
.Mouse/x DEI2 ,draw-cursor/x STR2
.Mouse/y DEI2 ,draw-cursor/y STR2
.Screen/addr DEO2
@draw-cursor ( color -- )
[ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 &y $2 ] .Screen/y DEO2
.Screen/sprite DEO
JMP2r
(
@|stdlib )
@mswap ( a* b* -- )
SWP2k LDA STH STH2 LDA STH STH2 STAr STAr
JMP2r
@prng-init ( -- )
( seed )
#00 .DateTime/second DEI
#00 .DateTime/minute DEI #60 SFT2 EOR2
#00 .DateTime/hour DEI #c0 SFT2 EOR2 ,prng/x STR2
#00 .DateTime/hour DEI #04 SFT2
#00 .DateTime/day DEI #10 SFT2 EOR2
#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
(
@|assets )
@cursor-icn [
80c0 e0f0 f8e0 1000 ]
@world

View File

@ -1,32 +0,0 @@
#!/bin/sh -e
ASM="uxncli $HOME/roms/drifblim.rom"
EMU="uxnemu"
LIN="uxncli $HOME/roms/uxnlin.rom"
SRC="wireworld.tal"
DST="wireworld.rom"
CPY="$HOME/roms"
ARG=""
echo ">> Cleaning"
if [[ "$*" == *"--lint"* ]]
then
echo ">> Linting $SRC"
$LIN $SRC
fi
echo ">> Assembling $SRC"
$ASM $SRC $DST
if [[ "$*" == *"--save"* ]]
then
echo ">> Saving $DST"
cp $DST $CPY
fi
echo ">> Running $DST"
$EMU $DST $ARG

View File

@ -1,254 +0,0 @@
( wireworld
electron head<3>, becomes electron tail<2>
electron tail<2>, becomes conductor<1>
conductor<1>, becomes electron head<3>
if there are exactly 1 or 2 electron heads around it. )
|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 &func $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2
|0000
@color $1
@pointer &x $2 &y $2
@timer &play $1
(
@|vectors )
|0100 ( -> )
( theme )
#0ff2 .System/r DEO2
#0d46 .System/g DEO2
#006f .System/b DEO2
( size )
#0200 .Screen/width DEO2
#0200 .Screen/height DEO2
( vectors )
;on-frame .Screen/vector DEO2
;on-mouse .Mouse/vector DEO2
;on-button .Controller/vector DEO2
( setup )
#01 .timer/play STZ
#01 set-color
( start )
;world ;get-addr/current STA2
#1000 ;run/future STA2
redraw
BRK
@on-frame ( -> )
.Mouse/state DEI #00 EQU [ JMP BRK ]
.timer/play LDZ [ JMP BRK ]
( every 4th )
[ LIT &f $1 ] INCk ,&f STR
#03 AND ?&no-run
run &no-run
BRK
@on-mouse ( -> )
;pointer-icn .Screen/addr DEO2
( clear last cursor )
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
#40 .Screen/sprite DEO
( draw new cursor )
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
#40 .color LDZ ADD .Screen/sprite DEO
( paint )
.Mouse/state DEI ?&down
BRK
&down ( -> )
.Mouse/y DEI2 #03 SFT2 NIP #02 NEQ ?&no-menu
.Mouse/x DEI2 #03 SFT2 NIP
DUP #02 NEQ ?&no-color1
#01 set-color
&no-color1
DUP #03 NEQ ?&no-color2
#02 set-color
&no-color2
DUP #04 NEQ ?&no-color3
#03 set-color
&no-color3
DUP #06 NEQ ?&no-toggle
.timer/play LDZk #00 EQU SWP STZ
#00 .Mouse/state DEO
draw-ui
&no-toggle
POP
&no-menu
( color ) .color LDZ .Mouse/state DEI #01 GTH #00 EQU MUL
( cell* ) .Mouse/x DEI2 #03 SFT2 .Mouse/y DEI2 #03 SFT2 make-addr STA
redraw
BRK
@on-button ( -> )
.Controller/button DEI
[ #01 ] NEQk NIP ?&no-a #01 set-color &no-a
[ #02 ] NEQk NIP ?&no-b #02 set-color &no-b
[ #04 ] NEQk NIP ?&no-select #03 set-color &no-select
[ #08 ] NEQk NIP ?&no-start ;world #2000 mclr redraw &no-start
POP
( space )
.Controller/key DEI #20 NEQ ?&no-space .timer/play LDZk #00 EQU SWP STZ &no-space
BRK
(
@|core )
@set-color ( color -- )
.color STZ
.pointer/x LDZ2 .Screen/x DEO2
.pointer/y LDZ2 .Screen/y DEO2
;pointer-icn .Screen/addr DEO2
#40 .color LDZ ADD .Screen/sprite DEO
#00 .Mouse/state DEO
JMP2r
@run ( -- )
#4000
&ver
STHk
#4000
&hor
( x,y ) DUP STHkr
( cell ) DUP2 get-addr STH2k LDA
( transform ) transform STH2r [ LIT2 &future $2 ] ADD2 STA
INC GTHk ?&hor
POP2
POPr
INC GTHk ?&ver
POP2
( Swap worlds )
;get-addr/current LDA2k ;run/future LDA2 STH2k ADD2 SWP2 STA2
#0000 STH2r SUB2 ;run/future STA2
!redraw
@get-addr ( x y -- addr* )
#00 SWP #60 SFT2 ROT #00 SWP ADD2 [ LIT2 &current $2 ] ADD2
JMP2r
@transform ( xy cell -- cell )
DUP ?&no-null NIP NIP JMP2r &no-null
DUP #03 NEQ ?&no-head POP POP2 #02 JMP2r &no-head
DUP #02 NEQ ?&no-tail POP POP2 #01 JMP2r &no-tail
DUP #01 NEQ ?&no-cond POP
LITr 00
DUP2 #01 SUB get-addr
( tl ) #0001 SUB2 LDAk #03 NEQ JMP INCr
( tc ) INC2 LDAk #03 NEQ JMP INCr
( tr ) INC2 LDA #03 NEQ JMP INCr
DUP2 get-addr
( ml ) #0001 SUB2 LDAk #03 NEQ JMP INCr
( mr ) INC2 INC2 LDA #03 NEQ JMP INCr
INC get-addr
( bl ) #0001 SUB2 LDAk #03 NEQ JMP INCr
( bc ) INC2 LDAk #03 NEQ JMP INCr
( br ) INC2 LDA #03 NEQ JMP INCr
STHkr #02 EQU STHr #01 EQU ORA
DUP ADD INC JMP2r
&no-cond
( unknown )
NIP NIP
JMP2r
@mclr ( addr* len* -- )
OVR2 ADD2 SWP2
&loop
STH2k #00 STH2r STA
INC2 GTH2k ?&loop
POP2 POP2
JMP2r
@make-addr ( x* y* -- addr* )
#60 SFT2 ADD2 ;get-addr/current LDA2 ADD2
JMP2r
(
@|drawing )
@redraw ( -- )
;cell-icn .Screen/addr DEO2
[ LIT2 01 -Screen/auto ] DEO
#0000
DUP2 .Screen/x DEO2
.Screen/y DEO2
#1000 #0000
&l
( x ) DUP2 #003f AND2
( y ) OVR2 #06 SFT2
make-addr LDA .Screen/sprite DEO
INCk #3f AND ?&no-bound
#0000 .Screen/x DEO2
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
&no-bound
INC2 GTH2k ?&l
POP2 POP2
@draw-ui ( -- )
( colors )
[ LIT2 01 -Screen/auto ] DEO
#0010
DUP2 .Screen/x DEO2
.Screen/y DEO2
;cell-icn .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEO
[ LIT2 02 -Screen/sprite ] DEO
[ LIT2 03 -Screen/sprite ] DEO
( toggle )
#0030 .Screen/x DEO2
;toggle-icn [ LIT2 00 -timer/play ] LDZ #30 SFT2 ADD2 .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEO
JMP2r
(
@|assets )
@pointer-icn [
80c0 e0f0 f8e0 1000 ]
@cell-icn [
7cfe fefe fefe 7c00 ]
@toggle-icn [
6666 6666 6666 6600
4666 767e 7666 4600 ]
(
I live in the atom with the happy protons and neutrons.
I'm also so negative all the freakin time.
What do I do?
How do I find peace? )
@world