As mentioned in the instruction summary in past articles, the QL processor runs in two modes - user and supervisor - and some instructions cannot be run in user mode without causing an exception to be generated. I promised to explain what these exceptions are, so here goes ....
An exception is an event or happening that causes the processor to deviate from its normal course of action and to jump to a predetermined place in the operating system where it starts executing a piece of code that handles such events. In QDOS (the QL's operating system) many of these routines have been 'botched' in an effort to save on memory and others simply do nothing. This is unfortunate, however, all is not lost.
All 68000 series processors have an area of memory set aside to hold the exception table. This table is 1024 bytes long and holds a full set of exception vectors - basically a long word holding the address of the sub-routine that handles the appropriate exception. In QDOS this table is only partially there as will become clear. There are 256 vectors normally, each one being 4 bytes long. Vector zero is at address zero in the memory map and vector 255 is at address $3FC.
The vector table should look like the following :
Table 6.1. MC6800x Exception Table
Vector | Address | Purpose |
---|---|---|
000 | 0000 | Reset - SSP value |
001 | 0004 | Reset - USP value |
002 | 0008 | Bus Error |
003 | 000C | Address Error |
004 | 0010 | ILLEGAL Instruction |
005 | 0014 | Divide by zero |
006 | 0018 | CHK instruction |
007 | 001C | TRAPV instruction |
008 | 0020 | Privilege violation |
009 | 0024 | Trace |
010 | 0028 | Line 1010 emulator |
011 | 002C | Line 1111 emulator |
012 | 0030 | Reserved for Motorola |
013 | 0034 | Reserved for Motorola |
014 | 0038 | Reserved for Motorola |
015 | 003C | Uninitialised Interrupt |
016 | 0040 | Reserved for Motorola |
... | ... | ... |
024 | 0060 | Spurious interrupt |
025 | 0064 | Interrupt level 1 |
026 | 0068 | Interrupt level 2 |
027 | 006C | Interrupt level 3 |
028 | 0070 | Interrupt level 4 |
029 | 0074 | Interrupt level 5 |
030 | 0078 | Interrupt level 6 |
031 | 007C | Interrupt level 7 |
032 | 0080 | TRAP #0 |
033 | 0084 | TRAP #1 |
034 | 0088 | TRAP #2 |
035 | 008C | TRAP #3 |
036 | 0090 | TRAP #4 |
037 | 0094 | TRAP #5 |
038 | 0098 | TRAP #6 |
039 | 009C | TRAP #7 |
040 | 00A0 | TRAP #8 |
041 | 00A4 | TRAP #9 |
042 | 00A8 | TRAP #10 |
043 | 00AC | TRAP #11 |
044 | 00B0 | TRAP #12 |
045 | 00B4 | TRAP #13 |
046 | 00B8 | TRAP #14 |
047 | 00BC | TRAP #15 |
048 | 00C0 | Reserved for Motorola |
... | ... | ... |
064 | 0100 | User vector 1 |
... | ... | ... |
255 | 03FF | User vector 192 |
It can be seen that a huge number of the vectors are reserved for Motorola to use in future processors. The User vectors look interesting, but have been obliterated by some of the code in QDOS and cannot be used.
On the QL, the vectors are as follows :
Table 6.2. QDOS Exception Table
Vector | Address | Purpose |
---|---|---|
000 | 0000 | Reset - SSP value |
001 | 0004 | Reset - USP value |
002 | 0008 | Bus Error - IGNORED |
003 | 000C | Address Error - MAY BE REDEFINED |
004 | 0010 | ILLEGAL Instruction - MAY BE REDEFINED |
005 | 0014 | Divide by zero - MAY BE REDEFINED |
006 | 0018 | CHK instruction - MAY BE REDEFINED |
007 | 001C | TRAPV instruction - MAY BE REDEFINED |
008 | 0020 | Privilege violation - MAY BE REDEFINED |
009 | 0024 | Trace - MAY BE REDEFINED |
010 | 0028 | Line 1010 emulator - UNUSABLE |
011 | 002C | Line 1111 emulator - UNUSABLE |
012 | 0030 | Reserved for Motorola - UNUSABLE |
013 | 0034 | Reserved for Motorola - UNUSABLE |
014 | 0038 | Reserved for Motorola - UNUSABLE |
015 | 003C | Uninitialised Interrupt - UNUSABLE |
016 | 0040 | Reserved for Motorola - UNUSABLE |
... | ... | ... |
024 | 0060 | Spurious interrupt - IGNORED |
025 | 0064 | Interrupt level 1 - IGNORED |
026 | 0068 | Interrupt level 2 - QL System interrupt |
027 | 006C | Interrupt level 3 - IGNORED |
028 | 0070 | Interrupt level 4 - IGNORED |
029 | 0074 | Interrupt level 5 - IGNORED |
030 | 0078 | Interrupt level 6 - IGNORED |
031 | 007C | Interrupt level 7 - HANGS THE QL - MAY BE REDEFINED |
032 | 0080 | TRAP #0 - Make a call to QDOS |
033 | 0084 | TRAP #1 - Make a call to QDOS |
034 | 0088 | TRAP #2 - Make a call to QDOS |
035 | 008C | TRAP #3 - Make a call to QDOS |
036 | 0090 | TRAP #4 - Make a call to QDOS |
037 | 0094 | TRAP #5 - IGNORED - MAY BE REDEFINED |
038 | 0098 | TRAP #6 - IGNORED - MAY BE REDEFINED |
039 | 009C | TRAP #7 - IGNORED - MAY BE REDEFINED |
040 | 00A0 | TRAP #8 - IGNORED - MAY BE REDEFINED |
041 | 00A4 | TRAP #9 - IGNORED - MAY BE REDEFINED |
042 | 00A8 | TRAP #10 - IGNORED - MAY BE REDEFINED |
043 | 00AC | TRAP #11 - IGNORED - MAY BE REDEFINED |
044 | 00B0 | TRAP #12 - IGNORED - MAY BE REDEFINED |
045 | 00B4 | TRAP #13 - IGNORED - MAY BE REDEFINED |
046 | 00B8 | TRAP #14 - IGNORED - MAY BE REDEFINED |
047 | 00BC | TRAP #15 - IGNORED - MAY BE REDEFINED |
048 | 00C0 | Reserved for Motorola - UNUSABLE |
... | ... | ... |
064 | 0100 | User vector 1 - UNUSABLE |
... | ... | ... |
255 | 03FF | User vector 192 - UNUSABLE |
All vectors marked 'UNUSABLE' have been botched in the ROM and have bits of code in place of the vectors. So you can see not much is left. The designers of QDOS didn't have enough room in the early ROMs to fit all the code in - some QLs even came with a 'dongle' hanging out of the external ROM slot so that they could fit all the code in. Later versions got rid of the dongle, but the vector table had been 'redesigned' to make the code fit. Luckily they did allow a number of the exceptions to be redefined so that programmers could write their own routines to handle these exceptions.