QDOS Internals

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

User Tools

Site Tools



These traps position the file pointer.

TrapValue in D0.BAction
FS_POSAB/IOF_POSA$42Position file absolute
FS_POSRE/IOF_POSR$43Position file relative
Call ParametersReturn Parameters
D0.BSee aboveD0.LError return.
D1.LFile position D1.LNew file position.
D3.WTimeout D3.LPreserved.
A0.LChannel ID A0.LPreserved.
A1.L A1.LCorrupted.


ERR_NCNot complete.
ERR_NOChannel not open.
ERR_EFEnd of file.


  • All registers not shown above are not used on entry and are preserved on exit.
  • The value in D1.L is the absolute position requested for FS_POSAB/IOF_POSA and is the offset from the current position for FS_POSRE/IOF_POSR.
  • If either trap returns with an off limits error then the pointer is set to the nearest limit (either 0 or the end of the file).
  • By setting D1 to 0 and using FS_POSRE/IOF_POSR the current position of the file can be determined.
  • In the case of FS_POSAB/IOF_POSA if the call is made for a direct sector access channel a special file position flag can be specified in D1. Using $F0FFF0FF returns the sector offset of the first physical sector of the current partition on multiple-partition devices (SMSQ v2.77+), otherwise D1 is unchanged.


The example below shows the use of FS_POSRE/IOF_POSR to find the current position in the file. It is assumed that A0 contains the channel ID.

pos     moveq   #fs_posre,d0    ; $43
        moveq   #0,d1           ; To find the current position
        moveq   #-1,d3          ; Timeout
        trap    #3              ; The current position is now in D1.L
        tst.l   d0              ; OK? . .
        bne     error           ; . . no!
qdosmsq/traps/trap_3/posa.txt · Last modified: 2009/05/17 16:49 by george.gwilt