-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
butano: sram code moved back from rom to ewram, since doing that does…
…n't make No$gba crash anymore
- Loading branch information
Showing
5 changed files
with
45 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2020 Gustavo Valiente [email protected] | ||
* zlib License, see LICENSE file. | ||
*/ | ||
|
||
#include "../include/bn_hw_sram.h" | ||
|
||
#include "../include/bn_hw_tonc.h" | ||
|
||
namespace bn::hw::sram | ||
{ | ||
|
||
void write(const void* source, int size, int offset) | ||
{ | ||
// This code should go in WRAM: | ||
// http://problemkaputt.de/gbatek.htm#gbacartbackupsramfram (Reading and Writing section) | ||
|
||
volatile const uint8_t* source_ptr = static_cast<const uint8_t*>(source); | ||
volatile uint8_t* sram_ptr = reinterpret_cast<uint8_t*>(MEM_SRAM) + offset; | ||
|
||
for(int i = 0; i < size; i++) | ||
{ | ||
sram_ptr[i] = source_ptr[i]; | ||
} | ||
} | ||
|
||
void read(void* destination, int size, int offset) | ||
{ | ||
// This code should go in WRAM: | ||
// http://problemkaputt.de/gbatek.htm#gbacartbackupsramfram (Reading and Writing section) | ||
|
||
volatile const uint8_t* sram_ptr = reinterpret_cast<const uint8_t*>(MEM_SRAM) + offset; | ||
volatile uint8_t* destination_ptr = static_cast<uint8_t*>(destination); | ||
|
||
for(int i = 0; i < size; i++) | ||
{ | ||
destination_ptr[i] = sram_ptr[i]; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters