QDOS Internals

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

User Tools

Site Tools


Table of Contents


This trap sets or reads the file version number.

Call ParametersReturn Parameters
D0.B$4ED0.LError return.
D1.LVersion D1.LVersion.
D3.WTimeout D3.LPreserved.
A0.LChannel ID A0.LPreserved.


Any I/O sub system errors including

ERR_NCNot complete.


  • All registers not shown above are not used on entry and are preserved on exit.
  • D1.L has three initial values:
    • -1 causes the file version number to be returned in D1.L.
    • 0 causes the the file version number to be set to its current value and returned in D1.L.
    • 1 to 65535 causes the value in D1.L to be set as the new version number. The value in D1.L is preserved on return.
  • If the version number is set by this trap, it will not be incremented when the file is closed, or flushed.


The example below shows the use of this trap call to set the version number of a file in D7.L and prevent its being incremented when the file is closed.

vers    moveq   #io_open,d0     ; $01
        moveq   #-1,d1          ; This job
        moveq   #0,d3           ; OPEN
        lea     name,a1         ; Name of file 
        trap    #2              ; Open the file
        tst.l   d0              ; OK? . .
        bne     error           ; . . no!
        moveq   #0,d1           ; To find the version number
        moveq   #-1,d3          ; Timeout
        moveq   #iof_vers,d0    ; $4E
        trap    #3              ; Find the version
        tst.l   d0              ; OK? . .
        bne     error           ; . . no!
        move.l  d1,d7           ; Set the version number in D7.L
        moveq   #io_close,d0    ; $02
        tst.l   d0              ; OK? . .
        bne     error           ; . . no!

name    dc.w    name_e-name-2   ; Length of name
        dc.b    "flp1_klok"
name_e  ds.b    0        
qdosmsq/traps/trap_3/vers.txt · Last modified: 2009/06/01 10:23 by george.gwilt