×

Poking Technology's video: Hjalfi writes a lunar lander game for the Apollo Lunar Lander

@Hjalfi writes a lunar lander game for the Apollo Lunar Lander
In which yr hmbl svt writes a lunar lander game for the Apollo Guidance Computer (in the process porting the Cowgol compiler to generate code for it). What better way to commemorate the moon landings and _also_ indulge my fondness for compilers and strange processor architectures than to do a port to the Apollo Guidance Computer, possibly the weirdest and most expensive computer of all time? And what better game to run on a LEM than a lunar landing game? (Sadly, not having an actual LEM I'm using the VirtualAGC simulator: https://www.ibiblio.org/apollo/) This was a great deal tougher than I thought --- I actually was originally planning to get it all done in about 4-5 hours. I spent ages wrestling with 1s-Complement arithmetic (which, in the video, I had completely misunderstood: I was getting it mixed up with Signed Magnitude Representation; 1s-Complement works quite differently); it took a good four to five hours before I had that working properly. The game itself was pretty straightforward. The code (such as it is) is available on github here: https://github.com/davidgiven/cowgol/tree/tinycowc-agc/tinycowc And there's more of a writeup on it here. http://cowlark.com/2019-07-20-cowgol-agc Interesting timestamps follow. 00:00:00 Introduction 00:04:27 DAY 1 START 00:28:00 I manage to crash VirtualAGC 00:32:24 First subroutine call (with no parameters) 00:35:50 We add our first (and only) type --- an int15 00:39:12 Start working on expression handling and the virtual stack 00:45:40 We assign a value to a variable! Pity we can't represent values yet 00:47:50 Start implementing the constant pool 00:53:50 Actually run code for loading our variable 00:59:15 We can load variables too 00:59:42 Start adding numbers 01:09:30 Planning how to write to the DSKY 01:14:50 Passing parameters to subroutines 01:32:35 Discovery that YUL can't store addresses as constants 01:36:49 DEBUGGING BREAK --- and solve previous problem through creative evil 01:43:30 Subroutine calls with input parameters work 01:47:00 Adventures with multiplication 01:56:30 Wrestling with the DSKY 02:08:15 Actually get something displayed; conditionals and loops work 02:19:40 Setting individual DSKY digits works; start work on outputting numbers 02:30:10 More problems with labels 02:42:15 Wrestling with division 03:22:55 TEA BREAK 03:33:28 First successful division! 03:37:00 Discover that my virtual AGC keeps resetting; interrupt system debuggin 03:48:30 More fighting with the DSKY 03:58:00 Discover that my DSKY parameter generation is overflowing 04:22:35 1s-complement arithmetic is hard (doesn't help that I got it completely wrong) 04:24:00 Start implementing logic operations 04:33:45 Start go off on a total wild goose chase due to not understanding 1s complement 05:10:00 Realise my mistake and give up 05:24:10 SLEEP. DAY 2 START 05:26:10 Realise I need to keep my own copy of the DSKY state 05:54:35 Revenge of the labels! 06:09:00 Finally, I'm writing numbers to all the DSKY displays! The _right_ numbers! 06:20:20 And now we can display _negative_ numbers! 06:20:55 Start writing the _actual game_ 06:26:00 First attempt to read the Rotational Hand Controller pitch control. This fails 06:45:00 DEBUGGING BREAK --- I give up wrestling with the RHC and the DSKY and do some offline debugging. All better now 06:67:12 Writing the main game loop 06:53:30 First run of our prototype game. It's very broken 07:01:50 Discover a nasty arithmetic bug that just happened not to show up in our tests 07:08:10 The bride of division... from the swamp! 07:28:30 Division works now. Maybe? 07:29:33 Start debugging memory corruption issues 07:35:45 Octal: the cause of, and definitely not the solution to, all of life's problems. 07:38:30 Our game now looks like a bit like a game 07:40:00 Turns out that 15 bits isn't enough precision for our game, so fake some more 07:45:15 Our game is now playable, although it needs lots of tuning. Also being able to control the engine would be nice 07:48:05 The player's throttle control (the RHC) works. It's a game! 07:52:40 The game has a bit of challenge to it. I still land successfully due to leet skills 07:53:30 Start implementing the new game / replay loop, controlled from the DSKY 08:06:34 You can crash and land and be prompted for a new game 08:08:50 The game is done! 08:09:00 I decide to add one more effect, and immediately run out of block 2 fixed memory space 08:38:14 The moment when I realise I've run out of block 2 fixed memory space 08:50:50 The moment when I discover that block 3 fixed memory doesn't kick in automatically 09:00:33 I manage to shrink the program to just fit in block 2 (using all the available space) 09:00:50 THE GAME IS FINISHED

110

18
Poking Technology
Subscribers
3.2K
Total Post
174
Total Views
103.2K
Avg. Views
1.2K
View Profile
This video was published on 2019-07-21 02:41:57 GMT by @hjalfi on Youtube. Poking Technology has total 3.2K subscribers on Youtube and has a total of 174 video.This video has received 110 Likes which are higher than the average likes that Poking Technology gets . @hjalfi receives an average views of 1.2K per video on Youtube.This video has received 18 comments which are higher than the average comments that Poking Technology gets . Overall the views for this video was lower than the average for the profile.

Other post by @hjalfi