6809 and FLEX

discussion of beeb/electron applications, languages, utils and educational s/w
User avatar
danielj
Posts: 5345
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester

6809 and FLEX

Postby danielj » Sat Jan 17, 2015 1:43 pm

The DSK format has a header describing the geometry of the disk:

Code: Select all

   pfloppy->offset        = 0;
   pfloppy->write_protect = wp ? 1 : 0;
   pfloppy->max_sector    = pformat->sectors >> 1;
   pfloppy->max_sector0   = pformat->sectors >> 1;
   pfloppy->max_track     = pformat->tracks - 1;
   pfloppy->byte_p_sector = SECTOR_SIZE;
   pfloppy->byte_p_track0 = pformat->sectors * SECTOR_SIZE;
   pfloppy->byte_p_track  = pformat->sectors * SECTOR_SIZE;
   pfloppy->type         = TYPE_CONTAINER | TYPE_DSK_CONTAINER;


I'm just checking to see if the remainder of the file is just a straight dump to that format...

d.

User avatar
danielj
Posts: 5345
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester

Re: 6809 and FLEX

Postby danielj » Sat Jan 17, 2015 3:05 pm

First 16 bytes seem to be describing the format. More later :)

d.

User avatar
danielj
Posts: 5345
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester

Re: 6809 and FLEX

Postby danielj » Mon Jan 19, 2015 11:19 am

Right, scratch that last one. Most of the DSKs seem to be consistent on this:

Each track is made up of 256 byte sectors. 10 of these single density, 20 of these double density. Except, for the most part, track 0 which should always be single density.

If there are double density tracks, a dsk file will pad track 0 so everything's the same length. Disks are interleaved.

Sector 3 of track 0 can be used to work out the geometry of the disk:

Code: Select all

This is the layout of the SIR:
The first 16 bytes are not used (all zeros)
offset(hex)   size(hex)   contents
-----------   ---------   -------------------------
   $10           $0B       Volume Label
   $1B           $01       Volume Number High byte
   $1C           $01       Volume Number Low byte
   $1D           $01       First User Track
   $1E           $01       First User Sector
   $1F           $01       Last User Track
   $20           $01       Last User Sector
   $21           $01       Total Sectors High byte
   $22           $01       Total Sectors Low byte
   $23           $01       Creation Month
   $24           $01       Creation Day
   $25           $01       Creation Year
   $26           $01       Max Track
   $27           $01       Max Sector


As Ed mentioned, there's a sector missing on each track - it's not actually missing, they just don't give a sector that number. So there is no sector numbered 1 on track 0 (but there are still 10 sectors), and there's no sector numbered 0 on any of the other tracks. This obviously isn't recorded in a dsk file, but it does matter for writing them. Will just check this across the disks JGH kindly uploaded.

There's also a FLEX format, which is slightly different so far as I can tell...

d.

User avatar
danielj
Posts: 5345
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester

Re: 6809 and FLEX

Postby danielj » Mon Jan 19, 2015 11:46 am

So just as a quick example for posterity, from a disc image I dug up:

Code: Select all

[snip 16 bytes]
10:56   V
11:46   F
12:4C   L
13:45   E
14:58   X
15:30   0
16:39   9
17:00
18:00
19:00
1A:00
1B:00   |
1C:01   |- Vol 1
1D:0D   First User Track = 0D (I think this is the first free track)
1E:09   First User Sector = 09 (I think this is the first free sector)
1F:22   Last Free track = 22, Means this was a 35 Track Disc - quite standard.
20:0A   Last Free Sector on that track = 10.
21:00   |
22:D6   |- Total Sectors on Disc = 214 (53k capacity)
23:05   May
24:17   17th
25:6F   111? Is that 2011? who knows...
26:22   &22 tracks
27:0A   &0A sectors per track

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

Re: 6809 and FLEX

Postby BigEd » Mon Jan 19, 2015 11:51 am

(For reference, link back to the previous thread which spawned this one)

RobC
Posts: 1820
Joined: Sat Sep 01, 2007 9:41 pm

Re: 6809 and FLEX

Postby RobC » Mon Jan 19, 2015 3:42 pm

