mirror of
https://github.com/mlaux/gb6.git
synced 2024-06-10 11:29:33 +00:00
init lcd pixels, fix compile warnings
This commit is contained in:
parent
b0c690c693
commit
ec9226e144
|
@ -22,7 +22,9 @@ int main(int argc, char *argv[])
|
|||
if (!rom_load(&rom, argv[1])) {
|
||||
printf("error loading rom\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
lcd_new(&lcd);
|
||||
|
||||
// this might be too much abstraction but it'll let me
|
||||
// test the cpu, rom, and dmg independently and use the cpu
|
||||
|
|
|
@ -265,6 +265,9 @@ static u8 read_reg(struct cpu *cpu, int index)
|
|||
case 7: return cpu->a;
|
||||
default: cpu_panic(cpu);
|
||||
}
|
||||
|
||||
// unreachable
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u8 write_reg(struct cpu *cpu, int index, u8 val)
|
||||
|
@ -280,6 +283,9 @@ static u8 write_reg(struct cpu *cpu, int index, u8 val)
|
|||
case 7: cpu->a = val; break;
|
||||
default: cpu_panic(cpu);
|
||||
}
|
||||
|
||||
// unreachable
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void extended_insn(struct cpu *cpu, u8 insn)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "lcd.h"
|
||||
|
@ -13,6 +14,12 @@ static void clear_bit(struct lcd *lcd, u16 addr, u8 bit)
|
|||
lcd_write(lcd, addr, lcd_read(lcd, addr) & ~(1 << bit));
|
||||
}
|
||||
|
||||
void lcd_new(struct lcd *lcd)
|
||||
{
|
||||
// todo < 8 bpp
|
||||
lcd->pixels = malloc(LCD_WIDTH * LCD_HEIGHT);
|
||||
}
|
||||
|
||||
u8 lcd_is_valid_addr(u16 addr)
|
||||
{
|
||||
return addr >= REG_LCD_BASE && addr <= REG_LCD_LAST;
|
||||
|
|
Loading…
Reference in New Issue
Block a user