gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/examples/gb/lcd_isr_wobble/lcd_isr_wobble.c
1 #include <gb/gb.h>
2 #include <stdint.h>
3 #include <stdio.h>
4
5 #include <gb/emu_debug.h>
6
7 const uint8_t scanline_offsets_tbl[] = {0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0};
8 const uint8_t * scanline_offsets = scanline_offsets_tbl;
9
10 void scanline_isr(void) {
11 SCX_REG = scanline_offsets[(uint8_t)(LY_REG & 0x07u)];
12 }
13
14
15 void main(void) {
16 printf("This is\na wobble\ntest\nfor DMG\n|\n|\n|\n|\n|");
17
18 CRITICAL {
19 STAT_REG = STATF_MODE00;
20 add_LCD(scanline_isr);
21 add_LCD(nowait_int_handler);
22 }
23 set_interrupts(IE_REG | LCD_IFLAG);
24
25 while (TRUE) {
26 vsync();
27 scanline_offsets = scanline_offsets_tbl + ((sys_time >> 2) & 0x07u);
28 }
29 }
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.