git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit 7d504679dd7695cad76a3832e2bf08390e724493
parent eb4bd5f814526af019bf0ad1601ff2557bcca8dd
Author: Toxa <untoxa@mail.ru>
Date:   Sat, 26 Jun 2021 19:22:31 +0300

helper macro for constructing of interrupt vectors

Diffstat:
Agbdk-lib/include/gb/isr.h32++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+), 0 deletions(-)

diff --git a/gbdk-lib/include/gb/isr.h b/gbdk-lib/include/gb/isr.h @@ -0,0 +1,32 @@ +/** @file gb/isr.h + + Allows constructing of raw ISR vectors. + +*/ +#ifndef _ISR_H_INCLUDE_ +#define _ISR_H_INCLUDE_ + +#include <stdint.h> + +// #define VECTOR_VBL 0x40 // you can not define raw vector for VBlank interrupt +#define VECTOR_STAT 0x48 +#define VECTOR_TIMER 0x50 +#define VECTOR_SERIAL 0x58 +#define VECTOR_JOYPAD 0x60 + +typedef struct isr_vector_t { + uint8_t opcode; + void * func; +} isr_vector_t; + +/** Creates the interrupt vector at the given address for the raw interrupt service routrine + + @param ADDR address of the vector + + @param FUNC ISR function +*/ +#define ISR_VECTOR(ADDR, FUNC) \ +static const isr_vector_t __at((ADDR)) __ISR_ ## ADDR = {0xc3, (void *)&(FUNC) }; + + +#endif // _ISR_H_INCLUDE_

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.