pub struct VausState { /* private fields */ }Expand description
The Arkanoid “Vaus” paddle overlay state.
Models the NES 7-pin variant on $4017: an 8-bit potentiometer value
shifted out MSb-first (inverted on the wire) on bit 4, plus a fire button
on bit 3.
Implementations§
Source§impl VausState
impl VausState
Sourcepub const fn set(&mut self, position: u8, fire: bool)
pub const fn set(&mut self, position: u8, fire: bool)
Update the live paddle position + fire state. Takes effect on the next conversion (strobe falling edge), matching the standard controller’s latch-on-strobe semantics.
Sourcepub const fn write_strobe(&mut self, value: u8)
pub const fn write_strobe(&mut self, value: u8)
Handle a $4016 strobe write. On the rising edge the conversion latches
the current position into the shift register (we model the conversion as
instantaneous, which is the standard fixed-position emulation choice).
Sourcepub const fn read(&mut self) -> u8
pub const fn read(&mut self) -> u8
Read the device byte for a $4017 access, advancing the shift register.
Returns the full 8-bit value already positioned on bits 3 (fire) and 4
(knob data); the caller ORs in the open-bus upper bits.
Bit 4 carries the inverted MSb of the shift register (knob data is
inverted on the wire per the wiki). Bit 3 carries the fire button (1 =
pressed). All other bits are 0.
Sourcepub const fn peek(&self) -> u8
pub const fn peek(&self) -> u8
Side-effect-free sample of the next device byte (debugger peek).
Sourcepub const fn from_parts(
position: u8,
fire: bool,
shift: u8,
strobe: bool,
) -> Self
pub const fn from_parts( position: u8, fire: bool, shift: u8, strobe: bool, ) -> Self
Reconstruct from save-state parts.
Sourcepub const fn position_raw(&self) -> u8
pub const fn position_raw(&self) -> u8
Raw potentiometer position (save-state).
Sourcepub const fn strobe_raw(&self) -> bool
pub const fn strobe_raw(&self) -> bool
Raw strobe state (save-state).