Housekeeping

This commit is contained in:
Devine Lu Linvega 2023-05-22 17:22:24 -07:00
parent 878f606081
commit 6de8f677d0
1 changed files with 16 additions and 60 deletions

View File

@ -7,14 +7,7 @@
|80 @Controller &vector $2 &button $1 &key $1 |80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1 |90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1
|0000
@world &frame $1 &count $2
@anchor &x $2 &y $2 &x2 $2 &y2 $2
@pointer &x $2 &y $2
|0100 ( -> ) |0100 ( -> )
( theme ) ( theme )
#970f .System/r DEO2 #970f .System/r DEO2
#7d0f .System/g DEO2 #7d0f .System/g DEO2
@ -26,26 +19,21 @@
;on-mouse .Mouse/vector DEO2 ;on-mouse .Mouse/vector DEO2
draw-border draw-border
draw-blocks draw-blocks
BRK BRK
( (
@|vectors ) @|vectors )
@on-mouse ( -> ) @on-mouse ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;cursor-icn update-cursor [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;cursor-icn update-cursor
.Mouse/state DEI ?&on-touch .Mouse/state DEI ?&on-touch
BRK BRK
&on-touch ( -> ) &on-touch ( -> )
.Mouse/x DEI2 #0008 SUB2 NIP #18 DIV .Mouse/x DEI2 #0008 SUB2 NIP #18 DIV
.Mouse/y DEI2 #0008 SUB2 NIP #18 DIV .Mouse/y DEI2 #0008 SUB2 NIP #18 DIV
;try-move ;try-move/cc .Mouse/state DEI #01 GTH JMP SWP2 POP2 JSR2 ;try-move ;try-move/cc .Mouse/state DEI #01 GTH [ JMP SWP2 POP2 ] JSR2
#00 .Mouse/state DEO #00 .Mouse/state DEO
BRK BRK
( (
@ -60,7 +48,6 @@ BRK
&l &l
#00 OVR #0006 MUL2 ;game ADD2 [ LIT2 &t $2 ] is-at ?&found #00 OVR #0006 MUL2 ;game ADD2 [ LIT2 &t $2 ] is-at ?&found
INC GTHk ?&l INC GTHk ?&l
&end
POP2 POP2
#ffff #ffff
JMP2r JMP2r
@ -72,17 +59,13 @@ JMP2r
JMP2r JMP2r
@is-at ( block* x y -- f ) @is-at ( block* x y -- f )
OVR2 LDA2 STH2 OVR2 LDA2 STH2
SWP2 INC2 INC2 LDA2 SUB2 SWP2 INC2 INC2 LDA2 SUB2
STHr LTH STHr LTH
SWP STHr LTH AND SWP STHr LTH AND
JMP2r JMP2r
@try-move ( x y -- ) @try-move ( x y -- )
#01 phex/b #2018 DEO
pick pick
DUP2 #ffff EQU2 ?&blank DUP2 #ffff EQU2 ?&blank
DUP2 #0000 EQU2 ?&blank DUP2 #0000 EQU2 ?&blank
@ -91,10 +74,8 @@ JMP2r
( left ) #ff00 OVR2 OVR2 can-move ?&move POP2 ( left ) #ff00 OVR2 OVR2 can-move ?&move POP2
( right ) #0001 OVR2 OVR2 can-move ?&move POP2 ( right ) #0001 OVR2 OVR2 can-move ?&move POP2
POP2 POP2
JMP2r JMP2r
&cc ( x y -- ) &cc ( x y -- )
#00 phex/b #2018 DEO
pick pick
DUP2 #ffff EQU2 ?&blank DUP2 #ffff EQU2 ?&blank
DUP2 #0000 EQU2 ?&blank DUP2 #0000 EQU2 ?&blank
@ -110,20 +91,12 @@ JMP2r
SWP SWP
LDAkr STHr ADD STH2kr STA INC2r LDAkr STHr ADD STH2kr STA INC2r
LDAkr STHr ADD STH2r STA LDAkr STHr ADD STH2r STA
draw-blocks !draw-blocks
JMP2r
&blank ( block* -- ) &blank ( block* -- )
POP2 POP2
JMP2r JMP2r
@is-free ( x y -- f )
POP2 #00
JMP2r
@can-move ( block* x y -- f ) @can-move ( block* x y -- f )
OVR2 ,&self STR2 OVR2 ,&self STR2
OVR2 STH2 INC2r INC2r LDA2r OVR2 STH2 INC2r INC2r LDA2r
STHr ADD ,&offy STR STHr ADD ,&offy STR
@ -131,7 +104,6 @@ JMP2r
LDA2 LDA2
,&height STR ,&height STR
,&width STR ,&width STR
[ LIT2 &height $1 00 ] [ LIT2 &height $1 00 ]
&v &v
STHk STHk
@ -150,56 +122,35 @@ JMP2r
INC GTHk ?&v INC GTHk ?&v
POP2 POP2
#01 #01
JMP2r JMP2r
@game ( size, pos ) [
&a 0202 0000 =draw-a
&b 0201 0200 =draw-b
&v 0201 0201 =draw-v
&w 0101 0002 =draw-w
&x 0101 0102 =draw-x
&d 0102 0003 =draw-d
&y 0102 0103 =draw-y
&z 0201 0203 =draw-z
&c 0201 0204 =draw-c ]
( (
@|drawing ) @|drawing )
@draw-blocks ( -- ) @draw-blocks ( -- )
#0900 #0900
&l &l
#00 OVR draw-block #00 OVR draw-block
INC GTHk ?&l INC GTHk ?&l
POP2 POP2
JMP2r JMP2r
@clear-block ( id* -- ) @clear-block ( id* -- )
#00 ;draw-times/color STA #00 ;draw-times/color STA
INC2 INC2 LDA2k to-screen INC2 INC2 LDA2k to-screen
INC2 INC2 LDA2 JSR2 INC2 INC2 LDA2 JSR2
#81 ;draw-times/color STA #81 ;draw-times/color STA
JMP2r JMP2r
@draw-block ( id* -- ) @draw-block ( id* -- )
#0006 MUL2 ;game ADD2 #0006 MUL2 ;game ADD2
INC2 INC2 LDA2k to-screen INC2 INC2 LDA2k to-screen
INC2 INC2 LDA2 JSR2 INC2 INC2 LDA2
JMP2
JMP2r
@to-screen ( x y -- ) @to-screen ( x y -- )
#00 SWP #0018 MUL2 #0008 ADD2 .Screen/y DEO2 #00 SWP #0018 MUL2 #0008 ADD2 .Screen/y DEO2
#00 SWP #0018 MUL2 #0008 ADD2 .Screen/x DEO2 #00 SWP #0018 MUL2 #0008 ADD2 .Screen/x DEO2
JMP2r JMP2r
@draw-a ( -- ) ;blocks-chr/a .Screen/addr DEO2 #56 .Screen/auto DEO #06 !draw-times @draw-a ( -- ) ;blocks-chr/a .Screen/addr DEO2 #56 .Screen/auto DEO #06 !draw-times
@ -213,20 +164,17 @@ JMP2r
@draw-21 ( addr* -- ) .Screen/addr DEO2 #56 .Screen/auto DEO #03 !draw-times @draw-21 ( addr* -- ) .Screen/addr DEO2 #56 .Screen/auto DEO #03 !draw-times
@draw-y ( -- ) ;blocks-chr/y !draw-12 @draw-y ( -- ) ;blocks-chr/y !draw-12
@draw-d ( -- ) ;blocks-chr/d @draw-d ( -- ) ;blocks-chr/d
@draw-12 ( addr* -- ) .Screen/addr DEO2 #26 .Screen/auto DEO #06 !draw-times @draw-12 ( addr* -- ) .Screen/addr DEO2 #26 .Screen/auto DEO #06 ( >> )
@draw-times ( times -- ) @draw-times ( times -- )
#00 SWP SUB #00 SWP SUB
&l &l
[ LIT &color 81 ] .Screen/sprite DEO [ LIT &color 81 ] .Screen/sprite DEO
INC DUP ?&l INC DUP ?&l
POP POP
JMP2r JMP2r
@draw-border ( -- ) @draw-border ( -- )
( top corners ) ( top corners )
#00 .Screen/auto DEO #00 .Screen/auto DEO
#0000 .Screen/y DEO2 #0000 .Screen/y DEO2
@ -262,7 +210,6 @@ JMP2r
#0068 .Screen/x DEO2 #0068 .Screen/x DEO2
;frame-chr/mr .Screen/addr DEO2 ;frame-chr/mr .Screen/addr DEO2
#81 .Screen/sprite DEO #81 .Screen/sprite DEO
JMP2r JMP2r
@update-cursor ( color addr* -- ) @update-cursor ( color addr* -- )
@ -278,9 +225,18 @@ JMP2r
JMP2r JMP2r
( (
@|stdlib ) @|state )
@phex ( short* -- ) SWP phex/b &b DUP #04 SFT phex/c &c #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO JMP2r @game ( size, pos ) [
&a 0202 0000 =draw-a
&b 0201 0200 =draw-b
&v 0201 0201 =draw-v
&w 0101 0002 =draw-w
&x 0101 0102 =draw-x
&d 0102 0003 =draw-d
&y 0102 0103 =draw-y
&z 0201 0203 =draw-z
&c 0201 0204 =draw-c ]
( (
@|assets ) @|assets )