Disassemblies of BBC Micro Games

bbc micro/electron/atom/risc os coding queries and routines
User avatar
fizgog
Posts: 618
Joined: Thu Jun 17, 2021 3:18 pm
Location: Nottinghamshire
Contact:

Re: Disassemblies of BBC Micro Games

Post by fizgog »

TobyLobster wrote: Tue Sep 26, 2023 11:36 am Level7 has disassembled Fortress

http://level7.org.uk/miscellany/fortres ... sembly.txt
One of my favourite games growing up, Being 12 I couldn't comprehend how Mat managed to achieve this marvel on a beeb, don't think there is another game like it on the beeb?
Pitfall, Gridrunner, Matrix: Gridrunner 2, LaserZone, AcornViewer, AcornPad
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Disassemblies of BBC Micro Games

Post by tricky »

Back in the 80s,I started rally -x with 4 pixel high character rows to get smoother vertical scrolling and had 4 way scrolling but it displayed twice as I hadn't found vertical total, so the screen was half height/time and didn't work on some displays. It wasn't 'til later that I worked out timers to change crtc settings when I wanted.
The slightly weird thing is that you have to store your graphics in the second 4 byes of each character and display them in the first but it all works out ok :)

I'm assuming that is how this game works.
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Disassemblies of BBC Micro Games

Post by Rich Talbot-Watkins »

I like the NOP slide code which is called sporadically, whose only purpose it to ensure DRAM refresh on the columns which are no longer being touched by the CRTC due to it only reading the first 4 bytes of each block of 8.
User avatar
Kecske Bak
Posts: 752
Joined: Wed Jul 13, 2005 8:03 am
Location: Mélykút, Hungary
Contact:

Re: Disassemblies of BBC Micro Games

Post by Kecske Bak »

I wonder if level7 will ever look at the tape version of Skirmish, which has probably the BBC Micro's best ever tape loader. The cassette version of Uridium would probably be interesting too. However the game I am most curious about is Elixir. I often wonder how that worked.
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by MarkMoxon »

Rich Talbot-Watkins wrote: Thu Sep 28, 2023 4:49 pm I like the NOP slide code which is called sporadically, whose only purpose it to ensure DRAM refresh on the columns which are no longer being touched by the CRTC due to it only reading the first 4 bytes of each block of 8.
Brilliant! I wondered what the “NOP cascade” was all about, but couldn’t find an explanation in the disassembly. I’d never have guessed that’s what it was for!

Thank you.

Mark
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Disassemblies of BBC Micro Games

Post by Rich Talbot-Watkins »

I'm surprised there wasn't one. I gleaned this random fact from Mat Newman's interview in the World In Pixels book! Apparently before he added it, memory was just decaying randomly and causing the sort of bugs which I honestly can't imagine how they identified.
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Disassemblies of BBC Micro Games

Post by Rich Talbot-Watkins »

I'm not aware of a single emulator which emulates DRAM refresh / decay! It's one of those last remaining emulator features which is yet to be done, along with ghost keypresses when the keyboard matrix short circuits with 3 or more keys held.
julie_m
Posts: 587
Joined: Wed Jul 24, 2019 9:53 pm
Location: Derby, UK
Contact:

Re: Disassemblies of BBC Micro Games

Post by julie_m »

Is there any software "in the wild" that breaks on an emulator for not precisely emulating DRAM decay?

I mean, I'm not sure how you'd even test for it without risking the integrity of the testing software; and insofar as it means something is amiss if the system doesn't crash, it feels like pouring lumpy gravy through a sieve held over the sink ..... But maybe there are still some £2.99 tapes still languishing in some long-forgotten bargain basement somewhere, featuring an over-zealous copy-protection scheme which was mistaken by reviewers for a randomly-activating bug that made a game unfinishable, or trashed unsaved work in a serious application, because a bit of DRAM in their machines was lucky enough to hold onto its data for just a fraction of a second longer than the author was expecting.

(I do know of hardware that relies on the destructive nature of the read-out process of magnetic core memory ..... In fact, I have one in my front room, and ought to think about getting it working again .....)
gfoot
Posts: 987
Joined: Tue Apr 14, 2020 9:05 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by gfoot »

julie_m wrote: Fri Sep 29, 2023 2:02 pm Is there any software "in the wild" that breaks on an emulator for not precisely emulating DRAM decay?

