Jump to content
IGNORED

Order of sectors in sector dump format


Recommended Posts

https://www.unige.ch/medecine/nouspikel/ti99/dc2.txt

 

Quote
*---------------------------------------
* Sector read/write
*---------------------------------------
A40E8  LI   4,>000A           try ten times
A40EC  MOVB @A4630,@>0050(9)  no error
       BL   @A4496            select drive
       BL   @A45F0            point to # of last track
       CLR  0
       MOVB @>FBFE(15),0      get # of last track accessed
       CI   0,>D700
       JH   A410C             too high: drive was reset
       BL   @A4524            seek track 0
       SETO 0                 inverted data bus" >FF will be >00
A410C  MOVB 0,@>5FFA          place >00 in track register
       MOV  @>004A(9),1       sector #
       SBZ  7                 side 0
       CLR  7
       CI   1,>02D0           max 720 (DS/SD)
       JHE  A41B6             error 7
       CI   1,>0168           on which side is it?
       JL   A413E             0-359: on side 0
       AI   1,-719            on side 1: sector # grow from in to out
       ABS  1                 719 - sector #
       CLR  0
       DIV  @A4632,0          sect/track (=9)
       AI   1,-8              invert: 8=0, 0=8, 7=1, etc
       ABS  1
       SBO  7                 side 1
       LI   7,>0100           side number = >01
       JMP  A414E
A413E  CI   1,>0001           is it sector 0 or 1?
       JH   A4148             no
       BL   @A4524            yes: seek track 0
A4148  CLR  0
       DIV  @A4632,0          R0=track #, R1=sector #

Yes.

  • Like 1
18 hours ago, Asmusr said:

I think I found the answer: tracks on side two are ordered from track 39 down to track 0, but the order of sectors within each track is still increasing.

Yeah. Since sector dump images don't include the track information, it's just a straight run of incrementing sectors. Confusion over how that was discussed in the original V9T9 docs had me include an option to invert it in Classic99, but I never saw such an image and I believe I disabled it.

 

I've not tried analyzing a track dump image to see if that track information really is stored that way there. ;)

 

Yes, the sector dumps use a logical sector order, so sector n comes before n+1. No track information is retained.

 

Different to that, the track dumps (aka PC99 format) keep the track information, including the sector placement. See

 

https://www.ninerpedia.org/wiki/Sector_Dump_Format

https://www.ninerpedia.org/wiki/Track_Dump_Format

The thing I don't understand is where the logical sector order comes from? I can see that for a real FDC it's faster to switch from side 0 track 39 to side 1 track 39, but that doesn't mean that sectors in a disk image should be ordered like that. For me it would be more logical if we could simply calculate the sector index as side * 360 + track * 9 + sector. Anyway, no problem once I found out how it works.

 

Edit: The aim is to calculate where on the disk image a sector exists, which would be sector index * 256.

Edited by Asmusr

By "logical order" I mean that subsequent sectors have increasing numbers. You could also call it linear block addressing.

 

The sector dump is a sequence of contents of sector 0, 1, 2, 3, 4 ... 1439 (for DSDD). There are no sides in this format, neither are there tracks. The offset of sector n from the beginning is n*256.

 

 

  • Like 1

This is my implementation for FDD h/w emulation.  It works with any sector dump files I have tested:
 

static void seekDisk (void)
{
    int sector = fdd.sector;

    if (fdd.side)
    {
        /*  Add the offset for the first side */
        sector += sectorsPerTrack * tracksPerSide;

        /*  For double sided disks saved in a sector-dump (.dsk file), the track
         *  number is "inverted" so track 39 is the first track on the second
         *  side and track 0 is the last track.
         */
        sector += (tracksPerSide - 1 - fdd.track) * sectorsPerTrack;
    }
    else
        sector += fdd.track * sectorsPerTrack;

    mprintf (LVL_DISK, "DSK - access sector %d [T:%d Sec:%d Side:%d]\n", sector,
             fdd.track, fdd.sector, fdd.side);

    if (driveHandler[fdd.unit].seek)
        driveHandler[fdd.unit].seek (sector);
}

 

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...