From 932e70a44337608b9545ac1a4f0c680428db6dee Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Wed, 22 Feb 2023 10:12:35 +1100 Subject: [PATCH] serial: dont fake a connection if it's not there --- src/processor/memory/mmio/serial.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/processor/memory/mmio/serial.rs b/src/processor/memory/mmio/serial.rs index 1fe785e..f7500d2 100644 --- a/src/processor/memory/mmio/serial.rs +++ b/src/processor/memory/mmio/serial.rs @@ -35,11 +35,15 @@ pub struct Serial { output_byte: u8, bits_remaining: u8, control: SerialControl, + is_connected: bool, } impl Serial { pub fn tick(&mut self, steps: usize) -> bool { let mut will_interrupt = false; + if !self.is_connected { + return false; + } for _ in 0..steps { if self.control.transfer_in_progress { self.output_byte = self.output_byte << 1 | self.byte >> 7; @@ -98,6 +102,7 @@ impl Default for Serial { output_byte: 0, bits_remaining: 7, control: SerialControl::default(), + is_connected: false, } } }