Disassemblies of BBC Micro Games

bbc micro/electron/atom/risc os coding queries and routines
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 »

Level7 has disassembled Hopper

http://www.level7.org.uk/miscellany/hop ... sembly.txt

I wrote to them to suggest it a month or so ago - completely impressed with the turnaround there! =D>

Hopper is known to be one of at least two games that were written with Neil Raine's GOAL game framework, so presumably the whole bytecode engine is there. I wonder what secrets we will learn?
User avatar
TobyLobster
Posts: 618
Joined: Sat Aug 31, 2019 7:58 am
Contact:

Re: Disassemblies of BBC Micro Games

Post by TobyLobster »

Rich Talbot-Watkins wrote: Sun Jan 15, 2023 9:15 pm Level7 has disassembled Hopper
Added to list.
User avatar
TobyLobster
Posts: 618
Joined: Sat Aug 31, 2019 7:58 am
Contact:

Re: Disassemblies of BBC Micro Games

Post by TobyLobster »

The Hunt (graphical text adventure from Robico Software) has been disassembled by Level7:
http://level7.org.uk/miscellany/the-hun ... sembly.txt
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: Sun Mar 12, 2023 8:18 am Level7 has disassembled Omega Orb:

http://level7.org.uk/miscellany/omega-o ... sembly.txt
Never realised this game was partially written in basic, one of the games I bought when I was a kid but sadly no longer have.
Pitfall, Gridrunner, Matrix: Gridrunner 2, LaserZone, AcornViewer, AcornPad
User avatar
Cybershark
Posts: 736
Joined: Wed Jun 14, 2006 11:16 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by Cybershark »

fizgog wrote: Sun Mar 12, 2023 8:59 am
TobyLobster wrote: Sun Mar 12, 2023 8:18 am Level7 has disassembled Omega Orb:

http://level7.org.uk/miscellany/omega-o ... sembly.txt
Never realised this game was partially written in basic, one of the games I bought when I was a kid but sadly no longer have.
Yes, most of his earlier games - prior to him becoming the conversion king - were chunks of code which were handled by a BASIC shell.

Could've really done with that disassembly a couple of weeks back, when we were playing this on the High Score Challenge. Would be amazing to fix those energy-draining enemy explosions!
User avatar
TobyLobster
Posts: 618
Joined: Sat Aug 31, 2019 7:58 am
Contact:

Re: Disassemblies of BBC Micro Games

Post by TobyLobster »

Level7 has disassembled Cyborg Warriors (written by Tony Oakden, published by Superior Software):

http://level7.org.uk/miscellany/cyborg- ... sembly.txt
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 »

Level7 have disassembled Zalaga (Nick Pelling, Aardvark)

http://www.level7.org.uk/miscellany/za ... sembly.txt
Pitfall, Gridrunner, Matrix: Gridrunner 2, LaserZone, AcornViewer, AcornPad
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 Jun 20, 2023 8:46 pm Level7 has disassembled Arcadians by Nick Pelling (aka Orlando) http://www.level7.org.uk/miscellany/arc ... sembly.txt
Well done Level7

Another cracking disassembly of a great game by a beeb legend.
Pitfall, Gridrunner, Matrix: Gridrunner 2, LaserZone, AcornViewer, AcornPad
User avatar
D-Type
Posts: 1
Joined: Sun Jun 18, 2023 4:10 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by D-Type »

TobyLobster wrote: Sun Aug 08, 2021 9:05 pm Disassemblers:
* 6502Bench (SourceGen) https://github.com/fadden/6502bench/ (Windows only)
* bbc-disgo https://github.com/dave-f/bbc-disgo (Go based)
* BBC Disasm https://github.com/chriskillpack/bbcdisasm (Go based)
* BeebDis https://github.com/prime6809/BeebDis (Pascal based)
<<SNIP>>
Your list is missing DASMFW (DisASseMbler FrameWork), which is a modern reimplementation of the old F9DASM for 6809, but now works for several CPUs, mostly Motorola and MOS (6502).
https://github.com/Arakula/dasmfw

AFAICT, it works similarly to BeebDis, but with more processing and output formatting options.

You can give it a custom info file (several, actually) for your machine-specific memory map.

It's developed with Windows C++, but should compile easily on other platforms.

Disassembled code can be reassembled natively with Kingswood as65 assembler on Windows, but you can also define your own assembly directives, if you want to use something different.

I've spent a year on and off (190+ Commits so far) reverse-engineering Vic-20 Jetpac (6502) with DASMFW, AS65 and MAME Debugger, it works great, the only gotcha is that it doesn't have functionality for local variables (yet), but you can work around that.
https://github.com/phillipeaton/JETPAC_ ... etpacX.a65
Last edited by D-Type on Thu Jun 22, 2023 2:03 pm, edited 1 time in total.
P*h*i*l*l*i*p EEaattoonn in real life
User avatar
TobyLobster
Posts: 618
Joined: Sat Aug 31, 2019 7:58 am
Contact:

