pub struct Bus {
pub tia: Tia,
pub riot: Riot,
pub board: Option<Cartridge>,
pub open_bus: u8,
pub write_log: WriteLog,
}Expand description
The main system bus for Rusty2600, holding the chips.
Fields§
§tia: TiaThe TIA video/audio chip.
riot: RiotThe RIOT RAM/Timer/IO chip.
board: Option<Cartridge>The cartridge board (mapper).
open_bus: u8Open bus value (last driven value).
write_log: WriteLogThe debugger’s optional write log — see WriteLog.
Implementations§
Source§impl Bus
impl Bus
pub fn new() -> Self
Sourcepub fn peek(&self, addr: u16) -> u8
pub fn peek(&self, addr: u16) -> u8
Side-effect-free read, for debugger/tooling use only: a real
cpu_read can trigger bankswitch hotspots, RIOT’s INTIM
read-clears-underflow-flag behavior, and cart snoop_read side
effects, none of which a memory-viewer peek should ever cause. Reads
via a full clone of self (cheap relative to a UI refresh cadence,
and correctly avoids the unsafe-free crate’s inability to alias a
&mut for a “no-op” read) so the real system state is untouched.
For more than a byte or two, prefer Self::peek_range — it clones
self ONCE and reads every byte from that one clone, instead of
paying a full Bus clone (TIA + RIOT + the cart’s ROM/RAM) per byte.
Sourcepub fn peek_range(&self, base: u16, len: u16) -> Vec<u8> ⓘ
pub fn peek_range(&self, base: u16, len: u16) -> Vec<u8> ⓘ
Side-effect-free read of len consecutive addresses starting at
base (wrapping at 16 bits), for a debugger memory viewer or a
disassembly window. Clones self once, then reads every byte from
that single clone — any bankswitch hotspot triggered by reading byte
N is visible to byte N+1’s read (an honest reflection of “whatever
the bank state currently is,” same caveat any bank-switched-system
memory viewer has), but the REAL system is never touched.