mirror of
https://github.com/italicsjenga/gba.git
synced 2024-12-23 19:01:30 +11:00
bf853b71d6
* Literally clear the repo to nothing for starters * The screen color changes with key presses There's enough code here that the screen color can change when you press the keys. Right now it's most all unsafe code directly in the example file. The strange thing is that llvm is making us define atomic helper functions when it's not supposed to do that, so we need to investigate more before proceeding too much. * can't tell if this is broken or if mgba is busted on mac * unix dumper * don't panic * oops * GbaCell into its own file, also i had broken the rt irq handler. * closer to an acceptable demo. * make IrqFn into just an alias. * wrap most current mmio types. * more stuff * Use paste to remove a whole bunch of repetition (#166) * gba cells are "unwind safe", they can't be in a bad intermediate state, that's the point * Once again we must thank Yandros for saving us from ourselves. * assembly updates. * oops * finish video MMIO basics, no docs yet. * small note. * simplify asm irq handler stack usage. * ewram support. * more cell stuff. * Remove the non-Zlib dependency, sorry Sp00ph :( * add proper dma support. * small docs improvement. * bitmap and oam declarations * more macros * single bit constants will be extremely useful * add `IntrWait` * rename for clarity * improvements * use the new constant * improve sound support * timers * key support * add a prelude module. * fix doc * more and more assembly (mem fns will need global_asm probably) * more comments. * comment updates. * readme * more video support, and put IrqFn alias into interrupts module. * finish working in the EABI code. * CI config. * funding file. * rustc plz inline these functions when you can :3 * "rt0" is unnecessarily cryptic * overhaul the readme. * phrasing Co-authored-by: Sp00ph <61327188+Sp00ph@users.noreply.github.com>
35 lines
712 B
Rust
35 lines
712 B
Rust
#![no_std]
|
|
#![no_main]
|
|
#![feature(isa_attribute)]
|
|
|
|
use gba::prelude::*;
|
|
|
|
#[panic_handler]
|
|
fn panic_handler(_: &core::panic::PanicInfo) -> ! {
|
|
loop {}
|
|
}
|
|
|
|
static KEYS: GbaCell<KeyInput> = GbaCell::new(KeyInput::new());
|
|
|
|
extern "C" fn irq_handler(_: u16) {
|
|
// just as a demo, we'll read the keys during vblank.
|
|
KEYS.write(KEYINPUT.read());
|
|
}
|
|
|
|
#[no_mangle]
|
|
extern "C" fn main() -> ! {
|
|
RUST_IRQ_HANDLER.write(Some(irq_handler));
|
|
DISPSTAT.write(DisplayStatus::new().with_irq_vblank(true));
|
|
IE.write(IrqBits::VBLANK);
|
|
IME.write(true);
|
|
|
|
DISPCNT.write(DisplayControl::new().with_show_bg0(true));
|
|
|
|
loop {
|
|
VBlankIntrWait();
|
|
|
|
let k = KEYS.read();
|
|
BACKDROP_COLOR.write(Color(k.to_u16()));
|
|
}
|
|
}
|