[Coco] Fixing OS-9 format for those that "roll their own"

Robert Gault robert.gault at att.net
Sat Oct 19 17:53:59 EDT 2013


There is no question that the NitrOS-9 format command is not adjusting DD.FMT in 
LSN0 to indicate whether a disk is hard or a floppy. We can argue whether that 
should be done but it is my opinion that for a hard disk, DD.FMT should be $82. 
At the very least, DD.FMT should not be $3 which indicates DD plus 2 sides.

For those who want to compile format to fix this and for those that are posting 
to the NitrOS-9 project, here is a suggested change.

original code in Format
in the section * initialize sector 0

L0561    ldb   <numsides  get number of sides
          cmpb  #$01       just 1?
          beq   L0569      branch if so
          ora   #FMT.SIDE  else set double-sided bit
L0569    tst   <tpi       48tpi?
          beq   L056F      branch if so
          ora   #FMT.TDNS  else set 96 tpi
L056F    sta   <DD.FMT,x  save


Suggested changes for hard drives

* Patch to correctly indicate a hard drive.
L0561    tst   <dtype     obtained from the descriptor
          bpl   L0561b     not a hard drive so go
          ora   #$80       indicate a hard drive
          bra   L0569      skip floppy sides; probably could also skip tpi
L0561b   ldb   <numsides  get number of sides
          cmpb  #$01       just 1?
          beq   L0569      branch if so
          ora   #FMT.SIDE  else set double-sided bit
L0569    tst   <tpi       48tpi?
          beq   L056F      branch if so
          ora   #FMT.TDNS  else set 96 tpi
L056F    sta   <DD.FMT,x  save

This has been tested and works correctly for both hard and floppy drives.

Robert



More information about the Coco mailing list