VECTORS AND VECTOR
TABLES
What are vector tables? You remember that a vector is a pair of memory locations that hold the address of a routine. A vector table is, quite simply, a table of vectors. Thus, locations 58368 through 58533 hold the addresses of various routines, mostly having to do with I/O or interrupts.
EDITRV
58368-58383 E400-E40F
This is the vector table for the screen editor handler. For a description of its contents, along with the contents of the next four vector tables, see HATABS at locations 794 through 831 (where we called it a "handler address table").
SCRENV
58384-58399 E410-E41F
The vector table for the display handler. See the note at EDITRV.
KEYBDV
58400-58415 E420-E42F
The vector table for the keyboard handler. See the note at EDITRV.
PRINTV
58416-58431 E430-E43F
The vector table for the printer handler. See the note at EDITRV.
CASETV
58432-58447 E440-E44F
The vector table for the cassette handler. See the note at EDITRV.
You will notice that the following 16 vectors are three bytes long rather than two. Why the extra byte? The first byte of each vector is a 6502 JMP instruction, while the address is in the second two bytes.
The purpose of these vectors may not be obvious to you (they weren't to me). Atari knew that it would probably need to make changes to the OS at some point. It also wanted to make sure that old programs would still be able to work with these newer versions of the OS, even though some of the addresses would be different. The solution was to use vectors. That way, even though the addresses in the vectors would change, the addresses of the vectors would remain the same, and programs using these addresses would still work. The reason that some programs don't work with version "B" of the OS is that these programs didn't use the vectors.
DISKIV
58448-58450 E450-E452
DISKIV is the initialization vector for the disk handler. It points to location 60906.
DISKINV
58451-58453 E453-E455
This is the entry vector for the disk handler. It points to location 60912.
CIOV
48454-48456 E456-E458
CIOV is the entry vector for CIO (Central Input/Output). See Appendix Seven on I/O for an explanation of what CIO does.
You can use CIO yourself by first setting up an IOCB (see locations 832 through 959), and then using the following routine:
100
DIM ML$(7)
110 GOSUB 10000
120 CIO=USR(ADR(ML$),IOCB*16)
130 END
10000 FOR BYT=1 TO 7
10010 READ INSTR
10020 ML$(BYT,BYT)=CHR$(INSTR)
10030 NEXT BYT
10040 RETURN
10050 DATA 104,104,104,170,32,86,228
110 GOSUB 10000
120 CIO=USR(ADR(ML$),IOCB*16)
130 END
10000 FOR BYT=1 TO 7
10010 READ INSTR
10020 ML$(BYT,BYT)=CHR$(INSTR)
10030 NEXT BYT
10040 RETURN
10050 DATA 104,104,104,170,32,86,228
The data is for this machine language routine:
68
PLA
68 PLA
68 PLA
AA TAX
2056E4 JSR $E456
68 PLA
68 PLA
AA TAX
2056E4 JSR $E456
CIO expects the number of the IOCB you want to use, times 16, in the X register. That's why we have IOCB* 16 in the preceding program. You should substitute the IOCB number you are using for IOCB. Remember to OPEN the IOCB first.
CIOV points to 58564
SIOV
58457-58459 E459-E45B
This is the entry vector for SIO (Serial Input/Output). Again, check Appendix Seven on I/O for an explanation of SIO's function. SIOV points to 59737.
SETVBV
58460-58462 E45C-E45E
SETVBV is the entry vector for a routine that serves two purposes. First of all, as we saw at VVBLKD (548,549), it will set up VVBLKI and VVBLKD for us. Second, as we saw at CDTMA1 (550,551), it will also set up the vectors for the system timers. See VVBLKD and CDTMA1 for more information.
SETVBV points to 59666 in version "A" of the OS, 59629 in version "B."
SYSVBV
58463-58465 E45F-E461
This is the entry vector for the stage one VBLANK routine. Unless you have your own routine, VVBLKI (546,547) normally points here. See VVBLKI and VVBLKD (548,549) for more information on VBLANK.
SYSVBV points to 59345 in version "A" of the OS, 59310 in version "B."
XITVBV
58466-58468 E462-E464
XITVBV is the exit vector for the VBLANK routine. This is what VVBLKD points to unless you've changed it.
Use XITVBV to return to where the computer left off from when the VBLANK interrupt occurred. It points to 59710 in version "A" of the OS, 59653 in version "B."
The following four vectors are designed for use by the OS only.
SIOINV
58469-58471 E465-E467
This is the initialization vector for SIO.
SENDEV
58472-58474 E468-E46A
SENDEV is the vector for the "send-enable" routine.
INTINV
58475-58477 E46B-E46D
This is the initialization vector for the interrupt handler routine.
CIOINV
58478-58480 E46E-E470
CIOINV is the initialization vector for CIO.
BLKBDV
58481-58483 E471-E473
This is the entry vector for the blackboard mode, which is more commonly known as the "ATARI MEMO PAD" mode. Type "BYE" from BASIC, or turn on the computer with no cartridges or disk drives to see what I mean. This mode lets you type things on the screen without anybody caring what you type. In other words, you can press RETURN and nothing will happen. To get back to BASIC, press SYSTEM RESET (this won't erase your BASIC program).
BLKBDV points to 61987.
WARMSV
58484-58486 E474-E476
WARMSV is the entry vector for the warmstart routine. The OS jumps through here when SYSTEM RESET is pressed.
WARMSV points to 61723.
In case these locations don't seen useful to you, try this:
X =
USR(58484)
What you have just done is told the computer to go to 58484, which contains a machine language instruction to go to the address in the next two memory locations. Since this routine is for what's called warmstart, the computer will now act just like you pressed SYSTEM RESET. You use the other locations in this section just like this. TRY IT!
COLDSV
58487-58489 E477-E479
This, appropriately, is the entry vector for the coldstart routine. Whereas going through WARMSV only initializes the OS RAM, going through COLDSV initializes all RAM, meaning that any programs in memory will be erased. See COLDST at location 580 for a way to hook COLDSV up to SYSTEM RESET rather than WARMSV.
COLDSV points to 61733
The following two vectors are designed for use by the OS only.
RBLOKV
58490-58492 E47A-E47C
RBLOKV is the entry vector for the cassette "read-block" routine.
CSOPIV
58493-58495 E47D-E47F
This is the vector for the cassette "OPEN-for-input" routine.
VCTABL
58496-58533 E480-E4A5
VCTABL is a table of the initial values for the OS RAM vectors.
Now we're into the final part of the OS, which consists mostly of the various built-in handlers, interrupt routines, and so forth. What follows is a list of addresses for some of these routines, which can be useful to you in one of several ways. If you're a beginner, the list will provide you with an idea of exactly what the OS does. If you're a machine language programmer then, along with the OS listing, the list will help you find the various routines so that you can see exactly how things are done. By studying the routines, you can also pick up on programming techniques (don't be afraid of the OS listing; it's really not that difficult to understand). Finally, if you really know what you're doing, you can rewrite the routines and put them in your own programs, customizing them to your own needs.
Most of the routines will not work without some kind of previous setup, so make sure you check the OS listing before you attempt to use them.
Please note that all the following addresses are for the original OS only. Some of them may be different in the newer versions. At the time of this writing, however, the OS listing is for the original version, and that is why these addresses are used.
Return to Table of Contents | Previous Chapter | Next Chapter