A new BBC Micro MOS Reassembly

bbc micro/electron/atom/risc os coding queries and routines
User avatar
TobyLobster
Posts: 20
Joined: Sat Aug 31, 2019 7:58 am
Contact:

A new BBC Micro MOS Reassembly

Post by TobyLobster » Fri Aug 21, 2020 8:23 am

I have created a new annotated reassembly of the BBC Micro MOS. I try to explain everything in detail, but welcome corrections to fix and improve it. It's designed to be browsed via HTML, or it can be downloaded as an assembly file for the ACME assembler. The main focus is on the regular version 1.20, but it also includes separate assembly files for each of the older / alternate versions too. Assembling creates a byte for byte identical binary of the MOS.

https://tobylobster.github.io/mos/

This has taken a lot of work and has certainly taught me much about how everything works internally, so I hope people are curious to explore and find it interesting and/or useful!

User avatar
BigEd
Posts: 3431
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: A new BBC Micro MOS Reassembly

Post by BigEd » Fri Aug 21, 2020 11:29 am

Looks great! Several versions too - very interesting to read of the differences.

I won't mention version 2.0 though, as I only heard of it yesterday... oops.

User avatar
spanners
Posts: 60
Joined: Fri Mar 23, 2018 2:37 pm
Location: Glasgow
Contact:

Re: A new BBC Micro MOS Reassembly

Post by spanners » Fri Aug 21, 2020 12:36 pm

Excellent work. Thanks!

VectorEyes
Posts: 376
Joined: Fri Apr 13, 2018 2:48 pm
Contact:

Re: A new BBC Micro MOS Reassembly

Post by VectorEyes » Fri Aug 21, 2020 1:29 pm

Just been taking a look at this and I have to say, this is an amazing piece of work. Thankyou!

User avatar
sweh
Posts: 2262
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: A new BBC Micro MOS Reassembly

Post by sweh » Fri Aug 21, 2020 1:58 pm

Is it just me, or are the downloads failing with "404" errors (eg os12_acme.a and CircuitDiagram.pdf) ?
Rgds
Stephen

User avatar
0xC0DE
Posts: 734
Joined: Tue Mar 19, 2019 7:52 pm
Location: The Netherlands
Contact:

Re: A new BBC Micro MOS Reassembly

Post by 0xC0DE » Fri Aug 21, 2020 2:03 pm

Fantastic!!! =D> =D> =D>
0xC0DE
"I program my home computer / Beam myself into the future"
:arrow: Follow me on Twitter
:arrow: Visit my YouTube channel featuring my demos for Acorn Electron and BBC Micro

User avatar
dv8
Posts: 333
Joined: Mon Jun 22, 2009 10:07 pm
Contact:

Re: A new BBC Micro MOS Reassembly

Post by dv8 » Fri Aug 21, 2020 3:49 pm

Nice work. Any plans to do the same for the B+ (OS 2.0) or Master (MOS 3.2 and 3.5) ?

User avatar
archie456
Posts: 58
Joined: Sat Sep 07, 2019 4:22 pm
Location: Chelmsford
Contact:

Re: A new BBC Micro MOS Reassembly

Post by archie456 » Fri Aug 21, 2020 4:41 pm

Great piece of work!
Really interesting looking through it! Well done.

This should be on a sticky somewhere on this forum...

User avatar
BigEd
Posts: 3431
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: A new BBC Micro MOS Reassembly

Post by BigEd » Fri Aug 21, 2020 5:28 pm

Jut noticed all the cross-referencing for variables - splendid!

User avatar
Diminished
Posts: 519
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: A new BBC Micro MOS Reassembly

Post by Diminished » Fri Aug 21, 2020 7:57 pm

Awesome.

User avatar
roland
Posts: 4048
Joined: Thu Aug 29, 2013 9:29 pm
Location: Born (NL)
Contact:

Re: A new BBC Micro MOS Reassembly

Post by roland » Fri Aug 21, 2020 9:37 pm

Wow, you must have spend an enormous amount of time to get this site up =D>

However, like Sweh says, the downloads seem not to work....
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN :shock:

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

Re: A new BBC Micro MOS Reassembly

Post by TobyLobster » Fri Aug 21, 2020 9:57 pm

