Friday, December 22, 2023

0000 0000 1101 1010

Lunar Landing like it's 1978

My first attempt at programming was a Lunar Lander game back in 1978. I used an Apple II which had arrived at my school and then was promptly stored in the cleaner's room (!!) to gather dust.

I used to be let in after school and on weekends to try to make this thing work. Fortunately the manuals were great and pretty soon I had written a BASIC Lunar Lander.

Wouldn't it be nice to go back to those times and get enjoyment from a game that mostly happens in your head?

Well the successful building of a KimUno recently (video and blog) has meant an opening to go back to the future and play with these games/applications again.

I hadn't been too successful trying to shove code into the memory available, due in no small part to the byzantine memory map of this replica.

But I did think I could succeed if I made a ROM and programmed the game at the source, straight into the Arduino Pro Mini that drives the whole deal. These are the steps I thought might result in a Lunar Lander on a KimUno. 

1. Find a good Lunar Lander written in 6502 style for the Kim1.
2. Use an assembler to make the Hex code for the game (see below).
3. Convert the Hex code to the array format used by the KimUno code with the help of my old friend Nedit (xNedit).
4. Change the roms.h, cpu.c and config.h files of the KimUno project code to insert the game ROM at $3000.
5. Compile and upload to the Arduino Pro Mini
6. Practise my landings.

Here's the Hex code if you wish to try it yourself!

3000: A2 0D BD CC 30 95 D5 CA
3008: 10 F8 A2 05 A0 01 F8 18
3010: B5 D5 75 D7 95 D5 CA 88
3018: 10 F6 B5 D8 10 02 A9 99
3020: 75 D5 95 D5 CA 10 E5 A5
3028: D5 10 0D A9 00 85 E2 A2
3030: 02 95 D5 95 DB CA 10 F9
3038: 38 A5 E0 E5 DD 85 E0 A2
3040: 01 B5 DE E9 00 95 DE CA
3048: 10 F7 B0 0C A9 00 A2 03
3050: 95 DD CA 10 FB 20 BD 30
3058: A5 DE A6 DF 09 F0 A4 E1
3060: F0 20 F0 9C F0 A4 A2 FE
3068: A0 5A 18 A5 D9 69 05 A5
3070: D8 69 00 B0 04 A2 AD A0
3078: DE 98 A4 E2 F0 04 A5 D5
3080: A6 D6 85 FB 86 FA A5 D9
3088: A6 D8 10 05 38 A9 00 E5
3090: D9 85 F9 A9 02 85 E3 D8
3098: 20 1F 1F 20 6A 1F C9 13
30A0: F0 C0 B0 03 20 AD 30 C6
30A8: E3 D0 ED F0 B7 C9 0A 90
30B0: 05 49 0F 85 E1 60 AA A5
30B8: DD F0 FA 86 DD A5 DD 38
30C0: F8 E9 05 85 DC A9 00 E9
30C8: 00 85 DB 60 45 01 00 99
30D0: 81 00 99 97 02 08 00 00
30D8: 01 01 00 00 00 00 00 00

And here is the video showing the final project and all the little funny bits along the way!




No comments:

Post a Comment