New: fully documented source code for Lander

subjects relating to classic games for the archimedes and risc pc
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

dpsharp wrote: Thu Feb 29, 2024 9:25 am
MarkMoxon wrote: Tue Feb 27, 2024 2:02 pm If anyone has any suggestions on getting this working properly on a Pi, that would be great. It's not a platform I don't know much about...
It runs correctly on a Pi with just a little configuration... just needs a text file in !Boot.Loader folder called CMDLINE/TXT containing the word disable_mode_changes (and then reboot) and have !ADFFS loaded, all as per Jon's video at https://www.youtube.com/watch?v=HpQk1l7Rvu0
grannyg wrote: Thu Feb 29, 2024 12:43 pm Just to report it works fine on a Pi running RISC OS 5.29.
Thank you! I now have BigLander working fine on my Pi. It's a bit blurry and RISC OS is a bit small in the middle of my big monitor, but it all works and is blisteringly fast.

Thanks everyone, I can't believe it's working on all those versions of RISC OS now. Result! :-)

Mark
sirbod
Posts: 1624
Joined: Mon Apr 09, 2012 9:44 am
Location: Essex
Contact:

Re: New: fully documented source code for Lander

Post by sirbod »

MarkMoxon wrote: Thu Feb 29, 2024 5:06 pm I now have BigLander working fine on my Pi. It's a bit blurry
You can change the GPU upscaler method. Edit !Boot.Loader.CONFIG/TXT and add:

Code: Select all

#set GPU upscaling to nearest neighbour
scaling_kernel=8
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

sirbod wrote: Thu Feb 29, 2024 9:24 pm
MarkMoxon wrote: Thu Feb 29, 2024 5:06 pm I now have BigLander working fine on my Pi. It's a bit blurry
You can change the GPU upscaler method. Edit !Boot.Loader.CONFIG/TXT and add:

Code: Select all

#set GPU upscaling to nearest neighbour
scaling_kernel=8
Thank you Jon! That's so much better. It really looks amazing now...

I'll add all this Pi advice to the README, when I get a moment. Really appreciate all the help. :-)

Mark
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

Incidentally, for anyone following this project, I'm glad to announce that the documentation side of it is now complete. You can read the fully documented source code and 21 deep dive articles in the usual place:

https://lander.bbcelite.com

I hope you enjoy reading it as much as I've enjoyed writing it!

I might have a poke around in BigLander next to try to stop you blowing up on the launchpad (as this makes life quite hard in emulators), but the main project is a wrap. :-)

Mark
bob147
Posts: 340
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: New: fully documented source code for Lander

Post by bob147 »

Well done Mark, great to see an archimedes game getting the same in depth treatment as the beeb games. BigLander looks fab. Those deep dives will make excellent commute reading material!
User avatar
NickLuvsRetro
Posts: 285
Joined: Sat Jul 17, 2021 4:18 pm
Contact:

Re: New: fully documented source code for Lander

Post by NickLuvsRetro »

Does the triangle routine not check against negative XY values at the start of the routine? (i.e., vertices off to the left and top) Or is there some conditional flag magic I'm not not seeing correctly. (sleeping badly atm, so I suspect the latter)

https://lander.bbcelite.com/source/all/ ... rt-1-of-11
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

NickLuvsRetro wrote: Mon Mar 04, 2024 2:18 pm Does the triangle routine not check against negative XY values at the start of the routine? (i.e., vertices off to the left and top) Or is there some conditional flag magic I'm not not seeing correctly. (sleeping badly atm, so I suspect the latter)

https://lander.bbcelite.com/source/all/ ... rt-1-of-11
I didn't explain that part, did I! The LO condition is typically used when comparing unsigned integers, so any negative coordinates will be treated as very large numbers (as they have bit 31 set). So any negative coordinates will be deemed greater than 320 and 239, so this does indeed check for negative coordinates, and jumps to trin23 if there are any.

LO is the same as CC, and HS is the same as CS, but I'm not sure if that makes it any clearer!

I've added an explanation to the commentary, so hopefully it makes a bit more sense now.

Edit: Here's a link to the PRM section on condition codes, where it talks about LO and HS being unsigned comparisons:
http://www.riscos.com/support/developer ... ml#idx-460

Mark
User avatar
NickLuvsRetro
Posts: 285
Joined: Sat Jul 17, 2021 4:18 pm
Contact:

Re: New: fully documented source code for Lander

Post by NickLuvsRetro »

Aha! This is great news, as I've been very naively checking both conditions in my own code. I like learning something new, thanks Mark! :D

I had actually been looking at the condition flags earlier today for something that would set N and C flags at the same time and didn't see anything. Your explanation makes perfect sense when it treats them as unsigned.
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: New: fully documented source code for Lander

Post by MarkMoxon »

I've added an update to the Lander repository that some of you may find interesting (I know I like it, anyway!).

The repository now includes a BBC BASIC version of the source that will build Lander (and BigLander) on an Archimedes and Risc PC:

screenshot.png

I suspect that Lander hasn't been compiled on real hardware since David Braben did it in 1987, as the source has never been released, and the RISC OS version simply wrapped the original Arthur binaries rather than rebuilding them. Read on to find out how you can recreate a bit of history on your own machine.

Here are links for the sources: the source code for Lander, and the source code for BigLander.

You can download these text files, convert them to BBC BASIC using Edit (or your preferred converter), and the resulting BBC BASIC file should run on your Archimedes to produce a working game binary (called GameCode) that you can double-click to play Lander. Full instructions can be found in the repository and on the website.

There are some things to note.
  • BBC BASIC doesn't allow colons in comments (well, it does, but it treats them as statement separators, which causes chaos if you have colons in comments), so the Archimedes source contains semicolons instead.
  • Also, unmatched brackets and double-quotes in comments give warnings in BASIC and break the conversion from text, so I have replaced brackets with square brackets and double-quotes with single-quotes in comments.
  • The use of REMs for comments outside of the assembly part does make some lines wider than 80 columns.
  • As BBC BASIC doesn't support comma-separated EQU values, some of the code layouts are less than perfect (e.g. the ship blueprints).
But overall, this is a fully buildable and fully commented source code for Lander and BigLander that builds on an Archimedes. As long as you have enough memory (your Next slot needs at least 832K to build Lander, and at least 904K to build Big Lander), then you can build it yourself.

Also, for BigLander, the source produced by the build process includes the landscape dimensions specified in the make command, so if you are so inclined, you can generate Archimedes source for any landscape you like.

I hope you like it!

Mark
Post Reply

Return to “32-bit acorn software: classic games”