pub struct BandaiHyperShotState { /* private fields */ }Expand description
The Bandai Hyper Shot (Exciting Boxing punching bag) overlay state (v1.3.0 Workstream F1).
The punching bag has 8 sensors read on $4017, multiplexed by $4016
bit 1 (the “A” select) into two groups of four returned on bits 4..1. Per
the NESdev “Exciting Boxing Punching Bag” page:
$4016 write: $4017 read:
7 bit 0 7 bit 0
---- ---- ---- ----
xxxx xxAx xxxE DCBx
| | |||
+- select group | ||+-- Left Hook (A=0) / Left Jab (A=1)
| |+--- Move Right (A=0) / Body (A=1)
| +---- Move Left (A=0) / Right Jab (A=1)
+------ Right Hook (A=0) / Straight (A=1)We model the 8 sensors as a live bitmask and the A select from the last
$4016 write; the read is a pure function of both (deterministic).
Implementations§
Source§impl BandaiHyperShotState
impl BandaiHyperShotState
Sourcepub const fn set(&mut self, sensors: u8)
pub const fn set(&mut self, sensors: u8)
Set the live 8-sensor mask. Bits 0..=3 are the A=0 group (Left Hook, Move Right, Move Left, Right Hook); bits 4..=7 are the A=1 group (Left Jab, Body, Right Jab, Straight).
Sourcepub const fn write_strobe(&mut self, value: u8)
pub const fn write_strobe(&mut self, value: u8)
Handle a $4016 write: bit 1 (A) selects which sensor group is
returned on the next reads.
Sourcepub const fn read(&self) -> u8
pub const fn read(&self) -> u8
Read the device byte for a $4017 access. The selected group’s four
sensors appear on bits 4..1. The caller ORs in the open-bus upper bits.
Sourcepub const fn peek(&self) -> u8
pub const fn peek(&self) -> u8
Side-effect-free sample (debugger peek) — identical to Self::read.
Sourcepub const fn from_parts(sensors: u8, select: bool) -> Self
pub const fn from_parts(sensors: u8, select: bool) -> Self
Reconstruct from save-state parts.
Sourcepub const fn sensors_raw(&self) -> u8
pub const fn sensors_raw(&self) -> u8
Raw sensor mask (save-state).
Sourcepub const fn select_raw(&self) -> bool
pub const fn select_raw(&self) -> bool
Raw A-select (save-state).
Trait Implementations§
Source§impl Clone for BandaiHyperShotState
impl Clone for BandaiHyperShotState
Source§fn clone(&self) -> BandaiHyperShotState
fn clone(&self) -> BandaiHyperShotState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more