CdUnit

Struct CdUnit 

Source
pub struct CdUnit {
Show 13 fields pub switches: UnitSwitches, pub bus: ScsiBus, pub adpcm: Adpcm, pub ram: Vec<u8>, pub bram: Vec<u8>, pub bram_locked: bool, pub arcade: Option<ArcadeCard>, pub enable: u8, pub active: u8, pub reset_register: u8, pub right_channel: bool, pub sample_latch: u16, pub mclk: i64, /* private fields */
}
Expand description

CD RAM, backup RAM, the registers, the SCSI bus and the CD-DA player.

Fields§

§switches: UnitSwitches§bus: ScsiBus§adpcm: Adpcm§ram: Vec<u8>§bram: Vec<u8>§bram_locked: bool

[hw: pcetech 8] locked at power-up

§arcade: Option<ArcadeCard>

the Arcade Card, if fitted: banks $40-$43 and $1A00-$1AFF (arcade.rs)

§enable: u8§active: u8§reset_register: u8§right_channel: bool§sample_latch: u16§mclk: i64

Implementations§

Source§

impl CdUnit

Source

pub fn new(disc: Option<Disc>) -> CdUnit

Source

pub fn with( disc: Option<Disc>, bram: Option<&[u8]>, arcade: Option<ArcadeCard>, ) -> Result<CdUnit, String>

bram: the backup RAM’s first bytes (None: the formatted-empty header, U36); more than 2 KiB is an error (the RAM is 2 KiB, pcetech 8; the reference’s issue 0001).

Source

pub fn disc(&self) -> Option<&Rc<Disc>>

Source

pub fn insert(&mut self, disc: Option<Disc>)

Source

pub fn cdda(&mut self) -> &mut CddaPlayer

The CD-DA player (the reference’s unit.cdda).

Source

pub fn bram(&self) -> &[u8] ⓘ

The 2 KiB of backup RAM, for the host to keep between sessions.

Source

pub fn set_bram(&mut self, data: &[u8])

Put kept backup RAM back (up to 2 KiB; the rest is left as it is).

Source

pub fn pending_timers(&self) -> (Option<i64>, Option<i64>)

The unit’s own timers: (the CD-to-ADPCM DMA’s next byte, the next event of any kind). For tests and debuggers (the reference’s tests read _dma_at and _next_event).

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for CdUnit

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl DeviceState for CdUnit

Source§

fn state_identity(&self) -> String

What the unit is and which media it holds: the disc by its table of contents (never its sectors), and whether the Arcade Card is fitted.

Source§

fn save_state(&self) -> Vec<u8> ⓘ

Everything of the device that changes as the console runs.
Source§

fn load_state(&mut self, data: &[u8]) -> Result<(), String>

Put the device in a saved state. A device without state accepts only an empty one.
Source§

impl PageHandler for CdUnit

Source§

fn read(&mut self, address: u32, mclk: i64, pins: &mut BoardPins<'_>) -> u8

Source§

fn write( &mut self, address: u32, value: u8, mclk: i64, pins: &mut BoardPins<'_>, )

Source§

impl PortDevice for CdUnit

Source§

fn present(&self) -> bool

K7 low: the I/O port reports “CD unit attached” (C6 polarity)

Source§

fn audio_sources(&mut self) -> Vec<&mut dyn AudioSource>

Socket 9: CD-DA, then ADPCM (the order the reference appends them to the board’s list).

Source§

fn claims(&self) -> Vec<(usize, usize)>

Source§

fn catch_up(&mut self, mclk: i64, pins: &mut BoardPins<'_>)

Socket 5: the device keeps its own rational ratio and remainder and runs up to mclk when asked; the board asks at every advance (the reference’s issue 0002).
Source§

fn reset(&mut self, kind: ResetKind, pins: &mut BoardPins<'_>)

Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Source§

impl Serialize for CdUnit

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for CdUnit

§

impl !RefUnwindSafe for CdUnit

§

impl !Send for CdUnit

§

impl !Sync for CdUnit

§

impl Unpin for CdUnit

§

impl !UnwindSafe for CdUnit

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,