diff --git a/Cargo.toml b/Cargo.toml index d099971..7918067 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "gba" description = "A crate (and book) for making GBA games with Rust." -version = "0.3.0" +version = "0.3.1" authors = ["Lokathor ", "Thomas Winwood "] repository = "https://github.com/rust-console/gba" readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index 8d9f9c2..240d76a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,5 @@ #![cfg_attr(not(test), no_std)] #![feature(asm)] -#![feature(const_int_wrapping)] -#![feature(const_int_rotate)] #![feature(cfg_target_vendor)] #![allow(clippy::cast_lossless)] #![deny(clippy::float_arithmetic)] @@ -129,6 +127,15 @@ pub mod sram; pub mod mgba; +extern "C" { + /// This marks the end of the `.data` and `.bss` sections in IWRAM. + /// + /// Memory in IWRAM _before_ this location is not free to use, you'll trash + /// your globals and stuff. Memory here or after is freely available for use + /// (careful that you don't run into your own stack of course). + static __bss_end: u8; +} + newtype! { /// A color on the GBA is an RGB 5.5.5 within a `u16` #[derive(PartialOrd, Ord, Hash)] diff --git a/src/mgba.rs b/src/mgba.rs index 24e6648..8f5caa7 100644 --- a/src/mgba.rs +++ b/src/mgba.rs @@ -1,4 +1,8 @@ //! Special utils for if you're running on the mGBA emulator. +//! +//! Note that this assumes that you're using the very latest version (0.7-beta1 +//! at the time of this writing). If you've got some older version of things +//! there might be any number of differences or problems. use super::*; @@ -6,6 +10,7 @@ use super::*; #[repr(u16)] #[allow(missing_docs)] pub enum MGBADebugLevel { + /// Warning! This causes the emulator to halt emulation! Fatal = 0, Error = 1, Warning = 2, @@ -51,9 +56,12 @@ impl MGBADebug { pub fn send(&mut self, level: MGBADebugLevel) { if level == MGBADebugLevel::Fatal { Self::SEND_ADDRESS.write(Self::SEND_FLAG | MGBADebugLevel::Error as u16); + + // Note(Lokathor): A Fatal send causes the emulator to halt! Self::SEND_ADDRESS.write(Self::SEND_FLAG | MGBADebugLevel::Fatal as u16); } else { Self::SEND_ADDRESS.write(Self::SEND_FLAG | level as u16); + self.bytes_written = 0; } } }