fix 8x16, inconsistent flags for lcd (1 << n) vs just n

This commit is contained in:
Matthew Laux 2022-08-03 02:10:15 -05:00
parent e32535b016
commit f79100694d
2 changed files with 8 additions and 8 deletions

View File

@ -7,18 +7,18 @@
void lcd_set_bit(struct lcd *lcd, u16 addr, u8 bit)
{
lcd_write(lcd, addr, lcd_read(lcd, addr) | (1 << bit));
lcd_write(lcd, addr, lcd_read(lcd, addr) | bit);
}
void lcd_clear_bit(struct lcd *lcd, u16 addr, u8 bit)
{
lcd_write(lcd, addr, lcd_read(lcd, addr) & ~(1 << bit));
lcd_write(lcd, addr, lcd_read(lcd, addr) & ~bit);
}
int lcd_isset(struct lcd *lcd, u16 addr, u8 bit)
{
u8 val = lcd_read(lcd, addr);
return val & (1 << bit);
return val & bit;
}
void lcd_set_mode(struct lcd *lcd, int mode)

View File

@ -23,11 +23,11 @@
#define REG_LCD_LAST REG_WX
#define STAT_FLAG_MATCH 2
#define STAT_INTR_SOURCE_HBLANK 3
#define STAT_INTR_SOURCE_VBLANK 4
#define STAT_INTR_SOURCE_MODE2 5
#define STAT_INTR_SOURCE_MATCH 6
#define STAT_FLAG_MATCH (1 << 2)
#define STAT_INTR_SOURCE_HBLANK (1 << 3)
#define STAT_INTR_SOURCE_VBLANK (1 << 4)
#define STAT_INTR_SOURCE_MODE2 (1 << 5)
#define STAT_INTR_SOURCE_MATCH (1 << 6)
#define LCDC_ENABLE_BG (1 << 0)