Skip to content

Commit

Permalink
update ARM7 code
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka committed Dec 16, 2023
1 parent 7fb9120 commit 805aa38
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile.blocksds.arm7
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ SOURCES_CPP := $(shell find -L $(SOURCEDIRS) -name "*.cpp")
# Compiler and linker flags
# -------------------------

DEFINES += -D__NDS__ -DARM7
DEFINES += -D__NDS__ -D__BLOCKSDS__ -DARM7

ARCH := -mcpu=arm7tdmi

Expand Down
4 changes: 2 additions & 2 deletions Makefile.blocksds.arm9
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ SOURCES_CPP := $(shell find -L $(SOURCEDIRS) -maxdepth 1 -name "*.cpp")
# Compiler and linker flags
# -------------------------

DEFINES += -D__NDS__ -DARM9 -DBLOCKSDS
DEFINES += -D__NDS__ -DARM9 -D__BLOCKSDS__

ARCH := -mcpu=arm946e-s+nofp

Expand Down Expand Up @@ -137,7 +137,7 @@ endif
endif

LDFLAGS := -Wl,--defsym=vfprintf=__i_vfprintf -Wl,--defsym=vfscanf=__i_vfscanf \
-mthumb -mthumb-interwork $(LIBDIRSFLAGS) \
-mthumb -mthumb-interwork $(LIBDIRSFLAGS) $(ARCH) \
-Wl,-Map,$(MAP) -Wl,--gc-sections -nostdlib \
-T$(BLOCKSDS)/sys/crts/ds_arm9.mem \
-T$(BLOCKSDS)/sys/crts/ds_arm9.ld \
Expand Down
13 changes: 11 additions & 2 deletions arm7/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,20 @@ void powerButtonCB() {
}

int main() {
#ifdef __BLOCKSDS__
enableSound();
#else
dmaFillWords(0, (void*)0x04000400, 0x100);

REG_SOUNDCNT |= SOUND_ENABLE;
writePowerManagement(PM_CONTROL_REG, ( readPowerManagement(PM_CONTROL_REG) & ~PM_SOUND_MUTE ) | PM_SOUND_AMP );
powerOn(POWER_SOUND);
#endif

readUserSettings();
ledBlink(0);

irqInit();
initClockIRQ();
fifoInit();
touchInit();

Expand All @@ -141,10 +144,16 @@ int main() {
fifoSetValue32Handler(UXNDS_FIFO_CHANNEL, fifo_handler, NULL);
installSystemFIFO();

irqSet(IRQ_VCOUNT, VcountHandler);
irqSet(IRQ_VBLANK, VcountHandler);
irqSet(IRQ_TIMER0, apu_handler);

#ifdef __BLOCKSDS__
initClockIRQTimer(3);
irqEnable(IRQ_VBLANK | IRQ_VCOUNT | IRQ_TIMER0);
#else
initClockIRQ();
irqEnable(IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK | IRQ_TIMER0);
#endif

setPowerButtonCB(powerButtonCB);

Expand Down
2 changes: 1 addition & 1 deletion arm9/source/emulator.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <nds.h>
#ifdef BLOCKSDS
#ifdef __BLOCKSDS__
# include <fatfs.h>
#else
# include <fat.h>
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/stubs.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Admittedly, this was more useful to reduce filesize before "datetime" device support.
#if 0
#ifdef BLOCKSDS
#ifdef __BLOCKSDS__
#include <stdint.h>

uint32_t get_fattime(void) {
Expand Down
2 changes: 1 addition & 1 deletion source/uxn.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ WITH REGARD TO THIS SOFTWARE.
#define dprintf(...)
#endif

#ifdef BLOCKSDS
#ifdef __BLOCKSDS__
#define iprintf printf
#define siprintf sprintf
#define sniprintf snprintf
Expand Down

0 comments on commit 805aa38

Please sign in to comment.