Last active
February 17, 2025 18:36
-
-
Save aparrish/31b1639e876e162cf24ddcf7bf10a7fb to your computer and use it in GitHub Desktop.
Revisions
-
aparrish revised this gist
Feb 17, 2025 . 1 changed file with 67 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,67 @@ [ 10 print implementation in an experimental stack-based language for the gameboy ] !section tenprint rom0 !staticvar @seed wram0 ^inchl_entrypoint $ab &seed put12 jp &tenprint @waitvblank $44 geff 144 diff jpnz &waitvblank ret @rand [ adapted from https://foobles.neocities.org/blog/2024-06-06/prng ] &seed get double jpnc :skip_xor $46 xor $ec add jp :done .skip_xor $eb add .done dup &seed put12 ret @tenprint $00 $40 puff [ turn off lcd so we can access vram ] [ draw / to tile data ] $00 .loop %11 over lshift over double $88 put12 %10 over lshift over double inc $88 put12 inc dup $08 diff jpnz :loop drop [ draw \ to tile data ] $00 .loop2 %11000000 over rshift over double $10 add $88 put12 %10000000 over rshift over double inc $10 add $88 put12 inc dup $08 diff jpnz :loop2 drop %10010001 $40 puff [ turn the lcd on again ] %11100100 $47 puff [ set palette ] %00010000 $00 puff [ read buttons ] [ populate the tile map ] .forever #9800 { call &waitvblank [ set palette based on keys ] $00 geff %1 and { %11100100 $47 puff } { %00011011 $47 puff } ifte [ draw a row ] $0 { *add21 call &rand %1 and $80 add waitvram put21 inc dup 20 lt } while drop $20 add21 dup2 #9A40 ne2 } while drop2 jp :forever halt -
aparrish created this gist
Jan 28, 2025 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,69 @@ [ 10 print implementation in an experimental stack-based language for the gameboy ] !section tenprint rom0 !staticvar @seed wram0 ^inchl_entrypoint $ab &seed put jp &tenprint @waitvblank $44 geff 144 diff jpnz &waitvblank ret @rand [ from https://foobles.neocities.org/blog/2024-06-06/prng ] &seed get double jpnc :skip_xor $46 xor $ec add jp :done .skip_xor $eb add .done dup &seed put ret @tenprint $00 $40 puff [ turn off lcd so we can access vram ] [ draw / to tile data ] $00 .loop %11 over lshift over double $88 put %10 over lshift over double inc $88 put inc dup $08 diff jpnz :loop drop [ draw \ to tile data ] $00 .loop2 %11000000 over rshift over double $10 add $88 put %10000000 over rshift over double inc $10 add $88 put inc dup $08 diff jpnz :loop2 drop %10010001 $40 puff [ turn the lcd on again ] %11100100 $47 puff [ set palette ] [ populate the tilemap ] .forever #9800 { dup2 #9A40 eq2 blnot } { dup2 $0 { dup 20 lt } { call &waitvblank dup push over2 rotl add21 call &rand %1 and $80 add rotr put pop inc } while drop drop drop $20 add21 } while jp :forever halt