2018-12-18 20:05:59 +11:00
|
|
|
#![no_std]
|
|
|
|
#![feature(asm)]
|
2018-11-14 06:47:52 +11:00
|
|
|
#![warn(missing_docs)]
|
2018-12-18 11:00:22 +11:00
|
|
|
#![allow(clippy::cast_lossless)]
|
2018-12-08 19:53:37 +11:00
|
|
|
#![deny(clippy::float_arithmetic)]
|
2018-11-14 06:47:52 +11:00
|
|
|
|
|
|
|
//! This crate helps you write GBA ROMs.
|
|
|
|
//!
|
2018-12-18 11:00:22 +11:00
|
|
|
//! ## SAFETY POLICY
|
2018-11-14 06:47:52 +11:00
|
|
|
//!
|
|
|
|
//! Some parts of this crate are safe wrappers around unsafe operations. This is
|
|
|
|
//! good, and what you'd expect from a Rust crate.
|
|
|
|
//!
|
|
|
|
//! However, the safe wrappers all assume that you will _only_ attempt to
|
|
|
|
//! execute this crate on a GBA or in a GBA Emulator.
|
|
|
|
//!
|
|
|
|
//! **Do not** use this crate in programs that aren't running on the GBA. If you
|
|
|
|
//! do, it's a giant bag of Undefined Behavior.
|
|
|
|
|
2018-12-18 11:00:22 +11:00
|
|
|
/// Assists in defining a newtype wrapper over some base type.
|
|
|
|
///
|
|
|
|
/// Note that rustdoc and derives are all the "meta" stuff, so you can write all
|
|
|
|
/// of your docs and derives in front of your newtype in the same way you would
|
|
|
|
/// for a normal struct. Then the inner type to be wrapped it name.
|
|
|
|
///
|
|
|
|
/// The macro _assumes_ that you'll be using it to wrap zero safe numeric types,
|
|
|
|
/// so it automatically provides a `const fn` method for `new` that just wraps
|
|
|
|
/// `0`. If this is not desired you can add `, no frills` to the invocation.
|
|
|
|
///
|
|
|
|
/// Example:
|
|
|
|
/// ```
|
|
|
|
/// newtype! {
|
|
|
|
/// /// Records a particular key press combination.
|
|
|
|
/// #[derive(Debug, Copy, Clone, Default, PartialEq, Eq)]
|
|
|
|
/// KeyInput, u16
|
|
|
|
/// }
|
|
|
|
/// ```
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! newtype {
|
|
|
|
($(#[$attr:meta])* $new_name:ident, $old_name:ident) => {
|
|
|
|
$(#[$attr])*
|
|
|
|
#[repr(transparent)]
|
|
|
|
pub struct $new_name($old_name);
|
|
|
|
impl $new_name {
|
|
|
|
/// A `const` "zero value" constructor
|
|
|
|
pub const fn new() -> Self {
|
|
|
|
$new_name(0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
($(#[$attr:meta])* $new_name:ident, $old_name:ident, no frills) => {
|
|
|
|
$(#[$attr])*
|
|
|
|
#[repr(transparent)]
|
|
|
|
pub struct $new_name($old_name);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
pub mod builtins;
|
|
|
|
|
|
|
|
pub mod fixed;
|
2018-11-14 06:47:52 +11:00
|
|
|
|
2018-12-17 09:17:30 +11:00
|
|
|
pub mod bios;
|
|
|
|
|
2018-12-18 11:00:22 +11:00
|
|
|
pub mod core_extras;
|
|
|
|
pub(crate) use crate::core_extras::*;
|
|
|
|
|
2018-11-14 06:47:52 +11:00
|
|
|
pub mod io_registers;
|
|
|
|
|
|
|
|
pub mod video_ram;
|
2018-11-15 19:23:04 +11:00
|
|
|
pub(crate) use crate::video_ram::*;
|