QDOS Internals

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

User Tools

Site Tools



These are the error codes that QDOSMSQ can return from a vectored utility, a Trap or from SuperBasic extensions.

Always check for errors

When writing assembler routines, it is always advised to explicitly check the value in D0.L for an error code. This is done quickest using :

        trap    #n                ; Do the trap.
        tst.l   d0                ; Did it work?
        beq.s   all_ok            ; Yes, all is well

errors  :                         ; Handle errors here
        bra     kill_job          ; And exit the job, or code somehow.
all_ok  :                         ; Carry on from here if all worked.

Some traps and vectored utilities do not set the Z flag before returning which is why you have to do it. Well, actually, it's not that they don't set it but when you call a trap, the status register is stacked for the duration and restored at the end, so while D0 may have an appropriate error code in it, the Z flag's state is unknown. A vector should always have correctly set the Z flag, so save some coding and execution time by simply checking the Z flag, as follows:

        move.w  <whatever>,a2     ; Get the vectored routine.
        jsr     (a2)              ; Do it.
        beq.s   vec_ok            ; All is well, skip error handler.

v_error :                         ; Handle errors here
        bra     kill_job          ; And exit the job, or code somehow.
vec_ok  :                         ; Carry on from here if all worked.

Error codes

ValueQDOS MnemonicSMS MnemonicDescription
-1ERR_NCERR_NCOperation not complete .
-2ERR_NJERR_IJOBNot a (valid) job.
-3ERR_OMERR_IMEMOut of memory.
-4ERR_ORERR_ORNGOut of range.
-5ERR_BOERR_BFFLBuffer overflow.
-6ERR_NOERR_ICHNChannel not open.
-7ERR_NFERR_FDNFFile or device not found.
-8ERR_EXERR_FEXFile already exists.
-9ERR_IUERR_FDIUFile or device already in use.
-10ERR_EFERR_EOFEnd of file.
-11ERR_DFERR_DRFLDrive full.
-12ERR_BNERR_INAMBad device.
Transmission error
Parity error (SMS only).
-14ERR_FFERR_FMTFFormat failed.
-15ERR_BPERR_IPARBad parameter.
-16ERR_FEERR_MCHKFile error.
-17ERR_EXERR_IEXPExpression error.
-18ERR_OVERR_OVFLArithmetic overflow.
-19ERR_NIERR_NIMPNot implemented.
-20ERR_ROERR_RDORead only.
-21ERR_BLERR_ISYNBad line of Basic.
-22 ERR_RWFRead/write failed (SMS only).
qdosmsq/errors/start.txt · Last modified: 2008/06/25 13:36 by norman