OS-9 Level 2 for (updated) Dragons

A place to discuss everything Dragon related that doesn't fall into the other categories.
pser1
Posts: 1866
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: OS-9 Level 2 for (updated) Dragons

Post by pser1 »

Hello,
this is much heavier than I had expected :-(
Anyway, I have traced the boot sequence along a lot of steps without issues:
- REL reallocates boot track code to $ED00 and jumps to the new place
- OS9P1 creates the module directory entries for modules already in memory (Rel, Boot, OS9p1)
- Searches module 'Init' but it doesn't exist in memory
- Tries to call 'Boot'. Finds it in the module directory and switches to it
So far so good, the excellent comments I have found in OS9L2 and NitrOS9L2 have helped me a lot!
But now the code has entered 'Boot', a module without any explanation. I cannot find any source file
for that module :-(
I know that it *must* read sector/track 0 to find the exact place where the file 'OS9Boot' is in the disk
and once found, it has to read/load the whole lot of modules into RAM
I am sure that this step is failing, butI need to know exactly where it fails and the reason why this happens
that's why I would love to have more info about that module ...
The debugging/tracing process is dramatically slow because I use to write down on paper every asm code and the results (registers changed)
basically to be able to compare results starting the Tandy OS9L2 that works flawlessly ... sorry for being of so old school-like but right now I prefer
to advance slowly but being sure I am always going forwards ;-)
If any of you know about a place where I could find the source code for the BOOT module, please let me know!!
thanks in advance
pere
lcurtisboyle
Posts: 31
Joined: Thu Nov 05, 2020 9:47 pm

Re: OS-9 Level 2 for (updated) Dragons

Post by lcurtisboyle »

Boot modules vary by drives hooked up (hard drive, floppy, etc.) so you need to find the one for the floppy controller that the Dragon normally uses. I would think the NitrOS9 GitHub should have those somewheres (for Level 1, anyways, although I don't think there is much difference between a Level 1 boot vs a Level 2 boot). NitrOS9 EOU should include some sample commented Boot source for floppy and/or the CocoSDC. In the current version of EOU, they will be in:
/dd/sourcecode/asm/nitros9/kernel. I think there is even a D64 boot source in there.
pser1
Posts: 1866
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: OS-9 Level 2 for (updated) Dragons

Post by pser1 »

Thanks a lot, L.Curtis
In fact, I am applying Bob Hall's procedure to convert a Level II Tandy OS9 into a Dragonized version ...
I am using the boot track from Tandy (REL+BOOT+OS9p1) but then I overwrite the BOOT module with
the one included in Dragon Data Level 1 v1.2 patched as proposed by Bob.
I could download the source code of OS9P1 very well commented from Tandy and from NitrOS9 and that
has allowed me to trace the execution of REL and OS9p1 'knowing' what they are doing every time they call a
subroutine, but now that I am entering 'Boot' to load the big file (OS9Boot) from disk, I have no comments
at all. I just unassembled it with F9DASM and have added a few comments related to things I 'think' I know
but, despite being a short module, there are plenty of code lines without comment/explanation and I haven't
been able to find a commented Boot file on internet.
I will try to debug/trace it anyway tomorrow ... I know it must read sector zero of the disk and somehow it
must calculate/find the place where OS9Boot begins. After that it should load the whole file into RAM and
return control to OS9p1 just to try again to link the module 'INIT'
I am afraid I am going to have problems with the disk I am using to contain OS9Boot and CMDS ...
I just formatted a double sided disk (368Kb) wiht Tandy OS9L2 and used OS9Gen to create the OS9Boot
using all of the modules Bob Hall has said.
Probably the descriptors D0, D1 and Ddisk could be not compatible with disks 368K ... but I am not sure
about that. Hope to find out the problem along this weekend!
cheers!
lcurtisboyle
Posts: 31
Joined: Thu Nov 05, 2020 9:47 pm

Re: OS-9 Level 2 for (updated) Dragons

Post by lcurtisboyle »

As mentioned, there is commented source for a variety of the Boot Modules (including Dragon 64) included in NitrOS9 EOU. One thing that may really help you is download Kevin Darling's book "Inside OS-9 Level II" from the Color Computer archive - it actually describes how the boot process works and exactly what it is doing. It was an invaluable reference for us when we made NitrOS-9 in the first place.
pser1
Posts: 1866
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: OS-9 Level 2 for (updated) Dragons

Post by pser1 »

Hi, L.Curtis
I already own this book ... amongst 14 more, I will have a read at it ...
The same applies to the NitrOS9 EOU project. Must search for these source files too

By now I have already debugged a great part of the Boot module.
It has read sector #0 from the OS9L2 disk in drive 0 (1 for dragon) and has asked for some space ($43D5 bytes) and, apparently
the OS9 function F$BtMem has found it.
Now I have to trace how this is used, mainly to the point where the OS9Boot file will be read from disk and stored into RAM
I think that this is going to be the part that is failing ... but need to verify that!
Thanks a lot for the pointers!
cheers!
pere
pser1
Posts: 1866
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: OS-9 Level 2 for (updated) Dragons

Post by pser1 »

Hello,
finally I have found the erorr/bug/problem
The module Boot reads perfectly sector #0 where it finds the amount of memory needed to load the file OS9Boot
and where it has to begin reading.
I am using a double density disk formated with Tandy OS9Level2 disk
The Boot module we are using is the one from DragonData OS9L1 as recommended by Bob Hall
The OS9Boot file uses $43D5 bytes that the system is able to allocate, so the loading begins from sector 12 of track 0
It reads sectors 12-13-14-15-16-17-18 from sector 0 and then it jumps to sector 1 of track 1
That would be correct for a single density disk (184Kb) but that fails with the double density disk I am using (368Kb)
Jumping to track 1 from sector 18 of track 0 skips the 18 sectors of let's say side 1 of the disk
and so it jumps over 16 data sectors that should have been loaded instead of doing that unwanted jump :-(

Now I see two possible ways to overcome that problem
1) Patch the Boot module so that it counts sectors up to 36 per track.
2) I could format a new single density disk with Tandy OS9L2 and then apply command OS9Gen to it with the very same
files I put in the double density disk.
That second option will leave very few free space in the disk and we will need some CMDS commands and the startup file to be added
at some moment ...
If the first option has no side-effects, it could be very simple, just patch two bytes (value $12 -> $24) and then verify/u in OS9L2
in order to correct the CRC

Which option would you suggest to solve that problem?
cheers!
pere
pser1
Posts: 1866
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: OS-9 Level 2 for (updated) Dragons

Post by pser1 »

By now I have taken choice #2 and have formatted a 184Kb disk where OS9Gen has created the same OS9Boot
Now it reads perfectly the whole OS9Boot file into memory

Next time going to begin from that point ...
cheers!
pere
pser1
Posts: 1866
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: OS-9 Level 2 for (updated) Dragons

Post by pser1 »

By now I have taken choice #2 and have formatted a 184Kb disk where OS9Gen has created the same OS9Boot
Now it reads perfectly the whole OS9Boot file into memory

Next time going to begin from that point ...
cheers!
pere
pser1
Posts: 1866
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: OS-9 Level 2 for (updated) Dragons

Post by pser1 »

Hello,
I haven't had any time to look for the sources nor to read the book, sorry :-(
But I have used some time to continue debugging the 'Boot' module.
As I am using right now a disk single density (184Kb), 'Boot' is able to load the whole 'OS9Boot' file into memory and then
it parses the memory finding every module contained inside (17 modules) that are added to the module directory succesfully.
Next step it does is finding the module 'Init' in RAM and also the 'OS9p2' module (kernel part II).
My next debug session will begin when OS9p2 is called
I need to extract this file from Tandy OS9L2 disk and unasemble it to guide my debugging session ...
Still a long way to go!
cheers!
pere
bluearcus
Posts: 188
Joined: Wed Sep 07, 2016 4:45 pm

Re: OS-9 Level 2 for (updated) Dragons

Post by bluearcus »

Wow Pere,

You are making great progress here. Apologies for not having been following along - I hope I can clear some life stuff and watch a bit more closely going forwards.

Keep up the good work.

Mike
Post Reply