some spu regs needed to be fewer bits and write-only. also added tests
This commit is contained in:
parent
541dba3a78
commit
84aca05c89
|
@ -512,18 +512,18 @@ u8 SPU_struct::ReadByte(u32 addr)
|
||||||
}
|
}
|
||||||
case 0x2: return thischan.pan;
|
case 0x2: return thischan.pan;
|
||||||
case 0x3: return thischan.waveduty|(thischan.repeat<<3)|(thischan.format<<5)|((thischan.status == CHANSTAT_PLAY)?0x80:0);
|
case 0x3: return thischan.waveduty|(thischan.repeat<<3)|(thischan.format<<5)|((thischan.status == CHANSTAT_PLAY)?0x80:0);
|
||||||
case 0x4: return GETBYTE(0,thischan.addr);
|
case 0x4: return 0; //return GETBYTE(0,thischan.addr); //not readable
|
||||||
case 0x5: return GETBYTE(1,thischan.addr);
|
case 0x5: return 0; //return GETBYTE(1,thischan.addr); //not readable
|
||||||
case 0x6: return GETBYTE(2,thischan.addr);
|
case 0x6: return 0; //return GETBYTE(2,thischan.addr); //not readable
|
||||||
case 0x7: return GETBYTE(3,thischan.addr);
|
case 0x7: return 0; //return GETBYTE(3,thischan.addr); //not readable
|
||||||
case 0x8: return GETBYTE(0,thischan.timer);
|
case 0x8: return GETBYTE(0,thischan.timer);
|
||||||
case 0x9: return GETBYTE(1,thischan.timer);
|
case 0x9: return GETBYTE(1,thischan.timer);
|
||||||
case 0xA: return GETBYTE(0,thischan.loopstart);
|
case 0xA: return GETBYTE(0,thischan.loopstart);
|
||||||
case 0xB: return GETBYTE(1,thischan.loopstart);
|
case 0xB: return GETBYTE(1,thischan.loopstart);
|
||||||
case 0xC: return GETBYTE(0,thischan.length);
|
case 0xC: return 0; //return GETBYTE(0,thischan.length); //not readable
|
||||||
case 0xD: return GETBYTE(1,thischan.length);
|
case 0xD: return 0; //return GETBYTE(1,thischan.length); //not readable
|
||||||
case 0xE: return GETBYTE(2,thischan.length);
|
case 0xE: return 0; //return GETBYTE(2,thischan.length); //not readable
|
||||||
case 0xF: return GETBYTE(3,thischan.length);
|
case 0xF: return 0; //return GETBYTE(3,thischan.length); //not readable
|
||||||
default: return 0; //impossible
|
default: return 0; //impossible
|
||||||
} //switch on individual channel regs
|
} //switch on individual channel regs
|
||||||
} //default case
|
} //default case
|
||||||
|
@ -697,7 +697,7 @@ void SPU_struct::WriteByte(u32 addr, u8 val)
|
||||||
case 0x4: SETBYTE(0,thischan.addr,val); break;
|
case 0x4: SETBYTE(0,thischan.addr,val); break;
|
||||||
case 0x5: SETBYTE(1,thischan.addr,val); break;
|
case 0x5: SETBYTE(1,thischan.addr,val); break;
|
||||||
case 0x6: SETBYTE(2,thischan.addr,val); break;
|
case 0x6: SETBYTE(2,thischan.addr,val); break;
|
||||||
case 0x7: SETBYTE(3,thischan.addr,val); break;
|
case 0x7: SETBYTE(3,thischan.addr,val&0x7); break; //only 27 bits of this register are used
|
||||||
case 0x8:
|
case 0x8:
|
||||||
SETBYTE(0,thischan.timer,val);
|
SETBYTE(0,thischan.timer,val);
|
||||||
adjust_channel_timer(&thischan);
|
adjust_channel_timer(&thischan);
|
||||||
|
@ -710,8 +710,8 @@ void SPU_struct::WriteByte(u32 addr, u8 val)
|
||||||
case 0xB: SETBYTE(1,thischan.loopstart,val); break;
|
case 0xB: SETBYTE(1,thischan.loopstart,val); break;
|
||||||
case 0xC: SETBYTE(0,thischan.length,val); break;
|
case 0xC: SETBYTE(0,thischan.length,val); break;
|
||||||
case 0xD: SETBYTE(1,thischan.length,val); break;
|
case 0xD: SETBYTE(1,thischan.length,val); break;
|
||||||
case 0xE: SETBYTE(2,thischan.length,val); break;
|
case 0xE: SETBYTE(2,thischan.length,val & 0x3F); break; //only 22 bits of this register are used
|
||||||
case 0xF: SETBYTE(3,thischan.length,val); break;
|
case 0xF: SETBYTE(3,thischan.length,0); break;
|
||||||
} //switch on individual channel regs
|
} //switch on individual channel regs
|
||||||
} //default case
|
} //default case
|
||||||
} //switch on address
|
} //switch on address
|
||||||
|
|
|
@ -1,130 +1,41 @@
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
ifeq ($(strip $(DEVKITARM)),)
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(DEVKITARM)/ds_rules
|
include $(DEVKITARM)/ds_rules
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
export TARGET := $(shell basename $(CURDIR))
|
||||||
# TARGET is the name of the output
|
export TOPDIR := $(CURDIR)
|
||||||
# BUILD is the directory where object files & intermediate files will be placed
|
|
||||||
# SOURCES is a list of directories containing source code
|
|
||||||
# INCLUDES is a list of directories containing extra header files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
DATA := data
|
|
||||||
INCLUDES := include
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -mthumb -mthumb-interwork
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O2\
|
.PHONY: $(TARGET).arm7 $(TARGET).arm9
|
||||||
-march=armv5te -mtune=arm946e-s \
|
|
||||||
-ffast-math \
|
|
||||||
$(ARCH)
|
|
||||||
|
|
||||||
CFLAGS += $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS)
|
|
||||||
|
|
||||||
ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s
|
|
||||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# any extra libraries we wish to link with the project
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBS := -lfat -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) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I$(CURDIR)/$(BUILD)
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).arm9
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# main targets
|
# main targets
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
$(OUTPUT).nds : $(OUTPUT).arm9
|
all: $(TARGET).nds
|
||||||
$(OUTPUT).arm9 : $(OUTPUT).elf
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.bin.o : %.bin
|
$(TARGET).nds : $(TARGET).arm7 $(TARGET).arm9
|
||||||
|
ndstool -c $(TARGET).nds -7 $(TARGET).arm7 -9 $(TARGET).arm9
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@echo $(notdir $<)
|
$(TARGET).arm7 : arm7/$(TARGET).elf
|
||||||
@$(bin2o)
|
$(TARGET).arm9 : arm9/$(TARGET).elf
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
-include $(DEPENDS)
|
arm7/$(TARGET).elf:
|
||||||
|
$(MAKE) -C arm7
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
#---------------------------------------------------------------------------------
|
||||||
#---------------------------------------------------------------------------------------
|
arm9/$(TARGET).elf:
|
||||||
|
$(MAKE) -C arm9
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
$(MAKE) -C arm9 clean
|
||||||
|
$(MAKE) -C arm7 clean
|
||||||
|
rm -f $(TARGET).nds $(TARGET).arm7 $(TARGET).arm9
|
||||||
|
|
|
@ -0,0 +1,132 @@
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
.SUFFIXES:
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(DEVKITARM)),)
|
||||||
|
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(DEVKITARM)/ds_rules
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# BUILD is the directory where object files & intermediate files will be placed
|
||||||
|
# SOURCES is a list of directories containing source code
|
||||||
|
# INCLUDES is a list of directories containing extra header files
|
||||||
|
# DATA is a list of directories containing binary files
|
||||||
|
# all directories are relative to this makefile
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
BUILD := build
|
||||||
|
SOURCES := source
|
||||||
|
INCLUDES := include build
|
||||||
|
DATA :=
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# options for code generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ARCH := -mthumb-interwork
|
||||||
|
|
||||||
|
CFLAGS := -g -Wall -O2\
|
||||||
|
-mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\
|
||||||
|
-ffast-math \
|
||||||
|
$(ARCH)
|
||||||
|
|
||||||
|
CFLAGS += $(INCLUDE) -DARM7
|
||||||
|
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -fno-rtti
|
||||||
|
|
||||||
|
|
||||||
|
ASFLAGS := -g $(ARCH)
|
||||||
|
LDFLAGS = -specs=ds_arm7.specs -g $(ARCH) -Wl,-Map,$(notdir $*).map
|
||||||
|
|
||||||
|
LIBS := -ldswifi7 -lmm7 -lnds7
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# 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 ARM7BIN := $(TOPDIR)/$(TARGET).arm7
|
||||||
|
export ARM7ELF := $(CURDIR)/$(TARGET).arm7.elf
|
||||||
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
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)/*.*)))
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.PHONY: $(BUILD) clean
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(BUILD):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(BUILD) *.elf
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(ARM7BIN) : $(ARM7ELF)
|
||||||
|
@$(OBJCOPY) -O binary $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
|
||||||
|
$(ARM7ELF) : $(OFILES)
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o : %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
|
@ -0,0 +1,117 @@
|
||||||
|
/*---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
default ARM7 core
|
||||||
|
|
||||||
|
Copyright (C) 2005
|
||||||
|
Michael Noland (joat)
|
||||||
|
Jason Rogers (dovoto)
|
||||||
|
Dave Murphy (WinterMute)
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any
|
||||||
|
damages arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any
|
||||||
|
purpose, including commercial applications, and to alter it and
|
||||||
|
redistribute it freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you
|
||||||
|
must not claim that you wrote the original software. If you use
|
||||||
|
this software in a product, an acknowledgment in the product
|
||||||
|
documentation would be appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and
|
||||||
|
must not be misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source
|
||||||
|
distribution.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------*/
|
||||||
|
#include <nds.h>
|
||||||
|
#include <dswifi7.h>
|
||||||
|
#include <maxmod7.h>
|
||||||
|
#include "../../regstest.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
void VcountHandler() {
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
inputGetAndSend();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
void VblankHandler(void) {
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
Wifi_Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void pokeMessage(char* msg)
|
||||||
|
{
|
||||||
|
char* cp = msg;
|
||||||
|
int i=0;
|
||||||
|
while(*cp)
|
||||||
|
arm7comm->message[i++] = *cp++;
|
||||||
|
arm7comm->message[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fail(char* msg, u32 offender=0)
|
||||||
|
{
|
||||||
|
arm7comm->code = 1;
|
||||||
|
arm7comm->offender = offender;
|
||||||
|
pokeMessage(msg);
|
||||||
|
|
||||||
|
while (1) swiWaitForVBlank();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
int main() {
|
||||||
|
//---------------------------------------------------------------------------------
|
||||||
|
irqInit();
|
||||||
|
fifoInit();
|
||||||
|
|
||||||
|
// read User Settings from firmware
|
||||||
|
readUserSettings();
|
||||||
|
|
||||||
|
// Start the RTC tracking IRQ
|
||||||
|
initClockIRQ();
|
||||||
|
|
||||||
|
SetYtrigger(80);
|
||||||
|
|
||||||
|
installWifiFIFO();
|
||||||
|
installSoundFIFO();
|
||||||
|
|
||||||
|
mmInstall(FIFO_MAXMOD);
|
||||||
|
|
||||||
|
installSystemFIFO();
|
||||||
|
|
||||||
|
irqSet(IRQ_VCOUNT, VcountHandler);
|
||||||
|
irqSet(IRQ_VBLANK, VblankHandler);
|
||||||
|
|
||||||
|
irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK);
|
||||||
|
|
||||||
|
|
||||||
|
while (arm7comm->code != 0xDEADBEEF)
|
||||||
|
swiWaitForVBlank();
|
||||||
|
|
||||||
|
//spu source reg should only be 27bit
|
||||||
|
//but it is not readable so what does it matter
|
||||||
|
for(int i=0;i<16;i++)
|
||||||
|
{
|
||||||
|
vu32* reg = (vu32*)(0x04000404 + (i<<4));
|
||||||
|
*reg = 0xFFFFFFFF;
|
||||||
|
//if(*reg != 0x07FFFFFF) fail("spu source reg is only 27bit.\nshould be 0x07FFFFFF",*reg);
|
||||||
|
if(*reg != 0x00000000) fail("spu source reg is not readable!",*reg);
|
||||||
|
}
|
||||||
|
|
||||||
|
//spu length reg should only be 22bit
|
||||||
|
for(int i=0;i<16;i++)
|
||||||
|
{
|
||||||
|
vu32* reg = (vu32*)(0x0400040C + (i<<4));
|
||||||
|
*reg = 0xFFFFFFFF;
|
||||||
|
//if(*reg != 0x003FFFFF) fail("spu length reg is only 22bit.\nshould be 0x003FFFFF",*reg);
|
||||||
|
if(*reg != 0x00000000) fail("spu length reg is not readable!",*reg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
arm7comm->code = 2;
|
||||||
|
while (1) swiWaitForVBlank();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,132 @@
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
.SUFFIXES:
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(DEVKITARM)),)
|
||||||
|
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(DEVKITARM)/ds_rules
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# BUILD is the directory where object files & intermediate files will be placed
|
||||||
|
# SOURCES is a list of directories containing source code
|
||||||
|
# INCLUDES is a list of directories containing extra header files
|
||||||
|
# DATA is a list of directories containing binary files
|
||||||
|
# all directories are relative to this makefile
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
BUILD := build
|
||||||
|
SOURCES := source
|
||||||
|
INCLUDES := include
|
||||||
|
DATA :=
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# options for code generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ARCH := -mthumb -mthumb-interwork
|
||||||
|
|
||||||
|
CFLAGS := -g -Wall -O2\
|
||||||
|
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer\
|
||||||
|
-ffast-math \
|
||||||
|
$(ARCH)
|
||||||
|
|
||||||
|
CFLAGS += $(INCLUDE) -DARM9
|
||||||
|
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||||
|
|
||||||
|
ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s
|
||||||
|
|
||||||
|
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# any extra libraries we wish to link with the project
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
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 ARM9BIN := $(TOPDIR)/$(TARGET).arm9
|
||||||
|
export ARM9ELF := $(CURDIR)/$(TARGET).arm9.elf
|
||||||
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(BUILD):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(BUILD) *.elf *.nds* *.bin
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(ARM9BIN) : $(ARM9ELF)
|
||||||
|
@$(OBJCOPY) -O binary $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(ARM9ELF) : $(OFILES)
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o : %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPSDIR)/*.d
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
|
@ -19,8 +19,8 @@
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
#include <nds.h>
|
#include <nds.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "../../regstest.h"
|
||||||
|
|
||||||
#define myassert(e,msg) ((e) ? (void)0 : _myassert(__FILE__, __LINE__, #e, msg))
|
#define myassert(e,msg) ((e) ? (void)0 : _myassert(__FILE__, __LINE__, #e, msg))
|
||||||
|
|
||||||
|
@ -33,14 +33,37 @@ void _myassert(const char *fileName, int lineNumber, const char* conditionString
|
||||||
int main(void) {
|
int main(void) {
|
||||||
consoleDemoInit();
|
consoleDemoInit();
|
||||||
|
|
||||||
|
arm7comm->code = 0xDEADBEEF;
|
||||||
|
|
||||||
|
//fog table entries should not be readable. they should return 0
|
||||||
for(int i=0;i<32;i++)
|
for(int i=0;i<32;i++)
|
||||||
{
|
{
|
||||||
GFX_FOG_TABLE[i] = 0xFF;
|
GFX_FOG_TABLE[i] = 0xFF;
|
||||||
iprintf("%02X\n",GFX_FOG_TABLE[i]);
|
iprintf("%02X\n",GFX_FOG_TABLE[i]);
|
||||||
myassert(GFX_FOG_TABLE[i] == 0x00,"test whether fog table entries are writeable");
|
myassert(GFX_FOG_TABLE[i] == 0x00,"test whether fog table entries are non-readable");
|
||||||
|
}
|
||||||
|
|
||||||
|
iprintf("waiting for arm7 test to finish!\n");
|
||||||
|
|
||||||
|
//wait for arm7 test to finish
|
||||||
|
for(;;) {
|
||||||
|
if(arm7comm->code != 0xDEADBEEF) break;
|
||||||
|
swiWaitForVBlank();
|
||||||
|
}
|
||||||
|
|
||||||
|
iprintf("arm7 finish code: %d\n",arm7comm->code);
|
||||||
|
|
||||||
|
if(arm7comm->code == 1)
|
||||||
|
{
|
||||||
|
iprintf("arm7 test failed!\n");
|
||||||
|
iprintf("%s\n",arm7comm->message);
|
||||||
|
iprintf("offending val: 0x%08X\n",arm7comm->offender);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iprintf("all tests OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
iprintf("all tests OK");
|
|
||||||
for(;;) swiWaitForVBlank();
|
for(;;) swiWaitForVBlank();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
typedef struct _arm7comm_t
|
||||||
|
{
|
||||||
|
int code;
|
||||||
|
u32 offender;
|
||||||
|
char message[1024];
|
||||||
|
} arm7comm_t;
|
||||||
|
|
||||||
|
#define arm7comm ( (arm7comm_t*)0x02200000 )
|
Loading…
Reference in New Issue