~rabbits/donsol

b2b6f3d7754b335a8890b979b027c7b49218e987 — neauoire 11 months ago 07a71b3
Updated to the new datetime device location
5 files changed, 1414 insertions(+), 1449 deletions(-)

M build.sh
D src/assets.tal
A src/donsol.tal
D src/main.tal
D src/strings.tal
M build.sh => build.sh +1 -1
@@ 5,7 5,7 @@ rm -rf bin
mkdir bin

echo "Assembling.."
uxnasm src/main.tal bin/donsol.rom 
uxnasm src/donsol.tal bin/donsol.rom 

echo "Installing.."
if [ -d "$HOME/roms" ] && [ -e ./bin/donsol.rom ]

D src/assets.tal => src/assets.tal +0 -374
@@ 1,374 0,0 @@
@pointer-icn
	80c0 e0f0 f8e0 1000
@cursor-hor-icn
	4060 381e 1e38 6040
@cursor-ver-icn
	0018 183c 7e66 c300
@progress-fg-icn
	0000 183c 3c18 0000
@star-icn
	082a 1c7f 1c2a 0800
@progress-bg-icns
	3f40 8080 8080 403f
	ff00 0000 0000 00ff
	ff00 0000 0000 00ff
	ff00 0000 0000 00ff
	ff00 0000 0000 00ff
	fc02 0101 0101 02fc
@font
@blank-icn
	0000 0000 0000 0000
@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
@letters-uc-icns
	781c 3c36 3e66 66c3
	ee73 636e 6363 63de
	3c66 ccc0 c0c0 e67c
	ee73 6363 6363 63de
	fe66 6078 6063 667c
	fe66 6078 6060 6060
	3c66 c6c0 dec6 663c
	c6c6 c6ce fee6 c6c6
	3018 1818 1818 180c
	1e0c 0c0c 0c1c 3860
	c66c 6c78 786c 6cc6
	e060 6060 6066 7e78
	c6ee fed6 c6c6 c6c6
	c6c6 e6f6 dece c6c6
	7cce c6c6 c6c6 e67c
	fc66 6666 6c60 60c0
	7ce6 c6c6 c6c6 ce7f
	ee73 666c 6666 63c3
	3a66 603c 0606 665c
	fe30 60c0 c0c2 c67c
	e666 6666 6666 6e3f
	c366 6666 6666 3c18
	c3c3 c3d3 cbdf 7762
	c3c3 663c 3c66 c3c3
	c366 663c 1818 1818
	7ec6 0c18 fe60 c3fe
@letters-lc-icns
	0000 3e66 6666 3b00
	e060 607c 6666 7c00
	0000 3c66 6066 3c00
	0c06 063e 6666 3b00
	0000 3c66 7e60 3e00
	0e18 1818 3e18 1800
	0006 7ccc cc78 c27c
	c060 606c 7666 6600
	3000 180c 0c0c 0c00
	0c00 0c0c 0c0c 0c38
	c060 666c 786c e600
	3018 1818 1818 0c00
	00c0 667e 7e6b 6300
	00c0 7c66 6666 6300
	0000 3c6e 6676 3c00
	00c0 7c66 667c 60e0
	0000 3b66 663e 0607
	00c0 7c76 6060 6000
	0000 3e60 3c06 7c00
	0030 7e30 3030 361c
	0000 e666 666e 3b00
	0000 e666 663c 1800
	0000 e36b 7f3e 3600
	0003 663c 183c 66c0
	0000 e666 663e cc78
	0000 7e0c 7e31 7e00
	0c0c 1818 0030 3000
	0000 0000 0030 3000
@buttons-icns
	3c66 dbdb c3db 5a3c
	&b
	3c46 dbc7 dbdb 463c

@graphics
	8182 8282 8283 8542 8686 8687 8552 8686 8687 85e8 e4e5 e987 85ec e0e1 ed87 85f8 f5f6 fb87 8586 f9fa 8687 85fc fdfe ff87 89ee ebea ef8b ( heart1 )
	8182 8282 8283 8542 8686 8687 8546 8686 8687 8586 8686 8687 8586 4286 8687 8586 8642 8687 8586 8686 8687 8586 8686 8687 898a 8a8a 8a8b ( heart2 )
	8182 8282 8283 8542 8686 8687 8547 8686 8687 8586 8686 8687 8586 4286 8687 8586 8642 8687 8586 4286 8687 8586 8686 8687 898a 8a8a 8a8b ( heart3 )
	8182 8282 8283 8542 8686 8687 8548 8686 8687 8586 8686 8687 8586 4286 8687 8586 4242 8687 8586 4286 8687 8586 8686 8687 898a 8a8a 8a8b ( heart4 )
	8182 8282 8283 8542 8686 8687 8549 8686 8687 8586 8686 8687 8586 4242 8687 8586 4242 8687 8586 8642 8687 8586 8686 8687 898a 8a8a 8a8b ( heart5 )
	8182 8282 8283 8542 8686 8687 854a 8686 8687 8586 8686 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 8586 8686 8687 898a 8a8a 8a8b ( heart6 )
	8182 8282 8283 8542 8686 8687 854b 8686 8687 8586 8686 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 8586 8642 8687 898a 8a8a 8a8b ( heart7 )
	8182 8282 8283 8542 8686 8687 854c 8686 8687 8586 8686 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 898a 8a8a 8a8b ( heart8 )
	8182 8282 8283 8542 8686 8687 854d 8686 8687 8586 8642 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 898a 8a8a 8a8b ( heart9 )
	8182 8282 8283 8542 8686 8687 854e 8686 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 898a 8a8a 8a8b ( heart10 )
	8182 8282 8283 8542 8686 8687 854f 8686 8687 85e8 e4e5 e987 85ec e0e1 ed87 85f8 8e8f fb87 8586 c2c3 8687 85fc c0c7 ff87 89ee 9e9e ef8b ( heart11 )
	8182 8282 8283 8542 8686 8687 8550 8686 8687 85e8 e4e5 e987 85ec e0e1 ed87 85f8 8c8d fb87 8586 c2c3 8687 85fc c0c1 ff87 89ee c4c5 ef8b ( heart12 )
	8182 8282 8283 8542 8686 8687 8551 8686 8687 85e8 e4e5 e987 85ec e0e1 ed87 85f8 9c9d fb87 8586 f9fa 8687 85fc bcbd ff87 89ee bebf ef8b ( heart13 )
	8182 8282 8283 8543 8686 8687 8552 8686 8687 8586 f0f3 8687 85f0 f1f2 f387 85f4 f5f6 f787 8586 f9fa 8687 85fc fdfe ff87 89ee ebea ef8b ( diamond1 )
	8182 8282 8283 8543 8686 8687 8546 8686 8687 8586 8686 8687 8586 4386 8687 8586 8643 8687 8586 8686 8687 8586 8686 8687 898a 8a8a 8a8b ( diamond2 )
	8182 8282 8283 8543 8686 8687 8547 8686 8687 8586 8686 8687 8586 4386 8687 8586 8643 8687 8586 4386 8687 8586 8686 8687 898a 8a8a 8a8b ( diamond3 )
	8182 8282 8283 8543 8686 8687 8548 8686 8687 8586 8686 8687 8586 4386 8687 8586 4343 8687 8586 4386 8687 8586 8686 8687 898a 8a8a 8a8b ( diamond4 )
	8182 8282 8283 8543 8686 8687 8549 8686 8687 8586 8686 8687 8586 4343 8687 8586 4343 8687 8586 8643 8687 8586 8686 8687 898a 8a8a 8a8b ( diamond5 )
	8182 8282 8283 8543 8686 8687 854a 8686 8687 8586 8686 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 8586 8686 8687 898a 8a8a 8a8b ( diamond6 )
	8182 8282 8283 8543 8686 8687 854b 8686 8687 8586 8686 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 8586 8643 8687 898a 8a8a 8a8b ( diamond7 )
	8182 8282 8283 8543 8686 8687 854c 8686 8687 8586 8686 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 898a 8a8a 8a8b ( diamond8 )
	8182 8282 8283 8543 8686 8687 854d 8686 8687 8586 8643 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 898a 8a8a 8a8b ( diamond9 )
	8182 8282 8283 8543 8686 8687 854e 8686 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 898a 8a8a 8a8b ( diamond10 )
	8182 8282 8283 8543 8686 8687 854f 8686 8687 8586 f0f3 8687 85f0 f1f2 f387 85f4 8e8f f787 8586 c2c3 8687 85fc c0c7 ff87 89ee 9e9e ef8b ( diamond11 )
	8182 8282 8283 8543 8686 8687 8550 8686 8687 8586 f0f3 8687 85f0 f1f2 f387 85f4 8c8d f787 8586 c2c3 8687 85fc c0c1 ff87 89ee c4c5 ef8b ( diamond12 )
	8182 8282 8283 8543 8686 8687 8551 8686 8687 8586 f0f3 8687 85f0 f1f2 f387 85f4 9c9d f787 8586 f9fa 8687 85fc bcbd ff87 89ee bebf ef8b ( diamond13 )
	8182 8282 8283 8540 8686 8687 8552 8686 8687 8586 d0d3 8687 85d0 d1d2 d387 85d4 d5d6 d787 8586 d9da 8687 85dc ddde df87 89e6 e2e3 e78b ( spade1 )
	8182 8282 8283 8540 8686 8687 8546 8686 8687 8586 8686 8687 8586 8640 8687 8586 4086 8687 8586 8686 8687 8586 8686 8687 898a 8a8a 8a8b ( spade2 )
	8182 8282 8283 8540 8686 8687 8547 8686 8687 8586 8686 8687 8586 8640 8687 8586 4086 8687 8586 8640 8687 8586 8686 8687 898a 8a8a 8a8b ( spade3 )
	8182 8282 8283 8540 8686 8687 8548 8686 8687 8586 8686 8687 8586 8640 8687 8586 4040 8687 8586 8640 8687 8586 8686 8687 898a 8a8a 8a8b ( spade4 )
	8182 8282 8283 8540 8686 8687 8549 8686 8687 8586 8686 8687 8586 4040 8687 8586 4040 8687 8586 8640 8687 8586 8686 8687 898a 8a8a 8a8b ( spade5 )
	8182 8282 8283 8540 8686 8687 854a 8686 8687 8586 8686 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 8586 8686 8687 898a 8a8a 8a8b ( spade6 )
	8182 8282 8283 8540 8686 8687 854b 8686 8687 8586 8686 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 8586 4086 8687 898a 8a8a 8a8b ( spade7 )
	8182 8282 8283 8540 8686 8687 854c 8686 8687 8586 8686 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 898a 8a8a 8a8b ( spade8 )
	8182 8282 8283 8540 8686 8687 854d 8686 8687 8586 4086 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 898a 8a8a 8a8b ( spade9 )
	8182 8282 8283 8540 8686 8687 854e 8686 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 898a 8a8a 8a8b ( spade10 )
	8182 8282 8283 8540 8686 8687 854f 8686 8687 8586 d0d3 8687 85d0 d1d2 d387 85d4 5657 d787 8586 5e5f 8687 85dc cecf df87 89e6 9f9f e78b ( spade11 )
	8182 8282 8283 8540 8686 8687 8550 8686 8687 8586 d0d3 8687 85d0 d1d2 d387 85d4 5a5b d787 8586 5e5f 8687 85dc cec9 df87 89e6 cccd e78b ( spade12 )
	8182 8282 8283 8540 8686 8687 8551 8686 8687 8586 d0d3 8687 85d0 d1d2 d387 85d4 5859 d787 8586 5c5d 8687 85dc 5455 df87 89e6 88c8 e78b ( spade13 )
	8182 8282 8283 8541 8686 8687 8552 8686 8687 8586 d8db 8687 85d8 d1d2 db87 85d4 d5d6 d787 8586 d9da 8687 85dc ddde df87 89e6 e2e3 e78b ( clover1 )
	8182 8282 8283 8541 8686 8687 8546 8686 8687 8586 8686 8687 8586 4186 8687 8586 8641 8687 8586 8686 8687 8586 8686 8687 898a 8a8a 8a8b ( clover2 )
	8182 8282 8283 8541 8686 8687 8547 8686 8687 8586 8686 8687 8586 4186 8687 8586 8641 8687 8586 4186 8687 8586 8686 8687 898a 8a8a 8a8b ( clover3 )
	8182 8282 8283 8541 8686 8687 8548 8686 8687 8586 8686 8687 8586 4186 8687 8586 4141 8687 8586 4186 8687 8586 8686 8687 898a 8a8a 8a8b ( clover4 )
	8182 8282 8283 8541 8686 8687 8549 8686 8687 8586 8686 8687 8586 4141 8687 8586 4141 8687 8586 8641 8687 8586 8686 8687 898a 8a8a 8a8b ( clover5 )
	8182 8282 8283 8541 8686 8687 854a 8686 8687 8586 8686 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 8586 8686 8687 898a 8a8a 8a8b ( clover6 )
	8182 8282 8283 8541 8686 8687 854b 8686 8687 8586 8686 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 8586 8641 8687 898a 8a8a 8a8b ( clover7 )
	8182 8282 8283 8541 8686 8687 854c 8686 8687 8586 8686 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 898a 8a8a 8a8b ( clover8 )
	8182 8282 8283 8541 8686 8687 854d 8686 8687 8586 4141 8687 8586 4141 8687 8586 4140 8687 8586 4141 8687 8586 8641 8687 898a 8a8a 8a8b ( clover9 )
	8182 8282 8283 8541 8686 8687 854e 8686 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 898a 8a8a 8a8b ( clover10 )
	8182 8282 8283 8541 8686 8687 854f 8686 8687 8586 d8db 8687 85d8 d1d2 db87 85d4 5657 d787 8586 cacb 8687 85dc cecf df87 89e6 9f9f e78b ( clover11 )
	8182 8282 8283 8541 8686 8687 8550 8686 8687 8586 d8db 8687 85d8 d1d2 db87 85d4 5a5b d787 8586 cacb 8687 85dc cec9 df87 89e6 cccd e78b ( clover12 )
	8182 8282 8283 8541 8686 8687 8551 8686 8687 8586 d8db 8687 85d8 d1d2 db87 85d4 5859 d787 8586 5c5d 8687 85dc 5455 df87 89e6 88c8 e78b ( clover13 )
	8182 8282 8283 8553 8686 8687 8586 8686 8687 8586 8686 8687 8578 797a 7b87 857c 7d7e 7f87 8586 8686 8687 8586 8686 8687 898a 8a8a 8a8b ( joker1 )
	8182 8282 8283 8553 8686 8687 8586 8686 8687 8586 8686 8687 8570 7172 7387 8574 7576 7787 8586 8686 8687 8586 8686 8687 898a 8a8a 8a8b ( joker2 )
	9192 9292 9293 9596 9696 9697 9596 9696 9697 9596 9696 9697 9596 9696 9697 9596 9696 9697 9596 9696 9697 9596 9696 9697 999a 9a9a 9a9b ( blank )

@splash-table
	0000 0000 0000 0000 0000 0098 9898 9898 9898 9898 9800 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a9 aaa9 aaa9 aaa9 aaa9 aa00 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00b1 b1b1 b1b1 b1b1 b1b1 b100 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a5 a4a5 a4a5 a5a4 a5a4 a500 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a5 00a5 00a5 a500 a500 a500 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a5 96a5 96a5 a596 a596 a500 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00b1 b1b1 b1b1 b1b1 b1b1 b100 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00aa a9aa a9aa a9aa a9aa a900 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00b1 b1b1 b1b1 b1b1 b1b1 b100 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a5 a5a5 a5a5 a5a5 a5a5 a500 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 a7a7 a5a7 a5a5 a5a5 a3a5 a3a3 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 00b8 b1b5 b9b1 b5b8 b2b5 b9b1 90b9 b1b5 b300 0000 0000 0000 0000
	0000 0000 0000 00ba 00ba ba00 baba 00ba b6b1 b5ba 00ba ba00 0000 0000 0000 0000
	0000 0000 0000 00ba 00ba ba00 baba 00ba b300 baba 00ba ba00 0000 0000 0000 0000
	0000 0000 0000 00b0 b1bb b6b1 bbb0 00b4 b6b1 bbb6 b1bb b6b1 9000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 a1a1 a5a1 a9b1 b1a9 a0a5 a0a0 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a5 a4a5 aaa6 a6aa a5a4 a500 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a5 00a5 aa00 00aa a500 a500 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 a8a5 96a5 aa00 00aa a596 a5a8 0000 0000 0000 0000 0000
	0000 0000 0000 0000 00ac abab abab afae aeaf abab abab ad00 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 abaf afab 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 00ab ab00 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 000f 2537 3d00 0018 3336 3125 3000 0012 2536 2800 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

