From ebc71ed13b391af2d5b2f3d5fa2078064c85004e Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sat, 6 Jul 2024 19:12:31 +0200 Subject: [PATCH] nds: put a bit more code in ITCM --- arm9/source/emulator.c | 17 +++++++++++++++++ arm9/source/nds_ppu.c | 2 -- source/uxngba-c.c | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/arm9/source/emulator.c b/arm9/source/emulator.c index 7b40f08..ce96959 100644 --- a/arm9/source/emulator.c +++ b/arm9/source/emulator.c @@ -146,6 +146,7 @@ screen_deo(Uint8 *d, Uint8 port) } } +ITCM_ARM_CODE static Uint8 audio_dei(int instance_id, Uint8 *d, Uint8 port) { @@ -157,6 +158,7 @@ audio_dei(int instance_id, Uint8 *d, Uint8 port) } } +ITCM_ARM_CODE static void audio_deo(int instance_id, Uint8 *d, Uint8 port) { @@ -179,20 +181,35 @@ audio_deo(int instance_id, Uint8 *d, Uint8 port) } } +ITCM_ARM_CODE static Uint8 audio0_dei(Uint8 *d, Uint8 port) { return audio_dei(0, d, port); } +ITCM_ARM_CODE static Uint8 audio1_dei(Uint8 *d, Uint8 port) { return audio_dei(1, d, port); } +ITCM_ARM_CODE static Uint8 audio2_dei(Uint8 *d, Uint8 port) { return audio_dei(2, d, port); } +ITCM_ARM_CODE static Uint8 audio3_dei(Uint8 *d, Uint8 port) { return audio_dei(3, d, port); } +ITCM_ARM_CODE static Uint8 file0_dei(Uint8 *d, Uint8 port) { return file_dei(0, d, port); } +ITCM_ARM_CODE static Uint8 file1_dei(Uint8 *d, Uint8 port) { return file_dei(1, d, port); } +ITCM_ARM_CODE static void audio0_deo(Uint8 *d, Uint8 port) { audio_deo(0, d, port); } +ITCM_ARM_CODE static void audio1_deo(Uint8 *d, Uint8 port) { audio_deo(1, d, port); } +ITCM_ARM_CODE static void audio2_deo(Uint8 *d, Uint8 port) { audio_deo(2, d, port); } +ITCM_ARM_CODE static void audio3_deo(Uint8 *d, Uint8 port) { audio_deo(3, d, port); } +ITCM_ARM_CODE static void file0_deo(Uint8 *d, Uint8 port) { file_deo(0, u.ram.dat, d, port); } +ITCM_ARM_CODE static void file1_deo(Uint8 *d, Uint8 port) { file_deo(1, u.ram.dat, d, port); } +ITCM_ARM_CODE static Uint8 nds_system_dei(Uint8 *d, Uint8 port) { return system_dei(&u, port); } + +ITCM_ARM_CODE static void nds_system_deo(Uint8 *d, Uint8 port) { diff --git a/arm9/source/nds_ppu.c b/arm9/source/nds_ppu.c index 5600ea1..1c48b84 100644 --- a/arm9/source/nds_ppu.c +++ b/arm9/source/nds_ppu.c @@ -253,9 +253,7 @@ nds_ppu_1bpp(NdsPpu *p, Uint32 *layer, int16_t x, int16_t y, Uint8 *sprite, Uint tile_dirty[(y + 7) >> 3] |= dirtyflag; } -#ifndef DEBUG ITCM_ARM_CODE -#endif void nds_ppu_2bpp(NdsPpu *p, Uint32 *layer, int16_t x, int16_t y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy) { diff --git a/source/uxngba-c.c b/source/uxngba-c.c index 41d36e1..64cc723 100644 --- a/source/uxngba-c.c +++ b/source/uxngba-c.c @@ -44,18 +44,21 @@ DTCM_BSS u8 device_data[256]; __attribute__((aligned(65536))) u8 uxn_ram[64 * 1024 * RAM_PAGES]; +ITCM_ARM_CODE void deo_stub(u8 *dev, u8 port) { (void)dev; (void)port; } +ITCM_ARM_CODE void deo2_wrap(u8 *dev, u8 port, uxn_deo_t deo1) { deo1(dev,port); deo1(dev,port+1); } +ITCM_ARM_CODE Uint8 dei_stub(u8 *dev, u8 port) { return dev[port]; @@ -63,6 +66,7 @@ dei_stub(u8 *dev, u8 port) { unsigned int __aeabi_uidiv(unsigned int num, unsigned int den); +ITCM_ARM_CODE unsigned int uxn_uidiv(unsigned int num, unsigned int den) { return den ? __aeabi_uidiv(num, den) : 0;