[nostalgia] Restore GBA support

This commit is contained in:
2019-11-03 21:32:40 -06:00
parent deaa293c67
commit 758907ab5a
9 changed files with 152 additions and 108 deletions

View File

@@ -1,4 +1,3 @@
add_executable(
nostalgia
main.cpp

View File

@@ -16,11 +16,13 @@ using namespace nostalgia::world;
ox::Error run(ox::FileSystem *fs) {
Context ctx;
oxReturnError(init(&ctx));
ctx.rom = fs;
Zone zone;
oxReturnError(zone.init(&ctx, Bounds{0, 0, 40, 40}, "/TileSheets/Charset.ng", "/Palettes/Charset.npal"));
zone.draw(&ctx);
oxReturnError(init(&ctx));
//Zone zone;
//oxReturnError(zone.init(&ctx, Bounds{0, 0, 40, 40}, "/TileSheets/Charset.ng", "/Palettes/Charset.npal"));
//zone.draw(&ctx);
oxReturnError(initConsole(&ctx));
puts(nullptr, 9 * 32 + 10, "DOPENESS!!!");
oxReturnError(run());
oxReturnError(shutdownGfx());
return OxError(0);
@@ -28,9 +30,14 @@ ox::Error run(ox::FileSystem *fs) {
#ifndef OX_USE_STDLIB
extern "C" void _start() {
ox::FileSystem32 fs(ox::FileStore32(loadRom(), 32 * ox::units::MB));
int main() {
auto rom = loadRom();
if (!rom) {
return 1;
}
ox::FileSystem32 fs(ox::FileStore32(rom, 32 * ox::units::MB));
run(&fs);
return 0;
}
#else

View File

@@ -1,9 +1,39 @@
.section ".crt0","ax"
.global _start
.align
_entry:
.arm
.cpu arm7tdmi
_start:
// disable interrupts
//cpsid if
b _reset
.fill 156,1,0 // make room for Nintendo logo
.fill 16,1,0
.byte 0x30,0x31
reset:
@ disable interrupts
@ cpsid if
_initCpp:
// copy data
ldr r0,=__data_lma
ldr r1,=__data_start__
ldr r2,=__data_end__
// loop over data until copied
data_copy_loop:
cmp r1,r2
ldmltia r0!,{r3}
stmltia r1!,{r3}
blt data_copy_loop
@ vim:ft=arm
_reset:
ldr r0,=_reset
ldr r1,=_initCpp
mov lr,r1
ldr sp,=__ewram_end
b _initCpp
.size _start, . - _start
.end
// vim:ft=arm