QDOS Internals

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

User Tools

Site Tools



These traps link and unlink routines to and from lists. The full set is given in the following tables.

$1AMT_LXINT/SMS_LEXIExternal interrupt
$1CMT_LPOLL/SMS_LPOLPolling 50/60Hz
$20MT_LIOD/SMS_LIODIO device driver
$22MT_LDD/SMS_LFSDDirectory device driver
$1BMT_RXINT/SMS_REXIExternal interrupt
$1DMT_RPOLL/SMS_RPOLPolling 50/60Hz
$21MT_RIOD/SMS_RIODIO device driver
$23MT_RDD/SMS_RFSDDirectory device driver


Call ParametersReturn Parameters
D0.BSee aboveD0.LCorrupted?
A0.LAddress of link A0.LPreserved.


No errors are returned by these traps.


  • All registers not shown above are not used on entry and are preserved on exit.
  • A0.L points to an area whose nature depends on the type of list.
    • For external interrupt, polling and the scheduler, A0 points to two long words. The first is for the link and the second points to the linked routine.
    • For the device drivers A0 points to at least four long words. The first is the link pointer. The second, third and fourth are pointers to input/output, open and close routines. The directory device driver needs at least 40 bytes.
  • The routines for the external interrupt, polling and scheduler lists can assume that, on entry A6.L points to the systam variables. This address should not be changed by the routine.


The example shows a timer being set in system variables. This is linked to the polling list.

lnk     ds.l    2               ; Space for link.
rout    addq.l  #1,$DC(a6)      ; Add one to the timer in system variables.
        rts                     ; The routine must end with RTS.

link    lea     lnk,a0          ; Address of link.
        lea     rout,a1         ; Address of routine.
        move.l  a1,4(a0)        ; Set the pointer in the linkage block.
        moveq   #MT_LPOLL,d0    ; To link in the routine.
        trap    #1
qdosmsq/traps/trap_1/lexi.txt · Last modified: 2010/02/07 13:46 by george.gwilt