Skip to content

Commit

Permalink
nds: put a bit more code in ITCM
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka committed Jul 6, 2024
1 parent f6c5eca commit ebc71ed
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
17 changes: 17 additions & 0 deletions arm9/source/emulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ screen_deo(Uint8 *d, Uint8 port)
}
}

ITCM_ARM_CODE
static Uint8
audio_dei(int instance_id, Uint8 *d, Uint8 port)
{
Expand All @@ -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)
{
Expand All @@ -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)
{
Expand Down
2 changes: 0 additions & 2 deletions arm9/source/nds_ppu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 4 additions & 0 deletions source/uxngba-c.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,29 @@ 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];
}

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;
Expand Down

0 comments on commit ebc71ed

Please sign in to comment.