mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 01:21:34 +11:00
commit
5d4565b81e
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,2 @@
|
|||
target
|
||||
/out
|
||||
/.vscode
|
||||
|
|
18
.vscode/launch.json
vendored
Normal file
18
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "gdb",
|
||||
"request": "attach",
|
||||
"name": "Attach to gdbserver",
|
||||
"executable": "agb/target/thumbv4t-none-eabi/debug/examples/chicken",
|
||||
"target": "127.0.0.1:2345",
|
||||
"remote": true,
|
||||
"cwd": "${workspaceRoot}",
|
||||
"gdbpath": "arm-none-eabi-gdb",
|
||||
}
|
||||
]
|
||||
}
|
|
@ -7,7 +7,8 @@ description = "Library for Game Boy Advance Development"
|
|||
license = "MPL-2.0"
|
||||
|
||||
[profile.dev]
|
||||
opt-level = 2
|
||||
opt-level = 0
|
||||
debug = true
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
|
|
|
@ -12,6 +12,7 @@ fn main() {
|
|||
let out = std::process::Command::new("arm-none-eabi-as")
|
||||
.arg("-mthumb-interwork")
|
||||
.arg("-mthumb")
|
||||
.arg("-g")
|
||||
.args(&["-o", out_file_path.as_str()])
|
||||
.arg("crt0.s")
|
||||
.output()
|
||||
|
|
32
agb/gba.ld
32
agb/gba.ld
|
@ -69,6 +69,38 @@ SECTIONS {
|
|||
__ewram_rom_length_bytes = __ewram_data_end - __ewram_data_start;
|
||||
__ewram_rom_length_halfwords = (__ewram_rom_length_bytes + 1) / 2;
|
||||
|
||||
/* debugging sections */
|
||||
/* Stabs */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
|
||||
/* discard anything not already mentioned */
|
||||
/DISCARD/ : { *(*) }
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
use super::DISPLAY_CONTROL;
|
||||
use crate::memory_mapped::MemoryMapped1DArray;
|
||||
|
||||
const OBJECT_MEMORY_STANDARD: *mut [ObjectAttributeStandard; 128] = 0x0700_0000 as *mut [_; 128];
|
||||
const OBJECT_MEMORY_STANDARD: MemoryMapped1DArray<u32, 256> =
|
||||
unsafe { MemoryMapped1DArray::new(0x0700_0000) };
|
||||
|
||||
#[non_exhaustive]
|
||||
pub struct ObjectControl {}
|
||||
|
@ -37,8 +39,6 @@ impl ObjectStandard {
|
|||
}
|
||||
}
|
||||
|
||||
#[repr(packed)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct ObjectAttributeStandard {
|
||||
low: u32,
|
||||
high: u32,
|
||||
|
@ -46,8 +46,8 @@ pub struct ObjectAttributeStandard {
|
|||
|
||||
impl ObjectAttributeStandard {
|
||||
unsafe fn commit(&self, index: usize) {
|
||||
(&mut (*OBJECT_MEMORY_STANDARD)[index] as *mut ObjectAttributeStandard)
|
||||
.write_volatile(*self)
|
||||
OBJECT_MEMORY_STANDARD.set(index * 2, self.low);
|
||||
OBJECT_MEMORY_STANDARD.set(index * 2 + 1, self.high);
|
||||
}
|
||||
|
||||
pub fn set_hflip(&mut self, hflip: bool) {
|
||||
|
@ -108,7 +108,7 @@ impl ObjectControl {
|
|||
pub unsafe fn clear_objects(&mut self) {
|
||||
let mut o = ObjectAttributeStandard::new();
|
||||
o.set_mode(Mode::Hidden);
|
||||
for index in 0..(*OBJECT_MEMORY_STANDARD).len() {
|
||||
for index in 0..128 {
|
||||
o.commit(index);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue