C64 Maze Chomp.BAS

https://news.ycombinator.com/rss Hits: 5
Summary

c64 Maze Chomp.BAS 06 Dec, 2025 Maze Chomp is a simple maze game adapted from a listing in issue #3 of 1984's Input Magazine. ! The goal is to eat all the dots in as little time as possible. Controls: WASD keys, space to continue Input is a great magazine for learning BASIC. It's structured like a course, with different article-lessons in each issue. It covers not only the Commodore 64, but the Vic-20, Acorn Electron and BBC Micro, Sinclair Spectrum and ZX 81, and Tandy Dragon and TRS80 Color Computer. The Listing ``` 10 p1=1117: p2=p1 :rem where coins begin & loc of player 15 bd = 53280 : rem border address 20 bg = 53281 : rem background address 25 ll = 40 :rem characters in a line 30 cc$=chr$(5) : rem character color 35 cs$=chr$(147): rem clear screen poke value 40 ch$= chr$(19) ``` First we set the variables; p1 is the location of the player on the screen in the upper left corner as a memory address. BD is the screen border color as a memory address, and bg is the background color as an address. All of these will be used by POKE statements, but it's good practice to store them as variables instead of hard-coded numbers. cc$ holds the value for our character color, and cs$ is the chr$ character code to clear the screen. Saves on typing and BASIC memory when we use it often. 45 poke bd,6: rem set border color 50 poke bg,0: rem set background color 55 poke 650,128: rem set up key repeat for smooth input Line 55 sets up a simple address change that lets us store repeat key presses, so we can hold down the direction instead of tapping it. 60 ? cs$, cc$ : rem clear the screen, set the colors 70 rem *** the map *** 100 ? tab(12)"{cm a}{sh asterisk*13}{cm s}" 105 ? tab(12)"{sh -}.............B" 110 ? tab(12)"{sh -}.{cm +*3}.{cm +*3}.{cm +*3}.B" 115 ? tab(12)"{sh -}......{cm +}......B" 120 ? tab(12)"{sh -}{cm +*3}.{cm +}...{cm +}.{cm +*3}B" 125 ? tab(12)"{sh -}....{cm +}...{cm +}....B" 130 ? tab(12)"{sh -}.{cm +*2}...{cm +}...{cm +*2}.B" 135 ? tab(12)"{sh -}{cm +*4}.{cm +...

First seen: 2025-12-12 23:49

Last seen: 2025-12-13 03:50