Re: Disassemblies of BBC Micro Games

Post by TobyLobster »

D-Type wrote: Wed Jun 21, 2023 11:20 pm Your list is missing DASMFW (DisASseMbler FrameWork)
Thanks, added.
bob147
Posts: 340
Joined: Thu May 02, 2019 10:02 pm
Contact:

Re: Disassemblies of BBC Micro Games

Post by bob147 »

Level 7 have done 3D Pool, clearly enjoying the Nick Pelling back catalogue at the moment :-)
User avatar
TobyLobster
Posts: 618
Joined: Sat Aug 31, 2019 7:58 am
Contact:

Re: Disassemblies of BBC Micro Games

Post by TobyLobster »

bob147 wrote: Fri Jul 14, 2023 6:12 pm Level 7 have done 3D Pool, clearly enjoying the Nick Pelling back catalogue at the moment :-)
Added, thanks.
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 Frak!

http://level7.org.uk/miscellany/frak-disassembly.txt

Links to all game disassemblies can be found in the initial post.
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 Aug 01, 2023 8:33 am Level 7 has disassembled Frak!

http://level7.org.uk/miscellany/frak-disassembly.txt

Links to all game disassemblies can be found in the initial post.
Very nice work by Level7
Pitfall, Gridrunner, Matrix: Gridrunner 2, LaserZone, AcornViewer, AcornPad
User avatar
sa_scott
Posts: 420
Joined: Wed Feb 09, 2011 11:34 pm
Location: Witley, Surrey, UK
Contact:

Re: Disassemblies of BBC Micro Games

Post by sa_scott »

I was wondering if anyone is able to disassemble, or decrypt, the machine code DATA statements to Gordon Key's game listings?

- McBrolly (Micro User June 1987)
- Dune Hunter (Micro User November 1987)
- Block Breaker (Micro User April 1989)

There's another game I'm interested in 'studying', the game Wizard's Castle, from Micro User December 1985. This also contains some obfuscated machine code

Although I'm aware of the BBC Games Archive ability to disassemble games listed on their site, I find it difficult to see what's going on. In the case of Block Breaker, the supplied copy has been ready compiled, to decrease load time. Perhaps I can be pointed somewhere to help in how to figure out these displays?

I'm obviously aware of Key's earlier games, but these latter three have a quality to them that deserves a closer look (that said, this thread on McBrolly highlights one or two of its shortcomings, including that annoying bug that results in instant death when starting a particular level).

Thanks in advance :-D
Last edited by sa_scott on Mon Aug 21, 2023 9:19 am, edited 1 time in total.
--
Stephen Scott, Digital Media Muckerupper
Games: Androidz Redux, Headcase Hotel, Polymer Picker
www.sassquad.net
User avatar
jms2
Posts: 3765
Joined: Mon Jan 08, 2007 6:38 am
Location: Derby, UK
Contact:

Re: Disassemblies of BBC Micro Games

Post by jms2 »

Those games with DATA statements ought to be relatively easy to disassemble, because it's possible to work out what each machine code routine is doing (from the context where it's called). However the built-in disassembly view won't be able to do it because the code is embedded as text. It will be necessary to run the routine which converts the text to hex values, and then use a disassembler on an emulated BBC (rather than on the site) to actually disassemble it.

In the case of Block Breaker, the code is in a "ready to disassemble" format so it should just be a case of scrolling past the BASIC until you hit the machine code. However, there's another problem - the disassembler doesn't know what's code and what isn't, so it doesn't know where the start of the code is. Because many 6502 instructions consist of one opcode and one data byte, it's possible to be offset by one byte, ie trying to interpret the data as code and the code as data. The online disassembly view isn't a great deal of help because of this issue (unless it has some clever features that I've yet to discover).
User avatar
sa_scott
Posts: 420
Joined: Wed Feb 09, 2011 11:34 pm
Location: Witley, Surrey, UK
Contact:

Re: Disassemblies of BBC Micro Games

Post by sa_scott »

jms2 wrote: Mon Aug 21, 2023 9:19 am Those games with DATA statements ought to be relatively easy to disassemble, because it's possible to work out what each machine code routine is doing (from the context where it's called). However the built-in disassembly view won't be able to do it because the code is embedded as text. It will be necessary to run the routine which converts the text to hex values, and then use a disassembler on an emulated BBC (rather than on the site) to actually disassemble it.

In the case of Block Breaker, the code is in a "ready to disassemble" format so it should just be a case of scrolling past the BASIC until you hit the machine code. However, there's another problem - the disassembler doesn't know what's code and what isn't, so it doesn't know where the start of the code is. Because many 6502 instructions consist of one opcode and one data byte, it's possible to be offset by one byte, ie trying to interpret the data as code and the code as data. The online disassembly view isn't a great deal of help because of this issue (unless it has some clever features that I've yet to discover).
If one can extract the DATA statements, plus the decoder into an emulator, with a disassembler running, would that suffice?

