supergrafx_rust/lib.rs
1//! A Rust NEC SuperGrafx transcribed from
2//! [supergrafx-python](https://github.com/alewman/supergrafx-python) at `v0.1.0` (`eee789a`)
3//! and proven equivalent to it, as an add-on to pcengine-rust through its socket traits: the
4//! `SUPERGRAFX` machine row (two VDCs, 32 KiB), the HuC6202 `Vpc` (registers, windows, the
5//! priority mix), the `VideoPage` decode with the compatibility switch (the board's
6//! `PixelPath`), and the `SuperGrafx` builder.
7//!
8//! Each module is the transcription of the `supergrafx_python` module of the same name; where
9//! Rust forced a difference, the module header says so. `cards` and `trace` are not from the
10//! reference's package.
11//!
12//! ```
13//! use supergrafx_rust::{is_supergrafx_card, SuperGrafx};
14//! use pcengine_rust::pads::RUN;
15//!
16//! let image = vec![0u8; 0x2000]; // a HuCard image (bring your own)
17//! let _ = is_supergrafx_card(&image, Some("Daimakaimura (Japan).sgx"));
18//! let mut system = SuperGrafx::with_card(&image, false).unwrap().build();
19//! system.board_mut().set_pressed(0, RUN);
20//! system.run_frame();
21//! let _samples = system.board_mut().take_audio(); // 44.1 kHz stereo
22//! let _picture = system.board().capture.last_frame.as_ref(); // 242 rows of 9-bit values
23//! ```
24
25pub mod board;
26pub mod cards;
27pub mod machine;
28pub mod trace;
29pub mod vpc;
30
31pub use board::{set_compat, video_page, SuperGrafx, SuperGrafxOptions};
32pub use cards::{is_supergrafx_card, supergrafx_title};
33pub use machine::SUPERGRAFX;
34pub use pcengine_rust;
35pub use vpc::{PriorityLabels, VideoPage, Vpc, WindowOrigin};
36
37/// The README's example, compiled with the documentation tests.
38#[cfg(doctest)]
39#[doc = include_str!("../README.md")]
40pub struct ReadmeExample;