Vector Register

All 680x0 related coding posts in this section please.
Post Reply
User avatar
TheNameOfTheGame
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2610
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Vector Register

Post by TheNameOfTheGame »

I'm trying to program the vector register but getting a crash.

My understanding of it is that the mfp uses the vector base offset portion of the register to create the vector to pass to the cpu:

Code: Select all

*vector register
*$FFFA17 - byte  (R/W)
*+-----------------------------------------------------------+
*|                                   BIT 7 6 5 4 3 . . .     |
*| Vector Base Offset -------------------+-+-+-' |           |
*| In-Service Register Enable -------------------'           |
*|  1 - *Software End-interrupt mode                         |
*|  0 - Automatic End-interrupt mode                         |
*|  * - Default operating mode                               |
*+-----------------------------------------------------------+
*| Each individual function in the MK68901 is provided with  |
*| a unique interrupt vector that is presented to the system |
*| during the interrupt acknowledge cycle. The interrupt     |
*| vector returned during the interrrupt acknowledge cycle   |
*| is shown below.                                           |
*|                                                           |
*| Interrupt Vector                                          |
*|                                   BIT 7 6 5 4 3 2 1 0     |
*| Copied from the Vector Register-------+-+-+-' | | | |     |
*| Supplied by the MFP based upon ---------------+-+-+-'     |
*| the interrupting channel.                                 |
*+-----------------------------------------------------------+
So normally it is set to $48 which translates to offset 64 which would match the start of the normal 16 mfp interrupt channel vectors.

Code: Select all

VectorAddressException
----------------------
offset
0   $00 RESET (initial stack pointer)
1   $04 RESET
2   $08 BUSERR (Accessing non-existent memory)
3   $0C Address Error (not on Word boundary)
4   $10 Illegal Instruction
5   $14 Division by Zero (CPU)
6   $18 CHK or CHK2 instruction.
7   $1C TRAPV, TRAPcc or FTRAPcc instruction.
8   $20 Privilege violation.
9   $24 Trace mode (see Status Register).
10  $28 Illegal Line A Instruction
11  $2C Illegal Line F Instruction
14  $38 Stack frame error
15  $3C Uninitialize Interrupt
24  $60 Interrupt Protocol Error
25  $64 Level 1 Interrupt Autovector
26  $68 Level 2 Interrupt Autovector (horizontal blank)
27  $6C Level 3 Interrupt Autovector
28  $70 Level 4 Interrupt Autovector (vertical blank)
29  $74 Level 5 Interrupt Autovector
30  $78 Level 6 Interrupt Autovector
31  $7C Level 7 Interrupt Autovector
32  $80 TRAP 0
33  $84 TRAP 1 (GEMDOS)
34  $88 TRAP 2 (AES & VDI)
35  $8C TRAP 3
...      ...    ...
44  $B0 TRAP 12
45  $B4 TRAP 13 (BIOS)
46  $B8 TRAP 14 (XBIOS)
47  $BC TRAP 15
48  $C0 Unordered Condition (FPU)
49  $C4 Inexact Result (FPU)
50  $C8 Division by Zero (FPU)
51  $CC Underflow (FPU)
52  $D0 Operand Error (FPU)
53  $D4 Overflow (FPU)
54  $D8 Not a Number (FPU)
56  $DC PMMU Configuration (see TC).

64  $100 ST MFP Centronix Busy
65  $104 ST MFP Modem 1 Data Carrier Detect
66  $108 ST MFP Modem 1 Clear To Send
67  $10C ST MFP Blitter
68  $110 ST MFP Timer D - Modem 1 Baud Rate
69  $114 ST MFP Timer C - 200 Hz system timer
70  $118 ST MFP Midi & IKBD
71  $11C ST MFP FDC & HDC
72  $120 ST MFP Timer B - Hsync counter
73  $124 ST MFP Modem 1 transmit error
74  $128 ST MFP Modem 1 transmit buffer empty
75  $12C ST MFP Modem 1 receiver error
76  $130 ST MFP Modem 1 receiver buffer full
77  $134 ST MFP Timer A - Sound DMA frame counter
78  $138 ST MFP Modem 1 Ring Indicator
79  $13C ST MFP Monochrome Monitor Detect