I mean, I'm not sure how you'd even test for it without risking the integrity of the testing software; and insofar as it means something is amiss if the system doesn't crash, it feels like pouring lumpy gravy through a sieve held over the sink .....
With interrupts disabled, and the video system suitably curtailed, you have a lot of control over which addresses are refreshed, and could arrange your code such that some of the addresses are deliberately not refreshed. Bear in mind that reading those locations to see whether they've been corrupted yet would refresh them, so you'd need to sit in a tight loop for a while until there's maybe a 50% chance that data has been lost, then go and check for it changing; and if it hasn't changed, repeat the procedure to give it more chance to decay.

Edit: Of course, the system would be in a rotten state afterwards and you'd not be able to return control to the OS in a useful way without rebooting!
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Disassemblies of BBC Micro Games

Post by tricky »

Setting the clear memory on boot and then doing a fake power on boot should be ok.
gfoot
Posts: 987
Joined: Tue Apr 14, 2020 9:05 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by gfoot »

tricky wrote: Fri Sep 29, 2023 5:36 pm Setting the clear memory on boot and then doing a fake power on boot should be ok.
That's what I was thinking, it just makes it hard to do anything useful (if there is such a thing!) with the result. I posted an example here: viewtopic.php?t=27691

But you can make the loop still refresh nearly all of the memory, so it's actually not so bad - potentially if you wanted to return to BASIC or the OS you could save the vulnerable bytes from their workspaces somewhere else while running the test, and ensure their values are restored afterwards.
julie_m
Posts: 587
Joined: Wed Jul 24, 2019 9:53 pm
Location: Derby, UK
Contact:

Re: Disassemblies of BBC Micro Games

Post by julie_m »

Wow :D I can see how you could sort of make it work. If your program can shunt chunks of itself into parts of RAM that are definitely going to get refreshed by the test code running, there is some scope to recover afterwards. It would be unlikely to be any good for protecting a full game, due to the double whammy of the memory that needs to get corrupted during the test and the need for all the shunty-roundy code and maybe even some putty-backy code; but you could certainly ensure a fancy non-standard cassette loader was running from dynamic RAM and therefore not some sort of hacking environment .....

Of course, it's also useless for copy-protection; because even if some miscreant were hanging a 62256 off the address bus capturing all writes to Beeb memory addresses &0000 - &7FFF, the 6502 would still be reading from the motherboard DRAM, not that extra static RAM. And since you don't know for sure what you're going to get out of the unrefreshed memory, you're just betting it doesn't exactly match your test pattern, you can't rely on anything in there, but will have to overwrite it -- and the SRAM copy too.
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by MarkMoxon »

I'm not sure if this qualifies for the list, but it does at least *contain* a disassembly of a BBC Micro game, and it's built using BeebAsm, so it might be of interest even if it doesn't quite meet the criteria.

I've just finished documenting a fully buildable reassembly of Elite on the Nintendo Entertainment System (NES). A full 30% of the 128K NES game ROM is essentially a copy of BBC Master Elite - it has new graphics, sound and controller interfaces bolted onto it, but the core of the NES version is still the original Acornsoft version with only relatively minor tweaks.

The project repository is on GitHub:

https://github.com/markmoxon/nes-elite-beebasm

The BBC code makes up most of banks 0, 1 and 2, with another chunk in bank 7 - if you want to see it, you can jump straight to the source code here.

I’m planning to write series of deep dives, and create a web version of the source, just like the other versions of Elite. In the meantime, I hope you like exploring the documented source.

Mark
User avatar
TobyLobster
Posts: 618
Joined: Sat Aug 31, 2019 7:58 am
Contact:

Re: Disassemblies of BBC Micro Games

Post by TobyLobster »

MarkMoxon wrote: Fri Oct 06, 2023 6:51 pm I'm not sure if this qualifies for the list, but it does at least *contain* a disassembly of a BBC Micro game, and it's built using BeebAsm, so it might be of interest even if it doesn't quite meet the criteria.
This is great. I've bent the rules slightly and added a link since it certainly looks like an interesting version of the legendary BBC Micro game. Excellent work.
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by MarkMoxon »

