beginning ppu
This commit is contained in:
31
lib/io.c
31
lib/io.c
@ -1,4 +1,8 @@
|
||||
#include <io.h>
|
||||
#include <timer.h>
|
||||
#include <cpu.h>
|
||||
#include <dma.h>
|
||||
#include <lcd.h>
|
||||
|
||||
static char serial_data[2];
|
||||
|
||||
@ -11,6 +15,18 @@ u8 io_read(u16 address){
|
||||
return serial_data[1];
|
||||
}
|
||||
|
||||
if(BETWEEN(address, 0xFF04, 0xFF07)){
|
||||
return timer_read(address);
|
||||
}
|
||||
|
||||
if(BETWEEN(address, 0xFF40, 0xFF4B)){
|
||||
return lcd_read(address);
|
||||
}
|
||||
|
||||
if(address == 0xFF0F) {
|
||||
return cpu_get_int_flags();
|
||||
}
|
||||
|
||||
printf("UNSUPPORTED io_read(%04X)\n", address);
|
||||
return 0;
|
||||
}
|
||||
@ -27,6 +43,21 @@ void io_write(u16 address, u8 value){
|
||||
return;
|
||||
}
|
||||
|
||||
if(BETWEEN(address, 0xFF04, 0xFF07)){
|
||||
timer_write(address, value);
|
||||
return;
|
||||
}
|
||||
|
||||
if(address == 0xFF0F) {
|
||||
cpu_set_int_flags(value);
|
||||
return;
|
||||
}
|
||||
|
||||
if(BETWEEN(address, 0xFF40, 0xFF4B)){
|
||||
lcd_write(address, value);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("UNSUPPORTED io_write(%04X)\n", address);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user