-
-
Save weeble/d0d4edc4bbcc9855c867ecd904b09e7e to your computer and use it in GitHub Desktop.
My first uxn program. It's a little bit like Zelda!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( Yeah this is horrible. It's hacky, it's got lots of unused code left around | |
from when I started with a copy of [screen.tal]. I am still trying to figure | |
out a style, and this experiments with a few conventions. Some parts tried | |
using indendation to keep track of stack depth. It's indented with tabs and | |
spaces inconsistently. Caveat Emptor. No refunds. | |
[screen.tal]: https://git.sr.ht/~rabbits/uxn/tree/main/item/projects/examples/devices/screen.tal | |
) | |
|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 $4 &type $1 &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 &chord $1 | |
%HEX-DIGIT { | |
DUP | |
#09 GTH #07 MUL ADD | |
LIT "0 ADD | |
} | |
%PUT { .Console/write DEO } | |
%PUT-HEX { | |
DUP | |
#04 SFT | |
HEX-DIGIT | |
PUT | |
#0f AND | |
HEX-DIGIT | |
PUT | |
} | |
%DEBUG-TOP { | |
DUP PUT-HEX #0a PUT | |
} | |
%DEBUG-TOP2 { | |
DUP2 | |
SWP | |
PUT-HEX PUT-HEX #0a PUT | |
} | |
|0000 | |
@center &x $2 &y $2 | |
@camera &x $2 &y $2 | |
@hero &x $2 &y $2 &anim $1 &dir $1 &walking $1 | |
@btn $1 | |
@pal $1 | |
@clock $2 | |
@scratch &a $1 | |
|0100 ( -> ) | |
( vector ) | |
;on-frame .Screen/vector DEO2 | |
( theme ) | |
#f07f .System/r DEO2 | |
#f0e0 .System/g DEO2 | |
#f0c0 .System/b DEO2 | |
#f45f .System/r DEO2 | |
#e376 .System/g DEO2 | |
#a531 .System/b DEO2 | |
( gba screen size 00f0 x 00a0 ) | |
( nds screen size 0100 x 00c0 ) | |
#0080 .Screen/width DEO2 | |
#0080 .Screen/height DEO2 | |
( find screen center ) | |
.Screen/width DEI2 #01 SFT2 .center/x STZ2 | |
.Screen/height DEI2 #01 SFT2 .center/y STZ2 | |
#0000 .camera/x STZ2 | |
#0000 .camera/y STZ2 | |
( draw ) | |
( undo draw-size ) | |
( draw-sprites ) | |
( draw-1bpp ) | |
( draw-2bpp ) | |
BRK | |
( | |
@|vectors ) | |
%SET-WALK { #01 .hero/walking STZ } | |
%UNSET-WALK { #00 .hero/walking STZ } | |
%GET-WALK { .hero/walking LDZ } | |
@on-frame ( -> ) | |
( adjust camera ) | |
.Controller/button DEI | |
UNSET-WALK | |
DUP #10 AND ?&go-up !&no-go-up &go-up .hero/y LDZ2k #0001 SUB2 ROT STZ2 #01 .hero/dir STZ SET-WALK &no-go-up | |
DUP #20 AND ?&go-down !&no-go-down &go-down .hero/y LDZ2k INC2 ROT STZ2 #03 .hero/dir STZ SET-WALK &no-go-down | |
DUP #40 AND ?&go-left !&no-go-left &go-left .hero/x LDZ2k #0001 SUB2 ROT STZ2 #02 .hero/dir STZ SET-WALK &no-go-left | |
DUP #80 AND ?&go-right !&no-go-right &go-right .hero/x LDZ2k INC2 ROT STZ2 #00 .hero/dir STZ SET-WALK &no-go-right | |
DUP | |
.btn LDZ | |
#ff EOR AND | |
#40 AND | |
#00 NEQ | |
.pal LDZ | |
ADD | |
#0f AND | |
.pal STZ | |
DUP .btn STZ | |
POP | |
( clear screen ) | |
#0000 .Screen/x DEO2 | |
#0000 .Screen/y DEO2 | |
( #83 .Screen/pixel DEO ) | |
( scroll background ) | |
[ LIT2 &f $2 ] INC2k ,&f STR2 | |
( POP2 | |
#0000 ) | |
#01 SFT2 | |
#001f AND2 | |
#0080 SUB2 ( 0040 ) | |
POP2 | |
#fffc | |
DUP2 .Screen/x DEO2 | |
.Screen/y DEO2 | |
.camera/x LDZ2 .Screen/x DEO2 | |
.camera/y LDZ2 .Screen/y DEO2 | |
;patt-icn draw-fill | |
( | |
.center/x LDZ2 #0070 SUB2 .Screen/x DEO2 | |
.center/y LDZ2 #0048 SUB2 .Screen/y DEO2 | |
;anim-chr ,&f LDR2 #00ff AND2 #02 SFT #07 AND #40 SFT ADD2 .Screen/addr DEO2 | |
#8f .Screen/sprite DEO ) | |
( undo draw-size ) | |
( draw-sprites ) | |
( draw-1bpp ) | |
( draw-2bpp ) | |
( | |
#fffc .Screen/x DEO2 | |
#0040 .Screen/y DEO2 | |
;codes-chr .Screen/addr DEO2 | |
#f6 .Screen/auto DEO | |
#80 .pal LDZ ORA .Screen/sprite DEO | |
#0048 .Screen/y DEO2 | |
;codes-chr .Screen/addr DEO2 | |
#80 .Screen/sprite DEO | |
#71 .Screen/auto DEO | |
#0004 .Screen/x DEO2 | |
#000c .Screen/y DEO2 | |
#03 .Screen/pixel DEOk DEOk DEOk DEO | |
;z-icn .Screen/addr DEO2 | |
#0000 .Screen/x DEO2 | |
#0000 .Screen/y DEO2 | |
.pal LDZ .Screen/sprite DEO | |
#0020 .Screen/x DEO2 | |
;triangle draw-panel | |
#0040 #0000 paint-sprite ) | |
draw-map | |
.hero/x LDZ2 .Screen/x DEO2 | |
.hero/y LDZ2 .Screen/y DEO2 | |
get-anim-frame paint-rich-sprite | |
( Elf background ) | |
( .hero/x LDZ2 .Screen/x DEO2 ) | |
( .hero/y LDZ2 .Screen/y DEO2 ) | |
( #00 .Screen/auto DEO ) | |
( ;elf_bg paint-bg ) | |
( Elf foreground ) | |
( .hero/x LDZ2 .Screen/x DEO2 ) | |
( .hero/y LDZ2 .Screen/y DEO2 ) | |
( #00 .Screen/auto DEO ) | |
( ;elf_fg .Screen/addr DEO2 ) | |
( #85 .Screen/sprite DEO ) | |
.clock LDZk INC SWP STZ | |
BRK | |
@get-anim-frame ( -- frame ) | |
#00 | |
( 00 -- ) | |
GET-WALK | |
( 00 walk? -- ) | |
DUP | |
( 00 walk? walk? -- ) | |
.clock LDZ | |
( 00 walk? walk? clock -- ) | |
#03 SFT | |
( 00 walk? walk? timer -- ) | |
#01 AND | |
( 00 walk? walk? timer -- ) | |
MUL ADD | |
( 00 anim -- ) | |
.hero/dir LDZ | |
( 00 anim dir -- ) | |
#05 MUL | |
( 00 anim diroffs -- ) | |
ADD | |
( 00 anim -- ) | |
;Animation | |
ADD2 | |
( *anim -- ) | |
LDA | |
( -- frame ) | |
JMP2r | |
& | |
( | |
@|drawing ) | |
@paint-rich-sprite ( index -- ) | |
.Screen/x DEI2 STH2 | |
.Screen/y DEI2 STH2 | |
#00 .Screen/auto DEO | |
DUP | |
#80 AND | |
#00 NEQ | |
,&flipx STR | |
#7f AND | |
#00 | |
SWP | |
DUP2 | |
#30 SFT2 | |
;elf_bg ADD2 | |
,&flipx LDR | |
paint-bg | |
STH2r .Screen/y DEO2 | |
STH2r .Screen/x DEO2 | |
#40 SFT2 | |
;elf_fg ADD2 | |
.Screen/addr DEO2 | |
,&flipx LDR #40 SFT | |
#85 ORA | |
.Screen/sprite DEO | |
JMP2r | |
&flipx $1 | |
@paint-sprite ( x* y* -- ) | |
.Screen/y DEO2 ( set y position ) | |
.Screen/x DEO2 ( set x position ) | |
#16 .Screen/auto DEO ( set length 2 with auto y and addr ) | |
;23x-icns .Screen/addr DEO2 ( set addr ) | |
#01 .Screen/sprite DEOk DEOk DEO ( draw 3 rows of 1-bit sprites ) | |
JMP2r | |
@23x-icns | |
( 0 ) ( 1 ) | |
( 0 ) 0010 2847 2810 0001 0000 00e0 2040 8000 | |
( 1 ) 0204 080f 0000 0001 0000 00e0 2040 8000 | |
( 2 ) 0204 080f 0000 0000 0010 28c4 2810 0000 | |
@draw-panel ( addr2 -- ) | |
#01 .Screen/auto DEO | |
.Screen/x DEI2 STH2 | |
&loopstart | |
( addr2 -- ) | |
LDAk | |
( span -- ) | |
DUP #ff EQU | |
;&loopend JCN2 | |
DUP | |
#f0 AND | |
#04 SFT | |
#00 SWP | |
STH2kr ADD2 | |
.Screen/x DEO2 | |
#0f AND | |
&inner | |
DUP #00 EQU ,&innerend JCN | |
#00 .Screen/pixel DEO | |
#01 SUB | |
,&inner JMP | |
&innerend | |
POP | |
.Screen/y DEI2 | |
#0001 ADD2 | |
.Screen/y DEO2 | |
#0001 ADD2 | |
;&loopstart JMP2 | |
&loopend | |
POP2r | |
POP | |
POP2 | |
JMP2r | |
@draw-map ( -- ) | |
#01 .Screen/auto DEO | |
#00 | |
( ycount -- ) | |
&yloop | |
DUP #0f GTH ,&endy JCN | |
( ycount -- ) | |
DUP #00 SWP #30 SFT2 | |
( ycount y* -- ) | |
.Screen/y DEO2 | |
( ycount -- ) | |
#0000 .Screen/x DEO2 | |
#00 | |
( ycount xcount -- ) | |
&xloop | |
DUP #0f GTH ,&endx JCN | |
DUP2 | |
( ycount xcount ycount xcount -- ) | |
#00 SWP | |
( ycount xcount ycount xcount* -- ) | |
ROT #00 SWP | |
( ycount xcount xcount* ycount* -- ) | |
#40 SFT2 ADD2 | |
( ycount xcount offs* -- ) | |
;map ADD2 | |
( ycount xcount addr* -- ) | |
LDA | |
( ycount xcount tile -- ) | |
#00 SWP | |
#40 SFT2 | |
( ycount xcount tile* -- ) | |
;background ADD2 | |
.Screen/addr DEO2 | |
( ycount xcount addr* -- ) | |
#81 .Screen/sprite DEO | |
( ycount xcount -- ) | |
INC | |
,&xloop JMP | |
&endx | |
POP | |
INC | |
;&yloop JMP2 | |
&endy | |
POP | |
JMP2r | |
@draw-sprites ( -- ) | |
( horizontal ) | |
.center/x LDZ2 #0060 SUB2 .Screen/x DEO2 | |
.center/y LDZ2 #0048 SUB2 .Screen/y DEO2 | |
;font-icn .Screen/addr DEO2 | |
#f6 .Screen/auto DEO | |
#05 .Screen/sprite DEO | |
( vertical ) | |
.center/x LDZ2 #0070 SUB2 .Screen/x DEO2 | |
.center/y LDZ2 #0038 SUB2 .Screen/y DEO2 | |
;font-icn .Screen/addr DEO2 | |
#f0 .pal LDZ ORA .Screen/auto DEO | |
#05 .Screen/sprite DEO | |
( table ) | |
#00 .Screen/auto DEO | |
;preview-chr .Screen/addr DEO2 | |
#00 | |
&loop | |
( move ) #00 OVR #0f AND #30 SFT | |
.center/x LDZ2 #0060 SUB2 ADD2 .Screen/x DEO2 | |
( move ) #00 OVR #f0 AND #01 SFT | |
.center/y LDZ2 #0038 SUB2 ADD2 .Screen/y DEO2 | |
( draw ) DUP .Screen/sprite DEO | |
INC DUP ?&loop | |
POP | |
JMP2r | |
@draw-1bpp ( -- ) | |
#1000 | |
&loop | |
( color ) STHk | |
( y ) #00 OVR #42 SFT2 | |
.center/y LDZ2 #0038 SUB2 ADD2 STH2 | |
( x ) #00 OVR #03 AND #40 SFT2 #0040 ADD2 | |
.center/x LDZ2 #0010 SUB2 ADD2 | |
STH2r STHr #00 draw-circle | |
INC GTHk ?&loop | |
POP2 | |
JMP2r | |
@draw-2bpp ( -- ) | |
#1000 | |
&loop | |
( color ) STHk | |
( y ) #00 OVR #42 SFT2 | |
.center/y LDZ2 #0008 ADD2 ADD2 STH2 | |
( x ) #00 OVR #03 AND #40 SFT2 #0040 ADD2 | |
.center/x LDZ2 #0010 SUB2 ADD2 | |
STH2r STHr #80 draw-circle | |
INC GTHk ?&loop | |
POP2 | |
JMP2r | |
@draw-circle ( x* y* color depth -- ) | |
ADD STH | |
;preview-chr .Screen/addr DEO2 | |
.Screen/y DEO2 | |
.Screen/x DEO2 | |
#01 .Screen/auto DEO | |
STHr .Screen/sprite DEOk | |
#02 .Screen/auto DEO | |
SWP #10 ADD SWP DEOk | |
.Screen/x DEI2k #0008 SUB2 ROT DEO2 | |
#01 .Screen/auto DEO | |
SWP #10 ADD SWP DEOk | |
SWP #10 ADD SWP DEO | |
JMP2r | |
@draw-fill ( patt* color -- ) | |
.Screen/addr DEO2 | |
[ LIT2 01 -Screen/auto ] DEO | |
( #01 .Screen/auto DEO ) | |
.Screen/x DEI2 ,&anchor STR2 | |
.Screen/width DEI2 #03 SFT2 NIP #08 ADD ,&x STR | |
.Screen/height DEI2 #03 SFT2 NIP #08 ADD #00 | |
&h | |
DUP #02 SFT STH | |
[ LIT &x $1 ] #00 | |
&w | |
DUP #02 SFT STHkr ADD #01 AND .Screen/sprite DEO | |
INC GTHk ?&w | |
.Screen/y DEI2k #0008 ADD2 ROT DEO2 | |
[ LIT2 &anchor $2 ] .Screen/x DEO2 | |
POP2 POPr | |
INC GTHk ?&h | |
POP2 | |
JMP2r | |
@draw-size ( -- ) | |
#01 .Screen/auto DEO | |
.center/x LDZ2 #0030 ADD2 .Screen/x DEO2 | |
.center/y LDZ2 #0048 SUB2 .Screen/y DEO2 | |
.Screen/width DEI2 draw-dec | |
;x-icn .Screen/addr DEO2 | |
#01 .Screen/sprite DEO | |
.Screen/height DEI2 | |
@draw-dec ( short* -- ) | |
#00 ,&z STR | |
#2710 draw-dec/parse | |
#03e8 draw-dec/parse | |
#0064 draw-dec/parse | |
#000a draw-dec/parse | |
NIP | |
&emit | |
DUP [ LIT &z $1 ] EQU ?&skip | |
#ff ,&z STR #00 OVR #30 SFT ;font-icn ADD2 .Screen/addr DEO2 | |
#01 .Screen/sprite DEO | |
&skip | |
POP | |
JMP2r | |
&parse DIV2k DUP ,&emit JSR MUL2 SUB2 JMP2r | |
( | |
@|assets ) | |
@patt-icn [ | |
aa55 aa55 aa55 aa55 ] | |
@x-icn [ | |
0000 0018 1800 0000 ] | |
@z-icn [ | |
0306 0c18 3060 c080 ] | |
@triangle [ | |
3123 1507 1523 31ff ] | |
@preview-chr [ | |
0f38 675f dfbf bfbf 0007 1820 2344 4848 ] | |
@font-icn ( 0-f ) [ | |
007c 8282 8282 827c 0030 1010 1010 1010 | |
007c 8202 7c80 80fe 007c 8202 1c02 827c | |
000c 1424 4484 fe04 00fe 8080 7c02 827c | |
007c 8280 fc82 827c 007c 8202 1e02 0202 | |
007c 8282 7c82 827c 007c 8282 7e02 827c | |
007c 8202 7e82 827e 00fc 8282 fc82 82fc | |
007c 8280 8080 827c 00fc 8282 8282 82fc | |
007c 8280 f080 827c 007c 8280 f080 8080 [ | |
@anim-chr [ | |
0000 0018 1800 0000 c381 0000 0000 81c3 | |
0000 183c 3c18 0000 0000 0000 0000 0000 | |
0018 3c7e 7e3c 1800 0000 0000 0000 0000 | |
3c7e ffe7 e7ff 7e3c 0000 0018 1800 0000 | |
ffff e7c3 c3e7 ffff 0000 183c 3c18 0000 | |
ffe7 c381 81c3 e7ff 0018 3c7e 7e3c 1800 | |
c381 0000 0000 81c3 3c7e ffe7 e7ff 7e3c | |
0000 0000 0000 0000 ffff e7c3 c3e7 ffff | |
0000 0000 0000 0000 ffe7 c381 81c3 e7ff ] | |
@codes-chr [ | |
0000 023a 2222 027e 1000 7c44 4444 7c00 | |
0000 0808 0808 043c 1000 3010 1010 3800 | |
0000 023a 023e 027e 1000 7c04 7c40 7c00 | |
0000 023a 023a 027e 1000 7c04 3c04 7c00 | |
0000 0414 3402 760c 1000 1828 487c 0800 | |
0000 023e 023a 027e 1000 7c40 7c04 7c00 | |
0000 043c 023a 027e 1000 7840 7c44 7c00 | |
0000 0474 1402 360c 1000 7808 083c 0800 | |
0000 023a 023a 027e 1000 7c44 7c44 7c00 | |
0000 023a 023a 027e 1000 7c44 7c04 7c00 | |
0000 023a 2202 3a66 1000 7c44 447c 4400 | |
0000 0454 021a 027e 1000 7828 3c24 7c00 | |
0000 023e 2020 027e 1000 7c40 4040 7c00 | |
0000 025a 1212 027e 1000 7c24 2424 7c00 | |
0000 023e 043c 027e 1000 7c40 7840 7c00 | |
0000 023e 043c 2060 1000 7c40 7840 4000 | |
2800 7e7e 6666 7e7e 2800 7c44 4444 7c00 | |
2800 3818 1818 3c3c 2800 3010 1010 3800 | |
2800 7e3e 7e7e 7e7e 2800 7c04 7c40 7c00 | |
2800 7e3e 3e3e 7e7e 2800 7c04 3c04 7c00 | |
2800 1c3c 7c7e 7e0c 2800 1828 487c 0800 | |
2800 7e7e 7e3e 7e7e 2800 7c40 7c04 7c00 | |
2800 7c7c 7e7e 7e7e 2800 7840 7c44 7c00 | |
2800 7c7c 1c3e 3e0c 2800 7808 083c 0800 | |
2800 7e7e 7e7e 7e7e 2800 7c44 7c44 7c00 | |
2800 7e7e 7e3e 7e7e 2800 7c44 7c04 7c00 | |
2800 7e7e 667e 7e66 2800 7c44 447c 4400 | |
2800 7c7c 3e3e 7e7e 2800 7828 3c24 7c00 | |
2800 7e7e 6060 7e7e 2800 7c40 4040 7c00 | |
2800 7e7e 3636 7e7e 2800 7c24 2424 7c00 | |
2800 7e7e 7c7c 7e7e 2800 7c40 7840 7c00 | |
2800 7e7e 7c7c 6060 2800 7c40 7840 4000 | |
0000 023a 6622 027e 5400 7c44 4444 7c00 | |
0000 0808 1808 043c 5400 3010 1010 3800 | |
0000 023a 7e3e 027e 5400 7c04 7c40 7c00 | |
0000 023a 3e3a 027e 5400 7c04 3c04 7c00 | |
0000 0414 7c02 760c 5400 1828 487c 0800 | |
0000 023e 7e3a 027e 5400 7c40 7c04 7c00 | |
0000 043c 7e3a 027e 5400 7840 7c44 7c00 | |
0000 0474 1c02 360c 5400 7808 083c 0800 | |
0000 023a 7e3a 027e 5400 7c44 7c44 7c00 | |
0000 023a 7e3a 027e 5400 7c44 7c04 7c00 | |
0000 023a 6602 3a66 5400 7c44 447c 4400 | |
0000 0454 3e1a 027e 5400 7828 3c24 7c00 | |
0000 023e 6020 027e 5400 7c40 4040 7c00 | |
0000 025a 3612 027e 5400 7c24 2424 7c00 | |
0000 023e 7c3c 027e 5400 7c40 7840 7c00 | |
0000 023e 7c3c 2060 5400 7c40 7840 4000 | |
7c00 7c44 4444 7c00 7c00 7e7e 6666 7e7e | |
7c00 3010 1010 3800 7c00 3818 1818 3c3c | |
7c00 7c04 7c40 7c00 7c00 7e3e 7e7e 7e7e | |
7c00 7c04 3c04 7c00 7c00 7e3e 3e3e 7e7e | |
7c00 1828 487c 0800 7c00 1c3c 7c7e 7e0c | |
7c00 7c40 7c04 7c00 7c00 7e7e 7e3e 7e7e | |
7c00 7840 7c44 7c00 7c00 7c7c 7e7e 7e7e | |
7c00 7808 083c 0800 7c00 7c7c 1c3e 3e0c | |
7c00 7c44 7c44 7c00 7c00 7e7e 7e7e 7e7e | |
7c00 7c44 7c04 7c00 7c00 7e7e 7e3e 7e7e | |
7c00 7c44 447c 4400 7c00 7e7e 667e 7e66 | |
7c00 7828 3c24 7c00 7c00 7c7c 3e3e 7e7e | |
7c00 7c40 4040 7c00 7c00 7e7e 6060 7e7e | |
7c00 7c24 2424 7c00 7c00 7e7e 3636 7e7e | |
7c00 7c40 7840 7c00 7c00 7e7e 7c7c 7e7e | |
7c00 7c40 7840 4000 7c00 7e7e 7c7c 6060 | |
] | |
@elf_fg [ | |
7c82 9aca e1f2 7f36 007c 5040 406c 2000 | |
7c82 9acb ede7 fcc8 007c 50c0 c058 0000 | |
0000 40ff fec0 0000 0000 003f be80 0000 | |
7c82 daca e1f3 7f60 007c 50c0 c06c 0000 | |
7c82 9aca e1f2 7c1c 007c 5040 406c 2000 | |
7c82 1aca f1f2 7f1b 007c d0c0 c04c 3000 | |
66c3 81b5 9542 307e 3c7e 7fa1 0000 0c00 | |
0000 0000 0000 0000 0000 0000 0000 0000 | |
3c42 c3c7 ef7e 3c66 003c bdbb d604 0000 | |
3c42 c3c7 ef7e 3c30 003c bdbb d604 0000 | |
3c42 c3c7 ef7e 3c0c 003c bdbb d604 0000 | |
7c82 b595 c3c3 3c66 007c a081 c37e 0000 | |
7c82 b595 c3c3 3830 007c a081 c37e 0000 | |
7c82 b595 c3c3 1c0c 007c a081 c37e 0000 | |
1c3c 1818 1818 1810 0c00 1818 1818 1810 | |
0000 0000 0000 0000 0000 0000 0000 0000 | |
] | |
@elf_bg [ | |
7cfe fefe fffe 7f36 | |
7cfe feff ffff fcc8 | |
0000 40ff fec0 0000 | |
7cfe fefe ffff 7f60 | |
7cfe fefe fffe 7c1c | |
7cfe fefe fffe 7f1b | |
7eff ffff ff7e 3c7e | |
0000 0000 0000 0000 | |
3c7e ffff ff7e 3c66 | |
3c7e ffff ff7e 3c30 | |
3c7e ffff ff7e 3c0c | |
7cfe ffff ffff 3c66 | |
7cfe ffff ffff 3830 | |
7cfe ffff ffff 1c0c | |
1c3c 1818 1818 1810 | |
0000 0000 0000 0000 | |
] | |
@paint-bg ( addr* flipx? -- ) | |
,&yesflip JCN | |
&noflip | |
#80 ;&readmask STA | |
#10 ;&shiftarg STA | |
,&doneflip JMP | |
&yesflip | |
#01 ;&readmask STA | |
#01 ;&shiftarg STA | |
&doneflip | |
.Screen/x DEI2 STH2 | |
#00 | |
( addr* y-count -- ) | |
&loop | |
( ,&end JMP DEBUG! Skip outer loop ) | |
DUP #08 EQU ,&end JCN | |
ROT ROT | |
( y-count addr* -- ) | |
LDAk | |
( y-count addr* enc -- ) | |
( Okay! We have our encoded byte on the stack. ) | |
( Let's start our inner loop. ) | |
#00 | |
( y-count addr* enc x-count -- ) | |
&innerloop | |
( ,&innerend JMP DEBUG! Skip inner loop ) | |
DUP #08 EQU ,&innerend JCN | |
SWP | |
( ,&skip JMP DEBUG! Skip pixel ) | |
( y-count addr* x-count enc -- ) | |
DUP [ LIT &readmask 80 ] AND #00 EQU ,&skip JCN | |
( y-count addr* x-count enc -- ) | |
OVR #00 SWP ( Grab the loop counter and extend to word size ) | |
( y-count addr* x-count enc x-count* -- ) | |
STH2kr ( Grab the stash x offset ) | |
( y-count addr* x-count enc x-count* x-pos* -- ) | |
ADD2 ( Add them ) | |
( y-count addr* x-count enc x-pos* -- ) | |
.Screen/x DEO2 ( x coordinate ) | |
( y-count addr* x-count enc -- ) | |
#00 .Screen/pixel DEO ( Paint a white pixel ) | |
&skip | |
( y-count addr* x-count enc -- ) | |
[ LIT &shiftarg 10 ] SFT | |
SWP | |
( y-count addr* enc x-count -- ) | |
INC ( Increment x-count ) | |
,&innerloop JMP | |
&innerend | |
( End of inner loop. ) | |
( y-count addr* enc x-count -- ) | |
POP2 | |
( y-count addr* -- ) | |
INC2 ( Increment addr ) | |
.Screen/y DEI2 #0001 ADD2 .Screen/y DEO2 | |
ROT | |
( addr* y-count -- ) | |
INC ( Increment y-count ) | |
,&loop JMP | |
&end | |
( addr* y-count -- ) | |
POP | |
POP2 | |
POP2r | |
JMP2r | |
@Animation ( still ) ( walk1 ) ( walk2 ) ( hurt ) ( flipx? ) | |
&right 00 03 04 05 00 | |
&up 08 09 0a 05 00 | |
&left 80 83 84 05 01 | |
&down 0b 0c 0d 05 00 | |
@map [ | |
1800 000a 0b0b 0a0b 0c1e 001f 1f1f 1b1f | |
0000 0012 1313 0a0b 0c00 1b00 1f1f 1b1c | |
1900 0000 001d 1213 1400 0000 1b1c 1b1b | |
001a 0000 0000 0000 0000 001c 001b 1c1b | |
0000 0018 191a 0000 1c00 0000 001b 001c | |
0000 0000 1a1c 1800 0000 0000 1c00 0000 | |
0000 0000 0000 1a19 001d 1e00 0000 0000 | |
0000 0000 0018 0019 1a00 001a 001a 1900 | |
0000 0000 0000 0018 0018 0000 0000 0000 | |
0507 1b00 0000 0000 0019 0000 0000 0000 | |
0e0e 071b 0000 0018 0000 0000 0000 0000 | |
0e0e 1700 0000 0019 0000 1c1c 001c 0000 | |
0e0f 1f00 0000 0000 0000 001f 0507 1c00 | |
0e0e 0607 0000 0018 001c 0506 0e0f 1f00 | |
0e0e 0e0f 1b00 0000 001b 0d0e 0e0e 071b | |
0e0e 0e0f 1f1f 0000 001f 0d0e 0e0e 0f1f | |
] | |
@background [ | |
0000 0000 0000 0000 0000 0000 0000 0000 | |
ffff ffff ffff ffff ffff ffff ffff ffff | |
317b ffff ffff ffff 317b 7f3f 1f0f 4f6f | |
e1f3 ffff ffff ffff c1c3 c7cf dfff ffff | |
fcfe ffff ffff ffff fcfe febe 9e8e ceee | |
0000 0808 080c 1ebf 0416 3777 7773 6140 | |
0808 0888 8c9e bfff 1034 7677 7361 4000 | |
0000 8080 80c9 e9fb 4060 7072 7636 1604 | |
3f7f ffff ffff ffff 3f7f ffff ffff ffff | |
fcfe ffff ffff ffff fcfe ffff ffff ffff | |
ffff ffff ffff ffff 7f77 7373 7373 737b | |
ffff ffff ffff ffff efcf 8f8f 9fbf ffff | |
ffff ffff ffff ffff fef6 e6c6 c6c6 cede | |
ff87 c361 3f7f ffff 0078 3c1e 0000 0000 | |
e3f1 f8ff c387 0fff 1c0e 0700 3c78 f000 | |
efcf 8f8e 9cbe ffff 1030 7070 6040 0000 | |
ffff ffff ffff 7f3f ffff ffff ffff 7f3f | |
ffff ffff ffff fefc ffff ffff ffff fefc | |
ffff ffff ffff 7f3f 7f7b 3323 0303 0000 | |
ffff ffff ffff ffff bf9f 9f9b 9909 0000 | |
ffff ffff ffff fefc dece c6c2 c080 0000 | |
ff7f 3f63 c78f 7f3f 0000 001c 3870 0000 | |
ffff efcf 8f9f bfff 0000 1030 7060 4000 | |
fffe c7e3 f1ff fefc 0000 381c 0e00 0000 | |
60f0 f066 0f6f 6f06 60f0 f066 0f6f 6f06 | |
003c 7e7e 7e7c 3800 003c 7e7e 7e7c 3800 | |
18d8 c01c 3e3e 1c00 18d8 c01c 3e3e 1c00 | |
0000 0000 0000 0000 0040 6173 7737 1604 | |
0000 0000 0000 0000 0000 4060 642c 0c08 | |
1c3e 7fff ffff fe78 1c32 76c6 b630 0000 | |
0e1f 1f7f fefc fc78 0e1c 0670 f070 0000 | |
0000 0014 9ddb 5230 0899 dbeb 6224 2c0c | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment