DSPSpy: First version submitted, resurrected from the ages of time. Build the dsp code by running dspbuild.bat (or an equivalent shell script), then build the elf using devkitpro/libogc and boot it on your Wii using Homebrew Channel or whatever. You'll get a lot of numbers on your screen.

DSPTool: build fix.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2995 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-04-18 14:02:34 +00:00
parent ee933cb5d4
commit 6ec5d28eda
16 changed files with 7425 additions and 4 deletions

View File

@ -118,10 +118,10 @@ void CodeToHeader(const std::vector<u16> &code, const char *name, std::string *h
header->clear();
header->reserve(code.size() * 4);
header->append("#ifndef _MSCVER\n");
sprintf(buffer, "const unsigned short %s = {\n", name);
sprintf(buffer, "const unsigned short %s[0x1000] = {\n", name);
header->append(buffer);
header->append("#else\n");
sprintf(buffer, "const unsigned short %s __attribute__ ((aligned (64))) = {\n", name);
sprintf(buffer, "const unsigned short %s[0x1000] __attribute__ ((aligned (64))) = {\n", name);
header->append(buffer);
header->append("#endif\n\n ");
for (int i = 0; i < code.size(); i++)

144
Source/DSPSpy/Makefile Normal file
View File

@ -0,0 +1,144 @@
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
include $(DEVKITPPC)/wii_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
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := . source
RESOURCES := ../resources
DATA := data
INCLUDES := include
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -save-temps -g -O2 -Wall --no-strict-aliasing $(MACHDEP) $(INCLUDE)
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lfat -lasnd -lmodplay -lwiiuse -lbte -lz -logc -lm
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS :=
#---------------------------------------------------------------------------------
# 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,$(RESOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CFILES += $(foreach dir,$(RESOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
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) $(SFILES:.S=.o)
#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD) \
-I$(LIBOGC_INC)
#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
-L$(LIBOGC_LIB)
export OUTPUT := $(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
#---------------------------------------------------------------------------------
run:
wiiload $(OUTPUT).dol
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#%.biz: %.ds
# gcdsptool -c $< -o $@
#%.h: %.biz
# raw2c $< $@
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .bin extension
#---------------------------------------------------------------------------------
#%.bin.o : %.bin
#---------------------------------------------------------------------------------
# @echo $(notdir $<)
# $(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

317
Source/DSPSpy/asm.h Normal file
View File

@ -0,0 +1,317 @@
#ifndef __ASM_H__
#define __ASM_H__
#ifdef _LANGUAGE_ASSEMBLY
/* Condition Register Bit Fields */
#define cr0 0
#define cr1 1
#define cr2 2
#define cr3 3
#define cr4 4
#define cr5 5
#define cr6 6
#define cr7 7
/* General Purpose Registers (GPRs) */
#define r0 0
#define r1 1
#define sp 1
#define r2 2
#define toc 2
#define r3 3
#define r4 4
#define r5 5
#define r6 6
#define r7 7
#define r8 8
#define r9 9
#define r10 10
#define r11 11
#define r12 12
#define r13 13
#define r14 14
#define r15 15
#define r16 16
#define r17 17
#define r18 18
#define r19 19
#define r20 20
#define r21 21
#define r22 22
#define r23 23
#define r24 24
#define r25 25
#define r26 26
#define r27 27
#define r28 28
#define r29 29
#define r30 30
#define r31 31
/* Floating Point Registers (FPRs) */
#define fr0 0
#define fr1 1
#define fr2 2
#define fr3 3
#define fr4 4
#define fr5 5
#define fr6 6
#define fr7 7
#define fr8 8
#define fr9 9
#define fr10 10
#define fr11 11
#define fr12 12
#define fr13 13
#define fr14 14
#define fr15 15
#define fr16 16
#define fr17 17
#define fr18 18
#define fr19 19
#define fr20 20
#define fr21 21
#define fr22 22
#define fr23 23
#define fr24 24
#define fr25 25
#define fr26 26
#define fr27 27
#define fr28 28
#define fr29 29
#define fr30 30
#define fr31 31
#define vr0 0
#define vr1 1
#define vr2 2
#define vr3 3
#define vr4 4
#define vr5 5
#define vr6 6
#define vr7 7
#define vr8 8
#define vr9 9
#define vr10 10
#define vr11 11
#define vr12 12
#define vr13 13
#define vr14 14
#define vr15 15
#define vr16 16
#define vr17 17
#define vr18 18
#define vr19 19
#define vr20 20
#define vr21 21
#define vr22 22
#define vr23 23
#define vr24 24
#define vr25 25
#define vr26 26
#define vr27 27
#define vr28 28
#define vr29 29
#define vr30 30
#define vr31 31
#define SPRG0 272
#define SPRG1 273
#define SPRG2 274
#define SPRG3 275
#define PMC1 953
#define PMC2 954
#define PMC3 957
#define PMC4 958
#define MMCR0 952
#define MMCR1 956
#define LINK_REGISTER_CALLEE_UPDATE_ROOM 4
#define EXCEPTION_NUMBER 8
#define SRR0_OFFSET 12
#define SRR1_OFFSET 16
#define GPR0_OFFSET 20
#define GPR1_OFFSET 24
#define GPR2_OFFSET 28
#define GPR3_OFFSET 32
#define GPR4_OFFSET 36
#define GPR5_OFFSET 40
#define GPR6_OFFSET 44
#define GPR7_OFFSET 48
#define GPR8_OFFSET 52
#define GPR9_OFFSET 56
#define GPR10_OFFSET 60
#define GPR11_OFFSET 64
#define GPR12_OFFSET 68
#define GPR13_OFFSET 72
#define GPR14_OFFSET 76
#define GPR15_OFFSET 80
#define GPR16_OFFSET 84
#define GPR17_OFFSET 88
#define GPR18_OFFSET 92
#define GPR19_OFFSET 96
#define GPR20_OFFSET 100
#define GPR21_OFFSET 104
#define GPR22_OFFSET 108
#define GPR23_OFFSET 112
#define GPR24_OFFSET 116
#define GPR25_OFFSET 120
#define GPR26_OFFSET 124
#define GPR27_OFFSET 128
#define GPR28_OFFSET 132
#define GPR29_OFFSET 136
#define GPR30_OFFSET 140
#define GPR31_OFFSET 144
#define GQR0_OFFSET 148
#define GQR1_OFFSET 152
#define GQR2_OFFSET 156
#define GQR3_OFFSET 160
#define GQR4_OFFSET 164
#define GQR5_OFFSET 168
#define GQR6_OFFSET 172
#define GQR7_OFFSET 176
#define CR_OFFSET 180
#define LR_OFFSET 184
#define CTR_OFFSET 188
#define XER_OFFSET 192
#define MSR_OFFSET 196
#define DAR_OFFSET 200
#define STATE_OFFSET 204
#define MODE_OFFSET 206
#define FPR0_OFFSET 208
#define FPR1_OFFSET 216
#define FPR2_OFFSET 224
#define FPR3_OFFSET 232
#define FPR4_OFFSET 240
#define FPR5_OFFSET 248
#define FPR6_OFFSET 256
#define FPR7_OFFSET 264
#define FPR8_OFFSET 272
#define FPR9_OFFSET 280
#define FPR10_OFFSET 288
#define FPR11_OFFSET 296
#define FPR12_OFFSET 304
#define FPR13_OFFSET 312
#define FPR14_OFFSET 320
#define FPR15_OFFSET 328
#define FPR16_OFFSET 336
#define FPR17_OFFSET 344
#define FPR18_OFFSET 352
#define FPR19_OFFSET 360
#define FPR20_OFFSET 368
#define FPR21_OFFSET 376
#define FPR22_OFFSET 384
#define FPR23_OFFSET 392
#define FPR24_OFFSET 400
#define FPR25_OFFSET 408
#define FPR26_OFFSET 416
#define FPR27_OFFSET 424
#define FPR28_OFFSET 432
#define FPR29_OFFSET 440
#define FPR30_OFFSET 448
#define FPR31_OFFSET 456
#define FPSCR_OFFSET 464
#define PSR0_OFFSET 472
#define PSR1_OFFSET 480
#define PSR2_OFFSET 488
#define PSR3_OFFSET 496
#define PSR4_OFFSET 504
#define PSR5_OFFSET 512
#define PSR6_OFFSET 520
#define PSR7_OFFSET 528
#define PSR8_OFFSET 536
#define PSR9_OFFSET 544
#define PSR10_OFFSET 552
#define PSR11_OFFSET 560
#define PSR12_OFFSET 568
#define PSR13_OFFSET 576
#define PSR14_OFFSET 584
#define PSR15_OFFSET 592
#define PSR16_OFFSET 600
#define PSR17_OFFSET 608
#define PSR18_OFFSET 616
#define PSR19_OFFSET 624
#define PSR20_OFFSET 632
#define PSR21_OFFSET 640
#define PSR22_OFFSET 648
#define PSR23_OFFSET 656
#define PSR24_OFFSET 664
#define PSR25_OFFSET 672
#define PSR26_OFFSET 680
#define PSR27_OFFSET 688
#define PSR28_OFFSET 696
#define PSR29_OFFSET 704
#define PSR30_OFFSET 712
#define PSR31_OFFSET 720
/*
* maintain the EABI requested 8 bytes aligment
* As SVR4 ABI requires 16, make it 16 (as some
* exception may need more registers to be processed...)
*/
#define EXCEPTION_FRAME_END 728
#define IBAT0U 528
#define IBAT0L 529
#define IBAT1U 530
#define IBAT1L 531
#define IBAT2U 532
#define IBAT2L 533
#define IBAT3U 534
#define IBAT3L 535
#define DBAT0U 536
#define DBAT0L 537
#define DBAT1U 538
#define DBAT1L 538
#define DBAT2U 540
#define DBAT2L 541
#define DBAT3U 542
#define DBAT3L 543
#define HID0 1008
#define HID1 1009
#define HID2 920
#define GQR0 912
#define GQR1 913
#define GQR2 914
#define GQR3 915
#define GQR4 916
#define GQR5 917
#define GQR6 918
#define GQR7 919
#define L2CR 1017
#define DMAU 922
#define DMAL 923
#endif //_LANGUAGE_ASSEMBLY
#define MSR_RI 0x00000002
#define MSR_DR 0x00000010
#define MSR_IR 0x00000020
#define MSR_IP 0x00000040
#define MSR_SE 0x00000400
#define MSR_ME 0x00001000
#define MSR_FP 0x00002000
#define MSR_POW 0x00004000
#define MSR_EE 0x00008000
#define PPC_ALIGNMENT 4
#endif //__ASM_H__

28
Source/DSPSpy/color.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef __COLOR_H__
#define __COLOR_H__
// luminance is stored twice, thus one of the lum. is
// redundant, but this way we can fill the screen.
#define COLOR_BLACK (0x00800080)
#define COLOR_MAROON (0x266A26C0)
#define COLOR_GREEN (0x4B554B4A)
#define COLOR_OLIVE (0x7140718A)
#define COLOR_NAVY (0x0EC00E75)
#define COLOR_PURPLE (0x34AA34B5)
#define COLOR_TEAL (0x59955940)
#define COLOR_GRAY (0x80808080)
#define COLOR_SILVER (0xC080C080)
#define COLOR_RED (0x4C544CFF)
#define COLOR_LIME (0x952B9515)
#define COLOR_YELLOW (0xE100E194)
#define COLOR_BLUE (0x1DFF1D6B)
#define COLOR_FUCHSIA (0x69D469EA)
#define COLOR_AQUA (0xB2ABB200)
#define COLOR_WHITE (0xFF80FF80)
#define COLOR_MONEYGREEN (0xD076D074)
#define COLOR_SKYBLUE (0xC399C36A)
#define COLOR_CREAM (0xFA79FA82)
#define COLOR_MEDGRAY (0xA082A07F)
#endif /* COLOR_H */

211
Source/DSPSpy/display.cpp Normal file
View File

@ -0,0 +1,211 @@
#include <stdlib.h>
#include <string.h>
#include <reent.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#undef errno
extern int errno;
#include "asm.h"
#include "processor.h"
#include "color.h"
#define FONT_XSIZE 8
#define FONT_YSIZE 16
#define FONT_XFACTOR 1
#define FONT_YFACTOR 1
#define FONT_XGAP 2
#define FONT_YGAP 0
typedef struct _display_data_s {
u8 *framebuffer;
u8 *font;
int xres,yres,stride;
int cursor_x,cursor_y;
int border_left,border_right,border_top,border_bottom;
int scrolled_lines;
unsigned int foreground,background;
} display_data_s;
int displ_open(struct _reent *r, const char *path, int flags,int mode);
int displ_write(struct _reent *r, int fd, const char *ptr, int len);
static struct _display_data_s dsp_displ;
static struct _display_data_s *displ = &dsp_displ;
extern u8 display_font_8x16[];
static void __display_drawc(int xpos, int ypos, int c)
{
xpos >>= 1;
int ax, ay;
unsigned int *ptr = (unsigned int*)(displ->framebuffer + displ->stride * ypos + xpos * 4);
for (ay = 0; ay < FONT_YSIZE; ay++)
#if FONT_XFACTOR == 2
for (ax = 0; ax < 8; ax++)
{
unsigned int color;
if ((displ->font[c * FONT_YSIZE + ay] << ax) & 0x80)
color = displ->foreground;
else
color = displ->background;
#if FONT_YFACTOR == 2
// pixel doubling: we write u32
ptr[ay * 2 * displ->stride/4 + ax] = color;
// line doubling
ptr[(ay * 2 +1) * displ->stride/4 + ax] = color;
#else
ptr[ay * displ->stride/4 + ax] = color;
#endif
}
#else
for (ax = 0; ax < 4; ax ++)
{
unsigned int color[2];
int bits = (displ->font[c * FONT_YSIZE + ay] << (ax*2));
if (bits & 0x80)
color[0] = displ->foreground;
else
color[0] = displ->background;
if (bits & 0x40)
color[1] = displ->foreground;
else
color[1] = displ->background;
ptr[ay * displ->stride/4 + ax] = (color[0] & 0xFFFF00FF) | (color[1] & 0x0000FF00);
}
#endif
}
void ds_init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride)
{
unsigned int level;
_CPU_ISR_Disable(level);
displ->framebuffer = (u8 *)framebuffer;
displ->xres = xres;
displ->yres = yres;
displ->border_left = xstart;
displ->border_top = ystart;
displ->border_right = displ->xres;
displ->border_bottom = displ->yres;
displ->stride = stride;
displ->cursor_x = xstart;
displ->cursor_y = ystart;
displ->font = display_font_8x16;
displ->foreground = COLOR_WHITE;
displ->background = COLOR_BLACK;
displ->scrolled_lines = 0;
unsigned int c = (displ->xres*displ->yres)/2;
unsigned int *p = (unsigned int*)displ->framebuffer;
while(c--)
*p++ = displ->background;
_CPU_ISR_Restore(level);
}
void ds_clear(void)
{
unsigned int c = (displ->xres*displ->yres)/2;
unsigned int *p = (unsigned int*)displ->framebuffer;
c /= 2;
p += c;
while(c--)
*p++ = displ->background;
}
int display_putc(int c)
{
if(!displ) return -1;
switch(c)
{
case '\n':
displ->cursor_y += FONT_YSIZE*FONT_YFACTOR+FONT_YGAP;
displ->cursor_x = displ->border_left;
break;
default:
__display_drawc(displ->cursor_x,displ->cursor_y,c);
displ->cursor_x += FONT_XSIZE*FONT_XFACTOR+FONT_XGAP;
if((displ->cursor_x+FONT_XSIZE*FONT_XFACTOR)>displ->border_right) {
displ->cursor_y += FONT_YSIZE*FONT_YFACTOR+FONT_YGAP;
displ->cursor_x = displ->border_left;
}
}
if((displ->cursor_y+FONT_YSIZE*FONT_YFACTOR)>=displ->border_bottom) {
memcpy(displ->framebuffer,
displ->framebuffer+displ->stride*(FONT_YSIZE*FONT_YFACTOR+FONT_YGAP),
displ->stride*displ->yres-FONT_YSIZE);
unsigned int cnt = (displ->stride * (FONT_YSIZE * FONT_YFACTOR + FONT_YGAP))/4;
unsigned int *ptr = (unsigned int*)(displ->framebuffer + displ->stride * (displ->yres - FONT_YSIZE));
while(cnt--)
*ptr++ = displ->background;
displ->cursor_y -= FONT_YSIZE * FONT_YFACTOR + FONT_YGAP;
}
return 1;
}
int displ_write(struct _reent *r,int fd, const char *ptr,int len)
{
int i, count = 0;
char *tmp = (char*)ptr;
if(!tmp || len<=0) return -1;
i = 0;
while(*tmp!='\0' && i<len) {
count += display_putc(*tmp++);
i++;
}
return count;
}
void ds_text_out(int xpos, int ypos, const char *str)
{
ypos *= (FONT_YSIZE * FONT_YFACTOR + FONT_YGAP);
xpos *= (FONT_XSIZE * FONT_XFACTOR + FONT_XGAP);
while(*str != '\0')
{
__display_drawc(xpos, ypos, *str++);
xpos += (FONT_XSIZE * FONT_XFACTOR + FONT_XGAP);
};
}
void ds_printf(int x, int y, const char *fmt, ...)
{
char tmpbuf[255];
va_list marker;
va_start(marker,fmt);
vsprintf(tmpbuf, fmt, marker );
va_end(marker);
ds_text_out(x, y, tmpbuf);
}
void ds_set_colour(int f, int b)
{
displ->background = b;
displ->foreground = f;
}
void ds_underline(int xpos, int ypos, int len, int col)
{
int i;
ypos = (ypos + 1) * (FONT_YSIZE * FONT_YFACTOR + FONT_YGAP) - 1;
xpos *= (FONT_XSIZE * FONT_XFACTOR + FONT_XGAP)/2;
len *= (FONT_XSIZE * FONT_XFACTOR + FONT_XGAP)/2;
unsigned int *ptr = (unsigned int*)(displ->framebuffer + displ->stride * ypos + xpos * 4);
for(i=0 ; i < len ; i++)
ptr[i] = col;
}

