Skip to content

Commit

Permalink
NES: Removes some unnecessary IRAM_ATTR attributes
Browse files Browse the repository at this point in the history
Functions are called only once per frame AND don't do any intense computation do not belong in IRAM
  • Loading branch information
ducalex committed Feb 6, 2024
1 parent 8a8ea30 commit e19cacf
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion retro-core/components/nofrendo/nes/apu.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static const int dmc_clocks[16] =
static const int duty_flip[4] = { 2, 4, 8, 12 };


IRAM_ATTR void apu_fc_advance(int cycles)
void apu_fc_advance(int cycles)
{
// https://wiki.nesdev.com/w/index.php/APU_Frame_Counter
const int int_period = 4 * 7457;
Expand Down
2 changes: 1 addition & 1 deletion retro-core/components/nofrendo/nes/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static const mem_write_handler_t write_handlers[] =
};

/* Set 2KB memory page */
IRAM_ATTR void mem_setpage(uint32 page, uint8 *ptr)
void mem_setpage(uint32 page, uint8 *ptr)
{
ASSERT(page < 32);
ASSERT(ptr);
Expand Down
7 changes: 1 addition & 6 deletions retro-core/components/nofrendo/nes/ppu.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,12 +636,7 @@ bool ppu_enabled(void)
return (ppu.bg_on || ppu.obj_on);
}

bool ppu_inframe(void)
{
return (ppu.scanline < 240);
}

IRAM_ATTR void ppu_endline()
void ppu_endline(void)
{
/* modify vram address at end of scanline */
if (ppu.scanline < 240 && (ppu.bg_on || ppu.obj_on))
Expand Down
1 change: 0 additions & 1 deletion retro-core/components/nofrendo/nes/ppu.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ void ppu_refresh(void);
void ppu_reset(void);
void ppu_shutdown(void);
bool ppu_enabled(void);
bool ppu_inframe(void);
void ppu_setopt(ppu_option_t n, uint8_t val);
uint8_t ppu_getopt(ppu_option_t n);

Expand Down

0 comments on commit e19cacf

Please sign in to comment.