I have the Flex sources on a Flex disk and a Windows routine that will extract/view the files from a .dsk image. Both are attached.

I've managed to build the sources (using a09) and write the terminal I/O and disk drivers (using OSWORD &7F).

The binary is booting to the '+++' prompt in 6809Em on the Arc but I haven't yet managed to get it to work with the 6809 co-pro. Sometimes I get 'Not 6809 code' and other times it just hangs. I don't know if this is a problem with my code, the hardware or the version of the client code that's installed (v0.23).

I'll try to find some time to debug it tonight...
Attachments
tsc.zip
(1.69 MiB) Downloaded 77 times
FloppyMaint.zip
(138.36 KiB) Downloaded 73 times

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

Re: 6809 and FLEX

Postby roland » Mon Jan 19, 2015 4:12 pm

RobC wrote:I've managed to build the sources (using a09) and write the terminal I/O and disk drivers (using OSWORD &7F).


I assume you will share your new drivers ... :- I'm very interested in this software, once I get my Atom6809 up and running, so if you please want to share it ... ?
256K + 6502 Inside
MAN WOMAN :shock:

User avatar
danielj
Posts: 5345
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester

Re: 6809 and FLEX

Postby danielj » Mon Jan 19, 2015 4:20 pm

Brilliant work!

There is a bug in 0.23 according to the other thread:
http://www.stardot.org.uk/forums/viewto ... 77#p103277

Could that be causing your problems?

d.

RobC
Posts: 1820
Joined: Sat Sep 01, 2007 9:41 pm

Re: 6809 and FLEX

Postby RobC » Mon Jan 19, 2015 5:55 pm

roland wrote:I assume you will share your new drivers ... :- I'm very interested in this software, once I get my Atom6809 up and running, so if you please want to share it ... ?

Yes - I'll be happy to share but I do want to at least test them properly first! At the moment, I can't even get to the Flex prompt with the co-pro :oops:

danielj wrote:Brilliant work!

There is a bug in 0.23 according to the other thread:
http://www.stardot.org.uk/forums/viewto ... 77#p103277

Could that be causing your problems?

Thanks. To be honest, I haven't done a huge amount: the terminal IO drivers just hook into the entry points defined in JGH's client source and the disk drivers are just wrappers to the relevant OSWORD &7F calls.

I'll have a look at getting a JTAG programming capability to upgrade the firmware or look at loading the newer client code into RAM (assuming that's possible).

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

Re: 6809 and FLEX

Postby roland » Mon Jan 19, 2015 6:08 pm

OK. I don't know if I'm getting the same issues because I don't have that nice little tiny CoPro board. Mine is a real 6809 on a eurocard, so it is completely different. Also getting the FLEX OS into my board will be very different as on your system.

I'll probably start building my board next week or so.
256K + 6502 Inside
MAN WOMAN :shock:

RobC
Posts: 1820
Joined: Sat Sep 01, 2007 9:41 pm

Re: 6809 and FLEX

Postby RobC » Mon Jan 19, 2015 6:56 pm

Hi Roland,

I'd originally planned to build a 6809 co-pro for the Beeb: 68B09, TUBE IC, 2 x 32KB SRAM, 8K ROM and a GAL to do the control logic. I bought all the parts and had the GAL working but then put it to one side due to a lack of time. I did manage to make a decal for a Teletext adapter case so I'll be putting one of the matchbox co-pros in that.

I'll be happy to share anything I have with you once I'm happy that it's doing something useful!

User avatar
1024MAK
Posts: 6788
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...

Re: 6809 and FLEX

Postby 1024MAK » Tue Jan 20, 2015 2:18 am

For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

User avatar
jgharston
Posts: 2756
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: 6809 and FLEX

Postby jgharston » Wed Jan 21, 2015 11:31 pm

See, this is where I'm bashing my head against a wall, the documentation outright contradicts reality.

With the disk images at mdfs.net/temp, the documentation for .vdk disk images (eg) states:
start+2, 3 Header size (offset to start of disk image)
...
start+8 Number of tracks
start+9 Number of sides
... and there's always 10 sectors of 256 bytes per track.