File diff suppressed because it is too large Load Diff

59
Source/DSPSpy/dsp.h Normal file
View File

@ -0,0 +1,59 @@
#ifndef __DSP_H__
#define __DSP_H__
#include <gctypes.h>
#define DSPTASK_INIT 0
#define DSPTASK_RUN 1
#define DSPTASK_YIELD 2
#define DSPTASK_DONE 3
#define DSPTASK_CLEARALL 0x00000000
#define DSPTASK_ATTACH 0x00000001
#define DSPTASK_CANCEL 0x00000002
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef void (*DSPCallback)(void *task);
typedef struct _dsp_task {
vu32 state;
vu32 prio;
vu32 flags;
u16 init_vec;
u16 resume_vec;
u16 *iram_maddr;
u32 iram_len;
u16 iram_addr;
u16 *dram_maddr;
u32 dram_len;
u16 dram_addr;
DSPCallback init_cb;
DSPCallback res_cb;
DSPCallback done_cb;
DSPCallback req_cb;
struct _dsp_task *next;
struct _dsp_task *prev;
} dsptask_t;
void DSP_Init();
u32 DSP_CheckMailTo();
u32 DSP_CheckMailFrom();
u32 DSP_ReadMailFrom();
void DSP_AssertInt();
void DSP_SendMailTo(u32 mail);
u32 DSP_ReadCPUtoDSP();
dsptask_t* DSP_AddTask(dsptask_t *task);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

639
Source/DSPSpy/dsp_code.ds Normal file
View File