Thanks for the positive words everyone! I'm concerned at the downloads not working for some people, as they seem to work for me. They may still be deploying through the system perhaps. Do they work for anyone else?

User avatar
BigEd
Posts: 3431
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: A new BBC Micro MOS Reassembly

Post by BigEd » Fri Aug 21, 2020 10:12 pm

Not working for me either, unfortunately. Perhaps try testing with a proxy, like browserling.com?

User avatar
sweh
Posts: 2262
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: A new BBC Micro MOS Reassembly

Post by sweh » Fri Aug 21, 2020 11:57 pm

FWIW, if I right-click and say "open in new tab" then I see the URL https://tobylobster.github.io/web/Downl ... 120_acme.a and it returns
2020-08-21_18-57.png
The rest of the site seems to look great, though!
Rgds
Stephen


tom_seddon
Posts: 426
Joined: Tue Aug 30, 2005 12:42 am
Contact:

Re: A new BBC Micro MOS Reassembly

Post by tom_seddon » Sat Aug 22, 2020 1:21 am

Coeus wrote:
Sat Aug 22, 2020 1:09 am
try: https://tobylobster.github.io/mos/os120_acme.a
This works for me, trying it just now on my Mac. The links on the site don't work for me, though, either on my Mac (tried just now) or my work PC (tried earlier).

--Tom

P.S. the web version at https://tobylobster.github.io/mos/mos/index.html works fine for me, and looks really nice. I'll be referring to this in future...

User avatar
sweh
Posts: 2262
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: A new BBC Micro MOS Reassembly

Post by sweh » Sat Aug 22, 2020 2:44 am

Rgds
Stephen

User avatar
tricky
Posts: 4672
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: A new BBC Micro MOS Reassembly

Post by tricky » Sat Aug 22, 2020 9:43 am

Beautiful images, great site and the download works for me Chrome on Win7

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

Re: A new BBC Micro MOS Reassembly

Post by TobyLobster » Sat Aug 22, 2020 12:33 pm

I've just posted a fix for the broken download links - hopefully everything will work now (crosses fingers).

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

Re: A new BBC Micro MOS Reassembly

Post by TobyLobster » Sat Aug 22, 2020 12:48 pm

Perhaps try testing with a proxy, like browserling.com?
Thanks BigEd for this, that was useful

User avatar
BigEd
Posts: 3431
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: A new BBC Micro MOS Reassembly

Post by BigEd » Sat Aug 22, 2020 1:01 pm

Glad to be able to help - all working for me now!

User avatar
sweh
Posts: 2262
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: A new BBC Micro MOS Reassembly

Post by sweh » Sat Aug 22, 2020 5:26 pm

TobyLobster wrote:
Sat Aug 22, 2020 12:33 pm
I've just posted a fix for the broken download links - hopefully everything will work now (crosses fingers).
Looks good! =D>
Rgds
Stephen

jregel
Posts: 218
Joined: Fri Dec 20, 2013 6:39 pm
Location: Gloucestershire
Contact:

Re: A new BBC Micro MOS Reassembly

Post by jregel » Sat Aug 22, 2020 11:01 pm

Really interesting to look through this.

I will be spending quite a bit of time going over it!

Thanks very much for sharing all this hard work.

Any plans to do the Master MOS..? :-)
BBC Master Turbo, Retroclinic External Datacentre, VideoNuLA, PiTubeDirect with Pi Zero, Gotek USB Floppy Emulator

tom_seddon
Posts: 426
Joined: Tue Aug 30, 2005 12:42 am
Contact:

Re: A new BBC Micro MOS Reassembly

Post by tom_seddon » Sat Aug 22, 2020 11:47 pm

JGH has the beginnings of a Master MOS disassembly here: http://mdfs.net/Info/Comp/Acorn/Source/MOS.htm - I haven't been through it in any great detail, but it looks like it covers the key parts of Terminal and MOS, and he's disentangled some of the tables and added some commentary for MOS 3.20.

I've been meaning poke at this for a while - I'd like to add more commentary (my main interest here is the new filing system stuff - FS manager, new FS service calls, MOS's HAZEL usage, anything libfs-/tempfs-related that's interesting), and it'd be nice if it were assemblable on a PC (probably with BeebAsm... looks like the source is maybe for a patched BASIC V with a 6502 assembler, so this probably wouldn't be too hard).

