BBC Elite source, now fully documented and explained
- scarybeasts
- Posts: 1052
- Joined: Tue Feb 06, 2018 7:44 am
- Contact:
Re: BBC Elite source, now fully documented and explained
Great work Mark! The level of care, detail and quality put in here is spectacular.
Cheers
Chris
Cheers
Chris
Re: BBC Elite source, now fully documented and explained
I wouldn’t have known about Minsky if you hadn’t mentioned it in an older thread on this very site, Rich, so thanks for that! It’s a fascinating twist on the whole rotation story, and I’d have missed it otherwise. Makes you wonder what else I’ve accidentally glossed over.Rich Talbot-Watkins wrote: ↑Tue Sep 01, 2020 4:42 pm Wow, just had a chance to look at this! More detail there than I could possibly have imagined - great work! And nice to confirm that it really uses the Minsky hack for rotating things in place by small angles. Will look forward to browsing through this properly when I can!
Besides, there are definitely some rotation and circle-drawing routines in there that I don’t understand, so the investigations continue!
Mark
Re: BBC Elite source, now fully documented and explained
Nice work Mark .... very detailled info.....
A few years ago I did the Atom conversion. Electron Elite was the base for this but there are still a few bugs in the Atom version. Maybe I can solve them now with your source because I did the conversion but didn't understand 80% of how the engine works.
http://www.retrosoftware.co.uk/wiki/ind ... omic_Elite
Greetings
Kees
A few years ago I did the Atom conversion. Electron Elite was the base for this but there are still a few bugs in the Atom version. Maybe I can solve them now with your source because I did the conversion but didn't understand 80% of how the engine works.
http://www.retrosoftware.co.uk/wiki/ind ... omic_Elite
Greetings
Kees
- dominicbeesley
- Posts: 2212
- Joined: Tue Apr 30, 2013 12:16 pm
- Contact:
Re: BBC Elite source, now fully documented and explained
Simply brilliant!
Re: BBC Elite source, now fully documented and explained
Incredible achievement by all involved to make this available (and compile). Looking forward to the nights drawing in so I have an excuse to spend some quality time with this.
And just giving this a brief inspection now makes me even more in awe of what Angus Duggan did in the mid-90s with Elite-A.
Great work Mark for the deep dive commentary and organisation plus Kieran, Paul and Tom (I think those are variously responsible!) for the major stepping stones to get to there along the way. Wow.
One random observation from my skim through - interesting to see .BOMB used as a purchase indicator (&7F) and a state indicator (&FE or -2) to indicate tab being pressed and process it (ASLs .BOMB when Tab is pressed). Looking at Main flight loop (Part 5 of 16) there is a check that the current ship isn't a space station... wondering if I NOP that if it'll explode a space station... I think one of my childhood bucket list items might finally be ticked off if that works...
Sadly I suspect it's more complex than that but roll on the weekend and I will see if I have time to try it.
And just giving this a brief inspection now makes me even more in awe of what Angus Duggan did in the mid-90s with Elite-A.
Great work Mark for the deep dive commentary and organisation plus Kieran, Paul and Tom (I think those are variously responsible!) for the major stepping stones to get to there along the way. Wow.
One random observation from my skim through - interesting to see .BOMB used as a purchase indicator (&7F) and a state indicator (&FE or -2) to indicate tab being pressed and process it (ASLs .BOMB when Tab is pressed). Looking at Main flight loop (Part 5 of 16) there is a check that the current ship isn't a space station... wondering if I NOP that if it'll explode a space station... I think one of my childhood bucket list items might finally be ticked off if that works...
Code: Select all
CPY #2*SST \ If the ship in Y is the space station, jump to BA21
BEQ MA21 \ as energy bombs are useless against space stations
Re: BBC Elite source, now fully documented and explained
I remember when I first converted that bit from 6502 to C, I thought it was a bug. It wasn't until sometime later that I read one of Jim Blinn's graphics articles where he discusses it and mentions Minsky. Having dug deeper since I've seen it in papers from the '70s describe it as a common bug which has a beneficial effect and also Ivan Sutherland used it and described it back in 1963 (9 years before Minsky) for his SKETCHPAD program.MarkMoxon wrote: ↑Tue Sep 01, 2020 11:56 pm I wouldn’t have known about Minsky if you hadn’t mentioned it in an older thread on this very site, Rich, so thanks for that! It’s a fascinating twist on the whole rotation story, and I’d have missed it otherwise. Makes you wonder what else I’ve accidentally glossed over.
Thanks,
Christian.
Re: BBC Elite source, now fully documented and explained
That is something we can all agree on! Elite-A is an absolutely amazing bit of work. I know I couldn’t have taken on this project without all the work previously done by others, but did he really just disassemble the raw code and work it all from there? That’s just astonishing...
Mark
Re: BBC Elite source, now fully documented and explained
Yes, just working on the disassembled code, and he used a disassembler and assembler ROM for the Beeb that he had written himself.
A lot of the assembler source code looks like this:
Code: Select all
l_340e
STX $22
STA $23
LDA $40
JSR square
STA $9C
LDA $1B
STA $9B
LDY #$BF
LDA $28
STA $26
LDA $29
STA $27
Thanks,
Christian.
Re: BBC Elite source, now fully documented and explained
Wait, that's what I did for the C64 disassembly! I didn't want to use a RAM dump, as it would not be a clean representation of the original code, so I disassembled the disk image from scratch; fast-loader, packer, decrypter et al. This is why elite-harmless can assemble an original floppy disk, even with the several layers of indirection from the binary one would see in RAM. Thankfully, I did have the BBC sources to refer to, but it's been quite the slog.
Re: BBC Elite source, now fully documented and explained
I do appreciate what you've done is hard work, I've disassembled every version of Elite so I know what's involved. But even when I did Elite-TNK 20 years ago I had "modern" systems to help me. Angus was working on a BBC Model B, just a few years after Elite was released. There was no information out there on how Elite worked, not even much on how to do 3D. It was a big project to take on using a BBC micro.Kroc wrote: ↑Wed Sep 02, 2020 11:12 pm Wait, that's what I did for the C64 disassembly! I didn't want to use a RAM dump, as it would not be a clean representation of the original code, so I disassembled the disk image from scratch; fast-loader, packer, decrypter et al. This is why elite-harmless can assemble an original floppy disk, even with the several layers of indirection from the binary one would see in RAM. Thankfully, I did have the BBC sources to refer to, but it's been quite the slog.
Thanks,
Christian.
Re: BBC Elite source, now fully documented and explained
What? He did it all on a BBC Micro? I didn't realise that. That's... just... well, that really is something else.
Some people just manage to think like that, I guess. I remember when I was at university, we had a small but regular gathering of like-minded Acorn users, and we'd show each other what we were working on. One of the regulars was Dominic Symes, who went on to work for ARM. He'd started writing a super-fast text editor for RISC OS called Zap (it's still available, though he passed on the code years ago). When he showed us the source code, all his ARM assembler label and variable names were things like Zz and a8 and stuff like that. It was completely indecipherable, though Zap ended up being the most amazing editor, so it clearly worked for him. (The code was presumably rewritten by others in the intervening years, as it's pretty clean now.)cjpinder wrote: ↑Wed Sep 02, 2020 10:36 pm A lot of the assembler source code looks like this:Even harder to figure out then the original Elite code. How he kept track of what each of the zero page locations was being used for without labelling them is beyond me.Code: Select all
l_340e STX $22 STA $23 LDA $40 JSR square STA $9C LDA $1B STA $9B LDY #$BF LDA $28 STA $26 LDA $29 STA $27
Then again, I guess in the days of the BBC Micro, a lot of documentation would be done on a notepad by the side of the computer, so presumably Angus wrote down what all the zero-page locations meant. Still, working out what they all meant must have taken some time, particularly the denser flags where one bit does this, another bit does this and so on. That's real dedication.
(To be honest, I feel the same way about anyone who can disassemble from scratch to that level, so respect to both of you, Christian and Kroc. You're clearly on top of your game!)
Well, that's just showing off.
Mark
Re: BBC Elite source, now fully documented and explained
Turns out it really was that simple and so immensely satisfying...
https://www.youtube.com/watch?v=YDZNLbzOn1w
Disk file attached if you want to try it yourself...
- Attachments
-
- elite.ssd
- (26.5 KiB) Downloaded 90 times
Re: BBC Elite source, now fully documented and explained
Ha! That is absolutely epic!melchett wrote: ↑Thu Sep 03, 2020 10:57 amTurns out it really was that simple and so immensely satisfying...
https://www.youtube.com/watch?v=YDZNLbzOn1w
Disk file attached if you want to try it yourself...
It always amazes me how just one instruction can make such a difference. That's one of the things I loved about documenting the source, when a lone instruction, possibly just 8 bits, would earn itself paragraphs of explanation.
I mean, destroying an entire space station by changing one branch instruction? That's like discovering that the thermal exhaust port leads to the main reactor core. Mwuhahahahaha!
Mark
- scarybeasts
- Posts: 1052
- Joined: Tue Feb 06, 2018 7:44 am
- Contact:
Re: BBC Elite source, now fully documented and explained
Have you looked at code differences between different Elite variants?
I just posted a thread to discuss bug fixes and changes applied to the original release, including disc images for the variants we've found so far.
viewtopic.php?f=1&t=20410
I wonder which variant your disassembly is based on?
Cheers
Chris
Re: BBC Elite source, now fully documented and explained
The version I've looked at is the tape version source from Ian Bell's site - I don't know how many variants there are of the tape version? I'm hoping to document the extra code in the disc and second processor versions at some point, too - that should be interesting. But I'm going to add some polish to the tape analysis first, as it's still a bit rough round the edges.scarybeasts wrote: ↑Thu Sep 03, 2020 6:44 pmHave you looked at code differences between different Elite variants?
I just posted a thread to discuss bug fixes and changes applied to the original release, including disc images for the variants we've found so far.
viewtopic.php?f=1&t=20410
I wonder which variant your disassembly is based on?
I'm also planning to compare the version I've documented to the version on my tape version of the game, just to see if the binaries really do match, as that would be interesting to see!
Mark
- dominicbeesley
- Posts: 2212
- Joined: Tue Apr 30, 2013 12:16 pm
- Contact:
Re: BBC Elite source, now fully documented and explained
How different are the tape / disk variants? Is it likely possible to get them into a single source with IF/DEFs to build the variants or are they just too different - I speak from a position of ignorance, I don't really know the differences that well but I'd like to do some hacking...
D
D
Re: BBC Elite source, now fully documented and explained
From memory, there are quite a lot of cool extras in the disk version that aren't in the tape version:dominicbeesley wrote: ↑Fri Sep 04, 2020 10:43 am How different are the tape / disk variants? Is it likely possible to get them into a single source with IF/DEFs to build the variants or are they just too different - I speak from a position of ignorance, I don't really know the differences that well but I'd like to do some hacking...
- A load more ship types
- Two types of station
- Mining and military lasers
- Two missions
- A proper docking computer
- You can search for systems by name
- Bitstick support
So they are very different, but also very similar.
Mark
Re: BBC Elite source, now fully documented and explained
It would be best to use the 2nd Pro Elite sources as it is basically the disk version of Elite combined into one executable, rather than the two separate executables that Disk Elite is (one while docked, the other while in flight).dominicbeesley wrote: ↑Fri Sep 04, 2020 10:43 am How different are the tape / disk variants? Is it likely possible to get them into a single source with IF/DEFs to build the variants or are they just too different - I speak from a position of ignorance, I don't really know the differences that well but I'd like to do some hacking...
Thanks,
Christian.
Re: BBC Elite source, now fully documented and explained
I've just discovered a bug in the Commodore 64 port. Attempting to enable the docking computers does a check to see if the station is hostile: (BBC Code)
On the Commodore 64, it happens that the wrong label/address was perhaps used:
Unless I'm misunderstanding the purpose of this check, the game combines the key-down state ($00=unpressed, $FF=pressed) with the key state for the docking computers ("C") -- I can't think of any logical reason why that would otherwise be relevant! Just thought this would be interesting to pass on.
EDIT: Just tested and can confirm, you can't enable docking computers, if holding the joystick/key for down!
Code: Select all
LDA K%+NI%+32 \ Fetch the AI counter (byte #32) of the second ship
BMI MA68 \ from the ship data workspace at K%, which is reserved
\ for the sun or the space station (in this case it's
\ the latter), and if it's negative, meaning the
\ station is hostile, jump down to MA68 to skip the
\ following (so we can't use the docking computer to
\ dock at a station that has turned against us)
Code: Select all
; turn docking computer on?
;-----------------------------------------------------------------------
: lda key_docking_on ; key for docking computer pressed? ;$1FC2
and PLAYER_DOCKCOM ; does the player have a docking computer?
.bze :+ ; no, skip
.ifdef OPTION_ORIGINAL
;///////////////////////////////////////////////////////////////////////
eor joy_down ; combine with down key state??? ;=$8D35
.else ;///////////////////////////////////////////////////////////////////////
eor polyobj_01+PolyObject::attack ;=$F945
.endif ;///////////////////////////////////////////////////////////////////////
.bze :+
sta DOCKCOM_STATE ; turn docking computer on (A = $FF)
jsr _9204 ; play docking computer music
EDIT: Just tested and can confirm, you can't enable docking computers, if holding the joystick/key for down!
Re: BBC Elite source, now fully documented and explained
First thing that springs to mind is that in the tape version of BBC Elite, you dock instantly as soon as you hit the "C" key. The disk version implements the full computer experience where it steers the ship for you (though no Blue Danube, unfortunately!), but in the tape version, pressing "C" jumps you straight to the docking tunnel.
Would this be a reason for the EOR with joy_down in the C64 version? Perhaps you can break out of the docking computer by moving the joystick, something that wouldn't make sense in the insta-dock of the tape version?
Mark
- dominicbeesley
- Posts: 2212
- Joined: Tue Apr 30, 2013 12:16 pm
- Contact:
Re: BBC Elite source, now fully documented and explained
Thanks both,
I'll try and get a look at this in the next week or so - I'll probably stick with the tape version for my initial experiments but I'm hoping to get the Blitter's line drawing acceleration poked in - it looks like it _should_ be straightforward as the line drawing code is pretty clear, at least on first inspection.
How well does the buildable source deal with changes? Do I need to pad out to exactly the same size for the code or should all the tables/labels sort themselves out?
D
I'll try and get a look at this in the next week or so - I'll probably stick with the tape version for my initial experiments but I'm hoping to get the Blitter's line drawing acceleration poked in - it looks like it _should_ be straightforward as the line drawing code is pretty clear, at least on first inspection.
How well does the buildable source deal with changes? Do I need to pad out to exactly the same size for the code or should all the tables/labels sort themselves out?
D
Re: BBC Elite source, now fully documented and explained
I'm not sure what the intention (or outcome) of the EOR is; given that it's only checked when "C" is held, so it can't be for the purposes of breaking docking computer control because that wouldn't make sense only for one direction (any direction should cancel, if this is the intention). It may be that the order of keys in the key-table is implying something else from the BBC's perspective, and they didn't correct it; `joy_down` is the "X" key, and this happens to appear 3 bytes before "C" in the key table on the C64. I would be interested to know what the BBC disk version is checking against...MarkMoxon wrote: ↑Fri Sep 04, 2020 1:08 pm First thing that springs to mind is that in the tape version of BBC Elite, you dock instantly as soon as you hit the "C" key. The disk version implements the full computer experience where it steers the ship for you (though no Blue Danube, unfortunately!), but in the tape version, pressing "C" jumps you straight to the docking tunnel.
Would this be a reason for the EOR with joy_down in the C64 version? Perhaps you can break out of the docking computer by moving the joystick, something that wouldn't make sense in the insta-dock of the tape version?
EDIT: I checked Brink's disk disassembly, and it looks like there's no additional check!
Code: Select all
.MA64 \ check dock C key
AD 0F 03 LDA &030F \ KL+15 \ key 'C' docking computer
2D 84 03 AND &0384 \ DKCMP \ have a docking computer?
F0 03 BEQ MA68 \ onto Laser
8D 3F 03 STA &033F \ DAUTO \ auto docking set
.MA68 \ onto Laser
Re: BBC Elite source, now fully documented and explained
I've always had to pad out the code, and it seems pretty fussy if you don't. I haven't looked into what's causing that, but there could be tables near to page boundaries, that sort of thing. I'd definitely build it with:dominicbeesley wrote: ↑Fri Sep 04, 2020 1:14 pm Thanks both,
How well does the buildable source deal with changes? Do I need to pad out to exactly the same size for the code or should all the tables/labels sort themselves out?
Code: Select all
make build
Mark
Re: BBC Elite source, now fully documented and explained
Given that the C key is right next to the X key on the keyboard, is this check preventing the docking computer from kicking in when you're trying to pitch down with X, but accidentally push the C key down as well?
Mark
Re: BBC Elite source, now fully documented and explained
Oh wow, that's insightful! That's a real good catch
Re: BBC Elite source, now fully documented and explained
Sign of a misspent youth, endlessly playing Elite.
Mark
Re: BBC Elite source, now fully documented and explained
I updated this so you could destroy it with lasers too not just an energy bomb Mark... interesting that the code auto re-spawns a space station after the explosions complete. I could also add in a load of containers when it explodes... maybe later tonight.
Elite.ssd
Re: BBC Elite source, now fully documented and explained
Is everybody aware of Elite-B? http://aegidian.org/bb/viewtopic.php?f=7&t=16899 It's another highly-improved version of BBC Elite, but this time done from the original HIBASIC sources IFIRC.
- Diminished
- Posts: 1252
- Joined: Fri Dec 08, 2017 9:47 pm
- Contact:
Re: BBC Elite source, now fully documented and explained
Huh. This I didn't know.
Has anyone ever looked at the NES port? ISTR Ian Bell saying that was his favourite 8-bit version, since they had to work out a way of drawing vectors using the console's tile-based graphics system.