What better way to keep busy while having a bacterial throat and nose infection than to play around with an old programming language? So I created a simple screensaver today that should give you a warm old school computer feeling while you are not busy working at the computer. The program should run fine on the C64 and with minimal modifications on other computers supporting Commodore/Microsoft Basic.
Please find the ASCII and PRG file of the source code at https://github.com/jklingel/Screensaver. There is also a readme file for more explanations on how the code works. Feel free to modify and improve!
If you are technically interested in how the software works… The heart of the program (of version 1.2) looks like this, using an attempt to move to the right as an example:
- If you reached the rightmost screen column already, remember that moving right is not possible and return:
IF (LO+1)/40=INT((LO+1)/40)THEN MV(4)=1:RETURN
- If the next cell to the right has been already visited, remember that moving right is not possible and return:
IF PEEK(S+LO+1)=CH THEN MV(4)=1:RETURN
- If you are moving into a dead end, remember that moving right is not possible and return. A dead end is defined by having a visited cell up, down, and two steps ahead. It almost feels like machine learning 🙂 This command line needed the spaces removed as I reached the maximum of 80 characters. I added them here for readability:
IF PEEK(S+LO-39)=CH AND PEEK(S+LO+41)=CH AND PEEK(S+LO+2) THEN MV(4)=1:RETURN
- Set the location pointer one step to the right, print the character in the screen cell, increment the „cells visited“ counter, delete the „I cannot move“ array, and return:
FOR I=1TO4:MV(I)=0:NEXT I