--Tom

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

Re: A new BBC Micro MOS Reassembly

Post by TobyLobster » Sun Aug 30, 2020 4:16 pm

I've added a reassembly for MOS 2.00 (which is the MOS for the BBC Micro B+).

User avatar
archie456
Posts: 58
Joined: Sat Sep 07, 2019 4:22 pm
Location: Chelmsford
Contact:

Re: A new BBC Micro MOS Reassembly

Post by archie456 » Sun Aug 30, 2020 8:21 pm

Nice addition... one quesiton though:

BeebEm the B+ identifies as Acorn OS 112K you mentioned on the front page of OS2.00 that it always identifies as 64K.

I've always wondered why BeebEm states 112K, seems a strange number to me...

Cheers.

User avatar
jgharston
Posts: 4120
Joined: Thu Sep 24, 2009 12:22 pm
Location: Whitby/Sheffield
Contact:

Re: A new BBC Micro MOS Reassembly

Post by jgharston » Sun Aug 30, 2020 9:15 pm

archie456 wrote:
Sun Aug 30, 2020 8:21 pm
BeebEm the B+ identifies as Acorn OS 112K you mentioned on the front page of OS2.00 that it always identifies as 64K.

I've always wondered why BeebEm states 112K, seems a strange number to me...
The B+ allows sideways ROM code to count how much RAM there is and display a replacement startup banner. The usual setup is the SRAM Utils in the DFS 2.xx ROM does this, and it only looks for banks of sideways RAM in specific banks*, so if you've configured BeebEm to have SRAM in banks that SRAM Utils doesn't look in, it won't be counted and added to the total displayed in the banner.

*Off the top of my head, I think it looks for 0,1,4,5,6,7 only.

RAMCount does actually count all the RAM and display an appropriate banner, but relies on banks being fully decoded (ie, no reflections, eg bank 0 is also bank 4 is also bank 8 is also bank 12).

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.32
(C) Copyright J.G.Harston 1989,2005-2020
>_

dominicbeesley
Posts: 1162
Joined: Tue Apr 30, 2013 12:16 pm
Contact:

Re: A new BBC Micro MOS Reassembly

Post by dominicbeesley » Mon Aug 31, 2020 11:45 am

This looks excellent! Brilliant work -- I've been using the raybellis version from GitHub lately but this looks even better.

I have some requests though:
- is it possible to produce a version with original addresses embedded? - useful when stepping through in the debugger
- is there a version compatible with ca65/cc65 or beebAsm? - I don't need another assembler in my life right now!

If not no worries I'll write a script to convert assemble and produce a listing file.

D

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

Re: A new BBC Micro MOS Reassembly

Post by TobyLobster » Mon Aug 31, 2020 12:39 pm

jgharston wrote:
Sun Aug 30, 2020 9:15 pm
The B+ allows sideways ROM code to count how much RAM there is and display a replacement startup banner. The usual setup is the SRAM Utils in the DFS 2.xx ROM does this, and it only looks for banks of sideways RAM in specific banks*
That's interesting. It's a bit of an odd way of going about it, but the 16K of memory for the MOS is pretty full at this point so I guess that's why they had to look elsewhere! Anyway I didn't know that - thanks. I'll add a note to this effect. It did seem odd to report 64K only.

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

Re: A new BBC Micro MOS Reassembly

Post by TobyLobster » Mon Aug 31, 2020 4:36 pm

dominicbeesley wrote:
Mon Aug 31, 2020 11:45 am
- is it possible to produce a version with original addresses embedded? - useful when stepping through in the debugger
The HTML version (MOS 1.20) shows the address at each label, which can be useful.
dominicbeesley wrote:
Mon Aug 31, 2020 11:45 am
- is there a version compatible with ca65/cc65 or beebAsm? - I don't need another assembler in my life right now!
I don't have different assembler versions. I chose ACME as having a pretty neutral syntax so that it can be converted to other assemblers without much pain. I have steered clear of using anything fancy like macros as they tend to vary in both syntax and features that are specific to each assembler and are therefore harder to convert.

Post Reply

Return to “programming”