lib.rsannotatedlib.rssource41 lines · 1.0 KB · raw
1pub mod api;
2pub mod audio;
3mod bootrom;
4mod bus;
5mod pwm;
6mod registers;
7mod vdp;
8
9type GenesisVdp = genesis_components::vdp::Vdp;
10
11pub const SH2_CLOCK_MULTIPLIER: u64 = genesis_config::NATIVE_SH2_MULTIPLIER;

The security program is located at $36C-$76B in the master SH-2 boot ROM. The 32X will refuse to boot any cartridge where $400-$7FF in cartridge ROM isn't an exact match for this security program.

This can be used to auto-detect whether ROM files with generic extensions (e.g. .bin) are 32X ROMs

17pub const SECURITY_PROGRAM_CARTRIDGE_ADDR: usize = 0x400;
18pub const SECURITY_PROGRAM_LEN: usize = 0x400;
20#[inline]
21#[must_use]
22pub fn security_program() -> &'static [u8] {
23    &bootrom::SH2_MASTER[0x36C..0x36C + SECURITY_PROGRAM_LEN]
24}
25
26#[derive(Debug, Clone, Copy, PartialEq, Eq)]
27pub enum WhichCpu {
28    Master = 0,
29    Slave = 1,
30}
31
32impl WhichCpu {
33    #[inline]
34    #[must_use]
35    pub fn other(self) -> Self {
36        match self {
37            Self::Master => Self::Slave,
38            Self::Slave => Self::Master,
39        }
40    }
41}