megadrive_test2

annotate src/main.c @ 1:2560a8be8cb8

hblank interrupt test
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 14 Mar 2017 09:02:43 +0200
parents ce1b05082ac4
children 1d35c3b3a525
rev   line source
nuclear@1 1 #include <stdint.h>
nuclear@0 2 #include "vdp.h"
nuclear@0 3
nuclear@0 4 int main(void)
nuclear@0 5 {
nuclear@0 6 vdp_init();
nuclear@0 7
nuclear@1 8 vdp_set_pal_entry(0, 0, 0, 0, 0);
nuclear@0 9 vdp_set_pal_entry(0, 1, 7, 0, 3);
nuclear@0 10 vdp_set_bgcolor(0, 1);
nuclear@0 11
nuclear@1 12 vdp_enable_hintr(12);
nuclear@1 13 vdp_enable_vintr();
nuclear@1 14
nuclear@0 15 for(;;);
nuclear@0 16
nuclear@0 17 return 0;
nuclear@0 18 }
nuclear@1 19
nuclear@1 20 uint16_t testcol = 0x00c0;
nuclear@1 21
nuclear@1 22 void hblank_handler(void)
nuclear@1 23 {
nuclear@1 24 vdp_set_pal_entry(0, 1, ~testcol, 0, testcol);
nuclear@1 25 testcol = ~testcol;
nuclear@1 26 }
nuclear@1 27
nuclear@1 28 void vblank_handler(void)
nuclear@1 29 {
nuclear@1 30 testcol = 0x00c0;
nuclear@1 31 }