•  Back 
  •  XBIOS Function Reference 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  %About 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The ATARI Compendium
Author      : Scott Sanders / JAY Software
Version     : 1.25 (20/6/2003)
Subject     : Documentation
Nodes       : 1117
Index Size  : 32614
HCP-Version : 6
Compiled on : Atari
@charset    : UTF-8
@lang       : en
@default    : 
@help       : %About
@options    : +g -i -t4 +y +z
@width      : 100
View Ref-FileFloprate()
Floprd()
Flopwr()
Flopfmt()                                                             XBIOS

Syntax

WORD Flopfmt( buf, skew, dev, spt, track, side, intlv, magic, virgin )
VOIDP buf;
WORD *skew;
WORD dev, spt, track, side, intlv;
LONG magic;
WORD virgin;

Function      Flopfmt() formats a specified track on a floppy disk.

Opcode        10 (0x0A)

Availability  All TOS versions.

Parameters    buf is a pointer to a word-aligned buffer large enough to
              hold one disk track which is used to build a copy of each
              sector to write. skew should be NULL for non-interleaved
              sectors or point to a WORD array containing spt entries which
              specifies the sector interleave order. dev specifies which
              floppy drive to format ('A:' = FLOP_DRIVEA (0), 'B:' =
              FLOP_DRIVEB (1)). spt indicates the number of sectors to
              format. track indicates which track to format. side indicates
              the side to format. intlv should be FLOP_NOSKEW (1) for
              consecutive sectors or FLOP_SKEW (-1) to interleave the
              sectors based on the array pointed to by skew. magic is
              a fixed magic number which must be FLOP_MAGIC (0x87654321).
              virgin is the value to assign to uninitialized sector data
              (should be FLOP_VIRGIN (0xE5E5)).

Binding       move.w   virgin,-(sp)
              move.l   magic,-(sp)
              move.w   intlv,-(sp)
              move.w   side,-(sp)
              move.w   track,-(sp)
              move.w   spt,-(sp)
              move.w   dev,-(sp)
              pea      skew
              pea      buf
              move.w   #$0A,-(sp)
              trap     #14
              lea      26(sp),sp

Return Value  Flopfmt() returns 0 if the track was formatted successfully
              or non-zero otherwise. Also, upon exit, buf will be filled in
              with a WORD array of sectors that failed formatting
              terminated by an entry of 0. If no errors occurred then the
              first WORD of buf will be 0.

Comments      The steps required to a format a floppy disk are as
              follows:
              1. Call Flopfmt() to format the disk as desired.
              2. Call Protobt() to create a prototype boot sector in
                 memory.
              3. Call Flopwr() to write the prototype boot sector to track
                 0, side 0, sector 1. Interleaved sector formatting is
                 only possible as of TOS 1.2. skew should be set to NULL
                 and intlv should be set to FLOP_NOSKEW under TOS 1.0.
                 Specifying an intlv value of FLOP_SKEW and a skew array
                 equalling { 1, 2, 3, 4, 5, 6, 7, 8, 9 } is the same as
                 specifying an intlv value of FLOP_NOSKEW. To accomplish
                 a 9 sector 2:1 interleave you would use a skew array
                 which looked like: { 1, 6, 2, 7, 3, 8, 4, 9, 5 }.
                 The '_FDC' cookie (if present) contains specific
                 information regarding the installed floppy drives.
                 The lower three bytes of the cookie value contain
                 a three-letter code indicating the manufacturer of the
                 drive (Atari is 0x415443 'ATC'). The high byte determines
                 the capabilities of the highest density floppy drive
                 currently installed as follows:

                 Name        Value  Meaning

                 FLOPPY_DSDD   0    Standard Density (720K)

                 FLOPPY_DSHD   1    High Density (1.44MB)

                 FLOPPY_DSED   2    Extra High Density (2.88MB)

                 To format a high density diskette, multiple the spt
                 parameter by 2. To format a extra-high density diskette,
                 multiply the spt parameter by 4. This call forces a
                 'media changed' state on the device which will be
                 returned on the next Mediach() or Rwabs() call.

See Also      Floprate(), Floprd(), Flopwr()