2020-12-23 09:25:16 +00:00
|
|
|
const ROM: &[u8; 256] = include_bytes!("../bin/DMG_ROM.bin");
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, Default)]
|
2020-09-04 05:41:19 +00:00
|
|
|
pub struct Bus {}
|
2020-08-29 23:38:27 +00:00
|
|
|
|
|
|
|
impl Bus {
|
2020-09-04 05:41:19 +00:00
|
|
|
pub fn read_byte(&self, addr: u16) -> u8 {
|
2020-12-23 09:25:16 +00:00
|
|
|
match addr {
|
|
|
|
0x0000..=0x00FF => {
|
|
|
|
// Restart and Interrupt Vectors
|
|
|
|
ROM[addr as usize]
|
|
|
|
}
|
|
|
|
_ => unimplemented!(),
|
|
|
|
}
|
2020-08-29 23:38:27 +00:00
|
|
|
}
|
|
|
|
|
2020-12-23 09:25:16 +00:00
|
|
|
pub fn write_byte(&mut self, _addr: u16, _byte: u8) {
|
2020-08-29 23:38:27 +00:00
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
2020-09-04 05:41:19 +00:00
|
|
|
pub fn read_word(&self, addr: u16) -> u16 {
|
2020-12-23 09:25:16 +00:00
|
|
|
match addr {
|
|
|
|
0x0000..=0x00FF => {
|
|
|
|
// Restart and Interrupt Vectors
|
|
|
|
(ROM[(addr + 1) as usize] as u16) << 8 | ROM[addr as usize] as u16
|
|
|
|
}
|
|
|
|
_ => unimplemented!(),
|
|
|
|
}
|
2020-08-29 23:38:27 +00:00
|
|
|
}
|
|
|
|
|
2020-12-23 09:25:16 +00:00
|
|
|
pub fn write_word(&mut self, _addr: u16, _word: u16) {
|
2020-08-29 23:38:27 +00:00
|
|
|
unimplemented!()
|
|
|
|
}
|
2020-09-04 05:41:19 +00:00
|
|
|
}
|