QDOS Internals

Anything you never knew you wanted to know about the Sinclair QL.

User Tools

Site Tools



This trap call allows a medium to be formatted. It returns the number of good sectors and the total number of sectors on the medium. The latter includes any bad sectors that were detected.

Call ParametersReturn Parameters
D0.B$03D0.LError code.
D1.LUnusedD1.WNumber of good sectors.
D2.LUnusedD2.WTotal number of sectors, including bad ones.
A0.LPointer to medium name.A0.LCorrupted


ERR_OMOut of memory.
ERR_FFFormat failed.
ERR_NFFile or device not found.
ERR_IUFile in use.


  • All registers not shown above are not used on entry and are preserved on exit.
  • The medium name is allowed to be 10 characters in length not including the device name.
  • In recent years, with the introduction of hard drives, the return values in D1 and D2 may need to be multiplied.


The following shows the use of this call to format a medium :

        moveq   #io_formt,d0      ; Trap code
        lea     name,a0           ; Pointer to name of medium
        trap    #2                ; Do the format
        tst.l   d0                ; Test for errors
        bne.s   error             ; The format has failed.

        ;Carry on here - the format worked.

name    dc.w    12                ; Length of filename
        dc.b    'FLP1_Backups'    ; Bytes of actual filename
qdosmsq/traps/trap_2/format.txt · Last modified: 2008/06/25 13:00 by norman