@ -0,0 +1,639 @@
DSCR: equ 0xffc9 ; DSP DMA Control Reg
DSBL: equ 0xffcb ; DSP DMA Block Length
DSPA: equ 0xffcd ; DSP DMA DMEM Address
DSMAH: equ 0xffce ; DSP DMA Mem Address H
DSMAL: equ 0xffcf ; DSP DMA Mem Address L
ACSAH: equ 0xffd4
ACSAL: equ 0xffd5
ACEAH: equ 0xffd6
ACEAL: equ 0xffd7
ACCAH: equ 0xffd8
ACCAL: equ 0xffd9
AMDM: equ 0xffef ; ARAM DMA Request Mask
DIRQ: equ 0xfffb ; DSP Irq Request
DMBH: equ 0xfffc ; DSP Mailbox H
DMBL: equ 0xfffd ; DSP Mailbox L
CMBH: equ 0xfffe ; CPU Mailbox H
CMBL: equ 0xffff ; CPU Mailbox L
R00: equ 0x00
R01: equ 0x01
R02: equ 0x02
R03: equ 0x03
R04: equ 0x04
R05: equ 0x05
R06: equ 0x06
R07: equ 0x07
R08: equ 0x08
R09: equ 0x09
R0A: equ 0x0a
R0B: equ 0x0b
R0C: equ 0x0c
R0D: equ 0x0d
R0E: equ 0x0e
R0F: equ 0x0f
R10: equ 0x10
R11: equ 0x11
R12: equ 0x12
R13: equ 0x13
R14: equ 0x14
R15: equ 0x15
R16: equ 0x16
R17: equ 0x17
R18: equ 0x18
R19: equ 0x19
R1A: equ 0x1a
R1B: equ 0x1b
R1C: equ 0x1c
R1D: equ 0x1d
R1E: equ 0x1e
R1F: equ 0x1f
ACH0: equ 0x10
ACH1: equ 0x11
ACL0: equ 0x1e
ACL1: equ 0x1f
DSP_CR_IMEM: equ 2
DSP_CR_TO_CPU: equ 1
REGS_BASE: equ 0x0f80
MEM_HI: equ 0x0f7E
MEM_LO: equ 0x0f7F
; Interrupt vectors 8 vectors, 2 opcodes each
jmp irq0
jmp irq1
jmp irq2
jmp irq3
jmp irq4
jmp irq5
jmp irq6
jmp irq7
; Main code at 0x10
CW 0x1302
CW 0x1303
CW 0x1204
CW 0x1305
CW 0x1306
s40
lri $r12, #0x00ff
main:
cw 0x8900
cw 0x8100
; get address of memory dump and copy it
call wait_for_dsp_mbox
si @DMBH, #0x8888
si @DMBL, #0xdead
si @DIRQ, #0x0001
call wait_for_cpu_mbox
lrs $ACL0, @CMBL
andi $acl1, #0x7fff
sr @MEM_HI, $ACL1
sr @MEM_LO, $ACL0
lri $r18, #0
lri $r19, #0 ;(DSP_CR_IMEM | DSP_CR_TO_CPU)
lri $r1a, #0x2000
lr $r1c, @MEM_HI
lr $r1e, @MEM_LO
call do_dma
; get address of registers and DMA them to memory
call wait_for_dsp_mbox
si @DMBH, #0x8888
si @DMBL, #0xbeef
si @DIRQ, #0x0001
call wait_for_cpu_mbox
lrs $ACL0, @CMBL
andi $acl1, #0x7fff
sr @MEM_HI, $ACL1
sr @MEM_LO, $ACL0
lri $r18, #REGS_BASE
lri $r19, #0 ;(DSP_CR_IMEM | DSP_CR_TO_CPU)
lri $r1a, #0x80
lr $r1c, @MEM_HI
lr $r1e, @MEM_LO
call do_dma
lri $r00, #REGS_BASE+1
lrri $r01, @$r00
lrri $r02, @$r00
lrri $r03, @$r00
lrri $r04, @$r00
lrri $r05, @$r00
lrri $r06, @$r00
lrri $r07, @$r00
lrri $r08, @$r00
lrri $r09, @$r00
lrri $r0a, @$r00
lrri $r0b, @$r00
lrri $r0c, @$r00
lrri $r0d, @$r00
lrri $r0e, @$r00
lrri $r0f, @$r00
lrri $r10, @$r00
lrri $r11, @$r00
lrri $r12, @$r00
lrri $r13, @$r00
lrri $r14, @$r00
lrri $r15, @$r00
lrri $r16, @$r00
lrri $r17, @$r00
lrri $r18, @$r00
lrri $r19, @$r00
lrri $r1a, @$r00
lrri $r1b, @$r00
lrri $r1c, @$r00
lrri $r1d, @$r00
lrri $r1e, @$r00
lrri $r1f, @$r00
lr $r00, @REGS_BASE
nop
nop
nop
nop
cw 0x8600
call send_back
JMP ende
; call dump_memory
; call send_back
; 0x041e
;
cw 0x00de
cw 0x03f1
call send_back
cw 0x0200
cw 0x0a60
call send_back
cw 0x1c7e
call send_back
cw 0x8100
call send_back
cw 0x8900
call send_back
cw 0x009f
cw 0x00a0
call send_back
cw 0x00de
cw 0x03f1
call send_back
cw 0x5d00
call send_back
cw 0x0e50
call send_back
cw 0x0750
call send_back
cw 0x0270
call send_back
cw 0x5d00
call send_back
cw 0x00da
cw 0x03f2
call send_back
cw 0x8600
call send_back
JNS g_0c4d
; cw 0x0290
; cw 0x0c4d
; call send_back JX0
cw 0x00de
cw 0x03f3
call send_back
cw 0x5c00
call send_back
JLE g_0c38
; cw 0x0293
; cw 0x0c38 JX3
; call send_back
JMP g_0c52
; cw 0x029f
; cw 0x0c52
; call send_back
g_0c38:
cw 0x00db
cw 0x03f7
call send_back
cw 0x009e
cw 0x8000
call send_back
cw 0x4600
call send_back
JMP g_0c44
; cw 0x029f
; cw 0x0c44
; call send_back
g_0c3f:
cw 0x00db
cw 0x03f7
call send_back
cw 0x009e
cw 0x8000
call send_back
cw 0x5600
call send_back
g_0c44:
cw 0x00fe
cw 0x03f5
call send_back
cw 0x1fda
call send_back
cw 0x7c00
call send_back
cw 0x1f5e
call send_back
cw 0x00fe
cw 0x03f2
call send_back
JMP g_0c52
; cw 0x029f
; cw 0x0c52
; call send_back
g_0c4d:
cw 0x00de
cw 0x03f4
call send_back
cw 0x5d00
call send_back
JLE g_0c3f
; cw 0x0293
; cw 0x0c3f
; call send_back
g_0c52:
cw 0x8900
call send_back
cw 0x00dd
cw 0x03f5
call send_back
cw 0x1501
call send_back
cw 0x8100
call send_back
cw 0x00dc
cw 0x03f6
call send_back
cw 0x008b
cw 0x009f
call send_back
cw 0x0080
cw 0x0a00
call send_back
cw 0x0900
call send_back
BLOOPI #0x50, g_0c65
; cw 0x1150
; cw 0x0c65
; call send_back
cw 0x1878
call send_back
cw 0x4c00
call send_back
cw 0x1cfe
call send_back
cw 0x001f
call send_back
cw 0x1fd9
call send_back
g_0c65:
cw 0x1b18
call send_back
cw 0x009f
cw 0x0a60
call send_back
cw 0x1fc3
call send_back
cw 0x5c00
call send_back
cw 0x00fe
cw 0x03f1
call send_back
cw 0x00fc
cw 0x03f6
call send_back
cw 0x008b
cw 0xffff
call send_back
ende:
nop
nop
nop
nop
nop
nop
nop
dead_loop:
jmp dead_loop
do_dma:
sr @DSMAH, $r1c
sr @DSMAL, $r1e
sr @DSPA, $r18
sr @DSCR, $r19
sr @DSBL, $r1a
wait_dma:
LRS $ACL1, @DSCR
andcf $acl1, #0x0004
JLZ wait_dma
RET
wait_for_dsp_mbox:
lrs $ACL1, @DMBH
andcf $acl1, #0x8000
jlz wait_for_dsp_mbox
ret
wait_for_cpu_mbox:
lrs $ACL1, @cmbh
andcf $acl1, #0x8000
jlnz wait_for_cpu_mbox
ret
irq0:
lri $acl0, #0x0000
jmp irq
irq1:
lri $acl0, #0x0001
jmp irq
irq2:
lri $acl0, #0x0002
jmp irq
irq3:
lri $acl0, #0x0003
jmp irq
irq4:
lri $acl0, #0x0004
jmp irq
irq5:
; jmp finale
s40
mrr $r0d, $r1c
mrr $r0d, $r1e
clr $acc0
mrr $r1e, $r0d
mrr $r1c, $r0d
nop
nop
nop
nop
nop
nop
rti
lri $acl0, #0x0005
jmp irq
irq6:
lri $acl0, #0x0006
jmp irq
irq7:
lri $acl0, #0x0007
jmp irq
irq:
lrs $ACL1, @DMBH
andcf $acl1, #0x8000
jlz irq
si @DMBH, #0x8BAD
sr @DMBL, $r0b
;sr @DMBL, $acl0
si @DIRQ, #0x0001
halt
send_back:
; store registers to reg table
sr @REGS_BASE, $r00
lri $r00, #(REGS_BASE + 1)
srri @$r00, $r01
srri @$r00, $r02
srri @$r00, $r03
srri @$r00, $r04
srri @$r00, $r05
srri @$r00, $r06
srri @$r00, $r07
srri @$r00, $r08
srri @$r00, $r09
srri @$r00, $r0a
srri @$r00, $r0b
srri @$r00, $r0c
srri @$r00, $r0d
srri @$r00, $r0e
srri @$r00, $r0f
srri @$r00, $r10
srri @$r00, $r11
srri @$r00, $r12
srri @$r00, $r13
srri @$r00, $r14
srri @$r00, $r15
srri @$r00, $r16
srri @$r00, $r17
srri @$r00, $r18
srri @$r00, $r19
srri @$r00, $r1a
srri @$r00, $r1b
srri @$r00, $r1c
srri @$r00, $r1d
srri @$r00, $r1e
srri @$r00, $r1f
lri $r18, #0x0000
lri $r19, #1 ;(DSP_CR_IMEM | DSP_CR_TO_CPU)
lri $r1a, #0x200
lr $r1c, @MEM_HI
lr $r1e, @MEM_LO
lri $r01, #8+8
bloop $r01, dma_copy
call do_dma
addi $r1e, #0x200
mrr $r1f, $r18
addi $r1f, #0x100
mrr $r18, $r1f
nop
dma_copy:
nop
call wait_for_dsp_mbox
si @DMBH, #0x8888
si @DMBL, #0xfeeb
si @DIRQ, #0x0001
; wait for answer before we execute the next op
call wait_for_cpu_mbox
lrs $ACL0, @CMBL
andi $acl1, #0x7fff
lri $r00, #REGS_BASE+1
lrri $r01, @$r00
lrri $r02, @$r00
lrri $r03, @$r00
lrri $r04, @$r00
lrri $r05, @$r00
lrri $r06, @$r00
lrri $r07, @$r00
lrri $r08, @$r00
lrri $r09, @$r00
lrri $r0a, @$r00
lrri $r0b, @$r00
lrri $r0c, @$r00
lrri $r0d, @$r00
lrri $r0e, @$r00
lrri $r0f, @$r00
lrri $r10, @$r00
lrri $r11, @$r00
lrri $r12, @$r00
lrri $r13, @$r00
lrri $r14, @$r00
lrri $r15, @$r00
lrri $r16, @$r00
lrri $r17, @$r00
lrri $r18, @$r00
lrri $r19, @$r00
lrri $r1a, @$r00
lrri $r1b, @$r00
lrri $r1c, @$r00
lrri $r1d, @$r00
lrri $r1e, @$r00
lrri $r1f, @$r00
lr $r00, @REGS_BASE
ret
send_back_16:
cw 0x8e00
call send_back
cw 0x8f00
ret
dump_memory:
lri $r02, #0x0000
lri $acl0, #0x1000
lri $r01, #0x1000
bloop $r01, _fill_loop2
mrr $r03, $acl0
cw 0x80f0
mrr $r1f, $r00
mrr $r00, $r02
srri @$r00, $r1b
mrr $r02, $r00
mrr $r00, $r1f
addis $acc0, #0x1
_fill_loop2:
nop
ret

