HuC6280

Struct HuC6280 

Source
pub struct HuC6280<B: Bus> {
Show 19 fields pub a: u8, pub x: u8, pub y: u8, pub s: u8, pub pc: u16, pub p: u8, pub mpr: [u8; 8], pub bus: B, pub pins: Pins, pub zero_page_pointer_wraps: bool, pub sbc_honours_t: bool, pub decimal_formula: DecimalFormula, pub tsb_z_from_test: bool, pub block_reads_hardware_page_as_zero: bool, pub nop_63_cycles: u32, pub interrupt_entry_cycles: u32, pub vanished_interrupt: VanishedInterrupt, pub irq_poll_cycle: IrqPollCycle, pub tma_multiple: TmaMultiple, /* private fields */
}
Expand description

A Hudson HuC6280 core whose memory and devices are a host’s Bus.

step() calls the bus once per cycle it returns, in the chip’s order. Registers are plain fields: a, x, y, s, pc (logical, 16 bits), p (8 bits; B is not stored) and mpr (eight 8-bit mapping registers). The interrupt inputs, their poll and step()’s skeleton are 6502-rust’s frame; the three maskable sources come in through Pins::set_irq_lines and Pins::set_irq_disable.

Fields§

§a: u8§x: u8§y: u8§s: u8§pc: u16§p: u8§mpr: [u8; 8]

MPR0-MPR7, the 8-bit mapping registers (physical A13-A20).

§bus: B§pins: Pins§zero_page_pointer_wraps: bool

Named so a board or a later capture can change it: whether a pointer at zero-page offset $FF takes its high byte from offset $00 (Mesen’s ReadZeroPageWrap, MAME’s program_read16z; emulator tier, U8) or from logical $2100.

§sbc_honours_t: bool

C5: whether SBC honours T like ADC (false: SW and pcetech list only ORA AND EOR ADC).

§decimal_formula: DecimalFormula

C13: the decimal digit adjust of ADC and SBC.

§tsb_z_from_test: bool

C12: what TSB and TRB’s Z reports. false (default): the stored result is zero (pcetech 2.0 “Z = If result is zero”, MAME, Mednafen and Mesen2’s current source). true: the 65C02’s A AND M is zero, which is what the SingleStepTests corpus (an older Mesen) records.

§block_reads_hardware_page_as_zero: bool

C9: pcetech says reads of $0800-$17FF return 0 in a block transfer (hw-verified); MAME and Mednafen read the device. false reads the device like any access.

§nop_63_cycles: u32

C4: pcetech tested opcode $63 as a two-cycle NOP; MAME bills four. Emulator-tier knob for a board that wants MAME’s count.

§interrupt_entry_cycles: u32

C3: an interrupt entry takes 8 cycles in Mesen, Mednafen, Geargrafx and ares, 7 in MAME (emulator tier; no manual states it).

§vanished_interrupt: VanishedInterrupt

C18: what an interrupt does when its source has gone between the poll and the entry.

§irq_poll_cycle: IrqPollCycle

U25: which cycle of an instruction the interrupt lines are sampled at.

§tma_multiple: TmaMultiple

C6: TMA with several mask bits.

Implementations§

Source§

impl<B: Bus> HuC6280<B>

Source

pub fn set_irq_lines(&mut self, irq1: bool, irq2: bool, tiq: bool)

Set the three maskable inputs (Pins::set_irq_lines).

Source

pub fn irq_lines(&self) -> (bool, bool, bool)

The (IRQ1, IRQ2, TIQ) levels last set.

Source

pub fn irq_disable(&self) -> u8

The interrupt disable register (Pins::irq_disable).

Source

pub fn set_irq_disable(&mut self, value: u8)

Write the interrupt disable register (Pins::set_irq_disable).

Source§

impl<B: Bus> HuC6280<B>

Source

pub fn new(bus: B) -> Self

A HuC6280 on bus.

Source

pub fn kind(&self) -> Kind

The current cycle’s kind (Pins::kind).

Source

pub fn opcode(&self) -> u8

The opcode of the instruction being executed (Pins::opcode): the public accessor the SuperGrafx uses.

Source

pub fn high_speed(&self) -> bool

The clock switch (Pins::high_speed).

Source

pub fn physical(&self, address: u16) -> u32

The 21-bit physical address of a 16-bit logical one (HW HB-7).

Source§

impl<B: Bus> HuC6280<B>

Source

pub fn step(&mut self) -> u32

Execute one instruction, interrupt entry or reset; return its cycle count (Part::step, the frame’s).

Source

pub fn request_reset(&mut self)

Run the start sequence at the next boundary (the frame’s).

Source

pub fn request_non_maskable_interrupt(&mut self)

Latch an NMI edge (the frame’s).

Source

pub fn capture_state(&self) -> CpuState

Return a snapshot of all CPU-owned state at a boundary.

No host reads, no side effects. Memory and devices are the host’s and are not included.

Source

pub fn restore_state(&mut self, state: &CpuState) -> Result<(), String>

Restore a captured CPU state without touching the host.

Trait Implementations§

Source§

impl<B: Bus> Part for HuC6280<B>

Source§

fn frame(&self) -> &Frame

Source§

fn frame_mut(&mut self) -> &mut Frame

Source§

fn status(&self) -> u8

P, with the interrupt-disable flag in bit 2.
Source§

fn accept_reset(&mut self) -> u32

Source§

fn halted_cycle(&mut self) -> u32

Source§

fn enter_interrupt(&mut self, kind: u8) -> u32

Source§

fn execute(&mut self) -> u32

Source§

fn boundary_interrupt(&mut self) -> u8

The interrupt this boundary takes; a part with another input (ABORT) overrides it.
§

fn step(&mut self) -> u32

Execute one instruction, interrupt entry or reset; return its cycle count. Read more

Auto Trait Implementations§

§

impl<B> Freeze for HuC6280<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for HuC6280<B>
where B: RefUnwindSafe,

§

impl<B> Send for HuC6280<B>
where B: Send,

§

impl<B> Sync for HuC6280<B>
where B: Sync,

§

impl<B> Unpin for HuC6280<B>
where B: Unpin,

§

impl<B> UnwindSafe for HuC6280<B>
where B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.