// SPDX-License-Identifier: MIT //! The access bits of a bus callback, and the GBA's view of them. //! //! Transcribed from `arm7tdmi_python/access.py`. Every `read` and `write` callback carries a //! set of these bits: `SEQ` (the SEQ pin: an S cycle, the address follows the previous one), //! `CODE` (nOPC low: an opcode fetch) and `LOCK` (the LOCK pin: SWP's read and write, TRM //! table 6-14). The core reports the TRM's cycle types. pub const SEQ: u32 = 1; pub const CODE: u32 = 2; pub const LOCK: u32 = 8; /// The access bits as the GBA's memory times them: an access that follows an internal (or /// coprocessor) cycle is non-sequential. /// /// The TRM merges an I cycle with a following S cycle (merged IS, TRM 3.3.4), so the core /// reports SEQ there; the GBA's wait-state logic times that access as N (C1, user decision 1: /// the mGBA suite's hardware-captured timing tests pass only so; GBATEK "GBA Memory Map", /// wait states). A board passes every access through this with whether an I or C cycle came /// just before it. pub fn gba_access(access: u32, after_idle: bool) -> u32 { if after_idle { access & !SEQ } else { access } }