mirror of
https://github.com/elliotnunn/sys7.1-doc-wip.git
synced 2024-12-12 20:29:12 +00:00
220 lines
5.4 KiB
Plaintext
220 lines
5.4 KiB
Plaintext
;
|
|
; File: VectorTableInit.a
|
|
;
|
|
; Contains: This contains macros used to create the code that initilizes
|
|
; the ROM vectors. The user needs to assemble this file directly,
|
|
; and pass in the name of the of the vector table source file
|
|
; ( VectorTable.a ) and the value of ROMBASE on the command
|
|
; line with:
|
|
;
|
|
; Asm VectorTableInit.a -d ROMBASE=$40800000 -d "&VectorTable='filename'"
|
|
;
|
|
; Written by: Kurt Clark
|
|
;
|
|
; Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
|
|
;
|
|
; Change History (most recent first):
|
|
;
|
|
; <SM3> 2/25/93 kc Added a table listing all of the low memory vectors, and rewrote
|
|
; the macros to simplify things a little.
|
|
; <SM2> 2/21/93 kc Change to case on and add nonVectorizedRom conditional.
|
|
; <1> 12/2/92 kc first checked in
|
|
; To Do:
|
|
;
|
|
|
|
Machine mc68020
|
|
|
|
Case On
|
|
|
|
|
|
kInfoTableFormat Equ 1 ; info table format version
|
|
kDescTableFormat Equ 1 ; descriptor table format version
|
|
kDirectVector Equ 1 ; direct vector type
|
|
kIndirectVector Equ 2 ; indirect vector type
|
|
|
|
DescriptorVect Equ $2000 ; address of table descriptor vector
|
|
|
|
|
|
macro ; Nothing to do here.
|
|
&Name vDataTable
|
|
endmacro
|
|
|
|
|
|
macro
|
|
&Name vNoVector ; ibid.
|
|
endmacro
|
|
|
|
|
|
macro ; ibid.
|
|
&Name vATrap &TNum ; ( At some point we may decide to administer atraps
|
|
endmacro ; with the same technique we use for ROM vectors. )
|
|
|
|
|
|
macro ; ibid.
|
|
&Name vDirect &TVec, &CVec, &AReg ; ( At some point we may decide to direct vectors
|
|
endmacro ; with the same technique we use for ROM vectors. )
|
|
|
|
|
|
macro
|
|
&Name vIndirect &TVec, &CVec, &AReg, &Cond
|
|
|
|
If &Name = '' Then ; check name
|
|
|
|
AError 'Name missing from vIndirect Macro'
|
|
|
|
Exitm
|
|
|
|
Endif
|
|
|
|
If &Cond ≠ '' Then ; check conditional
|
|
|
|
If &Type(&Cond) = 'UNDEFINED' Or Not &Eval(&Cond) Then
|
|
|
|
Exitm
|
|
|
|
Endif
|
|
|
|
Endif
|
|
|
|
gblc &tables[$1000] ; list of tables
|
|
gbla &tableCnt ; number of tables
|
|
gbla &sizes[$1000] ; number of entries in each table
|
|
gbla &lastTVect ; last table vector
|
|
gbla &thisTVect ; this table vector
|
|
gbla &lastCVect ; last code vector
|
|
gbla &thisCVect ; this code vector
|
|
|
|
&thisTVect: seta &eval(&TVec) ; convert from string to int
|
|
&thisCVect: seta &eval(&CVec) ; convert from string to int
|
|
|
|
If &lastTVect ≠ &thisTVect Then ; check for new vector table
|
|
|
|
InitVec&TVec proc export ; initialize the vector table vector
|
|
import BASEOFROM ; import rom base
|
|
import VecInfo&TVec ; import vector table info
|
|
lea @VecTable(pc),a0 ; load address the vector table
|
|
move.l a0,&TVec ; stuff address of vector table into table vector
|
|
rts ; and return to sender
|
|
align 16
|
|
@VecTable dc.l VecInfo&TVec-BASEOFROM+ROMBASE; this will point to the table info rec
|
|
|
|
&lastTVect: seta &thisTVect
|
|
|
|
&lastCVect: seta 0
|
|
|
|
&tables[&tableCnt + 1]: setc &TVec
|
|
|
|
&tableCnt: seta &tableCnt + 1
|
|
|
|
Endif ; new vector table
|
|
|
|
; verify that the vector table offsets are sorted
|
|
|
|
If &thisCVect < &lastCVect Then
|
|
|
|
AError 'Code vectors are not sorted by offset'
|
|
|
|
ExitM
|
|
|
|
Endif
|
|
|
|
; fill in the unused "holes" with the address of UNIMPLEMENTED
|
|
|
|
If (&thisCVect - &lastCVect) > 4 Then
|
|
|
|
import UNIMPLEMENTED
|
|
|
|
dcb.l (&thisCVect - &lastCVect - 4)/4 ,UNIMPLEMENTED-BASEOFROM+ROMBASE
|
|
|
|
Endif
|
|
|
|
; Create the vector table
|
|
|
|
import __v__&Name ; import mangled name
|
|
|
|
dc.l __v__&Name-BASEOFROM+ROMBASE
|
|
|
|
&sizes[&thisTVect - $2000]: seta &thisCVect / 4 ; keep track of the table size
|
|
|
|
&lastCVect: seta &thisCVect
|
|
|
|
endmacro
|
|
|
|
|
|
macro
|
|
InitDescriptors
|
|
gbla &sizes[$1000] ; number of entries in each table
|
|
gblc &tables[$1000] ; list of tables
|
|
gbla &tableCnt ; number of tables
|
|
lcla &index ; loop index
|
|
lcla &vnum ; vector table number
|
|
lclc &vname ; vector table name
|
|
|
|
&index seta 1
|
|
while &index <= &tableCnt Do ; for each table
|
|
|
|
&vnum seta &eval ( &tables[&index] )
|
|
&vname setc &tables[&index]
|
|
|
|
VecInfo&vname Proc Export
|
|
dc.l kInfoTableFormat ; info table format version
|
|
dc.l kDirectVector ; vector type
|
|
dc.l &sizes[&vnum - $2000] ; number of entries in vector table
|
|
|
|
&index seta &index + 1
|
|
endw
|
|
|
|
|
|
InitDescriptors Proc Export
|
|
lea @descriptor(pc),a0 ; load address the table descriptor
|
|
move.l a0,DescriptorVect ; stuff address of table descriptor into vector
|
|
rts ; and return to sender
|
|
@descriptor dc.l kDescTableFormat ; descriptor table format version
|
|
dc.l &tableCnt ; number of entries in vector table
|
|
|
|
&index seta 1
|
|
while &index <= &tableCnt Do ; for each table
|
|
|
|
dc.l &tables[&index] ; stuff the address
|
|
|
|
&index seta &index + 1
|
|
endw
|
|
endmacro
|
|
|
|
|
|
macro
|
|
InitRomVectors
|
|
gblc &tables[$1000] ; list of tables
|
|
gbla &tableCnt ; number of tables
|
|
lcla &index ; loop index
|
|
|
|
INITROMVECTORS Proc Export
|
|
bsr.l InitDescriptors ; call routine to init descriptor
|
|
|
|
&index seta 1
|
|
|
|
while &index <= &tableCnt Do ; for each table
|
|
|
|
bsr.l InitVec&tables[&index] ; call the table's init routines
|
|
|
|
&index seta &index + 1
|
|
|
|
endw
|
|
|
|
rts ; return to startinit
|
|
|
|
endmacro
|
|
|
|
|
|
IF NOT nonVectorizedRom Then
|
|
|
|
Include &VectorTable ; create the vector tables
|
|
|
|
ENDIF
|
|
InitDescriptors ; create the vector table descriptors
|
|
|
|
InitRomVectors ; create code to init the vectors
|
|
|
|
End
|
|
|