#ifndef ISR_H
#define ISR_H

#include <stdint.h>

#define ERR_MAX 5

#define IRQ_MIN 0x20
#define IRQ_MAX 0x2f

#define IRQ0 0x20
#define IRQ1 0x21
#define IRQ2 0x22
#define IRQ3 0x23
#define IRQ4 0x24
#define IRQ5 0x25
#define IRQ6 0x26
#define IRQ7 0x27
#define IRQ8 0x28
#define IRQ9 0x29
#define IRQ10 0x2a
#define IRQ11 0x2b
#define IRQ12 0x2c
#define IRQ13 0x2d
#define IRQ14 0x2e
#define IRQ15 0x2f

static int err_count = 0;

static void (*interrupt_handlers[256]) (uint8_t vector, uint16_t err);

__attribute__((noreturn))
void exception_handler(uint8_t vector, uint16_t err);

int register_interrupt_handler(int vector, void (*handler)(uint8_t, uint16_t));
int unregister_interrupt_handler(int vector);

void default_handler(uint8_t vector, uint16_t err);

void fill_isr();

#endif