82  $148 TT MFP SCC DMAC
83  $14C TT MFP Modem 2 Ring Indicator
84  $150 TT MFP Timer D - Serial 1 Baud Rate
85  $154 TT MFP Timer C - Modem 2 alt Baud Rate
87  $15C TT MFP SCSI DMAC
88  $160 TT MFP Timer B
89  $164 TT MFP Serial 1 transmit error
90  $168 TT MFP Serial 1 transmit buffer empty
91  $16C TT MFP Serial 1 receiver error
92  $170 TT MFP Serial 1 receiver buffer full
93  $174 TT MFP Timer A
94  $178 TT MFP Real Time Clock
95  $17C TT MFP SCSI Controller

96  $180 Z8530 Modem 2 transmit buffer empty
98  $188 Z8530 Modem 2 external/status change
100 $190 Z8530 Modem 2 receive character ready
102 $198 Z8530 Modem 2 special receive condition
104 $1A0 Z8530 Serial 2 transmit buffer empty
106 $1A8 Z8530 Serial 2 external/status change
108 $1B0 Z8530 Serial 2 receive character ready
110 $1B8 Z8530 Serial 2 special receive condition

My idea was to write a $58 in the vector register to change the offset to 80 which would correspond with the space used by default for the tt mfp.

Ok, so normally with offset 64 Timer B int would cause a vector fetch at $120. Moving the offset to 80 I assumed would then cause a fetch for the TImer B vector from $160.

For testing, I am turning off interrupts and changing the vector register before setting the Timer B vector at $160. I have the rest of the mfp timers off but am getting a crash when I enable Timer B after this. This is using Hatari set for ST emulation.

Do I have any of this wrong?
User avatar
unseenmenace
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2039
Joined: Tue Sep 21, 2004 9:33 pm
Location: Margate, Kent, UK
Contact:

Re: Vector Register

Post by unseenmenace »

I think you might have some of those offsets wrong, the following page lists all the TOS vectors by the looks of it:

https://freemint.github.io/tos.hyp/en/t ... ctors.html

If I understand this correctly it shows the normal ST's MFP interrupt table at $100 and the TTs at $140?
UNSEEN MENACE
2 original ST's, several STFM's, 2 STE's, a TT and a 14MB Falcon,
a Lynx 2 and Jaguar with JagCD
User avatar
TheNameOfTheGame
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2610
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Re: Vector Register

Post by TheNameOfTheGame »

Hi, those are vector register values used to calculate the actual offset.
czietz
Hardware Guru
Hardware Guru
Posts: 2819
Joined: Tue May 24, 2016 6:47 pm

Re: Vector Register

Post by czietz »

TheNameOfTheGame wrote: Fri Apr 26, 2024 6:05 pm Do I have any of this wrong?
Hard to tell without having a (working minimal example of) your code. Did you disable or handle all other MFP interrupts besides the timers?
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 3334
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: Vector Register

Post by Cyprian »

TheNameOfTheGame wrote: Fri Apr 26, 2024 6:05 pm I'm trying to program the vector register but getting a crash.
ST MFP vector table address = VR * 4
TOS sets VR to $40. $40 * 4 = $100. And $100 is the TOS default MFP vector table.

VR = 0 means address ST MFP table starts from address 0 therefore e.g. Timer B starts from $20
VR = $40 means address ST MFP table starts from address $100 therefore e.g. Timer B starts from $120


---EDIT---
TheNameOfTheGame wrote: Fri Apr 26, 2024 6:05 pm My idea was to write a $58 in the vector register to change the offset to 80 which would correspond with the space used by default for the tt mfp.

Ok, so normally with offset 64 Timer B int would cause a vector fetch at $120. Moving the offset to 80 I assumed would then cause a fetch for the TImer B vector from $160.

For testing, I am turning off interrupts and changing the vector register before setting the Timer B vector at $160. I have the rest of the mfp timers off but am getting a crash when I enable Timer B after this. This is using Hatari set for ST emulation.

Do I have any of this wrong?
that looks ok to me. Maybe other MFP interrupts are still active and jump to a new address.

Attached you can find the timer Timer B example
You do not have the required permissions to view the files attached to this post.
ATW800/2 / V4sa / Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
http://260ste.atari.org
Post Reply

Return to “680x0”