diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cab9744 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.DS* +*jpg +*png +*bmp +/bin +*snarf +*theme +*nametable +*rom diff --git a/ray/bin/ray.rom b/ray/bin/ray.rom deleted file mode 100644 index 0720557..0000000 Binary files a/ray/bin/ray.rom and /dev/null differ diff --git a/ray/src/ray.tal b/ray/src/ray.tal index abc4838..2ae1a77 100644 --- a/ray/src/ray.tal +++ b/ray/src/ray.tal @@ -47,23 +47,39 @@ BRK @on-frame ( -> ) + ;draw-map JSR2 + + .Mouse/x DEI2 #003c DIV2k MUL2 SUB2 .player/a STZ2 + .player/x LDZ2 .player/y LDZ2 - [ LIT2 &range 0020 ] STH2k ;raycast JSR2 + #0060 + STH2k ;raycast JSR2 - OVR2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 - #03 SFT2 ;print JSR2 #2018 DEO - DUP2 .player/y LDZ2 STH2kr #01 SFT2 SUB2 ADD2 - #03 SFT2 ;print JSR2 #0a18 DEO + OVR2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 + OVR2 .player/y LDZ2 STH2kr #01 SFT2 SUB2 ADD2 + ;get-tile JSR2 #00 NEQ ,&color STR SWP2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 SWP2 .player/y LDZ2 STH2r #01 SFT2 SUB2 ADD2 - #02 ;draw-line JSR2 - - ,&range LDR2 INC2 ,&range STR2 + #02 [ LIT &color $1 ] ADD ;draw-line JSR2 BRK +@cast ( -- range ) + + #8001 + &r + #00 OVR STH2k ;raycast JSR2 + SWP2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 + SWP2 .player/y LDZ2 STH2r #01 SFT2 SUB2 ADD2 + ;get-tile JSR2 #00 NEQ ,&collide JCN + INC GTHk ,&r JCN + &collide + NIP + +JMP2r + @raycast ( range* -- x* y* ) STH2 @@ -98,8 +114,8 @@ JMP2r ( draw player ) - .player/x LDZ2 #0004 SUB2 .Screen/x DEO2 - .player/y LDZ2 #0004 SUB2 .Screen/y DEO2 + .player/x LDZ2 #0003 SUB2 .Screen/x DEO2 + .player/y LDZ2 #0003 SUB2 .Screen/y DEO2 ;player-icn .Screen/addr DEO2 #05 .Screen/sprite DEO @@ -120,8 +136,8 @@ JMP2r @get-tile ( x* y* -- tile ) - #03 SFT2 #0010 SFT2 - #03 SFT2 ADD2 #0003 MUL2 ;nametable ADD2 LDZ + #43 SFT2 SWP2 #03 SFT2 ADD2 #0003 MUL2 + ;nametable ADD2 LDA2 NIP JMP2r