I write that as if I know what I'm talking about. In terms of knowledge level, I'd like to get from this:
dog-scream.jpg
to this:
boffin-rimmer.jpg
Bit of a tall order, granted :lol:
--
Stephen Scott, Digital Media Muckerupper
Games: Androidz Redux, Headcase Hotel, Polymer Picker
www.sassquad.net
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 »

Very simple for block breaker, took me 5 mins

1. save the ballbre file to disk

2. We can see the program relocates to 0e00, so for quickness use this https://www.white-flame.com/wfdis/ and load the program at 0e00

3. Look for the CALL statements in the basic program - note them down about 4 of them

4. Goto the locations in the above disassembler using "G" and then "SHIFT A" at that location

5. Repeat for the other CALLS, if they have not already been dissembled

6. You now have the disassembly to look at.

Hard part is knowing what the disassembly does :)
Pitfall, Gridrunner, Matrix: Gridrunner 2, LaserZone, AcornViewer, AcornPad
User avatar
MillieTD83
Posts: 179
Joined: Mon Aug 24, 2009 6:53 pm
Location: Thetford, UK
Contact:

Re: Disassemblies of BBC Micro Games

Post by MillieTD83 »

sa_scott wrote: Mon Aug 21, 2023 2:33 pm
jms2 wrote: Mon Aug 21, 2023 9:19 am Those games with DATA statements ought to be relatively easy to disassemble, because it's possible to work out what each machine code routine is doing (from the context where it's called). However the built-in disassembly view won't be able to do it because the code is embedded as text. It will be necessary to run the routine which converts the text to hex values, and then use a disassembler on an emulated BBC (rather than on the site) to actually disassemble it.

In the case of Block Breaker, the code is in a "ready to disassemble" format so it should just be a case of scrolling past the BASIC until you hit the machine code. However, there's another problem - the disassembler doesn't know what's code and what isn't, so it doesn't know where the start of the code is. Because many 6502 instructions consist of one opcode and one data byte, it's possible to be offset by one byte, ie trying to interpret the data as code and the code as data. The online disassembly view isn't a great deal of help because of this issue (unless it has some clever features that I've yet to discover).
If one can extract the DATA statements, plus the decoder into an emulator, with a disassembler running, would that suffice?

I write that as if I know what I'm talking about. In terms of knowledge level, I'd like to get from this:

dog-scream.jpg

to this:

boffin-rimmer.jpg

Bit of a tall order, granted :lol:
"Everything else is poppycock! Isn't that so?"
REPEAT PRINT'"FOZZY!!!!! ";:UNTIL FALSE

BBC Master 128 w/MultiOS, PiTubeDirect, Econet, Datacentre+CF-IDE interface, Gotek
User avatar
sa_scott
Posts: 420
Joined: Wed Feb 09, 2011 11:34 pm
Location: Witley, Surrey, UK
Contact:

Re: Disassemblies of BBC Micro Games

Post by sa_scott »

fizgog wrote: Mon Aug 21, 2023 4:10 pm Very simple for block breaker, took me 5 mins

1. save the ballbre file to disk

2. We can see the program relocates to 0e00, so for quickness use this https://www.white-flame.com/wfdis/ and load the program at 0e00

3. Look for the CALL statements in the basic program - note them down about 4 of them

4. Goto the locations in the above disassembler using "G" and then "SHIFT A" at that location

5. Repeat for the other CALLS, if they have not already been dissembled

6. You now have the disassembly to look at.

Hard part is knowing what the disassembly does :)
ClearSoupyHamadryas-mobile.gif
ClearSoupyHamadryas-mobile.gif (2.35 MiB) Viewed 10648 times
But seriously, thanks for breaking that down. I'll give it a go ](*,)
--
Stephen Scott, Digital Media Muckerupper
Games: Androidz Redux, Headcase Hotel, Polymer Picker
www.sassquad.net
User avatar
TobyLobster
Posts: 618
Joined: Sat Aug 31, 2019 7:58 am
Contact:

Re: Disassemblies of BBC Micro Games

Post by TobyLobster »

I disassembled the McBrolly code, but have not labelled everything. Looks like it does the sprite drawing at least.
dis.asm.txt
(9.52 KiB) Downloaded 33 times
User avatar
sa_scott
Posts: 420
Joined: Wed Feb 09, 2011 11:34 pm
Location: Witley, Surrey, UK
Contact:

Re: Disassemblies of BBC Micro Games

Post by sa_scott »

TobyLobster wrote: Mon Aug 21, 2023 9:52 pm I disassembled the McBrolly code, but have not labelled everything. Looks like it does the sprite drawing at least.

dis.asm.txt
Marvellous! Thank you!

Since Dino and Hunkie Egg were published earlier in 1987, it would be interesting to see if those (unobfuscated) assembly listings used similar code? Would help to disentangle further how it works?
--
Stephen Scott, Digital Media Muckerupper
Games: Androidz Redux, Headcase Hotel, Polymer Picker
www.sassquad.net
Post Reply

Return to “programming”