3. Working QDOS Exceptions

RESET vectors 0 and 1 - these two vectors are simply the values that are put into the SSP and USP on system power up. Vector 0 gives the value for the stack pointer for supervisor mode and vector 1 gives the stack pointer for user mode.

ADDRESS ERROR - this occurs whenever the processor tries to do a word or long sized operation or access at an odd address. For example, the following code fragment will cause an address error :

MOVEA.L   #1,A1
MOVE.W   (A1),D0

On a normal QL this will usually cause the system to hang, but as the vector can be redefined, we can use it to point to an address that can correctly handle this error. More on this later.

ILLEGAL INSTRUCTION - this occurs when an instruction is executed that is not a valid instruction for the processor, or when the ILLEGAL instruction is executed. Illegal usually crashes the QL, but can be handled by our own routines.

DIVIDE BY ZERO - This should be obvious. This is ignored on the QL, but can be redefined for our own use.

CHK INSTRUCTION - Called when the CHK instruction is used and the value in a data register is out of bounds, Ignored on the QL but redefinable.

TRAPV INSTRUCTION - Called when the TRAPV instruction is executed and the V flag is set. Ignored by the QL but, once again, is redefinable.

PRIVILEGE VIOLATION - When a program running in user mode attempts to execute an instruction that is privileged, this exception is raised. Ignored by the QL, but redefinable.

TRACE - If the trace (T) bit is set in the Status Register, this execption is generated after each instruction. Can be redefind to call code in a machine code monitor program, but usually ignored by the QL.

INTERRUPT LEVEL 2 - there are 7 levels of interrupt on a normal 68000 series processor, but only one is used on the QL. The level 2 interrupt is generated by the internal electronics and causes the keyboard to be scanned, the scheduler to switch tasks etc. Levels 1 and 3 to 6 are ignored on the QL.

INTERRUPT LEVEL 7 - Level 7 is the non-maskable interrupt and is raised when you press CTRL ALT 7 together. When the QL hardware was being built and debugged, some external equipment was 'bolted on' and this combination of keys caused a level 7 interrupt which activated the debugging equipment. Unfortunately, when the QL went into production, the code was left in and pressing these keys together is a pretty good way to trash the system. May be redefined for our own use - this could be fun !

TRAP #0 - Switch the QL into supervisor mode and cause the SSP version of A7 to be used.

TRAP #1 - this is the QDOS manager trap and is used to control resources in the QL such as baud rates, jobs, memory allocation and deallocation etc.

TRAP #2 - this is the QL's I/O manager trap and is used to open & close channels as well as foramtting discs and deleting files.

TRAP #3 - This allows QDOS to read data from channels, queues, set colours etc.

TRAP #4 - Used by the SuperBasic interpreter to switch between A6 relative and Absolute addresses when calling various routines.

TRAP #5 to TRAP #15 - these are unused on the QL but can be redefined.