Simplify memory blanking

This commit is contained in:
Lorenzo Carletti 2021-12-02 21:09:24 +01:00
parent b71218955b
commit cfcdb18a9f
3 changed files with 8 additions and 18 deletions

View File

@ -36,3 +36,4 @@ int __attribute__((naked)) m2_jump_to_offset(byte* character) {}
byte* __attribute__((naked)) m2_malloc(int size) {}
void __attribute__((naked)) m2_title_teardown() {}
void __attribute__((naked)) vblank() {}
void __attribute__((naked)) reg_ram_reset(int flag) {}

View File

@ -20,10 +20,6 @@ void start_tests()
void blank_memory()
{
int blank_value = 0;
cpufastset(&blank_value, (void*)EWRAM, CPUFASTSET_FILL | (EWRAM_SIZE >> 2));
cpufastset(&blank_value, (void*)IWRAM, CPUFASTSET_FILL | (IWRAM_SIZE >> 3));
cpufastset(&blank_value, (void*)IO, CPUFASTSET_FILL | (IO_SIZE >> 2));
cpufastset(&blank_value, (void*)PALETTES, CPUFASTSET_FILL | (PALETTES_SIZE >> 2));
cpufastset(&blank_value, (void*)VRAM, CPUFASTSET_FILL | (VRAM_SIZE >> 2));
cpufastset(&blank_value, (void*)OBJECTS, CPUFASTSET_FILL | (OBJECTS_SIZE >> 2));
cpufastset(&blank_value, (void*)IWRAM, CPUFASTSET_FILL | (IWRAM_SIZE >> 2));
reg_ram_reset(NON_IWRAM_RESET);
}

View File

@ -1,21 +1,14 @@
#include "debug_printf/test_print.h"
#define CPUFASTSET_FILL (0x1000000)
#define EWRAM (0x2000000)
#define EWRAM_SIZE (0x40000)
#define IWRAM (0x3000000)
#define IWRAM_SIZE (0x8000)
#define IO (0x4000000)
#define IO_SIZE (0x400)
#define PALETTES (0x5000000)
#define PALETTES_SIZE (0x400)
#define VRAM (0x6000000)
#define VRAM_SIZE (0x18000)
#define OBJECTS (0x7000000)
#define OBJECTS_SIZE (0x400)
#define IWRAM_SIZE (0x8000-0x2000)
#define NON_IWRAM_RESET 0xFD
void start_tests();
void blank_memory();
extern void vblank();
extern void cpufastset(void *source, void *dest, int mode);
extern void reg_ram_reset(int flag);