TobyLobster wrote: Sat Oct 07, 2023 9:08 am
MarkMoxon wrote: Fri Oct 06, 2023 6:51 pm I'm not sure if this qualifies for the list, but it does at least *contain* a disassembly of a BBC Micro game, and it's built using BeebAsm, so it might be of interest even if it doesn't quite meet the criteria.
This is great. I've bent the rules slightly and added a link since it certainly looks like an interesting version of the legendary BBC Micro game. Excellent work.
Thank you, Toby! I'm glad you like it, and thanks for adding the link. It certainly feels like BBC Elite under the hood, so figured it was worth asking. :-)

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

Re: Disassemblies of BBC Micro Games

Post by bob147 »

Fascinating that the NES game is a true port rather than starting from scratch as you'd think would be necessary with such radically different hardware (even with the same CPU). Looking forward to the full bells and whistles web version of the source :D
User avatar
MarkMoxon
Posts: 607
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by MarkMoxon »

bob147 wrote: Mon Oct 09, 2023 3:53 pm Looking forward to the full bells and whistles web version of the source :D
Here you go: https://www.bbcelite.com/nes/

Deep dives coming soon...

Mark
User avatar
ChrisJC
Posts: 71
Joined: Sat Jan 16, 2021 2:01 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by ChrisJC »

I enjoyed the romance at the end of the disassembly. I wonder what happened next!

Chris.
User avatar
Diminished
Posts: 1235
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by Diminished »

ChrisJC wrote: Fri Oct 27, 2023 9:40 pm I enjoyed the romance at the end of the disassembly. I wonder what happened next!

Chris.
Related

viewtopic.php?p=317297#p317297
julie_m
Posts: 587
Joined: Wed Jul 24, 2019 9:53 pm
Location: Derby, UK
Contact:

Re: Disassemblies of BBC Micro Games

Post by julie_m »

ChrisJC wrote: Fri Oct 27, 2023 9:40 pm I enjoyed the romance at the end of the disassembly. I wonder what happened next!

Chris.
Oh, wow, that's totally not giving off any "walking in the woods late at night with a rolled-up carpet over one shoulder and a spade over the other" vibes at all, is it?
SteveF
Posts: 1663
Joined: Fri Aug 28, 2015 9:34 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by SteveF »

Inspired by Colin Hoad's latest top 85 video, I have started to disassemble Imogen. I don't know how far I'll get before I run out of steam but I thought I'd mention it here, then if anyone else is also interested in taking a look we can maybe collaborate instead of duplicating effort. I'm using the version from bbcmicro.co.uk as my starting point, FWIW.

The code is in my github repo. I'm using py8dis to get started, but the actual disassembly is also checked in (imogen.asm for the machine code at the end of the IMOGEN BASIC file, g.asm for the machine code G file).
User avatar
colinhoad
Posts: 228
Joined: Fri Mar 15, 2019 2:25 pm
Location: London, UK
Contact:

Re: Disassemblies of BBC Micro Games

Post by colinhoad »

SteveF wrote: Sat Nov 04, 2023 4:55 pm Inspired by Colin Hoad's latest top 85 video, I have started to disassemble Imogen.
Oooh this is exciting! I now wish my 6502 knowledge was good enough to help... sadly I can only watch from the sidelines. But I'll be watching with a keen interest, all the same!
bob147
Posts: 340
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by bob147 »

Wow, that cheat mode relying on the mines of terror rom, great stuff.
User avatar
TobyLobster
Posts: 618
Joined: Sat Aug 31, 2019 7:58 am
Contact:

Re: Disassemblies of BBC Micro Games

Post by TobyLobster »

Level 7 has disassembled the text adventure Doctor Who and the Warlord (1985), along with the later version (that was modified to removed references to Doctor Who) published in Acorn User (1988):

Doctor Who and the Warlord (Part A) http://level7.org.uk/miscellany/doctor- ... sembly.txt
Doctor Who and the Warlord (Part B) http://level7.org.uk/miscellany/doctor- ... sembly.txt
Warlord (Acorn User) http://level7.org.uk/miscellany/warlord-disassembly.txt
nicolagiacobbe
Posts: 215
Joined: Tue Jul 03, 2007 10:40 am
Location: italy
Contact:

Re: Disassemblies of BBC Micro Games

Post by nicolagiacobbe »

Wonderful. I always wanted to give a peek under the hood of Psycastria, thanks a lot for the work.
Post Reply

Return to “programming”