41
Source/DSPSpy/dsp_code.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef _MSCVER
const unsigned short dsp_code[0x1000] = {
#else
const unsigned short dsp_code[0x1000] __attribute__ ((aligned (64))) = {
#endif
0x029f, 0x015b, 0x029f, 0x015f, 0x029f, 0x0163, 0x029f, 0x0167, 0x029f, 0x016b, 0x029f, 0x016f, 0x029f, 0x0180, 0x029f, 0x0184,
0x1302, 0x1303, 0x1204, 0x1305, 0x1306, 0x8e00, 0x0092, 0x00ff, 0x8900, 0x8100, 0x02bf, 0x014f, 0x16fc, 0x8888, 0x16fd, 0xdead,
0x16fb, 0x0001, 0x02bf, 0x0155, 0x26ff, 0x0340, 0x7fff, 0x00ff, 0x0f7e, 0x00fe, 0x0f7f, 0x0098, 0x0000, 0x0099, 0x0000, 0x009a,
0x2000, 0x00dc, 0x0f7e, 0x00de, 0x0f7f, 0x02bf, 0x013f, 0x02bf, 0x014f, 0x16fc, 0x8888, 0x16fd, 0xbeef, 0x16fb, 0x0001, 0x02bf,
0x0155, 0x26ff, 0x0340, 0x7fff, 0x00ff, 0x0f7e, 0x00fe, 0x0f7f, 0x0098, 0x0f80, 0x0099, 0x0000, 0x009a, 0x0080, 0x00dc, 0x0f7e,
0x00de, 0x0f7f, 0x02bf, 0x013f, 0x0080, 0x0f81, 0x1901, 0x1902, 0x1903, 0x1904, 0x1905, 0x1906, 0x1907, 0x1908, 0x1909, 0x190a,
0x190b, 0x190c, 0x190d, 0x190e, 0x190f, 0x1910, 0x1911, 0x1912, 0x1913, 0x1914, 0x1915, 0x1916, 0x1917, 0x1918, 0x1919, 0x191a,
0x191b, 0x191c, 0x191d, 0x191e, 0x191f, 0x00c0, 0x0f80, 0x0000, 0x0000, 0x0000, 0x0000, 0x8600, 0x02bf, 0x0194, 0x029f, 0x0136,
0x00de, 0x03f1, 0x02bf, 0x0194, 0x0200, 0x0a60, 0x02bf, 0x0194, 0x1c7e, 0x02bf, 0x0194, 0x8100, 0x02bf, 0x0194, 0x8900, 0x02bf,
0x0194, 0x009f, 0x00a0, 0x02bf, 0x0194, 0x00de, 0x03f1, 0x02bf, 0x0194, 0x5d00, 0x02bf, 0x0194, 0x0e50, 0x02bf, 0x0194, 0x0750,
0x02bf, 0x0194, 0x0270, 0x02bf, 0x0194, 0x5d00, 0x02bf, 0x0194, 0x00da, 0x03f2, 0x02bf, 0x0194, 0x8600, 0x02bf, 0x0194, 0x0290,
0x00e7, 0x00de, 0x03f3, 0x02bf, 0x0194, 0x5c00, 0x02bf, 0x0194, 0x0293, 0x00bc, 0x029f, 0x00f0, 0x00db, 0x03f7, 0x02bf, 0x0194,
0x009e, 0x8000, 0x02bf, 0x0194, 0x4600, 0x02bf, 0x0194, 0x029f, 0x00d4, 0x00db, 0x03f7, 0x02bf, 0x0194, 0x009e, 0x8000, 0x02bf,
0x0194, 0x5600, 0x02bf, 0x0194, 0x00fe, 0x03f5, 0x02bf, 0x0194, 0x1fda, 0x02bf, 0x0194, 0x7c00, 0x02bf, 0x0194, 0x1f5e, 0x02bf,
0x0194, 0x00fe, 0x03f2, 0x02bf, 0x0194, 0x029f, 0x00f0, 0x00de, 0x03f4, 0x02bf, 0x0194, 0x5d00, 0x02bf, 0x0194, 0x0293, 0x00c9,
0x8900, 0x02bf, 0x0194, 0x00dd, 0x03f5, 0x02bf, 0x0194, 0x1501, 0x02bf, 0x0194, 0x8100, 0x02bf, 0x0194, 0x00dc, 0x03f6, 0x02bf,
0x0194, 0x008b, 0x009f, 0x02bf, 0x0194, 0x0080, 0x0a00, 0x02bf, 0x0194, 0x0900, 0x02bf, 0x0194, 0x1150, 0x011d, 0x1878, 0x02bf,
0x0194, 0x4c00, 0x02bf, 0x0194, 0x1cfe, 0x02bf, 0x0194, 0x001f, 0x02bf, 0x0194, 0x1fd9, 0x02bf, 0x0194, 0x1b18, 0x02bf, 0x0194,
0x009f, 0x0a60, 0x02bf, 0x0194, 0x1fc3, 0x02bf, 0x0194, 0x5c00, 0x02bf, 0x0194, 0x00fe, 0x03f1, 0x02bf, 0x0194, 0x00fc, 0x03f6,
0x02bf, 0x0194, 0x008b, 0xffff, 0x02bf, 0x0194, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x029f, 0x013d, 0x00fc,
0xffce, 0x00fe, 0xffcf, 0x00f8, 0xffcd, 0x00f9, 0xffc9, 0x00fa, 0xffcb, 0x27c9, 0x03c0, 0x0004, 0x029d, 0x0149, 0x02df, 0x27fc,
0x03c0, 0x8000, 0x029d, 0x014f, 0x02df, 0x27fe, 0x03c0, 0x8000, 0x029c, 0x0155, 0x02df, 0x009e, 0x0000, 0x029f, 0x0188, 0x009e,
0x0001, 0x029f, 0x0188, 0x009e, 0x0002, 0x029f, 0x0188, 0x009e, 0x0003, 0x029f, 0x0188, 0x009e, 0x0004, 0x029f, 0x0188, 0x8e00,
0x1dbc, 0x1dbe, 0x8100, 0x1fcd, 0x1f8d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02ff, 0x009e, 0x0005, 0x029f, 0x0188,
0x009e, 0x0006, 0x029f, 0x0188, 0x009e, 0x0007, 0x029f, 0x0188, 0x27fc, 0x03c0, 0x8000, 0x029d, 0x0188, 0x16fc, 0x8bad, 0x00eb,
0xfffd, 0x16fb, 0x0001, 0x0021, 0x00e0, 0x0f80, 0x0080, 0x0f81, 0x1b01, 0x1b02, 0x1b03, 0x1b04, 0x1b05, 0x1b06, 0x1b07, 0x1b08,
0x1b09, 0x1b0a, 0x1b0b, 0x1b0c, 0x1b0d, 0x1b0e, 0x1b0f, 0x1b10, 0x1b11, 0x1b12, 0x1b13, 0x1b14, 0x1b15, 0x1b16, 0x1b17, 0x1b18,
0x1b19, 0x1b1a, 0x1b1b, 0x1b1c, 0x1b1d, 0x1b1e, 0x1b1f, 0x0098, 0x0000, 0x0099, 0x0001, 0x009a, 0x0200, 0x00dc, 0x0f7e, 0x00de,
0x0f7f, 0x0081, 0x0010, 0x0061, 0x01ce, 0x02bf, 0x013f, 0x0200, 0x0200, 0x1ff8, 0x0300, 0x0100, 0x1f1f, 0x0000, 0x0000, 0x02bf,
0x014f, 0x16fc, 0x8888, 0x16fd, 0xfeeb, 0x16fb, 0x0001, 0x02bf, 0x0155, 0x26ff, 0x0340, 0x7fff, 0x0080, 0x0f81, 0x1901, 0x1902,
0x1903, 0x1904, 0x1905, 0x1906, 0x1907, 0x1908, 0x1909, 0x190a, 0x190b, 0x190c, 0x190d, 0x190e, 0x190f, 0x1910, 0x1911, 0x1912,
0x1913, 0x1914, 0x1915, 0x1916, 0x1917, 0x1918, 0x1919, 0x191a, 0x191b, 0x191c, 0x191d, 0x191e, 0x191f, 0x00c0, 0x0f80, 0x02df,
0x8e00, 0x02bf, 0x0194, 0x8f00, 0x02df, 0x0082, 0x0000, 0x009e, 0x1000, 0x0081, 0x1000, 0x0061, 0x0215, 0x1c7e, 0x80f0, 0x1fe0,
0x1c02, 0x1b1b, 0x1c40, 0x1c1f, 0x0401, 0x0000, 0x02df,
};

View File

@ -0,0 +1 @@
../../Binary/x64/DSPTool.exe -h dsp_code dsp_code.ds

97
Source/DSPSpy/irq.h Normal file
View File

@ -0,0 +1,97 @@
#ifndef __IRQ_H__
#define __IRQ_H__
#include <gctypes.h>
#include "context.h"
#define IM_NONE (0x00000000)
#define IRQ_MEM0 0
#define IRQ_MEM1 1
#define IRQ_MEM2 2
#define IRQ_MEM3 3
#define IRQ_MEMADDRESS 4
#define IRQ_DSP_AI 5
#define IRQ_DSP_ARAM 6
#define IRQ_DSP_DSP 7
#define IRQ_AI_AI 8
#define IRQ_EXI0_EXI 9
#define IRQ_EXI0_TC 10
#define IRQ_EXI0_EXT 11
#define IRQ_EXI1_EXI 12
#define IRQ_EXI1_TC 13
#define IRQ_EXI1_EXT 14
#define IRQ_EXI2_EXI 15
#define IRQ_EXI2_TC 16
#define IRQ_PI_CP 17
#define IRQ_PI_PETOKEN 18
#define IRQ_PI_PEFINISH 19
#define IRQ_PI_SI 20
#define IRQ_PI_DI 21
#define IRQ_PI_RSW 22
#define IRQ_PI_ERROR 23
#define IRQ_PI_VI 24
#define IRQ_PI_DEBUG 25
#define IRQ_PI_HSP 26
#define IRQ_MAX 32
#define IRQMASK(irq) (0x80000000u>>irq)
#define IM_MEM0 IRQMASK(IRQ_MEM0)
#define IM_MEM1 IRQMASK(IRQ_MEM1)
#define IM_MEM2 IRQMASK(IRQ_MEM2)
#define IM_MEM3 IRQMASK(IRQ_MEM3)
#define IM_MEMADDRESS IRQMASK(IRQ_MEMADDRESS)
#define IM_MEM (IM_MEM0|IM_MEM1|IM_MEM2|IM_MEM3|IM_MEMADDRESS)
#define IM_DSP_AI IRQMASK(IRQ_DSP_AI)
#define IM_DSP_ARAM IRQMASK(IRQ_DSP_ARAM)
#define IM_DSP_DSP IRQMASK(IRQ_DSP_DSP)
#define IM_DSP (IM_DSP_AI|IM_DSP_ARAM|IM_DSP_DSP)
#define IM_AI_AI IRQMASK(IRQ_AI_AI)
#define IM_AI (IRQ_AI_AI)
#define IM_EXI0_EXI IRQMASK(IRQ_EXI0_EXI)
#define IM_EXI0_TC IRQMASK(IRQ_EXI0_TC)
#define IM_EXI0_EXT IRQMASK(IRQ_EXI0_EXT)
#define IM_EXI0 (IM_EXI0_EXI|IM_EXI0_TC|IM_EXI0_EXT)
#define IM_EXI1_EXI IRQMASK(IRQ_EXI1_EXI)
#define IM_EXI1_TC IRQMASK(IRQ_EXI1_TC)
#define IM_EXI1_EXT IRQMASK(IRQ_EXI1_EXT)
#define IM_EXI1 (IM_EXI1_EXI|IM_EXI1_TC|IM_EXI1_EXT)
#define IM_EXI2_EXI IRQMASK(IRQ_EXI2_EXI)
#define IM_EXI2_TC IRQMASK(IRQ_EXI2_TC)
#define IM_EXI2 (IM_EXI2_EXI|IM_EXI2_TC)
#define IM_EXI (IM_EXI0|IM_EXI1|IM_EXI2)
#define IM_PI_CP IRQMASK(IRQ_PI_CP)
#define IM_PI_PETOKEN IRQMASK(IRQ_PI_PETOKEN)
#define IM_PI_PEFINISH IRQMASK(IRQ_PI_PEFINISH)
#define IM_PI_SI IRQMASK(IRQ_PI_SI)
#define IM_PI_DI IRQMASK(IRQ_PI_DI)
#define IM_PI_RSW IRQMASK(IRQ_PI_RSW)
#define IM_PI_ERROR IRQMASK(IRQ_PI_ERROR)
#define IM_PI_VI IRQMASK(IRQ_PI_VI)
#define IM_PI_DEBUG IRQMASK(IRQ_PI_DEBUG)
#define IM_PI_HSP IRQMASK(IRQ_PI_HSP)
#define IM_PI (IM_PI_CP|IM_PI_PETOKEN|IM_PI_PEFINISH|IM_PI_SI|IM_PI_DI|IM_PI_RSW|IM_PI_ERROR|IM_PI_VI|IM_PI_DEBUG|IM_PI_HSP)
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef void (raw_irq_handler_t)(u32,void *);
raw_irq_handler_t* IRQ_Request(u32 nIrq,raw_irq_handler_t *pHndl,void *pCtx);
raw_irq_handler_t* IRQ_Free(u32 nIrq);
raw_irq_handler_t* IRQ_GetHandler(u32 nIrq);
u32 IRQ_Disable();
void IRQ_Restore(u32 level);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

658
Source/DSPSpy/main_spy.cpp Normal file
View File

@ -0,0 +1,658 @@
// This is a test program for running code on the Wii DSP, with full control over input
// and automatic compare with output. VERY useful for figuring out what those little
// ops actually do.
// It's very unpolished though
// Use Dolphin's dsptool to generate a new dsp_code.h.
// Originally written by FIRES?
#include <gccore.h>
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ogcsys.h>
#include <time.h>
#include <fat.h>
#include <fcntl.h>
#include <wiiuse/wpad.h>
#include "color.h"
#include "network.h"
#include "dsp.h"
#include "asm.h"
#include "processor.h"
#include "irq.h"
#include "dsp.h"
// This is where the DSP binary is.
#include "dsp_code.h"
// DSPCR bits
#define DSPCR_DSPRESET 0x0800 // Reset DSP
#define DSPCR_ARDMA 0x0200 // ARAM dma in progress, if set
#define DSPCR_DSPINTMSK 0x0100 // * interrupt mask (RW)
#define DSPCR_DSPINT 0x0080 // * interrupt active (RWC)
#define DSPCR_ARINTMSK 0x0040
#define DSPCR_ARINT 0x0020
#define DSPCR_AIINTMSK 0x0010
#define DSPCR_AIINT 0x0008
#define DSPCR_HALT 0x0004 // halt DSP
#define DSPCR_PIINT 0x0002 // assert DSP PI interrupt
#define DSPCR_RES 0x0001 // reset DSP
u16 dspbuffer[16 * 1024] __attribute__ ((aligned (0x4000)));
// #define ENABLE_OUT
#undef ENABLE_OUT
static void *xfb = NULL;
void (*reload)() = (void(*)())0x80001800;
GXRModeObj *rmode;
static vu16* const _dspReg = (u16*)0xCC005000;
u16 *dspbufP;
u16 *dspbufC;
u32 *dspbufU;
u16 opcode[4] = {
0x0000, 0x0000, 0x0000, 0x0000,
};
u16 dspreg_in[32] = {
0x0410, 0x0510, 0x0610, 0x0710, 0x0810, 0x0910, 0x0a10, 0x0b10,
0x0411, 0x0522, 0x0633, 0x0744, 0x0855, 0x0966, 0x0a77, 0x0b88,
0x0014, 0xfff5, 0x00ff, 0x2200, 0x0000, 0x0000, 0x0000, 0x0000,
0x0003, 0x0004, 0x8000, 0x000C, 0x0007, 0x0008, 0x0009, 0x000a,
}; /// ax_h_1 ax_h_1
/* ttt
u16 dspreg_in[32] = {
0x0e4c, 0x03c0, 0x0bd9, 0x06a3, 0x0c06, 0x0240, 0x0010, 0x0ecc,
0x0000, 0x0000, 0x0000, 0x0000, 0x0322, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x00ff, 0x1b41, 0x0000, 0x0040, 0x00ff, 0x0000,
0x1000, 0x96cc, 0x0000, 0x0000, 0x3fc0, 0x96cc, 0x0000, 0x0000,
}; */
// if i set bit 0x4000 of SR my tests crashes :(
/*
// zelda 0x00da
u16 dspreg_in[32] = {
0x0a50, 0x0ca2, 0x04f8, 0x0ab0, 0x8039, 0x0000, 0x0000, 0x0000,
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x03d1, 0x0000, 0x0418, 0x0002, // r08 must have a value ... no idea why
0x0000, 0x0000, 0x00ff, 0x1804, 0xdb70, 0x4ddb, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0xde6d, 0x0000, 0x0000, 0x0000, 0x004e,
};*/
u16 dspreg_out[1000][32];
u16 dsp_steps = 0;
u16 show_step = 0;
#include "mem_dump.h"
// #include "dsp_test.cpp"
u32 padding[1024];
s32 cursor_x = 1;
s32 cursor_y = 1;
s32 old_cur_x;
s32 old_cur_y;
s32 small_cursor_x;
u32 ui_mode;
#define UIM_SEL 1
#define UIM_EDIT_REG 2
#define UIM_EDIT_BIN 4
PADStatus gpad;
PADStatus opad;
u16 *reg_value;
void ds_text_out(int xpos, int ypos, const char *str);
void ds_set_colour(int f, int b);
void ds_init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride);
void ds_underline(int xpos, int ypos, int len, int col);
void ds_printf(int x, int y, const char *fmt, ...);
void ds_clear(void);
volatile int regs_refreshed = false;
static void my__dsp_handler(u32 nIrq,void *pCtx)
{
// volatile u32 mail;
_dspReg[5] = (_dspReg[5]&~(DSPCR_AIINT|DSPCR_ARINT))|DSPCR_DSPINT;
/*
while(!DSP_CheckMailFrom());
mail = DSP_ReadMailFrom();
if (mail == 0x8888beef)
{
DSP_SendMailTo((u32)dspbuf | 0x80000000);
while(DSP_CheckMailTo());
regs_refreshed = false;
return;
}
else if (mail == 0x8888beeb)
{
regs_refreshed = true;
return;
}
*/
// printf("Mail: %08x\n", mail);
}
const int r_off_x = 2;
const int r_off_y = 2;
vu16 val_x = 0x1234;
void print_regs(u16 _step)
{
int i, j;
for(j = 0 ; j < 4 ; j++)
{
for(i = 0 ; i < 8 ; i++)
{
int reg = j * 8 + i;
ds_set_colour(COLOR_GREEN, COLOR_BLACK);
ds_printf(0 + j * 8, i + 2, "%02x_", reg);
ds_set_colour(COLOR_WHITE, COLOR_BLACK);
if (_step == 0)
ds_printf(3 + j * 8, i + 2, "%04x", dspreg_in[reg]);
else
ds_printf(3 + j * 8, i + 2, "%04x", dspreg_out[_step-1][reg]);
}
}
// for(i = 0 ; i < 4 ; i++)
{
ds_set_colour(COLOR_WHITE, COLOR_BLACK);
ds_printf(4, 11, "%03i / %03i", _step+1, dsp_steps);
/* ds_set_colour(COLOR_WHITE, COLOR_BLACK);
int j;
for(j = 0 ; j < 16 ; j++)
ds_printf(10 + j, i + 11, "%d", (opcode[i] >> (15 - j)) & 0x1);*/
}
for(j = 0 ; j < 4 ; j++)
{
for(i = 0 ; i < 8 ; i++)
{
char tmpbuf1[20];
int reg = j * 8 + i;
sprintf(tmpbuf1, "%02x_", reg);
ds_set_colour(COLOR_GREEN, COLOR_BLACK);
ds_text_out(33 + j * 8, i + 2, tmpbuf1);
sprintf(tmpbuf1, "%04x", dspreg_out[_step][reg]);
bool Red = true;
if (_step == 0)
Red = dspreg_in[reg] != dspreg_out[_step][reg];
else
Red = dspreg_out[_step-1][reg] != dspreg_out[_step][reg];
if (Red)
ds_set_colour(COLOR_RED, COLOR_BLACK);
else
ds_set_colour(COLOR_WHITE, COLOR_BLACK);
ds_text_out(36 + j * 8, i + 2, tmpbuf1);
}
}
//ds_printf(4, 15, "DMA: %04x %04x %04x", _dspReg[16], _dspReg[17], _dspReg[18]);
ds_printf(4, 15, "DICR: %04x ",val_x);
ds_printf(4, 25, " ");
static int count = 0;
int x, y;
y = 16;
x = 0;
if (count > 2)
ds_clear();
count = 0;
ds_set_colour(COLOR_WHITE, COLOR_BLACK);
for (i = 0x0; i < 0xf70 ; i++)
{
if (dspbufC[i] != mem_dump[i])
{
ds_printf(x, y, "%04x=%04x", i, dspbufC[i]);
count++;
x+=10; if (x >= 60) { x=0 ; y++;};
}
}
ds_printf(4, 25, "%08x", count);
}
void hide_cursor(void)
{
if (old_cur_y < 8)
{
ds_underline(old_cur_x * 8 + 3, old_cur_y + 2, 4, COLOR_BLACK);
}
else
{
if (old_cur_x == 0) ds_underline(4, cursor_y + 3, 4, COLOR_BLACK);
else ds_underline(10, cursor_y + 3, 16, COLOR_BLACK);
}
}
void show_cursor(void)
{
if (ui_mode == UIM_SEL)
{
if (cursor_y < 8)
{
ds_underline(cursor_x * 8 + 3, cursor_y + 2, 4, COLOR_WHITE);
}
else
{
if (cursor_x == 0)
ds_underline(4, cursor_y + 3, 4, COLOR_WHITE);
else
ds_underline(10, cursor_y + 3, 16, COLOR_WHITE);
}
}
else
{
if (cursor_y < 8)
{
ds_underline(cursor_x * 8 + 3 + small_cursor_x, cursor_y + 2, 1, COLOR_WHITE);
}
else
{
if (cursor_x == 0)
ds_underline(4 + small_cursor_x, cursor_y + 3, 1, COLOR_WHITE);
else
ds_underline(10 + small_cursor_x, cursor_y + 3, 1, COLOR_WHITE);
}
}
old_cur_x = cursor_x;
old_cur_y = cursor_y;
}
void check_pad(void)
{
PADStatus pads[4];
PAD_Read(pads);
if (opad.button == pads[0].button)
{
gpad.button = 0;
return;
}
opad.button = gpad.button = pads[0].button;
return;
}
void ui_pad_sel(void)
{
if (gpad.button & PAD_BUTTON_RIGHT)
{
cursor_x++;
}
if (gpad.button & PAD_BUTTON_LEFT)
{
cursor_x--;
}
if (gpad.button & PAD_BUTTON_UP)
{
cursor_y--;
}
if (gpad.button & PAD_BUTTON_DOWN)
{
cursor_y++;
if (cursor_y == 8)
cursor_x = 0;
}
if (cursor_y < 0)
{
cursor_y = 11;
cursor_x = 0;
}
else if (cursor_y > 11)
cursor_y = 0;
if (cursor_y < 8)
cursor_x &= 0x3;
else
cursor_x &= 0x1;
if (gpad.button & PAD_BUTTON_A)
{
if (cursor_y < 8)
{
ui_mode = UIM_EDIT_REG;
reg_value = &dspreg_in[cursor_y + cursor_x * 8];
}
else
{
if (cursor_x == 0)
ui_mode = UIM_EDIT_REG;
else
ui_mode = UIM_EDIT_BIN;
reg_value = &opcode[cursor_y-8];
}
}
}
void ui_pad_edit_bin(void)
{
u8 pos;
if (gpad.button & PAD_BUTTON_RIGHT)
{
small_cursor_x++;
}
if (gpad.button & PAD_BUTTON_LEFT)
{
small_cursor_x--;
}
small_cursor_x &= 0xf;
if (gpad.button & PAD_BUTTON_UP)
{
pos = 0xf - small_cursor_x;
*reg_value |= 1 << pos;
}
if (gpad.button & PAD_BUTTON_DOWN)
{
pos = 0xf - small_cursor_x;
*reg_value &= ~(1 << pos);
}
if (gpad.button & PAD_BUTTON_A)
{
ui_mode = UIM_SEL;
}
}
void ui_pad_edit_reg(void)
{
if (gpad.button & PAD_BUTTON_RIGHT)
{
small_cursor_x++;
}
if (gpad.button & PAD_BUTTON_LEFT)
{
small_cursor_x--;
}
if (gpad.button & PAD_BUTTON_UP)
{
*reg_value += 0x1 << (4 * (3 - small_cursor_x));
}
if (gpad.button & PAD_BUTTON_DOWN)
{
*reg_value -= 0x1 << (4 * (3 - small_cursor_x));
}
small_cursor_x &= 0x3;
if (gpad.button & PAD_BUTTON_A)
{
ui_mode = UIM_SEL;
}
if (gpad.button & PAD_BUTTON_X)
*reg_value = 0;
if (gpad.button & PAD_BUTTON_Y)
*reg_value = 0xffff;
}
void init_video(void)
{
VIDEO_Init();
switch(VIDEO_GetCurrentTvMode())
{
case VI_NTSC:
rmode = &TVNtsc480IntDf;
break;
case VI_PAL:
rmode = &TVPal528IntDf;
break;
case VI_MPAL:
rmode = &TVMpal480IntDf;
break;
default:
rmode = &TVNtsc480IntDf;
break;
}
PAD_Init();
//xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
xfb = SYS_AllocateFramebuffer(rmode);
VIDEO_Configure(rmode);
VIDEO_SetNextFramebuffer(xfb);
VIDEO_SetBlack(FALSE);
VIDEO_Flush();
VIDEO_WaitVSync();
//if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
//VIDEO_SetPreRetraceCallback(ScanPads);
}
void my_send_task(void *addr, u16 iram_addr, u16 len, u16 start)
{
while(DSP_CheckMailTo());
DSP_SendMailTo(0x80F3A001);
while(DSP_CheckMailTo());
DSP_SendMailTo((u32)addr);
while(DSP_CheckMailTo());
DSP_SendMailTo(0x80F3C002);
while(DSP_CheckMailTo());
DSP_SendMailTo(iram_addr);
while(DSP_CheckMailTo());
DSP_SendMailTo(0x80F3A002);
while(DSP_CheckMailTo());
DSP_SendMailTo(len);
while(DSP_CheckMailTo());
DSP_SendMailTo(0x80F3B002);
while(DSP_CheckMailTo());
DSP_SendMailTo(0);
while(DSP_CheckMailTo());
DSP_SendMailTo(0x80F3D001);
while(DSP_CheckMailTo());
DSP_SendMailTo(start);
while(DSP_CheckMailTo());
}
int main()
{
int i, j;
u32 mail;
u32 level;
{
vu16 *dicr = ((vu16 *)0xcc002002);
*dicr = 0x100;
*dicr = 0x002;
// *dicr = 0x000;
// *dicr = 0x001;
val_x = *dicr;
}
init_video();
//console_init(xfb,20,64,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*2);
ds_init(xfb,20,64,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*2);
ui_mode = UIM_SEL;
dspbufP = (u16 *)MEM_VIRTUAL_TO_PHYSICAL(dspbuffer);
dspbufC = dspbuffer;
dspbufU = (u32 *)(MEM_K0_TO_K1(dspbuffer));
DCInvalidateRange(dspbuffer, 0x2000);
for(j = 0 ; j < 0x800 ; j++)
dspbufU[j] = 0xffffffff;
_dspReg[5] = (_dspReg[5]&~(DSPCR_AIINT|DSPCR_ARINT|DSPCR_DSPINT))|DSPCR_DSPRESET;
_dspReg[5] = (_dspReg[5]&~(DSPCR_HALT|DSPCR_AIINT|DSPCR_ARINT|DSPCR_DSPINT));
_CPU_ISR_Disable(level);
IRQ_Request(IRQ_DSP_DSP, my__dsp_handler,NULL);
_CPU_ISR_Restore(level);
#if ENABLE_OUT
if_config("192.168.0.5", "192.168.0.1", "255.255.255.0", false);
//printf("Network Intitalized\n");
#endif
WPAD_Init();
while(1)
{
if (DSP_CheckMailFrom())
{
mail = DSP_ReadMailFrom();
ds_printf(2, 1, "Mail: %08x", mail);
if (mail == 0x8071feed)
{
int n;
for (n = 0 ; n < 32 ; n++)
dspbufC[0x00 + n] = dspreg_in[n];
DCFlushRange(dspbufC, 0x2000);
/*
for (n = 0 ; n < 600 ; n++)
{
if (((u16*)dsp_test)[n] == 0x1234)
{
((u16*)dsp_test)[n+0] = opcode[0];
((u16*)dsp_test)[n+1] = opcode[1];
((u16*)dsp_test)[n+2] = opcode[2];
((u16*)dsp_test)[n+3] = opcode[3];
break;
}
}
*/
DCFlushRange((void *)dsp_code, 0x1000);
my_send_task((void *)MEM_VIRTUAL_TO_PHYSICAL(dsp_code), 0, 4000, 0x10);
((u16*)dsp_code)[n] = 0x1234; // wtf?
}
else if (mail == 0x8888dead)
{
u16* tmpBuf = (u16 *)MEM_VIRTUAL_TO_PHYSICAL(mem_dump);
while (DSP_CheckMailTo());
DSP_SendMailTo((u32)tmpBuf);
while (DSP_CheckMailTo());
regs_refreshed = false;
}
else if (mail == 0x8888beef)
{
while (DSP_CheckMailTo());
DSP_SendMailTo((u32)dspbufP);
while (DSP_CheckMailTo());
regs_refreshed = false;
}
else if (mail == 0x8888feeb)
{
DCInvalidateRange(dspbufC, 0x2000);
for(i = 0 ; i < 32 ; i++)
dspreg_out[dsp_steps][i] = dspbufC[0xf80 + i];
regs_refreshed = true;
dsp_steps++;
while(DSP_CheckMailTo());
DSP_SendMailTo(0x8000DEAD);
while(DSP_CheckMailTo());
// dump_to_pc();
}
}
VIDEO_WaitVSync();
WPAD_ScanPads();
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)
exit(0);
//ds_clear();
//if (regs_refreshed)
{
print_regs(show_step);
//regs_refreshed = false;
}
hide_cursor();
switch(ui_mode)
{
case UIM_SEL:
ui_pad_sel();
show_cursor();
break;
case UIM_EDIT_REG:
ui_pad_edit_reg();
show_cursor();
break;
case UIM_EDIT_BIN:
ui_pad_edit_bin();
show_cursor();
break;
default:
break;
}
DCFlushRange(xfb, 0x200000);
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_B)
{
DCInvalidateRange(dspbufC, 0x2000);
int n;
for(n = 0 ; n < 0x2000 ; n++)
{
// dspbufU[n/2] = 0; dspbufC[n] = 0;
}
DCFlushRange(dspbufC, 0x2000);
_dspReg[5] = (_dspReg[5]&~(DSPCR_AIINT|DSPCR_ARINT|DSPCR_DSPINT))|DSPCR_DSPRESET;
_dspReg[5] = (_dspReg[5]&~(DSPCR_HALT|DSPCR_AIINT|DSPCR_ARINT|DSPCR_DSPINT));
_dspReg[5] |= DSPCR_RES;
while(_dspReg[5]&DSPCR_RES);
_dspReg[9] = 0x63;
}
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_2)
{
vu16 *dicr = ((vu16 *)0xcc002002);
*dicr = 0x001;
val_x = *dicr;
}
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A)
{
show_step++;
if (show_step >= dsp_steps)
show_step = 0;
}
};
// Reset the DSP
_dspReg[5] = (_dspReg[5]&~(DSPCR_AIINT|DSPCR_ARINT|DSPCR_DSPINT))|DSPCR_DSPRESET;
_dspReg[5] = (_dspReg[5]&~(DSPCR_HALT|DSPCR_AIINT|DSPCR_ARINT|DSPCR_DSPINT));
reload();
// Exit
exit(0);
return 0;
}