and viola, Flex132.vdk says: 40 tracks, 1 side. So, 256*10*40*1=100K. But the image is 182K. So, somebody's lying.

Also, the boot sector says: FlexSys starts at track 1, sector 1. So, that will be at &A10 bytes into the image (or possible &B10 bytes in). But there's nothing there! ARRRRGGGG!!!!! ](*,)

Code: Select all

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

User avatar
danielj
Posts: 5345
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester

Re: 6809 and FLEX

Postby danielj » Thu Jan 22, 2015 7:19 am

If you have a poke at that image and look at what should be sector 3 (although there's a whole load of other gumpf in there), it looks to me like it says the disk is &27 tracks with &12 sectors/track? I'm just working backwards from where the disk title text is...

So that's a double density dragon disk, although it's possible the first track will be single density?

VDK header is lying to you.

d.

User avatar
jgharston
Posts: 2756
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: 6809 and FLEX

Postby jgharston » Thu Jan 22, 2015 11:45 am

danielj wrote:If you have a poke at that image and look at what should be sector 3 (although there's a whole load of other gumpf in there), it looks to me like it says the disk is &27 tracks with &12 sectors/track? I'm just working backwards from where the disk title text is...
So that's a double density dragon disk, although it's possible the first track will be single density?
VDK header is lying to you.
As I was drifting off to sleep my subconscious started working on it. Hmm... 180K is 18 times 40 tracks. Hmm... Do I remember Dragon disks being 18 sectors? This morning a slight tweek to make the number of sectors/track be imagesize DIV tracks*bytepersector. Making some progress!.

Code: Select all

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

User avatar
danielj
Posts: 5345
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester

Re: 6809 and FLEX

Postby danielj » Thu Jan 22, 2015 8:33 pm

Excellent stuff :D

d.

User avatar
danielj
Posts: 5345
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester

Re: 6809 and FLEX

Postby danielj » Wed Jan 28, 2015 1:25 pm


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

Re: 6809 and FLEX

Postby roland » Wed Jan 28, 2015 4:36 pm

Thanks for notifying. It's a pity the download files cannot be found on that site :( It would be a great source for software.
256K + 6502 Inside
MAN WOMAN :shock:

User avatar
danielj
Posts: 5345
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester

Re: 6809 and FLEX

Postby danielj » Wed Jan 28, 2015 4:46 pm

Arse. I'll drop an email their way and see what the situation is. It looks like it's been stagnant for a long time.

d.

RobC
Posts: 1820
Joined: Sat Sep 01, 2007 9:41 pm

Re: 6809 and FLEX

Postby RobC » Wed Jan 28, 2015 6:18 pm

There's an FTP server that has all the software on it. I think you have to join the Flex Users mailing group before you get access. PM me for more details if you like :wink:

User avatar
danielj
Posts: 5345
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester

Re: 6809 and FLEX

Postby danielj » Wed Jan 28, 2015 7:07 pm

Hehe - I'll happily join the mailing list - who should I email?

d.

RobC
Posts: 1820
Joined: Sat Sep 01, 2007 9:41 pm

Re: 6809 and FLEX

Postby RobC » Wed Jan 28, 2015 8:40 pm

danielj wrote:Hehe - I'll happily join the mailing list - who should I email?

Think it's fufu-subscribe@flexusergroup.com but I've not had a response back yet.

However, as I mentioned before, one of the existing members has been very helpful in sending me lots of info and some software.

RobC
Posts: 1820
Joined: Sat Sep 01, 2007 9:41 pm

Re: 6809 and FLEX

Postby RobC » Mon Feb 02, 2015 8:29 pm

As I mentioned in the OmniFlop thread, I've managed to get Flex up and running.

I had to upgrade the 6809 code to v0.25 but it will now boot, run commands and read a Flex system disk:
Flex1.JPG

Flex2.JPG


I'm using a system disk that I created with OmniFlop as I haven't written a routine to created Flex formatted disks on the Beeb yet.

Oddly, I've got an intermittent bug when writing to disk/saving data from Flex. It's odd because it sometimes works and the write sector code is identical to the read sector code (apart from the operation number). Reading seems to be consistently reliable.

I'll try to do some debugging in the next couple of days...

As Flex doesn't seem to mandate a particular disk setup, I'd also welcome feedback on what this should cater for - I'm currently using two drives: one to hold the DFS disk with the BFLEX code and the other to hold the Flex system disk.

As Flex immediately looks for a Flex disk in what it sees as drive 0, the Flex drives are mapped in reverse to the way they are on the Beeb (0 becomes 1 and 1 becomes 0) so that I can boot with the DFS disk in drive 0 and Flex format disk in drive 1.

I could put the BFLEX routine in ROM and then leave both drives free to hold Flex disks. Or I could put a delay in the Flex boot process to allow for the swapping of disks. Both options would then allow for use with single drive setups.

Also, I'm currently using an 80T, single sided, single density disk image but I need to see what the majority of Flex software disk images uses. (Although the FloppyMaint utility I posted above will allow you to copy software from one disk image type to another.)

One other consideration is that I couldn't get OmniFlop to work with my 5.25" drive (even though it seems to have the required jumpers to switch between Beeb and PC usage). So, I'm currently having to use 3.5" disks (and consequently 80 tracks).

Thoughts on any of the above would be very much appreciated.

Once I've sorted out the write problem, I'll give it a good testing and then release the code.

Cheers,

Rob

User avatar
danielj
Posts: 5345
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester

Re: 6809 and FLEX

Postby danielj » Mon Feb 02, 2015 8:48 pm

Well done! - the write problem seems to be to do with register 3 in the tube ULA implementation and needs debugging - it occurs with all of the processor cores. Essentially you sometimes get a string of EE bytes written instead of the actual file. JGH and flynnjs were looking at this over the weekend. Check Jason's post in the matchbox copro thread.

Re. disc format, 80track single density 256byte sectors single/double sided? I don't think anyone's stuck on 40 tracks these days. (someone will no doubt now say they are!)

d.

RobC
Posts: 1820
Joined: Sat Sep 01, 2007 9:41 pm

Re: 6809 and FLEX

Postby RobC » Mon Feb 02, 2015 9:00 pm

Thanks Daniel - I really should keep up with all the threads :oops:

I had seen Jason's post about there being a problem on the Halifax thread but hadn't read the details!

It would explain what I'm seeing - sometimes it creates the file and other times it corrupts the disk.

Happy to go with that format - it's what I've got working (or semi-working!) at the moment.

Cheers,

Rob

User avatar
jgharston
Posts: 2756
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: 6809 and FLEX

Postby jgharston » Tue Feb 03, 2015 1:12 am

RobC wrote:As I mentioned in the OmniFlop thread, I've managed to get Flex up and running.
I had to upgrade the 6809 code to v0.25 but it will now boot, run commands and read a Flex system disk:
Wonderful! Well done!

RobC wrote:As Flex doesn't seem to mandate a particular disk setup, I'd also welcome feedback on what this should cater for - I'm currently using two drives: one to hold the DFS disk with the BFLEX code and the other to hold the Flex system disk.
I'd recommend "our" standard format: 256 bytes per sector, 10 sectors per track, starting at sector 0, tracks counting up side 0, then counting up side 1 (400K for 80T-doublesided). As things progress we can add 16-sector tracks if the host's controller supports them (640K for 80T-doublesided) or even 720K using a DOS physical format.

RobC wrote:I could put the BFLEX routine in ROM and then leave both drives free to hold Flex disks. Or I could put a delay in the Flex boot process to allow for the swapping of disks. Both options would then allow for use with single drive setups.
The Flex disk format reserves the first 512 bytes of the filesystem for system-specific data boot sector data. I'd recommend that we put a standard DFS catalog in that first 512 bytes - ie sector 0/00/0 and 0/00/1 - and put two files in that catalog: !BOOT and FLEX, both of which point to boot code to load the Flex system either with *FLEX or Shift-Break.

Now, here's the clever bit: the catalog entry for !BOOT and FLEX can actually point to the 512 bytes that are the catalog, so the rest of the catalog space can actually hold the Flex bootstrap! Lay out the first two sectors like this:

Code: Select all

0000 EQUS "FLEX DIS"
0008 EQUS "!BOOT  $"
0010 EQUS "FLEX   $"
0020 Boot code
...
0100 EQUS "K   ":EQUB 0:EQUB &10:EQUW &0220
0108 EQUW &C100:EQUW &C100:EQUB &0200:EQUB &0000
0110 EQUW &C100:EQUW &C100:EQUB &0200:EQUB &0000
0120 more boot code
This will give a catalog that looks like this:

Code: Select all

>[b]*EX[/b]
FLEX DISK  Option 2 (Run)
$.!BOOT   00C100 00C100 000200 0000
$.FLEX    00C100 00C100 000200 0000
The boot code would then load the Flex root directory and look for a "FLEX.SYS" file (or whatever it should be called) and load and enter it. This is how HADFS system disks work. ;)

I'll put together some initial boot code when I get to Sellafield.

Code: Select all

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

RobC
Posts: 1820
Joined: Sat Sep 01, 2007 9:41 pm

Re: 6809 and FLEX

Postby RobC » Tue Feb 03, 2015 6:31 am

Thanks JGH - that's brilliant. I'd started to think about putting a DFS catalogue in the first two sectors but wasn't sure of the details.

There's some example boot code in the Flex adaptation guide so I could just modify that.

I'll stick with 80T, 10 sectors per side and 256 bytes per sector for now as I know OmniFlop writes that format correctly. My drivers should already cope with double sided operation (but I still need to test that).

I'll probably focus on the write corruption for now and then look at the boot code.

Thanks again,

Rob

RobC
Posts: 1820
Joined: Sat Sep 01, 2007 9:41 pm

Re: 6809 and FLEX

Postby RobC » Tue Feb 03, 2015 9:46 pm

Just a quick update:

I've uncovered the write bug - turned out that the write routine was fine but my verify code had a bug in it and so was giving spurious errors.

Oddly, this somehow caused Flex to introduce a one byte corruption into the catalogue.

Anyway, it's working now and I'm able to create and view text files without any apparent problems :D

Next up I'll test the double sided operation and then look at the boot loader code.

Shouldn't be too long before I have something that can be released...

User avatar
jgharston
Posts: 2756
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: 6809 and FLEX

Postby jgharston » Thu Feb 05, 2015 7:30 pm

Back from Sellafield, 8 hours of driving including 4 hours in a traffic jam...

RobC wrote:Next up I'll test the double sided operation and then look at the boot loader code.

This should do it. The system boot filename is replaceable, and the disk access code does double-sided disk access.

I'm thinking that the boot system file (eg TUBEFLEX.SYS in the above boot code) should have the system-specific stuff in it (the equivalent of CPM's BIOS) and load the non-system-specific Flex code (the equivalent of CPM's BDOS) from another file (eg FLEX.SYS).

The Flex Customisation Guide suggests that the boot code loads everything from one single file. I haven't looked at the Flex system disks in enough detail to see if that one single file is the entire system, or if it is just the target-specific stuff and another file holds the generic stuff, but the specific/generic sp[lit is the way I would do it.

Code: Select all

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

RobC
Posts: 1820
Joined: Sat Sep 01, 2007 9:41 pm

Re: 6809 and FLEX

Postby RobC » Thu Feb 05, 2015 8:26 pm

Thanks JGH - that's great.

I put together some code last night based on the loader in the Flex Adaptation Guide. (The example given is a bit crude in that it loads from a hard-wired track and sector rather than searching for a hard-wired filename but it seems to do the job.)

I've stuck to the Flex format of having the first 10 sectors on side 0 and the next 10 sectors on side 1.

I believe the loader is just meant to load the FLEX.SYS file which would imply loading the whole of Flex. The build instructions for the Flex source code indicate that the target-specific stuff and generic stuff are all combined into a single binary.

I had some issues with commands not being recognised and reporting "File not found" but then realised that they only happened when I made typos! The problems seem to be caused by the Flex terminal not handling delete/backspace properly. I've now changed the default backspace character and the problems seem to have gone away.

Thanks again,

Rob


Return to “software: other”

Who is online

Users browsing this forum: fuzzel and 3 guests