@spritesheet
	efc7 8301 01ab c7ff efc7 8301 01ab c7ff
	c7c7 0101 01ef c7ff c7c7 0101 01ef c7ff
	ffff ffff ffff ffff 9301 0101 83c7 efff
	ffff ffff ffff ffff efc7 8301 83c7 efff
	c739 3939 3939 39c7 c739 3939 3939 39c7
	7387 e7e7 e7e7 e781 7387 e7e7 e7e7 e781
	c3b1 79f1 e3c7 8901 c3b1 79f1 e3c7 8901
	7f81 f3ef 93f1 7183 7f81 f3ef 93f1 7183
	f1e3 e3c3 9300 f3e1 f1e3 e3c3 9300 f3e1
	3907 bf3f 03f1 3183 3907 bf3f 03f1 3183
	c53b 3f3f 0331 3183 c53b 3f3f 0331 3183
	7f81 c1f3 e7cf 9f3f 7f81 c1f3 e7cf 9f3f
	7f83 3131 8331 3183 7f83 3131 8331 3183
	7f83 3131 83e7 cf9f 7f83 3131 83e7 cf9f
	3c3c 99c3 c399 3c3c 3c3c 99c3 c399 3c3c
	e1f3 f3f3 f3e3 c79f e1f3 f3f3 f3e3 c79f
	8319 3939 3939 3180 8319 3939 3939 3180
	3993 9387 8793 9339 3993 9387 8793 9339
	87e3 c3c9 c199 993c 87e3 c3c9 c199 993c
	118c 9c9c 9c9c 9c21 118c 9c9c 9c9c 9c21
	f8f8 f8f0 e000 0000 f8fa fdfa e52a 150a
	1f1f 1f0f 0700 0000 1fbf 5faf 57ac 54a8
	0713 ffff e7ff ffff 0f1f 7f83 e7fe ff7e
	e0c8 ffff e7ff ffff f0f8 fec1 e77f ff7e
	051d ffff e7ff ffff 071f 7f83 e7fe ff7c
	a0b8 ffff e7ff ffff e0f8 fec1 e77f ff3e
	0719 ffff e7ff ffff 071f 7f83 e7ff fe7f
	e098 ffff f3ff ffff e0f8 fec1 f3ff 7ffe
	ffff f8f8 f8ff f8f9 bfef f8f8 f8fb f8f9
	ffff 1f1f 1fff 1f9f fdf7 1f1f 1fdf 1f9f
	ffff f8f8 f8ff f8f8 beef f8f8 f8fb f8f8
	ffff 1f1f 1fff 1f1f 7df7 1f1f 1fdf 9f9f
	3f40 8080 8080 403f 3f40 8080 8080 403f
	ff00 0000 0000 00ff ff00 0000 0000 00ff
	fc02 0101 0101 02fc fc02 0101 0101 02fc
	ff00 e0f0 f0e0 00ff ff00 0000 0000 00ff
	3f40 9fbf bf9f 403f 3f40 8080 8080 403f
	ff00 ffff ffff 00ff ff00 0000 0000 00ff
	fc02 f9fd fdf9 02fc fc02 0101 0101 02fc
	3f40 98bc bc98 403f 3f40 8080 8080 403f
	0000 0000 0000 0000 0c0c 1818 0030 3000
	0000 0000 0000 0000 0000 0000 0030 3000
	001c 37ea 77fe 3f3a 001c 37ea 77fe 3f3e
	3f2e 3f3a 3f3e 373f 3f3e 3f3e 3f3e 3f3f
	3c66 dbdb c3db 5a3c 0000 0000 0000 0000
	3c46 dbc7 dbdb 463c 0000 0000 0000 0000
	002f 0002 0000 0000 002f 023f 1f02 0a0a
	0000 0000 00ff ffff 0000 0000 00ff ffff
	ffff fcf0 e0c0 8000 ffff fcf0 e0c0 8000
	c000 0007 0f1f 1f1f c000 0007 0f1c 1818
	0300 00e0 f0f8 f8f8 0300 00e0 f038 1818
	ffff 3f0f 0703 0100 ffff 3f0f 0703 0100
	0080 c0e0 f0fc ffff 0080 c0e0 f0fc ffff
	1f1f 1f0f 0700 00c0 1818 1c0f 0700 00c0
	f8f8 f8f0 e000 0003 1818 38f0 e000 0003
	0001 0307 0f3f ffff 0001 0307 0f3f ffff
	ffff ffff ffff ffff ffff fcf0 e0c0 8000
	ffff ffff fffc f8f8 c000 0007 0f1c 1818
	ffff ffff ff3f 1f1f 0300 00e0 f038 1818
	ffff ffff ffff ffff ffff 3f0f 0703 0100
	ffff ffff ffff ffff 0080 c0e0 f0fc ffff
	f8f8 fcff ffff ffff 1818 1c0f 0700 00c0
	1f1f 3fff ffff ffff 1818 38f0 e000 0003
	ffff ffff ffff ffff 0001 0307 0f3f ffff
	0000 0024 6676 ffff 0000 0024 6676 ffff
	0000 0f1f 3f3f 3f3f 0000 0f1f 3f3f 3f3f
	0000 ffff ffff ffff 0000 ffff ffff ffff
	0000 f0f8 fcfc fcfc 0000 f0f8 fcfc fcfc
	e7db e77e 183c 3e56 e7db e77e 183c 3858
	3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f
	ffff ffff ffff ffff ffff ffff ffff ffff
	fcfc fcfc fcfc fcfc fcfc fcfc fcfc fcfc
	0000 0000 0000 0000 0500 0000 0000 ffff
	3f3f 3f3f 1f0f 0000 3f3f 3f3f 3f3f 3f1f
	ffff ffff ffff 0000 ffff ffff ffff ffff
	fcfc fcfc f8f0 0000 fcfc fcfc fcfc fcf8
	ffff 7fff e7ff ff7f 0719 ff83 e7ff feff
	fffb ffff f3ff fffe e09c fec1 f3ff 7fff
	ffff 7fff e7ff ff7f 0713 ff83 e7fe fffe
	fffb ffff e7ff fffe e0cc fec1 e77f ff7f
	04fc fcf8 f000 0000 04fc fcf8 f8f0 0000
	0000 0f10 2020 2020 0000 0f10 2020 2020
	0000 ff00 0000 0000 0000 ff00 0000 00ff
	0000 f008 0404 0404 0000 f008 0404 0404
	0000 0000 4020 20c0 0000 0000 0000 0000
	2020 2020 2020 2020 2121 2121 2121 2121
	0000 0000 0000 0000 8142 2418 1824 4281
	0404 0404 0404 0404 8484 8484 8484 8484
	0000 0002 9041 04ff 0000 0002 9041 04ff
	2020 2020 100f 0000 2020 2020 303f 3f1f
	0000 0000 00ff 0000 ff00 0000 00ff ffff
	0404 0404 08f0 0000 0404 0404 0cfc fcf8
	ffff 7fff e7ff ff7f 051d ff83 e7fe fffc
	fffb ffff e7ff fffe a0bc fec1 e77f ff3f
	ffff ffff ffff 0000 1800 1800 0000 ffff
	1800 1800 0000 0000 1800 1800 0000 ffff
	fffe fcf8 f0e0 c080 fffe fcf8 f0e0 c080
	ff7f 3f1f 0f07 0301 ff7f 3f1f 0f07 0301
	0000 0000 0000 0000 0000 0000 0000 0000
	80c0 e0f0 f8fc feff 80c0 e0f0 f8fc feff
	0000 ffe7 c381 8100 0000 ffe7 c381 8100
	00cf cf00 00f9 f900 00cf cf00 00f9 f900
	00aa aa00 00ff ff00 00aa aa00 00ff ff00
	0103 070f 1f3f 7fff 0103 070f 1f3f 7fff
	c8a1 2452 14b9 5238 c8a1 2452 14b9 5238
	ff00 99a7 e599 00ff ff00 99a7 e599 00ff
	bd89 99e5 a799 91bd bd89 99e5 a799 91bd
	ffff bf29 5205 4000 ffff bf29 5205 4000
	2b05 0805 0000 0000 2b05 0805 0000 0000
	d4a0 10a0 0000 0000 d4a0 10a0 0000 0000
	3c76 fddf ffff ffff 3c7e ffff ffff ffff
	ffbf fffe fbff ffff ffbf ffff ffff ffff
	3c3c 3c3c 7800 0000 3c3c 3c3c fcfc 3800
	00ff ffff ff00 0000 00ff ffff ffff 0000
	00ff ffff ff80 0000 00ff ffff ffff 8000
	0078 3c3c 3c3c 3c3c 0078 3c3c 3c3c 3c3c
	3c3c 3c3c 3c1e 0000 3c3c 3c3c 3c3f 1f0c
	0000 c0f0 f8f8 7c3c 0000 c0f0 f8f8 fc7c
	3e3f 1f1f 0700 0000 3e3f 1f1f 0f07 0000
	c0e0 f078 3c1e 0f07 c0e0 f078 3c1e 0f07
	0078 3b3f 3f3f 3e3c 0078 3b3f 3f3f 3f3e
	0000 030f 1f1f 3e3c 0000 030f 1f1f 3f3e
	3c3c 3c3c 3c3c 3c3c 3c3c 3c3c 3c3c 3c3c
	7cfc f8f8 e000 0000 7cfc f8f8 f8e0 0000
	f8fd faf5 ea15 eaf5 fffa fdfa d5ea 150a
	1f5f bf5f ab54 ab57 ffbf 5faf 57ab 54a8
	f5fa fcff ffff 0000 0a05 0300 0000 ffff
	af5f 3fff ffff 0000 50a0 c000 0000 ffff
	f8ff fff7 df3f ffff fff8 f8f8 e0c0 0000
	1fbf bfaf bbdc eff7 ff5f 5f5f 4723 1008
	ffff f8f8 f8ff ffff beef ffff fff8 f8f8
	ffff 1f1f 1fff ffff 7df7 ffff ff1f 1f1f
	ffff ffff ffff 0000 0000 0000 0000 ffff
	f7f7 f7f7 f7f7 0000 2808 0828 0808 ffff
	f8ff ffff df3f ffff fff8 f8f0 e0c0 0000
	1fff ffff fbfc ffff ff1f 1f0f 0703 0000
	0000 0000 0000 0000 5000 0000 0000 ffff
	1f1f 1f0f 0700 0000 5f5f 5f4f 4722 1008
	ffff f8f8 f8f8 f8ff beef f8f8 f8f8 f8fb
	ffff 1f1f 1f1f 1fff 7df7 1f1f 1f1f 1fdf
	0000 0000 0000 0000 0000 0000 0000 ffff
	2000 0020 0000 0000 2808 0828 0808 ffff
	f8f8 f8f0 e000 0000 f8f8 f8f0 e060 0000
	1f1f 1f0f 0700 0000 1f1f 1f0f 0706 0000
	fefc f8f0 e0c0 8020 fefc f8f0 e0c0 8020
	0001 0100 0000 0103 0000 0201 0000 0103
	0080 8000 0000 80c0 0080 4080 0000 80c0
	7f3f 1f0f 0703 0100 7f3f 1f0f 0703 0100
	4000 0001 0181 c0f0 4000 0083 1183 c4f0
	071d 7fbf cfff ffff 071f 3fc3 cffe ff7e
	e0b8 fefd e7ff ffff e0f8 fcc3 e77f ff7e
	0200 0080 8081 0307 0202 00c0 82d1 0307
	f8e0 c080 8000 0000 f8e0 c080 8000 2000
	ffff f8f8 f8ff f8f9 bdef f8f8 f8fb f8fd
	ffff 1f1f 1fff 1f9f bdf7 1f1f 1fdf 1fbf
	1f07 0301 0100 0000 1f07 0301 0100 0000
	ffff ffff fff8 e0c0 ffff ffff fff8 f0c0
	f8f9 f8f1 e001 0001 f8fd f8f5 e815 2815
	1f9f 1f8f 0780 0080 1fbf 1faf 17a8 14a8
	ffff ffff ff1f 0703 ffff ffff ff1f 0f03
	fffe fdff fefe fdfb 0003 0301 0101 0307
	ffff bfff 7f7f bfef 0040 c080 8080 c0d0
	0000 0000 0000 0000 0a05 0300 0000 ffff
	0000 0000 0000 0000 50a0 c000 0000 ffff
	ffff ffeb fdfa ffff ffff ff17 0305 0000
	ffff ffd7 af7f bfff ffff ffe8 d080 4000
	c0c0 c0c0 c0c0 0000 c0c0 e2c0 ead2 ffff
	0303 0303 0303 0000 0303 4703 574b ffff
	ffff ffff ffff ffff ffff fffc f0e0 c080
	ffff ffff ffff ffff ffff ff7f 1f0f 0703
	57ef 1fff ffff 0000 a890 e000 0000 ffff
	eaf7 f8ff ffff 0000 1509 0700 0000 ffff
	ffff ffff ffff ffff 8000 0000 0000 0000
	ffff ffff ffff ffff 0101 0000 0000 0000
	ffff ddeb d5e9 0000 c0c0 e0d4 e8d4 ffff
	ffff bbd7 ab97 0000 0303 072b 172b ffff
	ffff ffff ffff ffff fefc f8f0 e0c0 8102
	fdfa f7fd fefe fdfb 060d 1923 4181 0307
	bf5f efbf 7f7f bfef 60b0 98c4 8281 c0d0
	ffff ffff ffff ffff 7f3f 1f0f 0703 8140
	ffbb d7eb f5fa fcfe 04cc f8f4 fafd ffff
	ffff 7fff cfff ff7f 071d ff83 cffe fbfc
	fffb feff e7ff fffe e0bc ffc1 e77f df3f
	fadd eb57 af5f 3f7f 2533 1faf 5fbf ffff
	ffff ffaf d5eb f0fc 0000 80d1 ebf5 ffff
	ffff f8f8 f8ff f8f9 bfef ffff fffb ffff
	ffff 1f1f 1fff 1f9f fdf7 ffff ffdf ffff
	ffff ffeb d7af 0f3f 0000 0095 abd7 ffff
	ffff ffff ffff efdf ffff ffff fff8 f0f0
	faff faf7 ea57 aad7 fdf9 fdf9 d5a9 5529
	5fff 5fef 57ea 55eb bf9f bf9f ab95 aa94
	ffff ffff ffff f7fb ffff ffff ff1f 0f17

A src/donsol.tal => src/donsol.tal +1413 -0
@@ 0,0 1,1413 @@
( Donsol )

|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
|90 @Mouse      &vector $2 &x       $2 &y      $2 &state $1 &chord $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

|0000

@mode $1
@score $1
@deck
	&length $1
	&cards $36
@player
	&hp $1 &hp-tween $1
	&sp $1 &sp-tween $1
	&dp $1 &xp $1
	&ran $1 &sick $1
@table
	&a $1 &b $1 &c $1 &d $1 &selection $1 &timer $1
@cursor
	&x $2 &y $2 &last $1
@frame
	&x $2 &y $2 &x2 $2 &y2 $2

|0100 ( -> )

	( theme )
	#0f7f .System/r DEO2
	#057f .System/g DEO2
	#057f .System/b DEO2

	( resize )
	#0120 .Screen/width DEO2
	#00e0 .Screen/height DEO2

	( place )
	.Screen/width DEI2 #01 SFT2
	DUP2 #00e0 #01 SFT2 SUB2 .frame/x STZ2
		#00e0 #01 SFT2 ADD2 .frame/x2 STZ2
	.Screen/height DEI2 #01 SFT2
	DUP2 #0090 #01 SFT2 SUB2 .frame/y STZ2
		#0090 #01 SFT2 ADD2 .frame/y2 STZ2

	( random )
	;prng-init JSR2

	( theme support )
	;load-theme JSR2

	#09 .player/hp STZ
	#0a .player/sp STZ
	#0b .player/xp STZ

	,go-menu JSR

BRK

( menu )

@go-menu ( -- )

	;on-button-menu   .Controller/vector DEO2
	;on-mouse-menu    .Mouse/vector DEO2
	;on-frame-menu    .Screen/vector DEO2

	;clear-screen JSR2
	;draw-menu JSR2

JMP2r