515
Source/DSPSpy/mem_dump.h Normal file
View File

@ -0,0 +1,515 @@
unsigned int mem_dump[] __attribute__ ((aligned (64))) =
{
0x0c3966ad, 0x0d46ffdf, 0x0b396696, 0x0e5fffd8,
0x0a446669, 0x0f83ffd0, 0x095a6626, 0x10b4ffc8,
0x087d65cd, 0x11f0ffbf, 0x07ab655e, 0x1338ffb6,
0x06e464d9, 0x148cffac, 0x0628643f, 0x15ebffa1,
0x0577638f, 0x1756ff96, 0x04d162cb, 0x18cbff8a,
0x043561f3, 0x1a4cff7e, 0x03a46106, 0x1bd7ff71,
0x031c6007, 0x1d6cff64, 0x029f5ef5, 0x1f0bff56,
0x022a5dd0, 0x20b3ff48, 0x01be5c9a, 0x2264ff3a,
0x015b5b53, 0x241eff2c, 0x010159fc, 0x25e0ff1e,
0x00ae5896, 0x27a9ff10, 0x00635720, 0x297aff02,
0x001f559d, 0x2b50fef4, 0xffe2540d, 0x2d2cfee8,
0xffac5270, 0x2f0dfedb, 0xff7c50c7, 0x30f3fed0,
0xff534f14, 0x32dcfec6, 0xff2e4d57, 0x34c8febd,
0xff0f4b91, 0x36b6feb6, 0xfef549c2, 0x38a5feb0,
0xfedf47ed, 0x3a95feac, 0xfece4611, 0x3c85feab,
0xfec04430, 0x3e74feac, 0xfeb6424a, 0x4060feaf,
0xfeaf4060, 0x424afeb6, 0xfeac3e74, 0x4430fec0,
0xfeab3c85, 0x4611fece, 0xfeac3a95, 0x47edfedf,
0xfeb038a5, 0x49c2fef5, 0xfeb636b6, 0x4b91ff0f,
0xfebd34c8, 0x4d57ff2e, 0xfec632dc, 0x4f14ff53,
0xfed030f3, 0x50c7ff7c, 0xfedb2f0d, 0x5270ffac,
0xfee82d2c, 0x540dffe2, 0xfef42b50, 0x559d001f,
0xff02297a, 0x57200063, 0xff1027a9, 0x589600ae,
0xff1e25e0, 0x59fc0101, 0xff2c241e, 0x5b53015b,
0xff3a2264, 0x5c9a01be, 0xff4820b3, 0x5dd0022a,
0xff561f0b, 0x5ef5029f, 0xff641d6c, 0x6007031c,
0xff711bd7, 0x610603a4, 0xff7e1a4c, 0x61f30435,
0xff8a18cb, 0x62cb04d1, 0xff961756, 0x638f0577,
0xffa115eb, 0x643f0628, 0xffac148c, 0x64d906e4,
0xffb61338, 0x655e07ab, 0xffbf11f0, 0x65cd087d,
0xffc810b4, 0x6626095a, 0xffd00f83, 0x66690a44,
0xffd80e5f, 0x66960b39, 0xffdf0d46, 0x66ad0c39,
0x00000c8b, 0x18f82527, 0x30fb3c56, 0x471c5133,
0x5a8262f1, 0x6a6d70e2, 0x76417a7c, 0x7d897f61,
0x7fff7f61, 0x7d897a7c, 0x764170e2, 0x6a6d62f1,
0x5a825133, 0x471c3c56, 0x30fb2527, 0x18f80c8b,
0x0000f375, 0xe708dad9, 0xcf05c3aa, 0xb8e4aecd,
0xa57e9d0f, 0x95938f1e, 0x89bf8584, 0x8277809f,
0x8001809f, 0x82778584, 0x89bf8f1e, 0x95939d0f,
0xa57eaecd, 0xb8e4c3aa, 0xcf05dad9, 0xe708f375,
0x000007ff, 0x0fff17ff, 0x1fff27ff, 0x2fff37ff,
0x3fff47ff, 0x4fff57ff, 0x5fff67ff, 0x6fff77ff,
0x7fff7800, 0x70006800, 0x60005800, 0x50004800,
0x40003800, 0x30002800, 0x20001800, 0x10000800,
0x0000f801, 0xf001e801, 0xe001d801, 0xd001c801,
0xc001b801, 0xb001a801, 0xa0019801, 0x90018801,
0x80018800, 0x90009800, 0xa000a800, 0xb000b800,
0xc000c800, 0xd000d800, 0xe000e800, 0xf000f800,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x682e469b, 0x25080375, 0xe1e2c04f, 0x9ebc7d29,
0x5b963a03, 0x1870f6dd, 0xd54ab3b7, 0x92247091,
0x4efe2d6b, 0x0bd8ea45, 0xc8b2a71f, 0x858c63f9,
0x426620d3, 0xff40ddad, 0xbc1a9a87, 0x78f45761,
0x35ce143b, 0xf2a8d115, 0xaf828def, 0x6c5c4ac9,
0x293607a3, 0xe610c47d, 0xa2ea8157, 0x5fc43e31,
0x1c9efb0b, 0xd978b7e5, 0x965274bf, 0x532c3199,
0x1006ee73, 0xcce0ab4d, 0x89ba6827, 0x46942501,
0x00000001, 0x00020003, 0x00040005, 0x00060007,
0x00080009, 0x000a000b, 0x000c000d, 0x000e000f,
0x00000001, 0x00020003, 0x00040005, 0x00060007,
0x00080009, 0x000a000b, 0x000c000d, 0x000e000f,
0x00000001, 0x00020003, 0x00040005, 0x00060007,
0x00080009, 0x000a000b, 0x000c000d, 0x000e000f,
0x00000001, 0x00020003, 0x00040005, 0x00060007,
0x00080009, 0x000a000b, 0x000c000d, 0x000e000f,
0x5a825b9c, 0x5cb35dc7, 0x5ed75fe3, 0x60eb61f0,
0x62f163ee, 0x64e865dd, 0x66cf67bc, 0x68a6698b,
0x6a6d6b4a, 0x6c236cf8, 0x6dc96e96, 0x6f5e7022,
0x70e2719d, 0x72547307, 0x73b5745f, 0x750475a5,
0x764176d8, 0x776b77fa, 0x78847909, 0x79897a05,
0x7a7c7aee, 0x7b5c7bc5, 0x7c297c88, 0x7ce37d39,
0x7d897dd5, 0x7e1d7e5f, 0x7e9c7ed5, 0x7f097f37,
0x7f617f86, 0x7fa67fc1, 0x7fd87fe9, 0x7ff57ffd,
0x00058100, 0x0040806a, 0x19e08039, 0x8f208039,
0x8ee0806a, 0x79e00002, 0x8d00000a, 0x803ea5e0,
0x00038207, 0x5ffb8069, 0xffa0806a, 0x04000003,
0x82075ffb, 0x806a0860, 0x806a0cc0, 0x00038207,
0x5ffb806a, 0x1120806a, 0x15800003, 0x82075ffb,
0x8069ffa0, 0x806a0400, 0x00038207, 0x5ffb806a,
0x0860806a, 0x0cc00003, 0x82075ffb, 0x806a1120,
0x806a1580, 0x00038207, 0x5ffb8069, 0xffa0806a,
0x04000003, 0x82075ffb, 0x806a0860, 0x806a0cc0,
0x00038207, 0x5ffb806a, 0x1120806a, 0x15800003,
0x82075ffb, 0x8069ffa0, 0x806a0400, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x08000000, 0x00000800, 0x04000400,
0x1000f800, 0x0e00fa00, 0x0c00fc00, 0x1200f600,
0x1068f738, 0x12c0f704, 0x1400f400, 0x0800f800,
0x0400fc00, 0xfc000400, 0xfc000000, 0xf8000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000002, 0x00400004, 0x00075ffb, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00400000,
0x02d602d6, 0x00000000, 0x00400006, 0x82075ffb,
0x8069ffa0, 0x806a0400, 0x80398ee0, 0x806a79e0,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x803ea5e0, 0x000a0001,
0x00000000, 0x00000000, 0x00010000, 0x00000000,
0x806a19e0, 0x80398f20, 0x80398ee0, 0x806a79e0,
0x806a02c0, 0x806a0720, 0x00000000, 0x5ffb0000,
0x00010038, 0x80758e80, 0x0d000000, 0x0d604000,
0x00000000, 0x00000000, 0x00000000, 0x58000000,
0x03a80f40, 0x03e80000, 0x003d003d, 0x003d003d,
0x00010020, 0x80754380, 0x0d002000, 0x0d600000,
0x00000000, 0x00000000, 0x00000000, 0x3fff0000,
0x00010020, 0x80755780, 0x0d000000, 0x0d602000,
0x00000000, 0x00000000, 0x00000000, 0x3fff0000,
0x00010038, 0x80756b80, 0x0d004000, 0x0d600000,
0x00000000, 0x00000000, 0x00000000, 0x58000000,
0x00010038, 0x80758e80, 0x0d000000, 0x0d604000,
0x00000000, 0x00000000, 0x00000000, 0x58000000,
0x00000000, 0x00000000, 0x00000000, 0x58000000,
0x00501568, 0xffff0030, 0x00107f00, 0x08000100,
0x0000002d, 0xabb80500, 0xffff0000, 0xff06f000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x82407fff, 0x7dbf843f, 0x00000000, 0x00000000,
0xb23b7fff, 0x4dc4d808, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
};

