(move.tal)Cleaned up demo

This commit is contained in:
neauoire 2022-03-13 20:32:32 -07:00
parent 162400cb54
commit 9e9313d064
1 changed files with 41 additions and 52 deletions

View File

@ -1,14 +1,8 @@
( dev/controller/buttons )
%++ { INC2 }
%-- { #0001 SUB2 }
%2// { #01 SFT2 }
( devices ) ( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |0000 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |0020 @Screen &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller [ &vector $2 &button $1 &key $1 ] |0080 @Controller &vector $2 &button $1 &key $1
( variables ) ( variables )
@ -18,21 +12,19 @@
( init ) ( init )
|0100 ( -> ) |0100 ( -> ) @program
( theme ) ( theme )
#0daf .System/r DEO2 #0daf .System/r DEO2
#02ff .System/g DEO2 #02ff .System/g DEO2
#035f .System/b DEO2 #035f .System/b DEO2
( vectors )
( vectors )
;on-frame .Screen/vector DEO2 ;on-frame .Screen/vector DEO2
( set origin ) ( set origin )
.Screen/width DEI2 2// .Screen/x DEO2 .Screen/width DEI2 #01 SFT2 .Screen/x DEO2
.Screen/height DEI2 2// .Screen/y DEO2 .Screen/height DEI2 #01 SFT2 .Screen/y DEO2
( defaults )
;default_icn .Screen/addr DEO2 ;default-icn .Screen/addr DEO2
#41 .Screen/sprite DEO #41 .Screen/sprite DEO
#0a .slime STZ #0a .slime STZ
@ -41,49 +33,46 @@ BRK
@on-frame ( -> ) @on-frame ( -> )
#0a .slime STZ #0a .slime STZ
;default_icn .Screen/addr DEO2 ;default-icn .Screen/addr DEO2
( hold ctrl key to change slime color ) ( hold ctrl key to change slime color )
.Controller/button DEI #0f AND .Controller/button DEI #0f AND
DUP #01 NEQ ,&no-ctrl JCN #05 .slime STZ &no-ctrl DUP #01 NEQ ,&no-ctrl JCN #05 .slime STZ &no-ctrl
DUP #02 NEQ ,&no-alt JCN #0f .slime STZ &no-alt DUP #02 NEQ ,&no-alt JCN #0f .slime STZ &no-alt
POP POP
( clear )
( clear ) #40 .Screen/sprite DEO #40 .Screen/sprite DEO
( detect movement ) ( detect movement )
.Controller/button DEI #f0 AND .Controller/button DEI
DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN DUP #10 AND #00 EQU ,&no-up JCN
( move ) .Screen/y DEI2 #0001 SUB2 .Screen/y DEO2
.Screen/y DEI2 -- .Screen/y DEO2 ;up-icn .Screen/addr DEO2 &no-up
;up_icn .Screen/addr DEO2 &no-up DUP #20 AND #00 EQU ,&no-down JCN
DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN .Screen/y DEI2 INC2 .Screen/y DEO2
( move ) ;down-icn .Screen/addr DEO2 &no-down
.Screen/y DEI2 ++ .Screen/y DEO2 DUP #40 AND #00 EQU ,&no-left JCN
;down_icn .Screen/addr DEO2 &no-down .Screen/x DEI2 #0001 SUB2 .Screen/x DEO2
DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN ;left-icn .Screen/addr DEO2 &no-left
( move ) DUP #80 AND #00 EQU ,&no-right JCN
.Screen/x DEI2 -- .Screen/x DEO2 .Screen/x DEI2 INC2 .Screen/x DEO2
;left_icn .Screen/addr DEO2 &no-left ;right-icn .Screen/addr DEO2 &no-right
DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN
( move )
.Screen/x DEI2 ++ .Screen/x DEO2
;right_icn .Screen/addr DEO2 &no-right
POP POP
( draw face ) ( draw face )
#41 .Screen/sprite DEO #41 .Screen/sprite DEO
( draw slime ) ( draw slime )
;slime_icn .Screen/addr DEO2 ;slime-icn .Screen/addr DEO2
.slime LDZ .Screen/sprite DEO .slime LDZ .Screen/sprite DEO
BRK BRK
@default_icn [ 3c7e ffdb ffe7 7e3c ] @default-icn
@up_icn [ 2466 e7db ffff 7e3c ] 3c7e ffdb ffe7 7e3c
@down_icn [ 3c7e ffff dbe7 6624 ] @up-icn
@left_icn [ 3c7e ef1f 1fef 7e3c ] 2466 e7db ffff 7e3c
@right_icn [ 3c7e f7f8 f8f7 7e3c ] @down-icn
@slime_icn [ 0000 183c 3c18 0000 ] 3c7e ffff dbe7 6624
@left-icn
3c7e ef1f 1fef 7e3c
@right-icn
3c7e f7f8 f8f7 7e3c
@slime-icn
0000 183c 3c18 0000