@on-button-menu ( -> )

	.Controller/button DEI
	[ #01 ] NEQk NIP ,&no-a JCN
		;go-game JSR2 POP BRK
		&no-a
	[ #40 ] NEQk NIP ,&no-left JCN
		( clamp ) .mode LDZ #01 LTH ,&no-left JCN
		.mode LDZ #01 SUB .mode STZ
		;draw-menu/options JSR2 POP BRK
		&no-left
	[ #80 ] NEQk NIP ,&no-right JCN
		( clamp ) .mode LDZ #01 GTH ,&no-right JCN
		.mode LDZ INC .mode STZ
		;draw-menu/options JSR2 POP BRK
		&no-right
	POP

BRK

@on-mouse-menu ( -> )

	#42 .Mouse/state DEI #00 NEQ ADD ;draw-cursor JSR2

	.Mouse/y DEI2 .frame/y LDZ2 SUB2 #03 SFT2 NIP #11 NEQ ,&skip JCN
		.Mouse/x DEI2 .frame/x LDZ2 SUB2 #03 SFT2 NIP
		DUP #09 GTH ,&no-easy JCN
			#00 ;set-mode JSR2
			,&resume JMP
			&no-easy
		DUP #11 GTH ,&no-normal JCN
			#01 ;set-mode JSR2
			,&resume JMP
			&no-normal
		DUP #18 GTH ,&no-hard JCN
			#02 ;set-mode JSR2
			,&resume JMP
			&no-hard
		&resume
		POP
	&skip
	.Mouse/state DEI #00 EQU ,&no-click JCN
		;go-game JSR2 BRK
		&no-click

BRK

@on-frame-menu ( -> )

	( nothing.. )

BRK

@draw-menu ( -- )

	( draw castle )
	#0320 #0000
	&loop
		( x ) DUP2 #0020 ( mod ) DIV2k MUL2 SUB2 #30 SFT2 .frame/x LDZ2 ADD2 #0010 SUB2 .Screen/x DEO2
		( y ) DUP2 #0020 DIV2 #30 SFT2 .frame/y LDZ2 ADD2 #0040 SUB2 .Screen/y DEO2
		( addr ) DUP2 ;splash-table ADD2 LDA #40 SUB #00 SWP #40 SFT2 ;spritesheet ADD2 .Screen/addr DEO2
		( draw ) #81 .Screen/sprite DEO
		INC2 GTH2k ,&loop JCN
	POP2 POP2

	( draw score )
	.frame/x LDZ2 #0068 ADD2
	.frame/y LDZ2 #0008 SUB2
	.score LDZ #02
		;draw-value JSR2

	&options
	
	.frame/x LDZ2 .frame/y LDZ2
		( easy )
		OVR2 #00e0 #01 SFT2 #0048 SUB2 ADD2
		OVR2 #0078 ADD2
			#0010 ADD2 ;easy-txt #02 [ .mode LDZ #00 EQU ADD ] ;draw-label JSR2
		.Screen/x DEI2 #002c SUB2 .Screen/x DEO2
		;cursor-hor-icn .Screen/addr DEO2
		#01 [ .mode LDZ #00 EQU MUL ] .Screen/sprite DEO
		( normal )
		OVR2 #00e0 #01 SFT2 #0018 SUB2 ADD2
		OVR2 #0078 ADD2
			#0010 ADD2 ;normal-txt #02 [ .mode LDZ #01 EQU ADD ] ;draw-label JSR2
		.Screen/x DEI2 #003c SUB2 .Screen/x DEO2
		;cursor-hor-icn .Screen/addr DEO2
		#01 [ .mode LDZ #01 EQU MUL ] .Screen/sprite DEO
		( hard )
		OVR2 #00e0 #01 SFT2 #0028 ADD2 ADD2
		OVR2 #0078 ADD2
			#0010 ADD2 ;hard-txt #02 [ .mode LDZ #02 EQU ADD ] ;draw-label JSR2
		.Screen/x DEI2 #002c SUB2 .Screen/x DEO2
		;cursor-hor-icn .Screen/addr DEO2
		#01 [ .mode LDZ #02 EQU MUL ] .Screen/sprite DEO
	POP2 POP2

JMP2r

( game )

@go-game ( -- )

	;on-button-game   .Controller/vector DEO2
	;on-mouse-game    .Mouse/vector DEO2
	;on-frame-game    .Screen/vector DEO2

	;start-game JSR2

JMP2r

@on-frame-game ( -> )

	( table timer )
	.table/timer LDZ #00 EQU ,&no-timer JCN
		.table/timer LDZ #01 SUB [ DUP ] .table/timer STZ
		( blink cursor )
		#41 .table/timer LDZ #02 AND ADD ;draw-cursor JSR2
		( auto enter )
		#00 NEQ ,&no-timer-end JCN
			;enter-room JSR2
			&no-timer-end
		.player/xp LDZ #36 LTH ,&no-end JCN
			;dialogs/victory ;draw-dialog JSR2
			&no-end
		&no-timer

	( tween )
	.player/hp LDZ2
	GTHk #00 EQU ,&no-hp-dec JCN
		INCk .player/hp-tween STZ
		;draw-status JSR2
		&no-hp-dec
	LTHk #00 EQU ,&no-hp-inc JCN
		DUP #01 SUB .player/hp-tween STZ
		;draw-status JSR2
		&no-hp-inc
	POP2

	.player/sp LDZ2
	GTHk #00 EQU ,&no-sp-dec JCN
		INCk .player/sp-tween STZ
		;draw-status JSR2
		&no-sp-dec
	LTHk #00 EQU ,&no-sp-inc JCN
		DUP #01 SUB .player/sp-tween STZ
		;draw-status JSR2
		&no-sp-inc
	POP2

BRK

@on-button-game ( -> )

	( timer locked )
	.table/timer LDZ #00 EQU ,&enabled JCN
		BRK
		&enabled

	.Controller/button DEI
	[ #01 ] NEQk NIP ,&no-a JCN
		.table/selection LDZ #01 ;select JSR2 POP BRK
		&no-a
	[ #02 ] NEQk NIP ,&no-b JCN
		;run JSR2 POP BRK
		&no-b
	[ #08 ] NEQk NIP ,&no-sel JCN
		;load-theme JSR2
		;go-menu JSR2 POP BRK
		&no-sel
	#04 SFT
	[ #04 ] NEQk NIP ,&no-left JCN
		.table/selection LDZ #01 SUB #00 ;select JSR2 POP BRK
		&no-left
	[ #08 ] NEQk NIP ,&no-right JCN
		.table/selection LDZ INC #00 ;select JSR2 POP BRK
		&no-right
	POP

BRK

@on-mouse-game ( -> )

	( timer locked )
	.table/timer LDZ #00 EQU ,&enabled JCN
		BRK
		&enabled

	( run button on right-click or victory )
	.Mouse/state DEI #02 LTH ,&no-mouse2 JCN
		;run JSR2
		&no-mouse2

	( run button clicked )
	.Mouse/state DEI #00 EQU ,&no-run-button JCN
		( click anywhere on the victory screen to continue )
		.player/xp LDZ #36 EQU ,&do-run JCN
		( or on the run button in the interface )
		.Mouse/y DEI2 .frame/y LDZ2 SUB2 #03 SFT2 #0002 NEQ2 ,&no-run-button JCN 
		.Mouse/x DEI2 .frame/x LDZ2 SUB2 #03 SFT2 #0015 SUB2 #0005 GTH2 ,&no-run-button JCN
			&do-run
			;run JSR2
			&no-run-button

	( hover card )
	.Mouse/y DEI2 .frame/y LDZ2 #0030 ADD2 SUB2 #0048 LTH2
	.Mouse/x DEI2 .frame/x LDZ2 SUB2 #00e0 LTH2
		#0101 NEQ2 ,&no-hover JCN
			.Mouse/x DEI2 .frame/x LDZ2 SUB2 #0038 DIV2 NIP
			.Mouse/state DEI #01 EQU
				;select JSR2
			( release ) #00 .Mouse/state DEO
			&no-hover
	#42 .Mouse/state DEI #00 NEQ ADD ;draw-cursor JSR2
	( release-record ) #0000 .Mouse/state DEO .cursor/last STZ

BRK

( core )

@start-game ( -- )

	( reset player )
	#1515 .player/hp STZ2
	#0000 .player/sp STZ2
	#00 .player/dp STZ
	#00 .player/xp STZ
	#00 .player/ran STZ
	#00 .player/sick STZ

	( start deck )
	;init-deck JSR2
	;shuffle-deck JSR2

	;clear-screen JSR2
	;dialogs/modes .mode LDZ #00 SWP #10 SFT2 ADD2 LDA2 ;draw-dialog JSR2
	;enter-room JSR2

JMP2r

@set-mode ( mode -- )

	DUP .mode LDZ NEQ ,&changed JCN
		POP JMP2r
		&changed
	.mode STZ
	;draw-menu/options JSR2

JMP2r

@enter-room ( -- )

	#0400
	&loop
		,pull-card JSR OVR .table ADD STZ
		INC GTHk ,&loop JCN
	POP2
	;redraw JSR2

JMP2r

@pull-card ( -- card )

	.deck/length LDZ ,&continue JCN
		#36 JMP2r
		&continue
	( pull ) .deck/cards LDZ
	( decr ) .deck/length LDZ #01 SUB .deck/length STZ
	( shift left )
	#3600
	&loop
		DUP .deck/cards ADD
		( get card ) INCk LDZ
		( put card ) SWP STZ
		INC GTHk ,&loop JCN
	POP2

JMP2r

@init-deck ( -- )

	#3600
	&loop
		DUP DUP .deck/cards ADD STZ
		INC GTHk ,&loop JCN
	POP2
	#36 .deck/length STZ

JMP2r

@shuffle-deck ( -- )

	( first shuffle )
	#3600
	&a
		DUP
			( seed ) [ ;prng JSR2 ADD ] #36 ( mod ) DIVk MUL SUB
			( a b ) OVR .deck/cards ADD LDZ OVR .deck/cards ADD LDZ
			( b a ) SWP2 STH .deck/cards ADD STZ STHr .deck/cards ADD STZ
		INC GTHk ,&a JCN
	POP2
	( second shuffle )
	#3600
	&b
		DUP
			( seed ) [ ;prng JSR2 ADD ] #36 ( mod ) DIVk MUL SUB
			( a b ) OVR .deck/cards ADD LDZ OVR .deck/cards ADD LDZ
			( b a ) SWP2 STH .deck/cards ADD STZ STHr .deck/cards ADD STZ
		INC GTHk ,&b JCN
	POP2

JMP2r

@return-card ( card -- )

	.deck/length LDZ .deck/cards ADD STZ
	.deck/length LDZ INC .deck/length STZ

JMP2r

@pick-card ( id -- )

	DUP #36 LTH ,&not-flipped JCN
		POP JMP2r
		&not-flipped
	( set xp )
	.player/xp LDZ INC
		DUP .player/xp STZ
		.score LDZ [ GTHk #01 JCN SWP POP ] .score STZ
	DUP #00 SWP ;card-types ADD2 LDA
	( route card type )
	DUP #00 EQU ;pick-potion JCN2
	DUP #01 EQU ;pick-shield JCN2
	DUP ;pick-enemy JCN2

JMP2r

@pick-potion ( card type -- )

	POP
	.player/sick LDZ #01 NEQ ,&no-sick JCN
		;dialogs/sickness ;draw-dialog JSR2
		POP JMP2r
		&no-sick
	.player/hp LDZ #15 NEQ ,&no-waste JCN
		;dialogs/waste ;draw-dialog JSR2
		POP JMP2r
		&no-waste
	( get ) #00 SWP ;card-values ADD2 LDA .player/hp LDZ ADD
	( set ) #15 LTHk #01 JCN SWP POP .player/hp STZ
	( set sick ) #01 .player/sick STZ
	;dialogs/potion ;draw-dialog JSR2

JMP2r

@pick-shield ( card type -- )

	POP
	( get ) #00 SWP ;card-values ADD2 LDA
	( set ) .player/sp STZ
	( set max durability ) #16 .player/dp STZ
	( set sick ) #00 .player/sick STZ
	;dialogs/shield ;draw-dialog JSR2

JMP2r

@pick-enemy ( card type -- )

	POP
	( set sick ) #00 .player/sick STZ
	( get ) #00 SWP ;card-values ADD2 LDA
	.player/sp LDZ ,&shielding JCN

	&unshielded
		( damages ) ;take-damages JSR2
		( test death ) .player/hp LDZ #00 EQU ;&death JCN2
		;dialogs/unshielded ;draw-dialog JSR2
		JMP2r

	&shielding ( value -- )
		( test breaking ) DUP INC .player/dp LDZ GTH ,&breaking JCN
		( test blocking ) DUP .player/sp LDZ LTH ,&blocking JCN
		( durability ) DUP .player/dp STZ
		( damages ) .player/sp LDZ SUB ;take-damages JSR2
		( test death ) .player/hp LDZ #00 EQU ,&death JCN
		;dialogs/damages ;draw-dialog JSR2
		JMP2r

	&breaking ( value -- )
		( break shield ) #00 DUP .player/sp STZ .player/dp STZ
		( damages ) ;take-damages JSR2
		( test death ) .player/hp LDZ #00 EQU ,&death JCN
		;dialogs/breaking ;draw-dialog JSR2
		JMP2r

	&blocking ( value -- )
		( durability ) .player/dp STZ
		;dialogs/blocking ;draw-dialog JSR2
		JMP2r

	&death ( -- )
		;dialogs/death ;draw-dialog JSR2

JMP2r

@take-damages ( mod -- )

	( negative )
	DUP #80 LTH ,&no-neg JCN
		POP
		JMP2r
		&no-neg
	( killing )
	DUP .player/hp LDZ LTH ,&no-kill JCN
		POP #00 .player/hp STZ
		JMP2r
		&no-kill
	.player/hp LDZ SWP SUB .player/hp STZ

JMP2r

@select ( id state -- )

	.player/hp LDZ #00 GTH ,&alive JCN
		POP2 JMP2r
		&alive

	SWP
	( skip changed if has state )
	OVR ,&state JCN
	( check changed )
	DUP .table/selection LDZ NEQ ,&changed JCN
		POP2 JMP2r
		&changed
	&state
	;clear-selection JSR2

	OVR #00 EQU ,&no-use JCN
		DUP .table ADD LDZ ;pick-card JSR2
		DUP ;flip-card JSR2
		;draw-status JSR2
		&no-use

	#03 AND .table/selection STZ
	#01 ;draw-selection JSR2
	POP

JMP2r

@flip-card ( table -- )

	( already flipped )
	DUP .table ADD LDZ #36 NEQ ,&continue JCN
		POP JMP2r
		&continue

	#36 SWP .table ADD STZ
	;draw-table JSR2

	( start room timer )
	.player/hp LDZ #00 EQU ,&no-timer JCN
	;count-table JSR2 #04 NEQ ,&no-timer JCN
		#30 .table/timer STZ
		#00 .player/ran STZ
		&no-timer

JMP2r

@count-table ( -- count )

	( create counter ) LITr 00
	#0400
	&count
		DUP .table ADD LDZ #36 NEQ ,&continue JCN
			INCr
			&continue
		INC GTHk ,&count JCN
	POP2
	STHr

JMP2r

@count-monsters ( -- count )

	( create counter ) LITr 00
	#0400
	&count
		DUP .table ADD LDZ #36 EQU ,&continue JCN
		DUP .table ADD LDZ #00 SWP ;card-types ADD2 LDA #02 LTH ,&continue JCN
			INCr
			&continue
		INC GTHk ,&count JCN
	POP2
	STHr

JMP2r

@can-run ( -- flag )

	( can always run in first room )
	.deck/length LDZ ;count-table JSR2 #3200 NEQ2 ,&started JCN
		#01 JMP2r
		&started

	.mode LDZ
	( When all monsters in the room have been dealt with,
		or when the player has not escaped the previous room. )
	[ #00 NEQk NIP ] ,&no-easy JCN
		;count-monsters JSR2 #00 EQU
		.player/ran LDZ #00 EQU
			#0000 NEQ2 NIP JMP2r
		&no-easy
	( When the player has not escaped the previous room. )
	[ #01 NEQk NIP ] ,&no-normal JCN
		.player/ran LDZ #00 EQU NIP JMP2r
		&no-normal
	( When all monsters in the room have been dealt )
	[ #02 NEQk NIP ] ,&no-hard JCN
		;count-monsters JSR2 #00 EQU NIP JMP2r
		&no-hard
	POP

JMP2r

@run ( -- )

	( in lobby )
	.deck/length LDZ ;count-table JSR2 #3200 NEQ2 ,&started JCN
		;start-game JSR2 JMP2r
		&started
	( when dead )
	.player/hp LDZ #00 GTH ,&alive JCN
		;start-game JSR2 JMP2r
		&alive
	( when finished )
	.player/xp LDZ #36 LTH ,&incomplete JCN
		;start-game JSR2 JMP2r
		&incomplete
	( cannot run )
	;can-run JSR2 ,&continue JCN
		;dialogs/cannot_run ;draw-dialog JSR2
		JMP2r
		&continue
	( return cards )
	#0400
	&count
		DUP .table ADD LDZ #36 EQU ,&skip JCN
		DUP .table ADD LDZ ;return-card JSR2
		&skip
		INC GTHk ,&count JCN
	POP2
	#01 .player/ran STZ
	;enter-room JSR2
	;dialogs/run ;draw-dialog JSR2

JMP2r

@redraw ( -- )

	;draw-status JSR2
	;clear-selection JSR2
	#01 ;draw-selection JSR2
	;draw-table JSR2

JMP2r

@draw-dialog ( dialog* -- )

	STH2
	.frame/x LDZ2 .Screen/x DEO2
	.frame/y LDZ2 #0088 ADD2 .Screen/y DEO2
	( auto x ) #01 .Screen/auto DEO
	#1800
	&loop
		( get offset ) DUP #00 SWP STH2kr ADD2 LDA
		( get char ) #00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2
		#02 .Screen/sprite DEO
		INC GTHk ,&loop JCN
	POP2
	( auto none ) #00 .Screen/auto DEO
	POP2r

JMP2r

@draw-table ( -- )

	#0400
	&loop
		STHk
		STHkr #00 SWP #0038 MUL2 .frame/x LDZ2 ADD2
		#0030 .frame/y LDZ2 ADD2
		STHr .table ADD LDZ ,draw-card JSR
		INC GTHk ,&loop JCN
	POP2

JMP2r

@draw-card ( x* y* id -- )

	STH
	.Screen/y DEO2
	.Screen/x DEO2
	STHr
	( get card nametable )
	#00 SWP #0036 MUL2 ;graphics ADD2 STH2
	( auto x ) #01 .Screen/auto DEO
	#3600
	&loop
		( get offset ) DUP #00 SWP STH2kr ADD2 LDA
		( get tile ) #40 SUB #00 SWP #40 SFT2 ;spritesheet ADD2 .Screen/addr DEO2
		( draw ) #81 .Screen/sprite DEO
		DUP #06 ( mod ) DIVk MUL SUB #05 NEQ ,&no-edge JCN
			.Screen/x DEI2 #0030 SUB2 .Screen/x DEO2
			.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
			&no-edge
		INC GTHk ,&loop JCN
	POP2
	( auto none ) #00 .Screen/auto DEO
	POP2r

JMP2r

@clear-selection ( -- )

	( clear label )
	.frame/x LDZ2 .Screen/x DEO2
	.frame/y LDZ2 #0020 ADD2 .Screen/y DEO2
	;blank-icn .Screen/addr DEO2
	( auto x ) #01 .Screen/auto DEO
	#1b00
	&name-loop
		#01 .Screen/sprite DEO
		INC GTHk ,&name-loop JCN
	POP2
	( auto none ) #00 .Screen/auto DEO

	( clear cursors )
	.frame/y LDZ2 #007c ADD2 .Screen/y DEO2
	;blank-icn .Screen/addr DEO2
	#0400
	&cursors-loop
		STHk
		.frame/x LDZ2 #0014 ADD2 [ STHr #00 SWP #0038 MUL2 ADD2 ] .Screen/x DEO2
		#01 .Screen/sprite DEO
		INC GTHk ,&cursors-loop JCN
	POP2

JMP2r

@draw-selection ( color -- )

	STH
	.frame/x LDZ2
	.frame/y LDZ2 #0020 ADD2
		.table .table/selection LDZ ADD LDZ
		#00 SWP #10 SFT2 ;card-names ADD2 LDA2
		STHkr #02 MUL
		;draw-label JSR2

	.frame/x LDZ2 #0014 ADD2 [ .table/selection LDZ #00 SWP #0038 MUL2 ADD2 ] .Screen/x DEO2
	.frame/y LDZ2 #007c ADD2 .Screen/y DEO2
	;cursor-ver-icn .Screen/addr DEO2
		STHr #03 MUL .Screen/sprite DEO

JMP2r

@draw-status ( -- )

	( HP )
	.frame/x LDZ2
	.frame/y LDZ2
		OVR2 OVR2 #0010 ADD2 ;hp-txt #02 ;draw-label JSR2
		OVR2 #0020 ADD2 OVR2 #0010 ADD2 .player/hp-tween LDZ #01 ;draw-value JSR2
		.player/hp-tween LDZ [ #00 SWP ;hp-ratios ADD2 LDA ] #05 ;draw-ui-progress JSR2
	( sick )
	.frame/x LDZ2 #0010 ADD2 .Screen/x DEO2
	.frame/y LDZ2 #0010 ADD2 .Screen/y DEO2
	;star-icn ;blank-icn .player/sick LDZ #01 JCN SWP2 POP2 .Screen/addr DEO2
	#03 .Screen/sprite DEO

	( SP )
	.frame/x LDZ2 #0038 ADD2
	.frame/y LDZ2
		OVR2 OVR2 #0010 ADD2 ;sp-txt #02 ;draw-label JSR2
		OVR2 #0020 ADD2 OVR2 #0010 ADD2 .player/sp-tween LDZ #03 ;draw-value JSR2
		.player/sp-tween LDZ [ #00 SWP ;sp-ratios ADD2 LDA ] #0f ;draw-ui-progress JSR2
	( durability )
	.frame/x LDZ2 #0048 ADD2 .Screen/x DEO2
	.frame/y LDZ2 #0010 ADD2 .Screen/y DEO2
	.player/dp LDZ #00 SWP ;card-glyphs ADD2 LDA ;get-char JSR2 .Screen/addr DEO2
	#03 .Screen/sprite DEO

	( XP )
	.frame/x LDZ2 #0070 ADD2
	.frame/y LDZ2
		OVR2 OVR2 #0010 ADD2 ;xp-txt #02 ;draw-label JSR2
		OVR2 #0020 ADD2 OVR2 #0010 ADD2 .player/xp LDZ #02 ;draw-value JSR2
		.player/xp LDZ [ #00 SWP ;xp-ratios ADD2 LDA ] #0a ;draw-ui-progress JSR2

	( run )
	;can-run JSR2 STH
	.frame/x LDZ2 #00a8 ADD2 .Screen/x DEO2
	.frame/y LDZ2 #0010 ADD2 .Screen/y DEO2
	;buttons-icns/b .Screen/addr DEO2
	STHkr .Screen/sprite DEO

	.frame/x LDZ2 #00b8 ADD2
	.frame/y LDZ2 #0010 ADD2
	;run-txt STHr #03 MUL ;draw-label JSR2

JMP2r

@draw-ui-progress ( x* y* value color -- )

	( load ) STH STH .Screen/y DEO2 .Screen/x DEO2
	( background )
	( auto x addr ) #05 .Screen/auto DEO
	( set addr ) ;progress-bg-icns .Screen/addr DEO2
	#0600
	&bg
		( draw ) #02 .Screen/sprite DEO
		INC GTHk ,&bg JCN
	POP2
	( auto none ) #00 .Screen/auto DEO
	( foreground )
	( rewind ) .Screen/x DEI2 #0030 SUB2 .Screen/x DEO2
	( set addr ) ;progress-fg-icn .Screen/addr DEO2
	STHr #00
	&fg
		( draw ) STHkr .Screen/sprite DEO
		( incr ) .Screen/x DEI2 INC2 .Screen/x DEO2
		INC GTHk ,&fg JCN
	POP2

	POPr

JMP2r

@draw-cursor ( color -- )

	STH
	( clear last cursor )
	.cursor/x LDZ2 .Screen/x DEO2
	.cursor/y LDZ2 .Screen/y DEO2
	#40 .Screen/sprite DEO

	( record mouse positions )
	.Mouse/x DEI2 DUP2 .cursor/x STZ2 .Screen/x DEO2
	.Mouse/y DEI2 DUP2 .cursor/y STZ2 .Screen/y DEO2

	( draw new cursor )
	;pointer-icn .Screen/addr DEO2
	STHr .Screen/sprite DEO

JMP2r

@draw-label ( x* y* text* color -- )

	STH
	SWP2 .Screen/y DEO2
	SWP2 .Screen/x DEO2
	( auto x ) #01 .Screen/auto DEO
	&loop
		LDAk ,get-char JSR .Screen/addr DEO2
		STHkr .Screen/sprite DEO
		INC2 LDAk ,&loop JCN
	POP2
	POPr
	( auto none ) #00 .Screen/auto DEO

JMP2r

@get-char ( char -- addr* )

	DUP #40 GTH OVR #5b LTH #0101 NEQ2 ,&no-uc JCN
		#41 SUB #00 SWP #30 SFT2 ;letters-uc-icns ADD2 JMP2r
		&no-uc
	DUP #60 GTH OVR #7b LTH #0101 NEQ2 ,&no-lc JCN
		#61 SUB #00 SWP #30 SFT2 ;letters-lc-icns ADD2 JMP2r
		&no-lc
	DUP #2f GTH OVR #3a LTH #0101 NEQ2 ,&no-num JCN
		#30 SUB #00 SWP #30 SFT2 ;numbers-icns ADD2 JMP2r
		&no-num
	DUP #5f NEQ OVR #00 NEQ #0000 EQU2 ,&no-space JCN
		POP ;blank-icn JMP2r
		&no-space
	POP ;star-icn

JMP2r

@draw-value ( x* y* value color -- )

	STH STH
	.Screen/y DEO2
	.Screen/x DEO2

	STHkr #0a DIV #00 SWP #30 SFT2 ;numbers-icns ADD2 .Screen/addr DEO2
	OVRr STHr .Screen/sprite DEO
	.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
	STHr #0a ( mod ) DIVk MUL SUB #00 SWP #30 SFT2 ;numbers-icns ADD2 .Screen/addr DEO2
	STHr .Screen/sprite DEO

JMP2r

@clear-screen ( -- )

	;blank-icn .Screen/addr DEO2
	.Screen/height DEI2 #03 SFT2 NIP #00
	&y
		DUP #00 SWP #30 SFT2 .Screen/y DEO2
		.Screen/width DEI2 #03 SFT2 NIP #00
		&x
			DUP #00 SWP #30 SFT2 .Screen/x DEO2
			#01 .Screen/sprite DEO
			INC GTHk ,&x JCN
		POP2
		INC GTHk ,&y JCN
	POP2

JMP2r

( random )

@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

@theme-txt ".theme $1

@load-theme ( -- )

	;theme-txt .File/name DEO2
	#0006 .File/length DEO2
	#fffa .File/read DEO2

	.File/success DEI2 #0006 NEQ2 ,&ignore JCN
		#fffa LDA2 .System/r DEO2
		#fffc LDA2 .System/g DEO2
		#fffe LDA2 .System/b DEO2
		&ignore
	;redraw JSR2

JMP2r

@dialogs
	( clear )     0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	( potion )
	&potion       2333 3900 2836 2532 2f00 2500 3433 382d 3332 4000 0000 0000
	&sickness     2333 3900 2a29 2930 0037 2d27 2f40 0000 0000 0000 0000 0000
	&waste        2333 3900 3b25 3738 2928 0025 0034 3338 2d33 323f 0000 0000
	( shield )
	&shield       2333 3900 2a33 3932 2800 2500 372c 2d29 3028 4000 0000 0000
	( attack )
	&unshielded   193b 3f00 2333 3900 3229 2928 0025 0037 2c2d 2930 2840 0000
	&blocking     2333 3900 2630 3327 2f29 2800 382c 2900 2538 3825 272f 4000
	&breaking     2333 3936 0037 2c2d 2930 2800 2636 332f 293f 0000 0000 0000
	&damages      2333 3900 3739 363a 2d3a 2928 0038 2c29 0026 2538 3830 2940
	&death        2333 3900 282d 2928 4000 4200 1e36 3d00 252b 252d 3240 0000
	( run )
	&run          2333 3900 3625 3200 253b 253d 4000 0000 0000 0000 0000 0000
	&cannot_run   2333 3900 2725 3232 3338 0036 3932 0025 3b25 3d40 0000 0000
	( modes )
	&easy         0f25 373d 0017 3328 2900 4100 1d29 3029 2738 0027 2536 2840
	&normal       1833 3631 2530 0041 001d 2930 2927 3800 2725 3628 4000 0000
	&hard         1225 3628 0017 3328 2900 4100 1d29 3029 2738 0027 2536 2840
	( etc )
	&victory      202d 2738 3336 3d00 4100 1629 253a 2900 2839 322b 2933 3240
	&modes
		:&easy :&normal :&hard

@hp-txt "HP $1
@sp-txt "SP $1
@xp-txt "XP $1
@run-txt "RUN $1
@easy-txt "Easy $1
@normal-txt "Normal $1
@hard-txt "Hard $1

@card-types
	00 00 00 00 00 00 00 00 00 00 00 00 00 ( hearts )
	01 01 01 01 01 01 01 01 01 01 01 01 01 ( diamonds )
	02 02 02 02 02 02 02 02 02 02 02 02 02 ( spades )
	03 03 03 03 03 03 03 03 03 03 03 03 03 ( clovers )
	04 04 05 ( joker )

@card-values
	0b 02 03 04 05 06 07 08 09 0a 0b 0b 0b ( heart )
	0b 02 03 04 05 06 07 08 09 0a 0b 0b 0b ( diamonds )
	11 02 03 04 05 06 07 08 09 0a 0b 0d 0f ( spades )
	11 02 03 04 05 06 07 08 09 0a 0b 0d 0f ( clovers )
	15 15 00 ( joker )

@card-glyphs
	00 31 32 33 34 35 36 37
	38 39 58 4a 00 51 00 4b
	00 41 00 00 00 00 00 00

@hp-ratios
	00 01 02 03 04 06 07 08
	09 11 13 14 16 18 1a 1c
	1f 21 23 25 27 29

@sp-ratios
	00 02 05 09 10 16 1a 1c 20 23 26 29

@xp-ratios
	00 01 02 02 03 04 04 05 06 06 07 08 08
	09 10 10 11 12 12 13 14 14 15 16 16 17
	18 19 19 1a 1a 1b 1b 1c 1c 1d 1d 1e 1e
	21 22 22 23 23 24 24 25 25 26 26 27 27
	28 28 29 29

@cards
	&h01 "White_Mage_11 $1   &d01 "Red_Mage_11 $1     &s01 "Empress_17 $1  &c01 "Empress_17 $1
	&h02 "Small_Potion_2 $1  &d02 "Buckler_2 $1       &s02 "Slime_2 $1     &c02 "Rat_2 $1
	&h03 "Small_Potion_3 $1  &d03 "Buckler_3 $1       &s03 "Tunneler_3 $1  &c03 "Bat_3 $1
	&h04 "Medium_Potion_4 $1 &d04 "Kite_4 $1          &s04 "Fiend_4 $1     &c04 "Imp_4 $1
	&h05 "Medium_Potion_5 $1 &d05 "Kite_5 $1          &s05 "Drake_5 $1     &c05 "Goblin_5 $1
	&h06 "Large_Potion_6 $1  &d06 "Heater_6 $1        &s06 "Specter_6 $1   &c06 "Orc_6 $1
	&h07 "Large_Potion_7 $1  &d07 "Heater_7 $1        &s07 "Ghost_7 $1     &c07 "Ogre_7 $1
	&h08 "Super_Potion_8 $1  &d08 "Tower_Shield_8 $1  &s08 "Elemental_8 $1 &c08 "Beholder_8 $1
	&h09 "Super_Potion_9 $1  &d09 "Tower_Shield_9 $1  &s09 "Witch_9 $1     &c09 "Medusa_9 $1
	&h0a "Super_Potion_10 $1 &d0a "Tower_Shield_10 $1 &s0a "Familiar_10 $1 &c0a "Demon_10 $1
	&h0b "White_Mage_11 $1   &d0b "Red_Mage_11 $1     &s0b "Consort_11 $1  &c0b "Consort_11 $1
	&h0c "White_Mage_11 $1   &d0c "Red_Mage_11 $1     &s0c "Queen_13 $1    &c0c "Queen_13 $1
	&h0d "White_Mage_11 $1   &d0d "Red_Mage_11 $1     &s0d "Regnant_15 $1  &c0d "Regnant_15 $1
	&j01 "Red_Donsol_21 $1   &j02 "Black_Donsol_21 $1
	&b00 5f $1

@card-names
	:cards/h01 :cards/h02 :cards/h03 :cards/h04 :cards/h05
	:cards/h06 :cards/h07 :cards/h08 :cards/h09 :cards/h0a
	:cards/h0b :cards/h0c :cards/h0d
	:cards/d01 :cards/d02 :cards/d03 :cards/d04 :cards/d05
	:cards/d06 :cards/d07 :cards/d08 :cards/d09 :cards/d0a
	:cards/d0b :cards/d0c :cards/d0d
	:cards/s01 :cards/s02 :cards/s03 :cards/s04 :cards/s05
	:cards/s06 :cards/s07 :cards/s08 :cards/s09 :cards/s0a
	:cards/s0b :cards/s0c :cards/s0d
	:cards/c01 :cards/c02 :cards/c03 :cards/c04 :cards/c05
	:cards/c06 :cards/c07 :cards/c08 :cards/c09 :cards/c0a
	:cards/c0b :cards/c0c :cards/c0d
	:cards/j01 :cards/j02 :cards/b00

@pointer-icn
	80c0 e0f0 f8e0 1000
@cursor-hor-icn
	4060 381e 1e38 6040
@cursor-ver-icn
	0018 183c 7e66 c300
@progress-fg-icn
	0000 183c 3c18 0000
@star-icn
	082a 1c7f 1c2a 0800
@progress-bg-icns
	3f40 8080 8080 403f
	ff00 0000 0000 00ff
	ff00 0000 0000 00ff
	ff00 0000 0000 00ff
	ff00 0000 0000 00ff
	fc02 0101 0101 02fc
@font
@blank-icn
	0000 0000 0000 0000
@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
@letters-uc-icns
	781c 3c36 3e66 66c3
	ee73 636e 6363 63de
	3c66 ccc0 c0c0 e67c
	ee73 6363 6363 63de
	fe66 6078 6063 667c
	fe66 6078 6060 6060
	3c66 c6c0 dec6 663c
	c6c6 c6ce fee6 c6c6
	3018 1818 1818 180c
	1e0c 0c0c 0c1c 3860
	c66c 6c78 786c 6cc6
	e060 6060 6066 7e78
	c6ee fed6 c6c6 c6c6
	c6c6 e6f6 dece c6c6
	7cce c6c6 c6c6 e67c
	fc66 6666 6c60 60c0
	7ce6 c6c6 c6c6 ce7f
	ee73 666c 6666 63c3
	3a66 603c 0606 665c
	fe30 60c0 c0c2 c67c
	e666 6666 6666 6e3f
	c366 6666 6666 3c18
	c3c3 c3d3 cbdf 7762
	c3c3 663c 3c66 c3c3
	c366 663c 1818 1818
	7ec6 0c18 fe60 c3fe
@letters-lc-icns
	0000 3e66 6666 3b00
	e060 607c 6666 7c00
	0000 3c66 6066 3c00
	0c06 063e 6666 3b00
	0000 3c66 7e60 3e00
	0e18 1818 3e18 1800
	0006 7ccc cc78 c27c
	c060 606c 7666 6600
	3000 180c 0c0c 0c00
	0c00 0c0c 0c0c 0c38
	c060 666c 786c e600
	3018 1818 1818 0c00
	00c0 667e 7e6b 6300
	00c0 7c66 6666 6300
	0000 3c6e 6676 3c00
	00c0 7c66 667c 60e0
	0000 3b66 663e 0607
	00c0 7c76 6060 6000
	0000 3e60 3c06 7c00
	0030 7e30 3030 361c
	0000 e666 666e 3b00
	0000 e666 663c 1800
	0000 e36b 7f3e 3600
	0003 663c 183c 66c0
	0000 e666 663e cc78
	0000 7e0c 7e31 7e00
	0c0c 1818 0030 3000
	0000 0000 0030 3000
@buttons-icns
	3c66 dbdb c3db 5a3c
	&b
	3c46 dbc7 dbdb 463c

@graphics
	8182 8282 8283 8542 8686 8687 8552 8686 8687 85e8 e4e5 e987 85ec e0e1 ed87 85f8 f5f6 fb87 8586 f9fa 8687 85fc fdfe ff87 89ee ebea ef8b ( heart1 )
	8182 8282 8283 8542 8686 8687 8546 8686 8687 8586 8686 8687 8586 4286 8687 8586 8642 8687 8586 8686 8687 8586 8686 8687 898a 8a8a 8a8b ( heart2 )
	8182 8282 8283 8542 8686 8687 8547 8686 8687 8586 8686 8687 8586 4286 8687 8586 8642 8687 8586 4286 8687 8586 8686 8687 898a 8a8a 8a8b ( heart3 )
	8182 8282 8283 8542 8686 8687 8548 8686 8687 8586 8686 8687 8586 4286 8687 8586 4242 8687 8586 4286 8687 8586 8686 8687 898a 8a8a 8a8b ( heart4 )
	8182 8282 8283 8542 8686 8687 8549 8686 8687 8586 8686 8687 8586 4242 8687 8586 4242 8687 8586 8642 8687 8586 8686 8687 898a 8a8a 8a8b ( heart5 )
	8182 8282 8283 8542 8686 8687 854a 8686 8687 8586 8686 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 8586 8686 8687 898a 8a8a 8a8b ( heart6 )
	8182 8282 8283 8542 8686 8687 854b 8686 8687 8586 8686 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 8586 8642 8687 898a 8a8a 8a8b ( heart7 )
	8182 8282 8283 8542 8686 8687 854c 8686 8687 8586 8686 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 898a 8a8a 8a8b ( heart8 )
	8182 8282 8283 8542 8686 8687 854d 8686 8687 8586 8642 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 898a 8a8a 8a8b ( heart9 )
	8182 8282 8283 8542 8686 8687 854e 8686 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 8586 4242 8687 898a 8a8a 8a8b ( heart10 )
	8182 8282 8283 8542 8686 8687 854f 8686 8687 85e8 e4e5 e987 85ec e0e1 ed87 85f8 8e8f fb87 8586 c2c3 8687 85fc c0c7 ff87 89ee 9e9e ef8b ( heart11 )
	8182 8282 8283 8542 8686 8687 8550 8686 8687 85e8 e4e5 e987 85ec e0e1 ed87 85f8 8c8d fb87 8586 c2c3 8687 85fc c0c1 ff87 89ee c4c5 ef8b ( heart12 )
	8182 8282 8283 8542 8686 8687 8551 8686 8687 85e8 e4e5 e987 85ec e0e1 ed87 85f8 9c9d fb87 8586 f9fa 8687 85fc bcbd ff87 89ee bebf ef8b ( heart13 )
	8182 8282 8283 8543 8686 8687 8552 8686 8687 8586 f0f3 8687 85f0 f1f2 f387 85f4 f5f6 f787 8586 f9fa 8687 85fc fdfe ff87 89ee ebea ef8b ( diamond1 )
	8182 8282 8283 8543 8686 8687 8546 8686 8687 8586 8686 8687 8586 4386 8687 8586 8643 8687 8586 8686 8687 8586 8686 8687 898a 8a8a 8a8b ( diamond2 )
	8182 8282 8283 8543 8686 8687 8547 8686 8687 8586 8686 8687 8586 4386 8687 8586 8643 8687 8586 4386 8687 8586 8686 8687 898a 8a8a 8a8b ( diamond3 )
	8182 8282 8283 8543 8686 8687 8548 8686 8687 8586 8686 8687 8586 4386 8687 8586 4343 8687 8586 4386 8687 8586 8686 8687 898a 8a8a 8a8b ( diamond4 )
	8182 8282 8283 8543 8686 8687 8549 8686 8687 8586 8686 8687 8586 4343 8687 8586 4343 8687 8586 8643 8687 8586 8686 8687 898a 8a8a 8a8b ( diamond5 )
	8182 8282 8283 8543 8686 8687 854a 8686 8687 8586 8686 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 8586 8686 8687 898a 8a8a 8a8b ( diamond6 )
	8182 8282 8283 8543 8686 8687 854b 8686 8687 8586 8686 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 8586 8643 8687 898a 8a8a 8a8b ( diamond7 )
	8182 8282 8283 8543 8686 8687 854c 8686 8687 8586 8686 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 898a 8a8a 8a8b ( diamond8 )
	8182 8282 8283 8543 8686 8687 854d 8686 8687 8586 8643 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 898a 8a8a 8a8b ( diamond9 )
	8182 8282 8283 8543 8686 8687 854e 8686 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 8586 4343 8687 898a 8a8a 8a8b ( diamond10 )
	8182 8282 8283 8543 8686 8687 854f 8686 8687 8586 f0f3 8687 85f0 f1f2 f387 85f4 8e8f f787 8586 c2c3 8687 85fc c0c7 ff87 89ee 9e9e ef8b ( diamond11 )
	8182 8282 8283 8543 8686 8687 8550 8686 8687 8586 f0f3 8687 85f0 f1f2 f387 85f4 8c8d f787 8586 c2c3 8687 85fc c0c1 ff87 89ee c4c5 ef8b ( diamond12 )
	8182 8282 8283 8543 8686 8687 8551 8686 8687 8586 f0f3 8687 85f0 f1f2 f387 85f4 9c9d f787 8586 f9fa 8687 85fc bcbd ff87 89ee bebf ef8b ( diamond13 )
	8182 8282 8283 8540 8686 8687 8552 8686 8687 8586 d0d3 8687 85d0 d1d2 d387 85d4 d5d6 d787 8586 d9da 8687 85dc ddde df87 89e6 e2e3 e78b ( spade1 )
	8182 8282 8283 8540 8686 8687 8546 8686 8687 8586 8686 8687 8586 8640 8687 8586 4086 8687 8586 8686 8687 8586 8686 8687 898a 8a8a 8a8b ( spade2 )
	8182 8282 8283 8540 8686 8687 8547 8686 8687 8586 8686 8687 8586 8640 8687 8586 4086 8687 8586 8640 8687 8586 8686 8687 898a 8a8a 8a8b ( spade3 )
	8182 8282 8283 8540 8686 8687 8548 8686 8687 8586 8686 8687 8586 8640 8687 8586 4040 8687 8586 8640 8687 8586 8686 8687 898a 8a8a 8a8b ( spade4 )
	8182 8282 8283 8540 8686 8687 8549 8686 8687 8586 8686 8687 8586 4040 8687 8586 4040 8687 8586 8640 8687 8586 8686 8687 898a 8a8a 8a8b ( spade5 )
	8182 8282 8283 8540 8686 8687 854a 8686 8687 8586 8686 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 8586 8686 8687 898a 8a8a 8a8b ( spade6 )
	8182 8282 8283 8540 8686 8687 854b 8686 8687 8586 8686 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 8586 4086 8687 898a 8a8a 8a8b ( spade7 )
	8182 8282 8283 8540 8686 8687 854c 8686 8687 8586 8686 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 898a 8a8a 8a8b ( spade8 )
	8182 8282 8283 8540 8686 8687 854d 8686 8687 8586 4086 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 898a 8a8a 8a8b ( spade9 )
	8182 8282 8283 8540 8686 8687 854e 8686 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 8586 4040 8687 898a 8a8a 8a8b ( spade10 )
	8182 8282 8283 8540 8686 8687 854f 8686 8687 8586 d0d3 8687 85d0 d1d2 d387 85d4 5657 d787 8586 5e5f 8687 85dc cecf df87 89e6 9f9f e78b ( spade11 )
	8182 8282 8283 8540 8686 8687 8550 8686 8687 8586 d0d3 8687 85d0 d1d2 d387 85d4 5a5b d787 8586 5e5f 8687 85dc cec9 df87 89e6 cccd e78b ( spade12 )
	8182 8282 8283 8540 8686 8687 8551 8686 8687 8586 d0d3 8687 85d0 d1d2 d387 85d4 5859 d787 8586 5c5d 8687 85dc 5455 df87 89e6 88c8 e78b ( spade13 )
	8182 8282 8283 8541 8686 8687 8552 8686 8687 8586 d8db 8687 85d8 d1d2 db87 85d4 d5d6 d787 8586 d9da 8687 85dc ddde df87 89e6 e2e3 e78b ( clover1 )
	8182 8282 8283 8541 8686 8687 8546 8686 8687 8586 8686 8687 8586 4186 8687 8586 8641 8687 8586 8686 8687 8586 8686 8687 898a 8a8a 8a8b ( clover2 )
	8182 8282 8283 8541 8686 8687 8547 8686 8687 8586 8686 8687 8586 4186 8687 8586 8641 8687 8586 4186 8687 8586 8686 8687 898a 8a8a 8a8b ( clover3 )
	8182 8282 8283 8541 8686 8687 8548 8686 8687 8586 8686 8687 8586 4186 8687 8586 4141 8687 8586 4186 8687 8586 8686 8687 898a 8a8a 8a8b ( clover4 )
	8182 8282 8283 8541 8686 8687 8549 8686 8687 8586 8686 8687 8586 4141 8687 8586 4141 8687 8586 8641 8687 8586 8686 8687 898a 8a8a 8a8b ( clover5 )
	8182 8282 8283 8541 8686 8687 854a 8686 8687 8586 8686 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 8586 8686 8687 898a 8a8a 8a8b ( clover6 )
	8182 8282 8283 8541 8686 8687 854b 8686 8687 8586 8686 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 8586 8641 8687 898a 8a8a 8a8b ( clover7 )
	8182 8282 8283 8541 8686 8687 854c 8686 8687 8586 8686 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 898a 8a8a 8a8b ( clover8 )
	8182 8282 8283 8541 8686 8687 854d 8686 8687 8586 4141 8687 8586 4141 8687 8586 4140 8687 8586 4141 8687 8586 8641 8687 898a 8a8a 8a8b ( clover9 )
	8182 8282 8283 8541 8686 8687 854e 8686 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 8586 4141 8687 898a 8a8a 8a8b ( clover10 )
	8182 8282 8283 8541 8686 8687 854f 8686 8687 8586 d8db 8687 85d8 d1d2 db87 85d4 5657 d787 8586 cacb 8687 85dc cecf df87 89e6 9f9f e78b ( clover11 )
	8182 8282 8283 8541 8686 8687 8550 8686 8687 8586 d8db 8687 85d8 d1d2 db87 85d4 5a5b d787 8586 cacb 8687 85dc cec9 df87 89e6 cccd e78b ( clover12 )
	8182 8282 8283 8541 8686 8687 8551 8686 8687 8586 d8db 8687 85d8 d1d2 db87 85d4 5859 d787 8586 5c5d 8687 85dc 5455 df87 89e6 88c8 e78b ( clover13 )
	8182 8282 8283 8553 8686 8687 8586 8686 8687 8586 8686 8687 8578 797a 7b87 857c 7d7e 7f87 8586 8686 8687 8586 8686 8687 898a 8a8a 8a8b ( joker1 )
	8182 8282 8283 8553 8686 8687 8586 8686 8687 8586 8686 8687 8570 7172 7387 8574 7576 7787 8586 8686 8687 8586 8686 8687 898a 8a8a 8a8b ( joker2 )
	9192 9292 9293 9596 9696 9697 9596 9696 9697 9596 9696 9697 9596 9696 9697 9596 9696 9697 9596 9696 9697 9596 9696 9697 999a 9a9a 9a9b ( blank )

@splash-table
	0000 0000 0000 0000 0000 0098 9898 9898 9898 9898 9800 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a9 aaa9 aaa9 aaa9 aaa9 aa00 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00b1 b1b1 b1b1 b1b1 b1b1 b100 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a5 a4a5 a4a5 a5a4 a5a4 a500 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a5 00a5 00a5 a500 a500 a500 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a5 96a5 96a5 a596 a596 a500 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00b1 b1b1 b1b1 b1b1 b1b1 b100 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00aa a9aa a9aa a9aa a9aa a900 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00b1 b1b1 b1b1 b1b1 b1b1 b100 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a5 a5a5 a5a5 a5a5 a5a5 a500 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 a7a7 a5a7 a5a5 a5a5 a3a5 a3a3 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 00b8 b1b5 b9b1 b5b8 b2b5 b9b1 90b9 b1b5 b300 0000 0000 0000 0000
	0000 0000 0000 00ba 00ba ba00 baba 00ba b6b1 b5ba 00ba ba00 0000 0000 0000 0000
	0000 0000 0000 00ba 00ba ba00 baba 00ba b300 baba 00ba ba00 0000 0000 0000 0000
	0000 0000 0000 00b0 b1bb b6b1 bbb0 00b4 b6b1 bbb6 b1bb b6b1 9000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 a1a1 a5a1 a9b1 b1a9 a0a5 a0a0 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a5 a4a5 aaa6 a6aa a5a4 a500 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 00a5 00a5 aa00 00aa a500 a500 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 a8a5 96a5 aa00 00aa a596 a5a8 0000 0000 0000 0000 0000
	0000 0000 0000 0000 00ac abab abab afae aeaf abab abab ad00 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 abaf afab 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 00ab ab00 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 000f 2537 3d00 0018 3336 3125 3000 0012 2536 2800 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

@spritesheet
	efc7 8301 01ab c7ff efc7 8301 01ab c7ff
	c7c7 0101 01ef c7ff c7c7 0101 01ef c7ff
	ffff ffff ffff ffff 9301 0101 83c7 efff
	ffff ffff ffff ffff efc7 8301 83c7 efff
	c739 3939 3939 39c7 c739 3939 3939 39c7
	7387 e7e7 e7e7 e781 7387 e7e7 e7e7 e781
	c3b1 79f1 e3c7 8901 c3b1 79f1 e3c7 8901
	7f81 f3ef 93f1 7183 7f81 f3ef 93f1 7183
	f1e3 e3c3 9300 f3e1 f1e3 e3c3 9300 f3e1
	3907 bf3f 03f1 3183 3907 bf3f 03f1 3183
	c53b 3f3f 0331 3183 c53b 3f3f 0331 3183
	7f81 c1f3 e7cf 9f3f 7f81 c1f3 e7cf 9f3f
	7f83 3131 8331 3183 7f83 3131 8331 3183
	7f83 3131 83e7 cf9f 7f83 3131 83e7 cf9f
	3c3c 99c3 c399 3c3c 3c3c 99c3 c399 3c3c
	e1f3 f3f3 f3e3 c79f e1f3 f3f3 f3e3 c79f
	8319 3939 3939 3180 8319 3939 3939 3180
	3993 9387 8793 9339 3993 9387 8793 9339
	87e3 c3c9 c199 993c 87e3 c3c9 c199 993c
	118c 9c9c 9c9c 9c21 118c 9c9c 9c9c 9c21
	f8f8 f8f0 e000 0000 f8fa fdfa e52a 150a
	1f1f 1f0f 0700 0000 1fbf 5faf 57ac 54a8
	0713 ffff e7ff ffff 0f1f 7f83 e7fe ff7e
	e0c8 ffff e7ff ffff f0f8 fec1 e77f ff7e
	051d ffff e7ff ffff 071f 7f83 e7fe ff7c
	a0b8 ffff e7ff ffff e0f8 fec1 e77f ff3e
	0719 ffff e7ff ffff 071f 7f83 e7ff fe7f
	e098 ffff f3ff ffff e0f8 fec1 f3ff 7ffe
	ffff f8f8 f8ff f8f9 bfef f8f8 f8fb f8f9
	ffff 1f1f 1fff 1f9f fdf7 1f1f 1fdf 1f9f
	ffff f8f8 f8ff f8f8 beef f8f8 f8fb f8f8
	ffff 1f1f 1fff 1f1f 7df7 1f1f 1fdf 9f9f
	3f40 8080 8080 403f 3f40 8080 8080 403f
	ff00 0000 0000 00ff ff00 0000 0000 00ff
	fc02 0101 0101 02fc fc02 0101 0101 02fc
	ff00 e0f0 f0e0 00ff ff00 0000 0000 00ff
	3f40 9fbf bf9f 403f 3f40 8080 8080 403f
	ff00 ffff ffff 00ff ff00 0000 0000 00ff
	fc02 f9fd fdf9 02fc fc02 0101 0101 02fc
	3f40 98bc bc98 403f 3f40 8080 8080 403f
	0000 0000 0000 0000 0c0c 1818 0030 3000
	0000 0000 0000 0000 0000 0000 0030 3000
	001c 37ea 77fe 3f3a 001c 37ea 77fe 3f3e
	3f2e 3f3a 3f3e 373f 3f3e 3f3e 3f3e 3f3f
	3c66 dbdb c3db 5a3c 0000 0000 0000 0000
	3c46 dbc7 dbdb 463c 0000 0000 0000 0000
	002f 0002 0000 0000 002f 023f 1f02 0a0a
	0000 0000 00ff ffff 0000 0000 00ff ffff
	ffff fcf0 e0c0 8000 ffff fcf0 e0c0 8000
	c000 0007 0f1f 1f1f c000 0007 0f1c 1818
	0300 00e0 f0f8 f8f8 0300 00e0 f038 1818
	ffff 3f0f 0703 0100 ffff 3f0f 0703 0100
	0080 c0e0 f0fc ffff 0080 c0e0 f0fc ffff
	1f1f 1f0f 0700 00c0 1818 1c0f 0700 00c0
	f8f8 f8f0 e000 0003 1818 38f0 e000 0003
	0001 0307 0f3f ffff 0001 0307 0f3f ffff
	ffff ffff ffff ffff ffff fcf0 e0c0 8000
	ffff ffff fffc f8f8 c000 0007 0f1c 1818
	ffff ffff ff3f 1f1f 0300 00e0 f038 1818
	ffff ffff ffff ffff ffff 3f0f 0703 0100
	ffff ffff ffff ffff 0080 c0e0 f0fc ffff
	f8f8 fcff ffff ffff 1818 1c0f 0700 00c0
	1f1f 3fff ffff ffff 1818 38f0 e000 0003
	ffff ffff ffff ffff 0001 0307 0f3f ffff
	0000 0024 6676 ffff 0000 0024 6676 ffff
	0000 0f1f 3f3f 3f3f 0000 0f1f 3f3f 3f3f
	0000 ffff ffff ffff 0000 ffff ffff ffff
	0000 f0f8 fcfc fcfc 0000 f0f8 fcfc fcfc
	e7db e77e 183c 3e56 e7db e77e 183c 3858
	3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f
	ffff ffff ffff ffff ffff ffff ffff ffff
	fcfc fcfc fcfc fcfc fcfc fcfc fcfc fcfc
	0000 0000 0000 0000 0500 0000 0000 ffff
	3f3f 3f3f 1f0f 0000 3f3f 3f3f 3f3f 3f1f
	ffff ffff ffff 0000 ffff ffff ffff ffff
	fcfc fcfc f8f0 0000 fcfc fcfc fcfc fcf8
	ffff 7fff e7ff ff7f 0719 ff83 e7ff feff
	fffb ffff f3ff fffe e09c fec1 f3ff 7fff
	ffff 7fff e7ff ff7f 0713 ff83 e7fe fffe
	fffb ffff e7ff fffe e0cc fec1 e77f ff7f
	04fc fcf8 f000 0000 04fc fcf8 f8f0 0000
	0000 0f10 2020 2020 0000 0f10 2020 2020
	0000 ff00 0000 0000 0000 ff00 0000 00ff
	0000 f008 0404 0404 0000 f008 0404 0404
	0000 0000 4020 20c0 0000 0000 0000 0000
	2020 2020 2020 2020 2121 2121 2121 2121
	0000 0000 0000 0000 8142 2418 1824 4281
	0404 0404 0404 0404 8484 8484 8484 8484
	0000 0002 9041 04ff 0000 0002 9041 04ff
	2020 2020 100f 0000 2020 2020 303f 3f1f
	0000 0000 00ff 0000 ff00 0000 00ff ffff
	0404 0404 08f0 0000 0404 0404 0cfc fcf8
	ffff 7fff e7ff ff7f 051d ff83 e7fe fffc
	fffb ffff e7ff fffe a0bc fec1 e77f ff3f
	ffff ffff ffff 0000 1800 1800 0000 ffff
	1800 1800 0000 0000 1800 1800 0000 ffff
	fffe fcf8 f0e0 c080 fffe fcf8 f0e0 c080
	ff7f 3f1f 0f07 0301 ff7f 3f1f 0f07 0301
	0000 0000 0000 0000 0000 0000 0000 0000
	80c0 e0f0 f8fc feff 80c0 e0f0 f8fc feff
	0000 ffe7 c381 8100 0000 ffe7 c381 8100
	00cf cf00 00f9 f900 00cf cf00 00f9 f900
	00aa aa00 00ff ff00 00aa aa00 00ff ff00
	0103 070f 1f3f 7fff 0103 070f 1f3f 7fff
	c8a1 2452 14b9 5238 c8a1 2452 14b9 5238
	ff00 99a7 e599 00ff ff00 99a7 e599 00ff
	bd89 99e5 a799 91bd bd89 99e5 a799 91bd
	ffff bf29 5205 4000 ffff bf29 5205 4000
	2b05 0805 0000 0000 2b05 0805 0000 0000
	d4a0 10a0 0000 0000 d4a0 10a0 0000 0000
	3c76 fddf ffff ffff 3c7e ffff ffff ffff
	ffbf fffe fbff ffff ffbf ffff ffff ffff
	3c3c 3c3c 7800 0000 3c3c 3c3c fcfc 3800
	00ff ffff ff00 0000 00ff ffff ffff 0000
	00ff ffff ff80 0000 00ff ffff ffff 8000
	0078 3c3c 3c3c 3c3c 0078 3c3c 3c3c 3c3c
	3c3c 3c3c 3c1e 0000 3c3c 3c3c 3c3f 1f0c
	0000 c0f0 f8f8 7c3c 0000 c0f0 f8f8 fc7c
	3e3f 1f1f 0700 0000 3e3f 1f1f 0f07 0000
	c0e0 f078 3c1e 0f07 c0e0 f078 3c1e 0f07
	0078 3b3f 3f3f 3e3c 0078 3b3f 3f3f 3f3e
	0000 030f 1f1f 3e3c 0000 030f 1f1f 3f3e
	3c3c 3c3c 3c3c 3c3c 3c3c 3c3c 3c3c 3c3c
	7cfc f8f8 e000 0000 7cfc f8f8 f8e0 0000
	f8fd faf5 ea15 eaf5 fffa fdfa d5ea 150a
	1f5f bf5f ab54 ab57 ffbf 5faf 57ab 54a8
	f5fa fcff ffff 0000 0a05 0300 0000 ffff
	af5f 3fff ffff 0000 50a0 c000 0000 ffff
	f8ff fff7 df3f ffff fff8 f8f8 e0c0 0000
	1fbf bfaf bbdc eff7 ff5f 5f5f 4723 1008
	ffff f8f8 f8ff ffff beef ffff fff8 f8f8
	ffff 1f1f 1fff ffff 7df7 ffff ff1f 1f1f
	ffff ffff ffff 0000 0000 0000 0000 ffff
	f7f7 f7f7 f7f7 0000 2808 0828 0808 ffff
	f8ff ffff df3f ffff fff8 f8f0 e0c0 0000
	1fff ffff fbfc ffff ff1f 1f0f 0703 0000
	0000 0000 0000 0000 5000 0000 0000 ffff
	1f1f 1f0f 0700 0000 5f5f 5f4f 4722 1008
	ffff f8f8 f8f8 f8ff beef f8f8 f8f8 f8fb
	ffff 1f1f 1f1f 1fff 7df7 1f1f 1f1f 1fdf
	0000 0000 0000 0000 0000 0000 0000 ffff
	2000 0020 0000 0000 2808 0828 0808 ffff
	f8f8 f8f0 e000 0000 f8f8 f8f0 e060 0000
	1f1f 1f0f 0700 0000 1f1f 1f0f 0706 0000
	fefc f8f0 e0c0 8020 fefc f8f0 e0c0 8020
	0001 0100 0000 0103 0000 0201 0000 0103
	0080 8000 0000 80c0 0080 4080 0000 80c0
	7f3f 1f0f 0703 0100 7f3f 1f0f 0703 0100
	4000 0001 0181 c0f0 4000 0083 1183 c4f0
	071d 7fbf cfff ffff 071f 3fc3 cffe ff7e
	e0b8 fefd e7ff ffff e0f8 fcc3 e77f ff7e
	0200 0080 8081 0307 0202 00c0 82d1 0307
	f8e0 c080 8000 0000 f8e0 c080 8000 2000
	ffff f8f8 f8ff f8f9 bdef f8f8 f8fb f8fd
	ffff 1f1f 1fff 1f9f bdf7 1f1f 1fdf 1fbf
	1f07 0301 0100 0000 1f07 0301 0100 0000
	ffff ffff fff8 e0c0 ffff ffff fff8 f0c0
	f8f9 f8f1 e001 0001 f8fd f8f5 e815 2815
	1f9f 1f8f 0780 0080 1fbf 1faf 17a8 14a8
	ffff ffff ff1f 0703 ffff ffff ff1f 0f03
	fffe fdff fefe fdfb 0003 0301 0101 0307
	ffff bfff 7f7f bfef 0040 c080 8080 c0d0
	0000 0000 0000 0000 0a05 0300 0000 ffff
	0000 0000 0000 0000 50a0 c000 0000 ffff
	ffff ffeb fdfa ffff ffff ff17 0305 0000
	ffff ffd7 af7f bfff ffff ffe8 d080 4000
	c0c0 c0c0 c0c0 0000 c0c0 e2c0 ead2 ffff
	0303 0303 0303 0000 0303 4703 574b ffff
	ffff ffff ffff ffff ffff fffc f0e0 c080
	ffff ffff ffff ffff ffff ff7f 1f0f 0703
	57ef 1fff ffff 0000 a890 e000 0000 ffff
	eaf7 f8ff ffff 0000 1509 0700 0000 ffff
	ffff ffff ffff ffff 8000 0000 0000 0000
	ffff ffff ffff ffff 0101 0000 0000 0000
	ffff ddeb d5e9 0000 c0c0 e0d4 e8d4 ffff
	ffff bbd7 ab97 0000 0303 072b 172b ffff
	ffff ffff ffff ffff fefc f8f0 e0c0 8102
	fdfa f7fd fefe fdfb 060d 1923 4181 0307
	bf5f efbf 7f7f bfef 60b0 98c4 8281 c0d0
	ffff ffff ffff ffff 7f3f 1f0f 0703 8140
	ffbb d7eb f5fa fcfe 04cc f8f4 fafd ffff
	ffff 7fff cfff ff7f 071d ff83 cffe fbfc
	fffb feff e7ff fffe e0bc ffc1 e77f df3f
	fadd eb57 af5f 3f7f 2533 1faf 5fbf ffff
	ffff ffaf d5eb f0fc 0000 80d1 ebf5 ffff
	ffff f8f8 f8ff f8f9 bfef ffff fffb ffff
	ffff 1f1f 1fff 1f9f fdf7 ffff ffdf ffff
	ffff ffeb d7af 0f3f 0000 0095 abd7 ffff
	ffff ffff ffff efdf ffff ffff fff8 f0f0
	faff faf7 ea57 aad7 fdf9 fdf9 d5a9 5529
	5fff 5fef 57ea 55eb bf9f bf9f ab95 aa94
	ffff ffff ffff f7fb ffff ffff ff1f 0f17


D src/main.tal => src/main.tal +0 -974
@@ 1,974 0,0 @@
( Donsol )

%+  { ADD }  %-  { SUB }  %*  { MUL }  %/  { NEQ }
%<  { LTH }  %>  { GTH }  %=  { EQU }  %!  { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }

%!~ { NEQk NIP }

%2*  { #10 SFT } %2/  { #01 SFT } %2**  { #10 SFT2 } %2//  { #01 SFT2 }
%4*  { #20 SFT } %4/  { #02 SFT } %4**  { #20 SFT2 } %4//  { #02 SFT2 }
%8*  { #30 SFT } %8/  { #03 SFT } %8**  { #30 SFT2 } %8//  { #03 SFT2 }
%10* { #40 SFT } %10/ { #04 SFT } %10** { #40 SFT2 } %10// { #04 SFT2 }

%2MOD  { #01 AND } %2MOD2  { #0001 AND2 }
%4MOD  { #03 AND } %4MOD2  { #0003 AND2 }
%8MOD  { #07 AND } %8MOD2  { #0007 AND2 }
%10MOD { #0f AND } %10MOD2 { #000f AND2 }
%20MOD { #1f AND } %20MOD2 { #001f AND2 }

%RTN { JMP2r }
%TOB { NIP } %TOS  { #00 SWP }
%MOD  { DIVk MUL SUB } %MOD2 { DIV2k MUL2 SUB2 }
%BRK? { #01 JCN BRK }
%SWP? { #01 JCN SWP } %SWP2? { #01 JCN SWP2 }

%WIDTH { #00e0 }
%HEIGHT { #0090 }

( devices )

|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
|a0 @File       &vector $2 &success  $2 &stat   $2 &delete $1 &append $1 &name   $2 &length $2 &read   $2 &write $2
|b0 @DateTime   &year   $2 &month   $1 &day    $1 &hour  $1 &minute $1 &second $1 &dotw $1 &doty   $2 &isdst $1

( variables )

|0000

@mode $1
@score $1
@deck
	&length $1
	&cards $36
@player
	&hp $1 &hp-tween $1
	&sp $1 &sp-tween $1
	&dp $1 &xp $1
	&ran $1 &sick $1
@table
	&a $1 &b $1 &c $1 &d $1 &selection $1 &timer $1
@cursor
	&x $2 &y $2 &last $1
@frame
	&x $2 &y $2 &x2 $2 &y2 $2

( program )

|0100 ( -> )

	( theme )
	#0f7f .System/r DEO2
	#057f .System/g DEO2
	#057f .System/b DEO2

	( resize )
	#0120 .Screen/width DEO2
	#00e0 .Screen/height DEO2

	( place )
	.Screen/width DEI2 2//
	DUP2 WIDTH 2// -- .frame/x STZ2
		WIDTH 2// ++ .frame/x2 STZ2
	.Screen/height DEI2 2//
	DUP2 HEIGHT 2// -- .frame/y STZ2
		HEIGHT 2// ++ .frame/y2 STZ2

	( random )
	;prng-init JSR2

	( theme support )
	;load-theme JSR2

	#09 .player/hp STZ
	#0a .player/sp STZ
	#0b .player/xp STZ

	,go-menu JSR

BRK

( menu )

@go-menu ( -- )

	;on-button-menu   .Controller/vector DEO2
	;on-mouse-menu    .Mouse/vector DEO2
	;on-frame-menu    .Screen/vector DEO2

	;clear-screen JSR2
	;draw-menu JSR2

RTN

@on-button-menu ( -> )

	.Controller/button DEI
	[ #01 ] !~ ,&no-a JCN
		;go-game JSR2 POP BRK
		&no-a
	[ #40 ] !~ ,&no-left JCN
		( clamp ) .mode LDZ #01 < ,&no-left JCN
		.mode LDZ #01 - .mode STZ
		;draw-menu/options JSR2 POP BRK
		&no-left
	[ #80 ] !~ ,&no-right JCN
		( clamp ) .mode LDZ #01 > ,&no-right JCN
		.mode LDZ INC .mode STZ
		;draw-menu/options JSR2 POP BRK
		&no-right
	POP

BRK

@on-mouse-menu ( -> )

	#42 .Mouse/state DEI #00 ! + ;draw-cursor JSR2

	.Mouse/y DEI2 .frame/y LDZ2 -- 8// NIP #11 ! ,&skip JCN
		.Mouse/x DEI2 .frame/x LDZ2 -- 8// NIP
		DUP #09 > ,&no-easy JCN
			#00 ;set-mode JSR2
			,&resume JMP
			&no-easy
		DUP #11 > ,&no-normal JCN
			#01 ;set-mode JSR2
			,&resume JMP
			&no-normal
		DUP #18 > ,&no-hard JCN
			#02 ;set-mode JSR2
			,&resume JMP
			&no-hard
		&resume
		POP
	&skip
	.Mouse/state DEI #00 = ,&no-click JCN
		;go-game JSR2 BRK
		&no-click

BRK

@on-frame-menu ( -> )

	( nothing.. )

BRK

@draw-menu ( -- )

	( draw castle )
	#0320 #0000
	&loop
		( x ) DUP2 #0020 MOD2 8** .frame/x LDZ2 ++ #0010 -- .Screen/x DEO2
		( y ) DUP2 #0020 DIV2 8** .frame/y LDZ2 ++ #0040 -- .Screen/y DEO2
		( addr ) DUP2 ;splash-table ++ LDA #40 - TOS 10** ;spritesheet ++ .Screen/addr DEO2
		( draw ) #81 .Screen/sprite DEO
		INC2 GTH2k ,&loop JCN
	POP2 POP2

	( draw score )
	.frame/x LDZ2 #0068 ++
	.frame/y LDZ2 #0008 --
	.score LDZ #02
		;draw-value JSR2

	&options
	
	.frame/x LDZ2 .frame/y LDZ2
		( easy )
		OVR2 WIDTH 2// #0048 -- ++
		OVR2 #0078 ++
			#0010 ++ ;easy-txt #02 [ .mode LDZ #00 = + ] ;draw-label JSR2
		.Screen/x DEI2 #002c -- .Screen/x DEO2
		;cursor-hor-icn .Screen/addr DEO2
		#01 [ .mode LDZ #00 = * ] .Screen/sprite DEO
		( normal )
		OVR2 WIDTH 2// #0018 -- ++
		OVR2 #0078 ++
			#0010 ++ ;normal-txt #02 [ .mode LDZ #01 = + ] ;draw-label JSR2
		.Screen/x DEI2 #003c -- .Screen/x DEO2
		;cursor-hor-icn .Screen/addr DEO2
		#01 [ .mode LDZ #01 = * ] .Screen/sprite DEO
		( hard )
		OVR2 WIDTH 2// #0028 ++ ++
		OVR2 #0078 ++
			#0010 ++ ;hard-txt #02 [ .mode LDZ #02 = + ] ;draw-label JSR2
		.Screen/x DEI2 #002c -- .Screen/x DEO2
		;cursor-hor-icn .Screen/addr DEO2
		#01 [ .mode LDZ #02 = * ] .Screen/sprite DEO
	POP2 POP2

RTN

( game )

@go-game ( -- )

	;on-button-game   .Controller/vector DEO2
	;on-mouse-game    .Mouse/vector DEO2
	;on-frame-game    .Screen/vector DEO2

	;start-game JSR2

RTN

@on-frame-game ( -> )

	( table timer )
	.table/timer LDZ #00 = ,&no-timer JCN
		.table/timer LDZ #01 - [ DUP ] .table/timer STZ
		( blink cursor )
		#41 .table/timer LDZ #02 AND + ;draw-cursor JSR2
		( auto enter )
		#00 ! ,&no-timer-end JCN
			;enter-room JSR2
			&no-timer-end
		.player/xp LDZ #36 < ,&no-end JCN
			;dialogs/victory ;draw-dialog JSR2
			&no-end
		&no-timer

	( tween )
	.player/hp LDZ2
	GTHk #00 = ,&no-hp-dec JCN
		INCk .player/hp-tween STZ
		;draw-status JSR2
		&no-hp-dec
	LTHk #00 = ,&no-hp-inc JCN
		DUP #01 - .player/hp-tween STZ
		;draw-status JSR2
		&no-hp-inc
	POP2

	.player/sp LDZ2
	GTHk #00 = ,&no-sp-dec JCN
		INCk .player/sp-tween STZ
		;draw-status JSR2
		&no-sp-dec
	LTHk #00 = ,&no-sp-inc JCN
		DUP #01 - .player/sp-tween STZ
		;draw-status JSR2
		&no-sp-inc
	POP2

BRK

@on-button-game ( -> )

	( timer locked )
	.table/timer LDZ #00 = ,&enabled JCN
		BRK
		&enabled

	.Controller/button DEI
	[ #01 ] !~ ,&no-a JCN
		.table/selection LDZ #01 ;select JSR2 POP BRK
		&no-a
	[ #02 ] !~ ,&no-b JCN
		;run JSR2 POP BRK
		&no-b
	[ #08 ] !~ ,&no-sel JCN
		;load-theme JSR2
		;go-menu JSR2 POP BRK
		&no-sel
	#04 SFT
	[ #04 ] !~ ,&no-left JCN
		.table/selection LDZ #01 - #00 ;select JSR2 POP BRK
		&no-left
	[ #08 ] !~ ,&no-right JCN
		.table/selection LDZ INC #00 ;select JSR2 POP BRK
		&no-right
	POP

BRK

@on-mouse-game ( -> )

	( timer locked )
	.table/timer LDZ #00 = ,&enabled JCN
		BRK
		&enabled

	( run button on right-click or victory )
	.Mouse/state DEI #02 < ,&no-mouse2 JCN
		;run JSR2
		&no-mouse2

	( run button clicked )
	.Mouse/state DEI #00 = ,&no-run-button JCN
		( click anywhere on the victory screen to continue )
		.player/xp LDZ #36 = ,&do-run JCN
		( or on the run button in the interface )
		.Mouse/y DEI2 .frame/y LDZ2 -- 8// #0002 !! ,&no-run-button JCN 
		.Mouse/x DEI2 .frame/x LDZ2 -- 8// #0015 -- #0005 >> ,&no-run-button JCN
			&do-run
			;run JSR2
			&no-run-button

	( hover card )
	.Mouse/y DEI2 .frame/y LDZ2 #0030 ++ -- #0048 <<
	.Mouse/x DEI2 .frame/x LDZ2 -- #00e0 <<
		#0101 !! ,&no-hover JCN
			.Mouse/x DEI2 .frame/x LDZ2 -- #0038 // TOB
			.Mouse/state DEI #01 =
				;select JSR2
			( release ) #00 .Mouse/state DEO
			&no-hover
	#42 .Mouse/state DEI #00 ! + ;draw-cursor JSR2
	( release-record ) #0000 .Mouse/state DEO .cursor/last STZ

BRK

( core )

@start-game ( -- )

	( reset player )
	#1515 .player/hp STZ2
	#0000 .player/sp STZ2
	#00 .player/dp STZ
	#00 .player/xp STZ
	#00 .player/ran STZ
	#00 .player/sick STZ

	( start deck )
	;init-deck JSR2
	;shuffle-deck JSR2

	;clear-screen JSR2
	;dialogs/modes .mode LDZ TOS 2** ++ LDA2 ;draw-dialog JSR2
	;enter-room JSR2

RTN

@set-mode ( mode -- )

	DUP .mode LDZ ! ,&changed JCN
		POP RTN
		&changed
	.mode STZ
	;draw-menu/options JSR2

RTN

@enter-room ( -- )

	#0400
	&loop
		,pull-card JSR OVR .table + STZ
		INC GTHk ,&loop JCN
	POP2
	;redraw JSR2

RTN

@pull-card ( -- card )

	.deck/length LDZ ,&continue JCN
		#36 RTN
		&continue
	( pull ) .deck/cards LDZ
	( decr ) .deck/length LDZ #01 - .deck/length STZ
	( shift left )
	#3600
	&loop
		DUP .deck/cards +
		( get card ) INCk LDZ
		( put card ) SWP STZ
		INC GTHk ,&loop JCN
	POP2

RTN

@init-deck ( -- )

	#3600
	&loop
		DUP DUP .deck/cards + STZ
		INC GTHk ,&loop JCN
	POP2
	#36 .deck/length STZ

RTN

@shuffle-deck ( -- )

	( first shuffle )
	#3600
	&a
		DUP
			( seed ) [ ;prng JSR2 + ] #36 MOD
			( a b ) OVR .deck/cards + LDZ OVR .deck/cards + LDZ
			( b a ) SWP2 STH .deck/cards + STZ STHr .deck/cards + STZ
		INC GTHk ,&a JCN
	POP2
	( second shuffle )
	#3600
	&b
		DUP
			( seed ) [ ;prng JSR2 + ] #36 MOD
			( a b ) OVR .deck/cards + LDZ OVR .deck/cards + LDZ
			( b a ) SWP2 STH .deck/cards + STZ STHr .deck/cards + STZ
		INC GTHk ,&b JCN
	POP2

RTN

@return-card ( card -- )

	.deck/length LDZ .deck/cards + STZ
	.deck/length LDZ INC .deck/length STZ

RTN

@pick-card ( id -- )

	DUP #36 < ,&not-flipped JCN
		POP RTN
		&not-flipped
	( set xp )
	.player/xp LDZ INC
		DUP .player/xp STZ
		.score LDZ [ GTHk SWP? POP ] .score STZ
	DUP TOS ;card-types ++ LDA
	( route card type )
	DUP #00 = ;pick-potion JCN2
	DUP #01 = ;pick-shield JCN2
	DUP ;pick-enemy JCN2

RTN

@pick-potion ( card type -- )

	POP
	.player/sick LDZ #01 ! ,&no-sick JCN
		;dialogs/sickness ;draw-dialog JSR2
		POP RTN
		&no-sick
	.player/hp LDZ #15 ! ,&no-waste JCN
		;dialogs/waste ;draw-dialog JSR2
		POP RTN
		&no-waste
	( get ) TOS ;card-values ++ LDA .player/hp LDZ +
	( set ) #15 LTHk SWP? POP .player/hp STZ
	( set sick ) #01 .player/sick STZ
	;dialogs/potion ;draw-dialog JSR2

RTN

@pick-shield ( card type -- )

	POP
	( get ) TOS ;card-values ++ LDA
	( set ) .player/sp STZ
	( set max durability ) #16 .player/dp STZ
	( set sick ) #00 .player/sick STZ
	;dialogs/shield ;draw-dialog JSR2

RTN

@pick-enemy ( card type -- )

	POP
	( set sick ) #00 .player/sick STZ
	( get ) TOS ;card-values ++ LDA
	.player/sp LDZ ,&shielding JCN

	&unshielded
		( damages ) ;take-damages JSR2
		( test death ) .player/hp LDZ #00 = ;&death JCN2
		;dialogs/unshielded ;draw-dialog JSR2
		RTN

	&shielding ( value -- )
		( test breaking ) DUP INC .player/dp LDZ > ,&breaking JCN
		( test blocking ) DUP .player/sp LDZ < ,&blocking JCN
		( durability ) DUP .player/dp STZ
		( damages ) .player/sp LDZ - ;take-damages JSR2
		( test death ) .player/hp LDZ #00 = ,&death JCN
		;dialogs/damages ;draw-dialog JSR2
		RTN

	&breaking ( value -- )
		( break shield ) #00 DUP .player/sp STZ .player/dp STZ
		( damages ) ;take-damages JSR2
		( test death ) .player/hp LDZ #00 = ,&death JCN
		;dialogs/breaking ;draw-dialog JSR2
		RTN

	&blocking ( value -- )
		( durability ) .player/dp STZ
		;dialogs/blocking ;draw-dialog JSR2
		RTN

	&death ( -- )
		;dialogs/death ;draw-dialog JSR2

RTN

@take-damages ( mod -- )

	( negative )
	DUP #80 < ,&no-neg JCN
		POP
		RTN
		&no-neg
	( killing )
	DUP .player/hp LDZ < ,&no-kill JCN
		POP #00 .player/hp STZ
		RTN
		&no-kill
	.player/hp LDZ SWP - .player/hp STZ

RTN

@select ( id state -- )

	.player/hp LDZ #00 > ,&alive JCN
		POP2 RTN
		&alive

	SWP
	( skip changed if has state )
	OVR ,&state JCN
	( check changed )
	DUP .table/selection LDZ ! ,&changed JCN
		POP2 RTN
		&changed
	&state
	;clear-selection JSR2

	OVR #00 = ,&no-use JCN
		DUP .table + LDZ ;pick-card JSR2
		DUP ;flip-card JSR2
		;draw-status JSR2
		&no-use

	4MOD .table/selection STZ
	#01 ;draw-selection JSR2
	POP

RTN

@flip-card ( table -- )

	( already flipped )
	DUP .table + LDZ #36 ! ,&continue JCN
		POP RTN
		&continue

	#36 SWP .table + STZ
	;draw-table JSR2

	( start room timer )
	.player/hp LDZ #00 = ,&no-timer JCN
	;count-table JSR2 #04 ! ,&no-timer JCN
		#30 .table/timer STZ
		#00 .player/ran STZ
		&no-timer

RTN

@count-table ( -- count )

	( create counter ) LITr 00
	#0400
	&count
		DUP .table + LDZ #36 ! ,&continue JCN
			INCr
			&continue
		INC GTHk ,&count JCN
	POP2
	STHr

RTN

@count-monsters ( -- count )

	( create counter ) LITr 00
	#0400
	&count
		DUP .table + LDZ #36 = ,&continue JCN
		DUP .table + LDZ TOS ;card-types ++ LDA #02 < ,&continue JCN
			INCr
			&continue
		INC GTHk ,&count JCN
	POP2
	STHr

RTN

@can-run ( -- flag )

	( can always run in first room )
	.deck/length LDZ ;count-table JSR2 #3200 !! ,&started JCN
		#01 RTN
		&started

	.mode LDZ
	( When all monsters in the room have been dealt with,
		or when the player has not escaped the previous room. )
	[ #00 !~ ] ,&no-easy JCN
		;count-monsters JSR2 #00 =
		.player/ran LDZ #00 =
			#0000 !! NIP RTN
		&no-easy
	( When the player has not escaped the previous room. )
	[ #01 !~ ] ,&no-normal JCN
		.player/ran LDZ #00 = NIP RTN
		&no-normal
	( When all monsters in the room have been dealt )
	[ #02 !~ ] ,&no-hard JCN
		;count-monsters JSR2 #00 = NIP RTN
		&no-hard
	POP

RTN

@run ( -- )

	( in lobby )
	.deck/length LDZ ;count-table JSR2 #3200 !! ,&started JCN
		;start-game JSR2 RTN
		&started
	( when dead )
	.player/hp LDZ #00 > ,&alive JCN
		;start-game JSR2 RTN
		&alive
	( when finished )
	.player/xp LDZ #36 < ,&incomplete JCN
		;start-game JSR2 RTN
		&incomplete
	( cannot run )
	;can-run JSR2 ,&continue JCN
		;dialogs/cannot_run ;draw-dialog JSR2
		RTN
		&continue
	( return cards )
	#0400
	&count
		DUP .table + LDZ #36 = ,&skip JCN
		DUP .table + LDZ ;return-card JSR2
		&skip
		INC GTHk ,&count JCN
	POP2
	#01 .player/ran STZ
	;enter-room JSR2
	;dialogs/run ;draw-dialog JSR2

RTN

@redraw ( -- )

	;draw-status JSR2
	;clear-selection JSR2
	#01 ;draw-selection JSR2
	;draw-table JSR2

RTN

@draw-dialog ( dialog* -- )

	STH2
	.frame/x LDZ2 .Screen/x DEO2
	.frame/y LDZ2 #0088 ++ .Screen/y DEO2
	( auto x ) #01 .Screen/auto DEO
	#1800
	&loop
		( get offset ) DUP TOS STH2kr ++ LDA
		( get char ) TOS 8** ;font ++ .Screen/addr DEO2
		#02 .Screen/sprite DEO
		INC GTHk ,&loop JCN
	POP2
	( auto none ) #00 .Screen/auto DEO
	POP2r

RTN

@draw-table ( -- )

	#0400
	&loop
		STHk
		STHkr TOS #0038 ** .frame/x LDZ2 ++
		#0030 .frame/y LDZ2 ++
		STHr .table + LDZ ,draw-card JSR
		INC GTHk ,&loop JCN
	POP2

RTN

@draw-card ( x* y* id -- )

	STH
	.Screen/y DEO2
	.Screen/x DEO2
	STHr
	( get card nametable )
	TOS #0036 ** ;graphics ++ STH2
	( auto x ) #01 .Screen/auto DEO
	#3600
	&loop
		( get offset ) DUP TOS STH2kr ++ LDA
		( get tile ) #40 - TOS 10** ;spritesheet ++ .Screen/addr DEO2
		( draw ) #81 .Screen/sprite DEO
		DUP #06 MOD #05 ! ,&no-edge JCN
			.Screen/x DEI2 #0030 -- .Screen/x DEO2
			.Screen/y DEI2 #0008 ++ .Screen/y DEO2
			&no-edge
		INC GTHk ,&loop JCN
	POP2
	( auto none ) #00 .Screen/auto DEO
	POP2r

RTN

@clear-selection ( -- )

	( clear label )
	.frame/x LDZ2 .Screen/x DEO2
	.frame/y LDZ2 #0020 ++ .Screen/y DEO2
	;blank-icn .Screen/addr DEO2
	( auto x ) #01 .Screen/auto DEO
	#1b00
	&name-loop
		#01 .Screen/sprite DEO
		INC GTHk ,&name-loop JCN
	POP2
	( auto none ) #00 .Screen/auto DEO

	( clear cursors )
	.frame/y LDZ2 #007c ++ .Screen/y DEO2
	;blank-icn .Screen/addr DEO2
	#0400
	&cursors-loop
		STHk
		.frame/x LDZ2 #0014 ++ [ STHr TOS #0038 ** ++ ] .Screen/x DEO2
		#01 .Screen/sprite DEO
		INC GTHk ,&cursors-loop JCN
	POP2

RTN

@draw-selection ( color -- )

	STH
	.frame/x LDZ2
	.frame/y LDZ2 #0020 ++
		.table .table/selection LDZ + LDZ
		TOS 2** ;card-names ++ LDA2
		STHkr #02 *
		;draw-label JSR2

	.frame/x LDZ2 #0014 ++ [ .table/selection LDZ TOS #0038 ** ++ ] .Screen/x DEO2
	.frame/y LDZ2 #007c ++ .Screen/y DEO2
	;cursor-ver-icn .Screen/addr DEO2
		STHr #03 * .Screen/sprite DEO

RTN

@draw-status ( -- )

	( HP )
	.frame/x LDZ2
	.frame/y LDZ2
		OVR2 OVR2 #0010 ++ ;hp-txt #02 ;draw-label JSR2
		OVR2 #0020 ++ OVR2 #0010 ++ .player/hp-tween LDZ #01 ;draw-value JSR2
		.player/hp-tween LDZ [ TOS ;hp-ratios ++ LDA ] #05 ;draw-ui-progress JSR2
	( sick )
	.frame/x LDZ2 #0010 ++ .Screen/x DEO2
	.frame/y LDZ2 #0010 ++ .Screen/y DEO2
	;star-icn ;blank-icn .player/sick LDZ SWP2? POP2 .Screen/addr DEO2
	#03 .Screen/sprite DEO

	( SP )
	.frame/x LDZ2 #0038 ++
	.frame/y LDZ2
		OVR2 OVR2 #0010 ++ ;sp-txt #02 ;draw-label JSR2
		OVR2 #0020 ++ OVR2 #0010 ++ .player/sp-tween LDZ #03 ;draw-value JSR2
		.player/sp-tween LDZ [ TOS ;sp-ratios ++ LDA ] #0f ;draw-ui-progress JSR2
	( durability )
	.frame/x LDZ2 #0048 ++ .Screen/x DEO2
	.frame/y LDZ2 #0010 ++ .Screen/y DEO2
	.player/dp LDZ TOS ;card-glyphs ++ LDA ;get-char JSR2 .Screen/addr DEO2
	#03 .Screen/sprite DEO

	( XP )
	.frame/x LDZ2 #0070 ++
	.frame/y LDZ2
		OVR2 OVR2 #0010 ++ ;xp-txt #02 ;draw-label JSR2
		OVR2 #0020 ++ OVR2 #0010 ++ .player/xp LDZ #02 ;draw-value JSR2
		.player/xp LDZ [ TOS ;xp-ratios ++ LDA ] #0a ;draw-ui-progress JSR2

	( run )
	;can-run JSR2 STH
	.frame/x LDZ2 #00a8 ++ .Screen/x DEO2
	.frame/y LDZ2 #0010 ++ .Screen/y DEO2
	;buttons-icns/b .Screen/addr DEO2
	STHkr .Screen/sprite DEO

	.frame/x LDZ2 #00b8 ++
	.frame/y LDZ2 #0010 ++
	;run-txt STHr #03 * ;draw-label JSR2

RTN

@draw-ui-progress ( x* y* value color -- )

	( load ) STH STH .Screen/y DEO2 .Screen/x DEO2
	( background )
	( auto x addr ) #05 .Screen/auto DEO
	( set addr ) ;progress-bg-icns .Screen/addr DEO2
	#0600
	&bg
		( draw ) #02 .Screen/sprite DEO
		INC GTHk ,&bg JCN
	POP2
	( auto none ) #00 .Screen/auto DEO
	( foreground )
	( rewind ) .Screen/x DEI2 #0030 -- .Screen/x DEO2
	( set addr ) ;progress-fg-icn .Screen/addr DEO2
	STHr #00
	&fg
		( draw ) STHkr .Screen/sprite DEO
		( incr ) .Screen/x DEI2 INC2 .Screen/x DEO2
		INC GTHk ,&fg JCN
	POP2

	POPr

RTN

@draw-cursor ( color -- )

	STH
	( clear last cursor )
	.cursor/x LDZ2 .Screen/x DEO2
	.cursor/y LDZ2 .Screen/y DEO2
	#40 .Screen/sprite DEO

	( record mouse positions )
	.Mouse/x DEI2 DUP2 .cursor/x STZ2 .Screen/x DEO2
	.Mouse/y DEI2 DUP2 .cursor/y STZ2 .Screen/y DEO2

	( draw new cursor )
	;pointer-icn .Screen/addr DEO2
	STHr .Screen/sprite DEO

RTN

@draw-label ( x* y* text* color -- )

	STH
	SWP2 .Screen/y DEO2
	SWP2 .Screen/x DEO2
	( auto x ) #01 .Screen/auto DEO
	&loop
		LDAk ,get-char JSR .Screen/addr DEO2
		STHkr .Screen/sprite DEO
		INC2 LDAk ,&loop JCN
	POP2
	POPr
	( auto none ) #00 .Screen/auto DEO

RTN

@get-char ( char -- addr* )

	DUP #40 > OVR #5b < #0101 !! ,&no-uc JCN
		#41 - TOS 8** ;letters-uc-icns ++ RTN
		&no-uc
	DUP #60 > OVR #7b < #0101 !! ,&no-lc JCN
		#61 - TOS 8** ;letters-lc-icns ++ RTN
		&no-lc
	DUP #2f > OVR #3a < #0101 !! ,&no-num JCN
		#30 - TOS 8** ;numbers-icns ++ RTN
		&no-num
	DUP #5f ! OVR #00 ! #0000 == ,&no-space JCN
		POP ;blank-icn RTN
		&no-space
	POP ;star-icn

RTN

@draw-value ( x* y* value color -- )

	STH STH
	.Screen/y DEO2
	.Screen/x DEO2

	STHkr #0a DIV TOS 8** ;numbers-icns ++ .Screen/addr DEO2
	OVRr STHr .Screen/sprite DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	STHr #0a MOD TOS 8** ;numbers-icns ++ .Screen/addr DEO2
	STHr .Screen/sprite DEO

RTN

@clear-screen ( -- )

	;blank-icn .Screen/addr DEO2
	.Screen/height DEI2 8// NIP #00
	&y
		DUP TOS 8** .Screen/y DEO2
		.Screen/width DEI2 8// NIP #00
		&x
			DUP TOS 8** .Screen/x DEO2
			#01 .Screen/sprite DEO
			INC GTHk ,&x JCN
		POP2
		INC GTHk ,&y JCN
	POP2

RTN

( random )

@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

@theme-txt ".theme $1

@load-theme ( -- )

	;theme-txt .File/name DEO2
	#0006 .File/length DEO2
	#fffa .File/read DEO2

	.File/success DEI2 #0006 !! ,&ignore JCN
		#fffa LDA2 .System/r DEO2
		#fffc LDA2 .System/g DEO2
		#fffe LDA2 .System/b DEO2
		&ignore
	;redraw JSR2

RTN

~src/strings.tal
~src/assets.tal

D src/strings.tal => src/strings.tal +0 -100
@@ 1,100 0,0 @@

@dialogs
	( clear )     0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
	( potion )
	&potion       2333 3900 2836 2532 2f00 2500 3433 382d 3332 4000 0000 0000
	&sickness     2333 3900 2a29 2930 0037 2d27 2f40 0000 0000 0000 0000 0000
	&waste        2333 3900 3b25 3738 2928 0025 0034 3338 2d33 323f 0000 0000
	( shield )
	&shield       2333 3900 2a33 3932 2800 2500 372c 2d29 3028 4000 0000 0000
	( attack )
	&unshielded   193b 3f00 2333 3900 3229 2928 0025 0037 2c2d 2930 2840 0000
	&blocking     2333 3900 2630 3327 2f29 2800 382c 2900 2538 3825 272f 4000
	&breaking     2333 3936 0037 2c2d 2930 2800 2636 332f 293f 0000 0000 0000
	&damages      2333 3900 3739 363a 2d3a 2928 0038 2c29 0026 2538 3830 2940
	&death        2333 3900 282d 2928 4000 4200 1e36 3d00 252b 252d 3240 0000
	( run )
	&run          2333 3900 3625 3200 253b 253d 4000 0000 0000 0000 0000 0000
	&cannot_run   2333 3900 2725 3232 3338 0036 3932 0025 3b25 3d40 0000 0000
	( modes )
	&easy         0f25 373d 0017 3328 2900 4100 1d29 3029 2738 0027 2536 2840
	&normal       1833 3631 2530 0041 001d 2930 2927 3800 2725 3628 4000 0000
	&hard         1225 3628 0017 3328 2900 4100 1d29 3029 2738 0027 2536 2840
	( etc )
	&victory      202d 2738 3336 3d00 4100 1629 253a 2900 2839 322b 2933 3240
	&modes
		:&easy :&normal :&hard

@hp-txt "HP $1
@sp-txt "SP $1
@xp-txt "XP $1
@run-txt "RUN $1
@easy-txt "Easy $1
@normal-txt "Normal $1
@hard-txt "Hard $1

@card-types
	00 00 00 00 00 00 00 00 00 00 00 00 00 ( hearts )
	01 01 01 01 01 01 01 01 01 01 01 01 01 ( diamonds )
	02 02 02 02 02 02 02 02 02 02 02 02 02 ( spades )
	03 03 03 03 03 03 03 03 03 03 03 03 03 ( clovers )
	04 04 05 ( joker )

@card-values
	0b 02 03 04 05 06 07 08 09 0a 0b 0b 0b ( heart )
	0b 02 03 04 05 06 07 08 09 0a 0b 0b 0b ( diamonds )
	11 02 03 04 05 06 07 08 09 0a 0b 0d 0f ( spades )
	11 02 03 04 05 06 07 08 09 0a 0b 0d 0f ( clovers )
	15 15 00 ( joker )

@card-glyphs
	00 31 32 33 34 35 36 37
	38 39 58 4a 00 51 00 4b
	00 41 00 00 00 00 00 00

@hp-ratios
	00 01 02 03 04 06 07 08
	09 11 13 14 16 18 1a 1c
	1f 21 23 25 27 29

@sp-ratios
	00 02 05 09 10 16 1a 1c 20 23 26 29

@xp-ratios
	00 01 02 02 03 04 04 05 06 06 07 08 08
	09 10 10 11 12 12 13 14 14 15 16 16 17
	18 19 19 1a 1a 1b 1b 1c 1c 1d 1d 1e 1e
	21 22 22 23 23 24 24 25 25 26 26 27 27
	28 28 29 29

@cards
	&h01 "White_Mage_11 $1   &d01 "Red_Mage_11 $1     &s01 "Empress_17 $1  &c01 "Empress_17 $1
	&h02 "Small_Potion_2 $1  &d02 "Buckler_2 $1       &s02 "Slime_2 $1     &c02 "Rat_2 $1
	&h03 "Small_Potion_3 $1  &d03 "Buckler_3 $1       &s03 "Tunneler_3 $1  &c03 "Bat_3 $1
	&h04 "Medium_Potion_4 $1 &d04 "Kite_4 $1          &s04 "Fiend_4 $1     &c04 "Imp_4 $1
	&h05 "Medium_Potion_5 $1 &d05 "Kite_5 $1          &s05 "Drake_5 $1     &c05 "Goblin_5 $1
	&h06 "Large_Potion_6 $1  &d06 "Heater_6 $1        &s06 "Specter_6 $1   &c06 "Orc_6 $1
	&h07 "Large_Potion_7 $1  &d07 "Heater_7 $1        &s07 "Ghost_7 $1     &c07 "Ogre_7 $1
	&h08 "Super_Potion_8 $1  &d08 "Tower_Shield_8 $1  &s08 "Elemental_8 $1 &c08 "Beholder_8 $1
	&h09 "Super_Potion_9 $1  &d09 "Tower_Shield_9 $1  &s09 "Witch_9 $1     &c09 "Medusa_9 $1
	&h0a "Super_Potion_10 $1 &d0a "Tower_Shield_10 $1 &s0a "Familiar_10 $1 &c0a "Demon_10 $1
	&h0b "White_Mage_11 $1   &d0b "Red_Mage_11 $1     &s0b "Consort_11 $1  &c0b "Consort_11 $1
	&h0c "White_Mage_11 $1   &d0c "Red_Mage_11 $1     &s0c "Queen_13 $1    &c0c "Queen_13 $1
	&h0d "White_Mage_11 $1   &d0d "Red_Mage_11 $1     &s0d "Regnant_15 $1  &c0d "Regnant_15 $1
	&j01 "Red_Donsol_21 $1   &j02 "Black_Donsol_21 $1
	&b00 5f $1

@card-names
	:cards/h01 :cards/h02 :cards/h03 :cards/h04 :cards/h05
	:cards/h06 :cards/h07 :cards/h08 :cards/h09 :cards/h0a
	:cards/h0b :cards/h0c :cards/h0d
	:cards/d01 :cards/d02 :cards/d03 :cards/d04 :cards/d05
	:cards/d06 :cards/d07 :cards/d08 :cards/d09 :cards/d0a
	:cards/d0b :cards/d0c :cards/d0d
	:cards/s01 :cards/s02 :cards/s03 :cards/s04 :cards/s05
	:cards/s06 :cards/s07 :cards/s08 :cards/s09 :cards/s0a
	:cards/s0b :cards/s0c :cards/s0d
	:cards/c01 :cards/c02 :cards/c03 :cards/c04 :cards/c05
	:cards/c06 :cards/c07 :cards/c08 :cards/c09 :cards/c0a
	:cards/c0b :cards/c0c :cards/c0d
	:cards/j01 :cards/j02 :cards/b00
\ No newline at end of file