98
Source/DSPSpy/processor.h Normal file
View File

@ -0,0 +1,98 @@
#ifndef __PROCESSOR_H__
#define __PROCESSOR_H__
#include <gctypes.h>
#define __stringify(rn) #rn
#define ATTRIBUTE_ALIGN(v) __attribute__((aligned(v)))
#define ppcsync() asm volatile("sc")
#define ppchalt() ({ \
asm volatile("sync"); \
while(1) { \
asm volatile("nop"); \
asm volatile("li 3,0"); \
asm volatile("nop"); \
} \
})
#define mfdcr(_rn) ({register u32 _rval; \
asm volatile("mfdcr %0," __stringify(_rn) \
: "=r" (_rval)); _rval;})
#define mtdcr(rn, val) asm volatile("mtdcr " __stringify(rn) ",%0" : : "r" (val))
#define mfmsr() ({register u32 _rval; \
asm volatile("mfmsr %0" : "=r" (_rval)); _rval;})
#define mtmsr(val) asm volatile("mtmsr %0" : : "r" (val))
#define mfdec() ({register u32 _rval; \
asm volatile("mfdec %0" : "=r" (_rval)); _rval;})
#define mtdec(_val) asm volatile("mtdec %0" : : "r" (_val))
#define mfspr(_rn) ({register u32 _rval; \
asm volatile("mfspr %0," __stringify(_rn) \
: "=r" (_rval)); _rval;})
#define mtspr(_rn, _val) asm volatile("mtspr " __stringify(_rn) ",%0" : : "r" (_val))
#define mfwpar() mfspr(921)
#define mtwpar(_val) mtspr(921,_val)
#define mfmmcr0() mfspr(952)
#define mtmmcr0(_val) mtspr(952,_val)
#define mfmmcr1() mfspr(956)
#define mtmmcr1(_val) mtspr(956,_val)
#define mfpmc1() mfspr(953)
#define mtpmc1(_val) mtspr(953,_val)
#define mfpmc2() mfspr(954)
#define mtpmc2(_val) mtspr(954,_val)
#define mfpmc3() mfspr(957)
#define mtpmc3(_val) mtspr(957,_val)
#define mfpmc4() mfspr(958)
#define mtpmc4(_val) mtspr(958,_val)
#define cntlzw(_val) ({register u32 _rval; \
asm volatile("cntlzw %0, %1" : "=r"((_rval)) : "r"((_val))); _rval;})
#define _CPU_MSR_GET( _msr_value ) \
do { \
_msr_value = 0; \
asm volatile ("mfmsr %0" : "=&r" ((_msr_value)) : "0" ((_msr_value))); \
} while (0)
#define _CPU_MSR_SET( _msr_value ) \
{ asm volatile ("mtmsr %0" : "=&r" ((_msr_value)) : "0" ((_msr_value))); }
#define _CPU_ISR_Enable() \
{ register u32 _val = 0; \
asm volatile ("mfmsr %0; ori %0,%0,0x8000; mtmsr %0" : \
"=&r" (_val) : "0" (_val));\
}
#define _CPU_ISR_Disable( _isr_cookie ) \
{ register u32 _disable_mask = MSR_EE; \
_isr_cookie = 0; \
asm volatile ( \
"mfmsr %0; andc %1,%0,%1; mtmsr %1" : \
"=&r" ((_isr_cookie)), "=&r" ((_disable_mask)) : \
"0" ((_isr_cookie)), "1" ((_disable_mask)) \
); \
}
#define _CPU_ISR_Restore( _isr_cookie ) \
{ \
asm volatile ( "mtmsr %0" : \
"=r" ((_isr_cookie)) : \
"0" ((_isr_cookie))); \
}
#define _CPU_ISR_Flash( _isr_cookie ) \
{ register u32 _disable_mask = MSR_EE; \
asm volatile ( \
"mtmsr %0; andc %1,%0,%1; mtmsr %1" : \
"=r" ((_isr_cookie)), "=r" ((_disable_mask)) : \
"0" ((_isr_cookie)), "1" ((_disable_mask)) \
); \
}
#endif

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="DSPTool"
ProjectGUID="{1970D175-3DE8-4738-942A-4D98D1CDBF64}"
RootNamespace="DSPTool"

View File

@ -19,7 +19,7 @@
#include "FileUtil.h"
#include "DSPCodeUtil.h"
#include "dsp_test.h"
//#include "dsp_test.h"
// Stub out the dsplib host stuff, since this is just a simple cmdline tools.
u8 DSPHost_ReadHostMemory(u32 addr) { return 0; }