From b70c398e14ea2a1ccd317604a636f122ee9e45b5 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Tue, 19 Jan 2021 01:40:07 -0600 Subject: [PATCH] feat: implement registers 0xFF01 and 0xFF02 --- src/bus.rs | 5 ++++- src/serial.rs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/bus.rs b/src/bus.rs index af6d4f1..b1941a2 100644 --- a/src/bus.rs +++ b/src/bus.rs @@ -106,7 +106,8 @@ impl Bus { 0xFF00..=0xFF7F => { // IO Registers match addr { - // 0xFF01 => + 0xFF01 => self.serial.next, + 0xFF02 => self.serial.control.into(), 0xFF07 => self.timer.control.into(), 0xFF0F => self.interrupt.flag.into(), 0xFF11 => self.sound.ch1.sound_duty.into(), @@ -176,6 +177,8 @@ impl Bus { 0xFF00..=0xFF7F => { // IO Registers match addr { + 0xFF01 => self.serial.next = byte, + 0xFF02 => self.serial.control = byte.into(), 0xFF07 => self.timer.control = byte.into(), 0xFF0F => self.interrupt.flag = byte.into(), 0xFF11 => self.sound.ch1.sound_duty = byte.into(), diff --git a/src/serial.rs b/src/serial.rs index 0e87eb2..618660d 100644 --- a/src/serial.rs +++ b/src/serial.rs @@ -1,7 +1,7 @@ #[derive(Debug, Clone, Copy, Default)] pub struct Serial { - next: u8, - control: SerialControl, + pub next: u8, + pub control: SerialControl, } #[derive(Debug, Clone, Copy, Default)]