Finish ppu, and mbc1 mapping
This commit is contained in:
19
lib/io.c
19
lib/io.c
@ -3,10 +3,14 @@
|
||||
#include <cpu.h>
|
||||
#include <dma.h>
|
||||
#include <lcd.h>
|
||||
#include <gamepad.h>
|
||||
|
||||
static char serial_data[2];
|
||||
|
||||
u8 io_read(u16 address){
|
||||
if(address == 0xFF00) {
|
||||
return gamepad_get_output();
|
||||
}
|
||||
if(address == 0xFF01) {
|
||||
return serial_data[0];
|
||||
}
|
||||
@ -27,14 +31,24 @@ u8 io_read(u16 address){
|
||||
return cpu_get_int_flags();
|
||||
}
|
||||
|
||||
if(BETWEEN(address, 0xFF10, 0xFF3F)) {
|
||||
//ignore sound
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("UNSUPPORTED io_read(%04X)\n", address);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void io_write(u16 address, u8 value){
|
||||
if(address == 0xFF00) {
|
||||
gamepad_set_sel(value);
|
||||
return;
|
||||
}
|
||||
if(address == 0xFF01) {
|
||||
serial_data[0] = value;
|
||||
printf("%c", value);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -58,6 +72,11 @@ void io_write(u16 address, u8 value){
|
||||
return;
|
||||
}
|
||||
|
||||
if(BETWEEN(address, 0xFF10, 0xFF3F)) {
|
||||
//ignore sound
|
||||
return;
|
||||
}
|
||||
|
||||
printf("UNSUPPORTED io_write(%04X)\n", address);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user