Crate supergrafx_rust

Crate supergrafx_rust 

Source
Expand description

A Rust NEC SuperGrafx transcribed from supergrafx-python at v0.1.0 (eee789a) and proven equivalent to it, as an add-on to pcengine-rust through its socket traits: the SUPERGRAFX machine row (two VDCs, 32 KiB), the HuC6202 Vpc (registers, windows, the priority mix), the VideoPage decode with the compatibility switch (the board’s PixelPath), and the SuperGrafx builder.

Each module is the transcription of the supergrafx_python module of the same name; where Rust forced a difference, the module header says so. cards and trace are not from the reference’s package.

use supergrafx_rust::{is_supergrafx_card, SuperGrafx};
use pcengine_rust::pads::RUN;

let image = vec![0u8; 0x2000]; // a HuCard image (bring your own)
let _ = is_supergrafx_card(&image, Some("Daimakaimura (Japan).sgx"));
let mut system = SuperGrafx::with_card(&image, false).unwrap().build();
system.board_mut().set_pressed(0, RUN);
system.run_frame();
let _samples = system.board_mut().take_audio(); // 44.1 kHz stereo
let _picture = system.board().capture.last_frame.as_ref(); // 242 rows of 9-bit values

Re-exports§

pub use board::set_compat;
pub use board::video_page;
pub use board::SuperGrafx;
pub use board::SuperGrafxOptions;
pub use cards::is_supergrafx_card;
pub use cards::supergrafx_title;
pub use machine::SUPERGRAFX;
pub use vpc::PriorityLabels;
pub use vpc::VideoPage;
pub use vpc::Vpc;
pub use vpc::WindowOrigin;
pub use pcengine_rust;

Modules§

board
The SuperGrafx: the base PC Engine board with a machine row, a VPC and a second VDC (board.py).
cards
Which card images are SuperGrafx cards. Not from the reference: supergrafx-python is handed a card by its caller. A host that takes any HuCard image (a browser page) needs to know which machine to build, and a HuCard has no header that says.
machine
The SuperGrafx’s row of the machine table (machine.py; the base board’s machine::Machine).
trace
The lockstep gate’s side of this add-on: how a traced SuperGrafx is built from a command line, and the save-state checks. Not a module of the reference: its counterparts there are scripts/sgx_ours.py (the modes and --vpc-option) and scripts/sgx_state.py.
vpc
The HuC6202 video priority controller (VPC): the SuperGrafx’s pixel path and its register block (vpc.py).