-------------------------------------------------------------------------------
 S.I.M. Base Structure
-------------------------------------------------------------------------------


;--- Base ---------

 STRUCT toolbase       ;+0  The start address of SIM in memory


;--- Display ------

 APTR  plane           ;+0  The start address of the $5000 bytes display ram
                            (must be graphic memory!)

 APTR  backup          ;+4  The start address of the backup of the display.
                            When not zero, SIM will copy what is in the
                            memory of the future display to this address
                            when entered and copy it back when left.


;--- Entrances ----

 JMP   entrance1       ;+8  Entrance for JSR. Here you can simply enter SIM
                            by a 'JSR' to this address.

 JMP   entrance2       ;+12 Entrance for Exec's traphandle. When you want to
                            use SIM as traphandler of your task, write this
                            address to <taskstruct+50>.

 JMP   entrance3       ;+16 Debug server entrance.

 LONG  0               ;+20 *** RESERVED FOR EXPANSION ***


;--- Traps --------    ;When a trap is set directly, its vector is set to
                       ;the corresponding entrance in here.

 JMP   entrance22      ;+24 Bus error
 JMP   entrance23      ;+28 Address error
 JMP   entrance24      ;+32 Illegal instruction
 JMP   entrance25      ;+36 Divide-by-zero
 JMP   entrance26      ;+40 CHK instruction
 JMP   entrance27      ;+44 TRAPV instruction
 JMP   entrance28      ;+48 Privilege violation
 JMP   entrance29      ;+52 Trace
 JMP   entrance2a      ;+56 Op Code 1010
 JMP   entrance2b      ;+60 Op Code 1111


;--- Signal -------

 LONG  "SIM!"          ;+64 This Long signals that this is SIM
 LONG  version         ;+68 Version of SIM as 4 ASCII chars


;--- Backups ------    ;When SIM is entered it backups some customregisters
                       ;and vectors here.

 WORD  dmacon          ;+72 $DFF096/002
 WORD  intena          ;+74 $DFF09A/01C
 WORD  intreq          ;+76 $DFF09C/01E
 LONG  level2          ;+78 VBR+$68
 LONG  level3          ;+82 VBR+$6C

 BYTE  ciaacra         ;+86 $BFEE01
 BYTE  ciaacrb         ;+87 $BFEF01
 BYTE  ciabcra         ;+88 $BFDE00
 BYTE  ciabcrb         ;+89 $BFDF00
 BYTE  ciaapra         ;+90 $BFE001
 BYTE  ciaaprb         ;+91 $BFE101
 BYTE  ciaaddra        ;+92 $BFE201
 BYTE  ciaaddrb        ;+93 $BFE301
 BYTE  ciabddra        ;+94 $BFD200
 BYTE  ciaasp          ;+95 $BFEC01
 LONG  vpos            ;+96 $DFF004


;--- Reentry ------    ;Reentry values of things that can't be saved.
                       ;When SIM is left, it inits the registers named
                       ;with the values in this list.

 WORD  $2981           ;+100 DIWSTRT
 WORD  $29c1           ;+102 DIWSTOP
 WORD  $0038           ;+104 DDFSTRT
 WORD  $00d0           ;+106 DDFSTOP
 WORD  $5200           ;+108 BPLCON0
 WORD  $0000           ;+110 BPLCON1
 WORD  $0000           ;+112 BPLMOD1
 WORD  $0000           ;+114 COLOR00
 WORD  $0000           ;+116 COLOR01


;--- ICR Special --    ;The ICR data and mask.

 BYTE  lasticr         ;+118 $BFED00 read
 BYTE  reentryicrmask  ;+119 $BFED00 write


;--- Distances ----    ;Distances to internal structures.

 LONG  disasscalc-base ;+120 Distance to disasscalc module
 LONG  preferences-base;+124 Distance to preferences structure


;--- Debug --------    ;Debug server structure for entrance 3.

 LONG  0               ;+128 Offset from here to end of inited part
 LONG  "????"          ;+132 Sign of server


;--- Program ------    ;The registers of the program that is debugged.

 LONG  0               ;+136 Register d0
 LONG  0               ;+140 Register d1
 LONG  0               ;+144 Register d2
 LONG  0               ;+148 Register d3
 LONG  0               ;+152 Register d4
 LONG  0               ;+156 Register d5
 LONG  0               ;+160 Register d6
 LONG  0               ;+164 Register d7
 LONG  0               ;+168 Register a0
 LONG  0               ;+172 Register a1
 LONG  0               ;+176 Register a2
 LONG  0               ;+180 Register a3
 LONG  0               ;+184 Register a4
 LONG  0               ;+188 Register a5
 LONG  0               ;+192 Register a6
 LONG  0               ;+196 User stack pointer
 LONG  0               ;+200 Supervisor stack pointer/ISP
 LONG  0               ;+204 PC of program
 WORD  0               ;+208 SR of program


;--- Server data --

 LONG  0               ;+210 Reentry routine of server
 LONG  0               ;+214 Reentry usp of server
 LONG  0               ;+218 Reentry ssp of server/ISP
 LONG  0               ;+222 Reentry sr of server


;--- Extension ----

 APTR  0               ;+224 Pointer to zero ended list of APTRs that point
                             to zero ended texts. The texts in this list are
                             printed and the pointer is cleared
 APTR  0               ;+228 Pointer to task structure
 APTR  0               ;+232 Segmentlist
 APTR  0               ;+236 Symbollist with labels

 LONG  0               ;+240 MSP (68020+ only)
 LONG  0               ;+244 Reentry MSP (68020+ only)

 LONG  0,0             ; RESERVED

 LONG  sim_size        ;+256 Size of SIM
 BYTE  0               ;+260 CPU information
 BYTE  0               ;+261 MMU information
 WORD  0               ;+262 BEAMCON0 reentry value
 LONG  0               ;+264 VBR


;--- End ----------    ;+268 This is the end of the actual structure


--------------------------------------------------------------------------------

