QDOS Internals

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

User Tools

Site Tools



This trap sets a file header.

Call ParametersReturn Parameters
D0.B$46D0.LError return.
D1.L D1.WLength of header set.
D3.WTimeout D3.LPreserved.
A0.LChannel ID A0.LPreserved.
A1.LBase of header definitionA1.LEnd of header definition.


ERR_NCNot complete.
ERR_NOChannel not open.


  • All registers not shown above are not used on entry and are preserved on exit.
  • This trap sets the first 14 bytes of the file header.
  • Note that if this trap is dealing with a purely serial device the length of header in D1.W will be a spurious 15.
  • The format of a header is given here.


The example below shows the use of this trap call to increase the dataspace of a program by $1000 bytes. It is assumed that A0 contains the file's ID and that a 64-byte buffer is at buf(A6).

datsp   moveq   #fs_headr,d0    ; $47
        moveq   #64,d2          ; Space for 64-byte header
        moveq   #-1,d3          ; Timeout
        lea     buf(a6),a1      ; Buffer
        trap    #3              ; Read header
        tst.l   d0              ; OK . .
        bne     error           ; . . no!
        add.l   #$1000,buf+6(a6) ; Add $1000 to the dataspace
        moveq   #fs_heads,d0    ; $46
        lea     buf(a6),a1      ; Reset the header base address
        trap    #3              ; Write header
        tst.l   d0              ; OK . .
        bne     error           ; . . no!        
qdosmsq/traps/trap_3/shdr.txt · Last modified: 2009/05/27 15:41 by george.gwilt