Skip to content

Commit

Permalink
Commenting out some broken code and throwing unimplemented instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Liegey committed Dec 30, 2021
1 parent 2e25153 commit ed71a4d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 45 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![no_std]
#![feature(asm, global_asm, isa_attribute)]
#![feature(isa_attribute)]

//! This crate helps you write GBA ROMs.
//!
Expand Down Expand Up @@ -31,11 +31,11 @@ pub mod prelude {
#[cfg(target_arch = "arm")]
pub use crate::mmio_addresses::*;
#[cfg(target_arch = "arm")]
pub use crate::random::*;
#[cfg(target_arch = "arm")]
pub use crate::save::*;
#[cfg(target_arch = "arm")]
pub use crate::sync::*;
#[cfg(target_arch = "arm")]
pub use crate::random::*;
}

pub mod mmio_types;
Expand Down
89 changes: 47 additions & 42 deletions src/sync/statics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,59 +85,64 @@ unsafe fn transfer_align4_thumb<T: Copy>(mut dst: *mut T, mut src: *const T) {

#[cfg(target_arch = "arm")]
#[instruction_set(arm::a32)]
#[allow(unused_assignments)]
#[allow(unused_assignments, unused_variables, unused_mut)] // TODO(rust-console/gba#158)
unsafe fn transfer_align4_arm<T: Copy>(mut dst: *mut T, mut src: *const T) {
let size = size_of::<T>();
if size <= 16 {
unimplemented!("This should be done via transfer_thumb.");
} else if size <= 20 {
// Starting at size == 20, we have to switch to ARM due to lack of
// accessible registers in THUMB mode.
asm!(
"ldmia {0}!, {{r2-r5,r8}}",
"stmia {1}!, {{r2-r5,r8}}",
inout(reg) src, inout(reg) dst,
out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _,
)
// asm!(
// "ldmia {0}!, {{r2-r5,r8}}",
// "stmia {1}!, {{r2-r5,r8}}",
// inout(reg) src, inout(reg) dst,
// out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _,
// )
unimplemented!("Currently higher registers are unavailable. See rust-console/gba#158");
} else if size <= 24 {
asm!(
"push {{r9}}",
"ldmia {0}!, {{r2-r5,r8-r9}}",
"stmia {1}!, {{r2-r5,r8-r9}}",
"pop {{r9}}",
inout(reg) src, inout(reg) dst,
out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _,
)
// asm!(
// "push {{r9}}",
// "ldmia {0}!, {{r2-r5,r8-r9}}",
// "stmia {1}!, {{r2-r5,r8-r9}}",
// "pop {{r9}}",
// inout(reg) src, inout(reg) dst,
// out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _,
// )
unimplemented!("Currently higher registers are unavailable. See rust-console/gba#158");
} else if size <= 28 {
asm!(
"push {{r9}}",
"ldmia {0}!, {{r2-r5,r8-r10}}",
"stmia {1}!, {{r2-r5,r8-r10}}",
"pop {{r9}}",
inout(reg) src, inout(reg) dst,
out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _,
out("r10") _,
)
// asm!(
// "push {{r9}}",
// "ldmia {0}!, {{r2-r5,r8-r10}}",
// "stmia {1}!, {{r2-r5,r8-r10}}",
// "pop {{r9}}",
// inout(reg) src, inout(reg) dst,
// out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _,
// out("r10") _,
// )
unimplemented!("Currently higher registers are unavailable. See rust-console/gba#158");
} else if size <= 32 {
asm!(
"push {{r9}}",
"ldmia {0}!, {{r2-r5,r8-r10,r12}}",
"stmia {1}!, {{r2-r5,r8-r10,r12}}",
"pop {{r9}}",
inout(reg) src, inout(reg) dst,
out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _,
out("r10") _, out("r12") _,
)
// asm!(
// "push {{r9}}",
// "ldmia {0}!, {{r2-r5,r8-r10,r12}}",
// "stmia {1}!, {{r2-r5,r8-r10,r12}}",
// "pop {{r9}}",
// inout(reg) src, inout(reg) dst,
// out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _,
// out("r10") _, out("r12") _,
// )
unimplemented!("Currently higher registers are unavailable. See rust-console/gba#158");
} else if size <= 36 {
asm!(
"push {{r9}}",
"ldmia {0}!, {{r2-r5,r8-r10,r12,r14}}",
"stmia {1}!, {{r2-r5,r8-r10,r12,r14}}",
"pop {{r9}}",
inout(reg) src, inout(reg) dst,
out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _,
out("r10") _, out("r12") _, out("r14") _,
)
// asm!(
// "push {{r9}}",
// "ldmia {0}!, {{r2-r5,r8-r10,r12,r14}}",
// "stmia {1}!, {{r2-r5,r8-r10,r12,r14}}",
// "pop {{r9}}",
// inout(reg) src, inout(reg) dst,
// out("r2") _, out("r3") _, out("r4") _, out("r5") _, out("r8") _,
// out("r10") _, out("r12") _, out("r14") _,
// )
unimplemented!("Currently higher registers are unavailable. See rust-console/gba#158");
} else {
unimplemented!("Copy too large for use of ldmia/stmia.");
}
Expand Down

0 comments on commit ed71a4d

Please sign in to comment.