From d412ee777941a00ef401200c83bd5c6c5b5696c2 Mon Sep 17 00:00:00 2001 From: Lokathor Date: Fri, 4 Nov 2022 16:17:49 -0600 Subject: [PATCH] instruction inline example. --- dump.bat | 1 + dump.sh | 1 + examples/instruction_inline.rs | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 examples/instruction_inline.rs diff --git a/dump.bat b/dump.bat index 4745c4e..8da0181 100644 --- a/dump.bat +++ b/dump.bat @@ -1,2 +1,3 @@ cargo build --examples arm-none-eabi-objdump --headers --disassemble --demangle --architecture=armv4t --no-show-raw-insn -Mreg-names-std target/thumbv4t-none-eabi/debug/examples/hello >target/dump-hello.txt +arm-none-eabi-objdump --headers --disassemble --demangle --architecture=armv4t --no-show-raw-insn -Mreg-names-std target/thumbv4t-none-eabi/debug/examples/instruction_inline >target/dump-instruction_inline.txt diff --git a/dump.sh b/dump.sh index c103ff0..00df37f 100755 --- a/dump.sh +++ b/dump.sh @@ -1,3 +1,4 @@ #!/bin/sh cargo build --examples arm-none-eabi-objdump --headers --disassemble --demangle --architecture=armv4t --no-show-raw-insn -Mreg-names-std target/thumbv4t-none-eabi/debug/examples/hello >target/dump-hello.txt +arm-none-eabi-objdump --headers --disassemble --demangle --architecture=armv4t --no-show-raw-insn -Mreg-names-std target/thumbv4t-none-eabi/debug/examples/instruction_inline >target/dump-instruction_inline.txt diff --git a/examples/instruction_inline.rs b/examples/instruction_inline.rs new file mode 100644 index 0000000..9ae4bf8 --- /dev/null +++ b/examples/instruction_inline.rs @@ -0,0 +1,21 @@ +#![no_std] +#![no_main] +#![feature(isa_attribute)] + +use gba::prelude::*; + +#[panic_handler] +fn panic_handler(_: &core::panic::PanicInfo) -> ! { + loop {} +} + +#[instruction_set(arm::a32)] +fn make_3rd_bg_pal_entry_black() { + BG_PALETTE.index(3).write(Color::new()); +} + +#[no_mangle] +extern "C" fn main() -> ! { + make_3rd_bg_pal_entry_black(); + loop {} +}