Skip to content

Commit

Permalink
a32 halt functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Lokathor committed Jun 3, 2024
1 parent 91dc918 commit 2c0336a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/bios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ pub fn IntrWait(ignore_existing: bool, target_irqs: IrqBits) {
});
}

/// As [`IntrWait`], but using the `a32` instruction set.
#[inline]
#[cfg_attr(feature = "on_gba", instruction_set(arm::a32))]
pub fn a32_IntrWait(ignore_existing: bool, target_irqs: IrqBits) {
on_gba_or_unimplemented!(unsafe {
core::arch::asm! {
"swi #(0x04 << 24)",
inout("r0") ignore_existing as u32 => _,
inout("r1") target_irqs.0 => _,
out("r3") _,
options(preserves_flags),
}
});
}

/// `0x05`: Builtin shorthand for [`IntrWait(true, IrqBits::VBLANK)`](IntrWait)
#[inline]
#[cfg_attr(feature = "on_gba", instruction_set(arm::t32))]
Expand All @@ -60,6 +75,21 @@ pub fn VBlankIntrWait() {
});
}

/// As [`VBlankIntrWait`], but using the `a32` instruction set.
#[inline]
#[cfg_attr(feature = "on_gba", instruction_set(arm::t32))]
pub fn a32_VBlankIntrWait() {
on_gba_or_unimplemented!(unsafe {
core::arch::asm! {
"swi #(0x05 << 24)",
out("r0") _,
out("r1") _,
out("r3") _,
options(preserves_flags),
}
});
}

/// `0x09`: Arc tangent.
///
/// * **Returns:** The output is in the range +/- `pi/2`, but accuracy is worse
Expand Down

0 comments on commit 2c0336a

Please sign in to comment.