A Compiler and Implementing Dr. Nim

62 views
Skip to first unread message

David Read

unread,
Feb 4, 2024, 2:48:29 PMFeb 4
to uKenbak-1
I teach a compilers course and thought the uKenbak-1 would be an interesting target, removing the complexity of generating machine code for Intel or ARM-based systems. I implemented a small language and used the Dr. Nim game (E.S.R. 1960s, https://en.wikipedia.org/wiki/Dr._Nim) as a proof of concept.

I have attached the generated octal codes as well as the source. If you are interested in the compiler project, it is on GitHub at: https://github.com/DaveRead/microKENBAK-1-Compiler

The gameplay works as follows:
1. The four left-most data LEDs will display the starting number of marbles (15)
2. The INPUT LED will light (indicating the player's turn)
3. Enter 1, 2, or 3 using the two right-most data inputs to choose the number of marbles to take
4. Press Start to take the marbles
5. The four left-most data LEDS will display the remaining number of marbles
6a. If the player took the last marble (winner):
6a1. The INPUT and ADDRESS LEDs will light, indicating the player won
6a2. All the data LEDs will flash several times
6a3. Press Start to begin a new game (return to step 1)
6b. If marbles remain, play moves onto step 7
7. The MEMORY LED will be lit to indicate it is the computer's turn
8. The two right-most data LEDS will display the number of marbles the computer took
9. The four left-most data LEDS will display the remaining number of marbles
10a. If the computer took the last marble (winner):
10a1. The MEMORY and ADDRESS LEDs will be lit - indicating the computer won
10a2. All the data LEDs will flash several times
10a3. Press Start to begin a new game (return to step 1)
10b. If marbles remain, press start, and play returns to step 2 (player's turn)

NOTE: If the player chooses an illegal number of marbles, it will default to 1

Please let me know if you try it out and find any bugs or have ideas for improvements.

DrNim.ops
DrNim.kb1

famousd...@gmail.com

unread,
Feb 10, 2024, 11:40:39 AMFeb 10
to uKenbak-1
Thanks for sharing this!  I'll give it a try.
Reply all
Reply to author
Forward
0 new messages