From: Robin Krens Date: Thu, 9 Jun 2022 18:08:09 +0000 (+0200) Subject: main: interrupt vector setup X-Git-Url: https://robinkrens.nl/gitweb/?a=commitdiff_plain;h=9c724faeadbfff077b682353b409c5b8a5ed565d;p=swan-dev main: interrupt vector setup - interrupt at 0x20 - dummy_isr routine for vblank - used outport to set and enable interrupts --- diff --git a/src/main.c b/src/main.c index dc651f1..9be5eeb 100644 --- a/src/main.c +++ b/src/main.c @@ -1,3 +1,13 @@ +/** + * File : main.c + * Author : Robin Krens + * Date : 09.06.2022 + * Last Modified Date: 09.06.2022 + * Last Modified By : Robin Krens + */ +#include +#include +#include /* sprite data */ unsigned char bgtile_gfx[] = { @@ -34,9 +44,27 @@ void outport(unsigned char portnr, unsigned char val) :); } -void init_video(void) +__attribute__ ((naked)) void * dummy_isr(void) +{ + int a = 2; + a *= 2; + while(1); +} + +void setup_ivec(void) { + outport(IO_INT_BASE, INT_BASE); + + unsigned short * test_vec = (INT_BASE + INTVEC_VBLANK_START) << 2; + *test_vec++ = (&dummy_isr); + *test_vec = (0x2000); + outport(IO_INT_ENABLE, INT_VBLANK_START); + __asm__("sti"); +} + +void init_video(void) +{ } int main(void) @@ -48,9 +76,11 @@ int main(void) blaat[1] = 0xEE; blaat[32] = 0xEE; + setup_ivec(); init_video(); + outport(IO_VIDEO_MODE, VMODE_16C_CHK | VMODE_CLEANINIT); + outport(IO_FGBG_MAP, 0x40); outport(0x15, 0xEE); - while(1); unsigned char * ptr = PALETTE_T; for (int i = 0; i < sizeof(bgtile_pal); ++i) { @@ -61,6 +91,8 @@ int main(void) for (int i = 0; i < sizeof(bgtile_gfx); ++i) { *ptr++ = bgtile_gfx[i]; } + + outport(IO_DISPLAY_CTRL, BG_ON); while(1) { }