Skip to content

Commit

Permalink
Add disassembled nrio driver to staging
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Nov 15, 2024
1 parent d061361 commit c445ff0
Show file tree
Hide file tree
Showing 6 changed files with 6,813 additions and 0 deletions.
136 changes: 136 additions & 0 deletions staging/nrio/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------

ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
endif

include $(DEVKITARM)/ds_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
# SPECS is the directory containing the important build and link files
#---------------------------------------------------------------------------------
export TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
DATA := data
INCLUDES := include
SPECS := specs


#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -mthumb-interwork

CFLAGS := -g -Wall -O2\
-mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9 -fPIC

CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions

ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(CURDIR)/../$(SPECS)/dldi.specs -T $(CURDIR)/../$(SPECS)/dldi.ld -g $(ARCH) -Wl,-Map,$(TARGET).map

LIBS := -lnds9

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS)


#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT := $(CURDIR)/$(TARGET)

export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))

export DEPSDIR := $(CURDIR)/$(BUILD)

CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

export OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)

export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)

.PHONY: $(BUILD) clean all

#---------------------------------------------------------------------------------
all: $(BUILD)

$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make -C $(SPECS)
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).dldi $(TARGET).elf

@make -C $(SPECS) clean


#---------------------------------------------------------------------------------
else

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).dldi : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)


#---------------------------------------------------------------------------------
%.dldi: %.elf
@$(OBJCOPY) -O binary $< $@
@echo built ... $(notdir $@)


-include $(DEPENDS)


#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
65 changes: 65 additions & 0 deletions staging/nrio/source/iointerface.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#include <nds/ndstypes.h>

u32 dword_BF804D04 = 0;
u32 dword_BF804D08 = 0xFFFFFFFF;
u32 byte_BF804D0C = 0;
u8 unk_BF804D10[0x18];
u32 unk_BF804D28 = 0;
u32 unk_BF804D2C = 0;
u32 unk_BF804D30 = 0;
u32 unk_BF804D34 = 0;
u32 unk_BF804D38 = 0;
u8 unk_BF804D3C[0x40];
u32 unk_BF804D7C = 0;
u32 unk_BF804D80 = 0;
u32 unk_BF804D84 = 0;
u32 unk_BF804D88 = 0;
u32 unk_BF804D8C = 0;
u32 unk_BF804D90 = 0;
u32 unk_BF804D94 = 0;
u32 unk_BF804D98 = 0;
u32 unk_BF804D9C = 0;
u32 unk_BF804DA0 = 0;
u8 unk_BF804DA4[0x40];
u32 unk_BF804DE4 = 0;
u32 unk_BF804DE8 = 0;
u32 unk_BF804DEC = 0;
u32 unk_BF804DF0 = 0;
u32 unk_BF804DF4 = 0;
u32 unk_BF804DF8 = 0;
u32 unk_BF804DFC = 0;
u8 unk_BF804E00[0x100];
u8 unk_BF804F00[0x100];
u8 unk_BF805000[0x40];
u32 unk_BF805040 = 0;
u32 unk_BF805044 = 0;
u32 unk_BF805048 = 0;
u32 unk_BF80504C = 0;
u8 unk_BF805050[0x100];
u32 unk_BF805150 = 0;
u32 unk_BF805154 = 0;
u8 unk_BF805158[0x100];
u32 unk_BF805258 = 0;
u32 unk_BF80525C = 0;
u32 unk_BF805260 = 0;
u32 unk_BF805264 = 0;
u8 unk_BF805268[0x40];
u8 unk_BF8052A8[0x800];
u8 unk_BF805AA8[0x40];
u32 unk_BF805AE8 = 0;
u32 unk_BF805AEC = 0;
u32 unk_BF805AF0 = 0;
u32 unk_BF805AF4 = 0;
u32 unk_BF805AF8 = 0;
u8 unk_BF805AFC[0x40];
u32 unk_BF805B3C = 0;
u32 unk_BF805B40 = 0;
u8 unk_BF805B44[0x40];
u32 unk_BF805B84 = 0;
u32 unk_BF805B88 = 0;
u32 unk_BF805B8C = 0;
u32 unk_BF805B90 = 0;
u32 unk_BF805B94 = 0;
u32 unk_BF805B98 = 0;
u32 unk_BF805B9C = 0;
u32 unk_BF805BA0 = 0;
Loading

0 comments on commit c445ff0

Please sign in to comment.