So auto-vector interrupts are now available.
A tweak to the monitor switches on interrupts by moving $2000 to the stack register.
The 68000 has 7 auto-vectored interrupts which are located at specific addresses in the memory:
#define int1 0x64
#define int2 0x68
#define int3 0x6c
#define int4 0x70
#define int5 0x74
#define int6 0x78
#define int7 0x7c
The cpu expects a 3-bit interrupt number. I have an vhdl interrupt controller which manages the 7 hardware interrupts, provides the 3-bit number and then clears them when the CPU goes into the interrupt acknowledge cycle (FC = 7).
interrupts: entity work.interrupt_controller
port map (
clk => sys_clk,
reset => n_reset,
int1 => timer_in1,
int2 => timer_in2,
int3 => keyb_int,
int4 => '0',
int5 => '0',
int6 => '0',
int7 => '0',
int_out => int_out,
ack => auto_iack
);
auto_iack <= '1' when cpu_fc = "111" else '0';
To provide an interrupt handler the following code will update the memory address contained in these locations.
void setKeyboardHandler(void(*handler)()) {
asm(
"move.l %0,0x6c":
: "r" (handler)
:);
volatile uint32_t *keyb_int = (uint32_t*)int3;
printf("\r\nKeyboard address = 0x%0lX\r\n", *keyb_int);
}
setKeyboardHandler(&keyboardHandler);
An infinite loop can then run and then only be interrupted when the keyboard is pressed on "int3" - this would cause a call to the code located at address 0xF74.

Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Thanks to the developer of the Mist plus-too project for an indicator on how to deal with the interrupts.
https://github.com/mist-devel/plus_too/blob/master/tg68k.v
Are you sure? yes | no