I added a mechanism for restarting Lunar Lander at any point while the game is running. It won't work from the GAME OVER screen (you can just click any button on the game controller) or the NEW GAME screen (game is already restarted).
To restart Lunar Lander to the NEW GAME screen while playing, simply change the state of Sense Switch 1. So if it's ON turn it OFF and vice-versa.

The PDP-1 has a single instruction for determining the state of a Sense Switch.
Instruction Code # Explanation
~~~~~~~~~~~ ~~~~~~ ~~~~~~~~~~~
szs 6400s0 Skip on ZERO Sense Switch.
Where s in the code is the switch number 1-6.
I added the following code in the New Game setup section.
sw1, 0 / Value of Sense Switch 1 at the start of a game.
/ Get the current state of Sense Switch 1.
dzm sw1 / Default sw1 to 'off'.
lac (1 / Value to set if Sense Switch 1 is "on".
szs 10 / Skip if Sense Switch 1 is already off.
dac sw1 / Set sw1 to "on".
Then at the start of the main game loop I added the following.
/ Check for restart signal.
lac (0 / Default to Sense Switch 1 "off"
szs 10 / Skip if Sense Switch 1 is off.
lac (1 / Set to Sense Switch 1 "on".
sas sw1 / Is Sense Switch 1 still in the same state?
jmp ngm / No - Restart the game.
/ Yes - Keep playing.
I did not want to tie the reset signal to a specific state of the sense switch (ON or OFF) so that the game would start correctly no matter what the initial state was.
Michael Gardi
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.