still workinge
This commit is contained in:
parent
ce675833cc
commit
9db3b38e46
25
maze.tal
25
maze.tal
|
@ -14,17 +14,20 @@
|
||||||
%EMIT { #18 DEO }
|
%EMIT { #18 DEO }
|
||||||
%SPACE { #20 EMIT }
|
%SPACE { #20 EMIT }
|
||||||
%NEWLINE { #0a EMIT }
|
%NEWLINE { #0a EMIT }
|
||||||
%ITERATIONS { #0100 }
|
|
||||||
%MOD { DIVk MUL SUB }
|
%MOD { DIVk MUL SUB }
|
||||||
%MOD2 { DIV2k MUL2 SUB2 }
|
%MOD2 { DIV2k MUL2 SUB2 }
|
||||||
%DEC { #01 SUB }
|
%DEC { #01 SUB }
|
||||||
%DEC2 { #0001 SUB2 }
|
%DEC2 { #0001 SUB2 }
|
||||||
%NEGATE2 { #ffff MUL2 }
|
%NEGATE2 { #ffff MUL2 }
|
||||||
|
|
||||||
|
( TODO: once the dimensions are finalized inline constants )
|
||||||
|
|
||||||
%ROWS { #0027 } ( rows of cells )
|
%ROWS { #0027 } ( rows of cells )
|
||||||
%COLS { #003f } ( columns of cells )
|
%COLS { #003f } ( columns of cells )
|
||||||
%MAZEROWS { ROWS #0003 SUB2 #0002 DIV2 }
|
%MAZEROWS { ROWS #0003 SUB2 #0002 DIV2 }
|
||||||
%MAZECOLS { COLS #0003 SUB2 #0002 DIV2 }
|
%MAZECOLS { COLS #0003 SUB2 #0002 DIV2 }
|
||||||
|
( %MAZEROWS { ROWS INC2 #0002 DIV2 }
|
||||||
|
%MAZECOLS { COLS INC2 #0002 DIV2 } )
|
||||||
%NORTH { COLS NEGATE2 }
|
%NORTH { COLS NEGATE2 }
|
||||||
%EAST { #0001 }
|
%EAST { #0001 }
|
||||||
%SOUTH { COLS }
|
%SOUTH { COLS }
|
||||||
|
@ -38,6 +41,10 @@
|
||||||
%UNSEEN { LOAD #02 AND #00 EQU } ( cell* -> bool^ )
|
%UNSEEN { LOAD #02 AND #00 EQU } ( cell* -> bool^ )
|
||||||
%PATH { ADD2 #0002 DIV2 } ( cell1* cell2* -> cell3* )
|
%PATH { ADD2 #0002 DIV2 } ( cell1* cell2* -> cell3* )
|
||||||
|
|
||||||
|
%DIGIT { #00 SWP ;digits ADD2 LDA EMIT }
|
||||||
|
%EMIT-BYTE { DUP #04 SFT DIGIT #0f AND DIGIT }
|
||||||
|
%EMIT-SHORT { SWP EMIT-BYTE EMIT-BYTE }
|
||||||
|
|
||||||
( devices )
|
( devices )
|
||||||
|
|
||||||
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|
||||||
|
@ -83,7 +90,6 @@
|
||||||
( intialize rng )
|
( intialize rng )
|
||||||
;init-rng JSR2
|
;init-rng JSR2
|
||||||
|
|
||||||
( #03 .tint STZ )
|
|
||||||
#03 .tint STZ
|
#03 .tint STZ
|
||||||
#00 .regenerate STZ
|
#00 .regenerate STZ
|
||||||
|
|
||||||
|
@ -150,10 +156,6 @@ BRK
|
||||||
&done
|
&done
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
%DIGIT { #00 SWP ;digits ADD2 LDA EMIT }
|
|
||||||
%EMIT-BYTE { DUP #04 SFT DIGIT #0f AND DIGIT }
|
|
||||||
%EMIT-SHORT { SWP EMIT-BYTE EMIT-BYTE }
|
|
||||||
|
|
||||||
@try-move ( drow dcol -> )
|
@try-move ( drow dcol -> )
|
||||||
.charx LDZ2 ADD2 SWP2 ( col+dcol row+drow )
|
.charx LDZ2 ADD2 SWP2 ( col+dcol row+drow )
|
||||||
.chary LDZ2 ADD2 SWP2 ( row+drow dcol )
|
.chary LDZ2 ADD2 SWP2 ( row+drow dcol )
|
||||||
|
@ -282,6 +284,15 @@ RTN
|
||||||
POP2 POP2
|
POP2 POP2
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
|
( a move is illegal if it changes both x and y. )
|
||||||
|
( that occurs when the player wraps around the border. )
|
||||||
|
@illegal-move ( cell* -> bool^ )
|
||||||
|
DUP2
|
||||||
|
COLS MOD2 ;focus LDA2 COLS MOD2 NEQ2 STH
|
||||||
|
ROWS DIV2 ;focus LDA2 ROWS DIV2 NEQ2 STHr
|
||||||
|
AND
|
||||||
|
RTN
|
||||||
|
|
||||||
@create-maze ( -> )
|
@create-maze ( -> )
|
||||||
( create starting pt, must have even coords )
|
( create starting pt, must have even coords )
|
||||||
;random-short JSR2 MAZEROWS MOD2 INC2 #0002 MUL2 ( row* )
|
;random-short JSR2 MAZEROWS MOD2 INC2 #0002 MUL2 ( row* )
|
||||||
|
@ -297,8 +308,10 @@ RTN
|
||||||
DUP .directions ADD LDZ ( i^ d^ )
|
DUP .directions ADD LDZ ( i^ d^ )
|
||||||
DUP #02 MUL .cell-offsets ADD LDZ2 ( i^ d^ off* )
|
DUP #02 MUL .cell-offsets ADD LDZ2 ( i^ d^ off* )
|
||||||
DUP2 ;focus LDA2 ADD2 ADD2 ( i^ d^ cell2* )
|
DUP2 ;focus LDA2 ADD2 ADD2 ( i^ d^ cell2* )
|
||||||
|
DUP2 ;illegal-move JSR2 ,¬found JCN
|
||||||
DUP2 UNSEEN ( i^ d^ cell2* unseen^ )
|
DUP2 UNSEEN ( i^ d^ cell2* unseen^ )
|
||||||
,&found JCN ( i^ d^ cell2* )
|
,&found JCN ( i^ d^ cell2* )
|
||||||
|
¬found
|
||||||
POP2 POP INC ( j=i+1 )
|
POP2 POP INC ( j=i+1 )
|
||||||
DUP #04 LTH ( j^ j<4 )
|
DUP #04 LTH ( j^ j<4 )
|
||||||
,&search JCN ( j^ )
|
,&search JCN ( j^ )
|
||||||
|
|
Loading…
Reference in New Issue