LDLIBS := -lz $(shell sdl-config --libs) $(shell pkg-config --libs x11 xsp) -lpopt -lhgw
# Default CFLAGS for building in N8x0
-ARCH ?= arm
+ARCH ?= armel
CFLAGS ?= -DMAEMO -DMAEMO_VERSION=4 -march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -O2 -g -Wall -static-libgcc
ASFLAGS ?= -march=armv6j -mfpu=vfp -mfloat-abi=softfp -g
CXXFLAGS ?= $(CFLAGS)
+# Default CFLAGS for building in PC
+#ARCH := i386
+#CFLAGS := -DMAEMO -DMAEMO_VERSION=4 -O2 -g -Wall
+#ASFLAGS := -g
+#CXXFLAGS := $(CFLAGS)
+
GAME_VERSION ?= $(shell head -n 1 debian/changelog | sed 's/[^0-9.-]//g')-git
export GAME_VERSION
export DESTDIR
# Configuration settings
CONF_BUILD_ASM_CPU=0
CONF_BUILD_ASM_SPC700=0
+CONF_BUILD_ASM_SA1=0 # Still not there
-ifeq ($(ARCH),arm)
+ifeq ($(ARCH),armel)
CONF_BUILD_ASM_CPU=1
CONF_BUILD_ASM_SPC700=1
- CONF_BUILD_ROUTINES=misc_armel
-else ifeq ($(ARCH),intel)
- CONF_BUILD_ROUTINES=misc_i386
+ CONF_BUILD_MISC_ROUTINES=misc_armel
+else ifeq ($(ARCH),i386)
+ CONF_BUILD_MISC_ROUTINES=misc_i386
endif
# SNES stuff
-OBJS = 2xsaiwin.o apu.o c4.o c4emu.o cheats.o cheats2.o clip.o cpu.o cpuexec.o data.o
+OBJS = apu.o c4.o c4emu.o cheats.o cheats2.o clip.o cpu.o cpuexec.o data.o
OBJS += dma.o dsp1.o fxemu.o fxinst.o gfx.o globals.o loadzip.o memmap.o netplay.o ppu.o
OBJS += sa1.o sdd1.o sdd1emu.o snapshot.o soundux.o spc700.o srtc.o tile.o
OBJS += os9x_asm_cpu.o os9x_65c816.o
CPPFLAGS += -DCONF_BUILD_ASM_CPU=1
else
- OBJS += cpuops.o sa1cpu.o
+ OBJS += cpuops.o
endif
ifeq ($(CONF_BUILD_ASM_SPC700), 1)
CPPFLAGS += -DCONF_BUILD_ASM_SPC700=1
endif
-OBJS += $(CONF_BUILD_ROUTINES).o
+ifeq ($(CONF_BUILD_ASM_SA1), 1)
+ crash
+else
+ OBJS += sa1cpu.o
+endif
+
+OBJS += $(CONF_BUILD_MISC_ROUTINES).o
# from open-whatever sdk
OBJS += unzip.o ioapi.o
static int loadHacks(char * line)
{
int count = 0;
+ bool end_of_line = false;
char *pos = strchr(line, '|'), *start = line;
- // Skip: Title[start..pos]
+ // Title[start..pos]
+ *pos = '\0';
+ printf("Hacks: detected \"%s\"\n", start);
start = pos + 1;
pos = strchr(start, '|');
- if (!pos) return -1;
+ if (!pos) {
+ // If there are no flags, jump directly to hacks
+ goto parse_hacks;
+ }
// Skip: Flags1[start..pos]
start = pos + 1;
if (!pos) return 0; // No patches!
start = pos + 1;
- bool end_of_line = false;
- printf("Loading patches: %s", start);
+
+parse_hacks:
do {
char *end;
unsigned long addr;
char valStr[3] = { pos[0], pos[1], '\0' };
unsigned char val = strtoul(valStr, 0, 16);
+#ifdef DEBUG
printf("ROM[0x%lx..0x%lx]=0x%hhx 0x%hhx 0x%hhx\n",
addr + i - 1, addr + i + 1,
ROM[addr + i - 1], ROM[addr + i], ROM[addr + i + 1]);
printf("--> ROM[0x%lx]=0x%hhx\n", addr + i, val);
+#endif
ROM[addr + i] = val;
count++;
// Hit! This line's CRC matches our current ROM CRC.
int res = loadHacks(pos + 1);
if (res > 0) {
- printf("Hacks: searched %s for crc %lx, %d hacks loaded\n",
- file, gameCrc, res);
+ printf("Hacks: searched %s for crc %lX, %d byte%s patched\n",
+ file, gameCrc, res, (res == 1 ? "" : "s"));
} else if (res < 0) {
- printf("Hacks: searched %s for crc %lx, error parsing line\n",
+ printf("Hacks: searched %s for crc %lX, error parsing line\n",
file, gameCrc);
} else {
- printf("Hacks: searched %s for crc %lx, no hacks\n",
+ printf("Hacks: searched %s for crc %lX, no hacks\n",
file, gameCrc);
}
goto hacks_found;
fprintf(stderr, "Error reading hacks file: %s\n", file);
}
- printf("Hacks: searched %s for crc %lu; nothing found\n", file, gameCrc);
+ printf("Hacks: searched %s for crc %lX; nothing found\n", file, gameCrc);
hacks_found:
free(line);
- .DATA
+
/****************************************************************
****************************************************************/
- .align 4
-
- @ notaz
- .equiv ASM_SPC700, 1 ;@ 1 = use notaz's ASM_SPC700 core
+@ notaz
+.equiv ASM_SPC700, 1 ;@ 1 = use notaz's ASM_SPC700 core
/****************************************************************
DEFINES
reg_cpu_var .req R14
-
@ not used
@ R13 @ Pointer 32 bit on a struct.
@ R15 = pc (sic!)
-
-/*
-.equ Carry 1
-.equ Zero 2
-.equ IRQ 4
-.equ Decimal 8
-.equ IndexFlag 16
-.equ MemoryFlag 32
-.equ Overflow 64
-.equ Negative 128
-.equ Emulation 256*/
-
.equ STATUS_SHIFTER, 24
.equ MASK_EMUL, (1<<(STATUS_SHIFTER-1))
.equ MASK_SHIFTER_CARRY, (STATUS_SHIFTER+1)
.text
+.align 4
+
.globl asmS9xGetByte
.globl asmS9xGetWord
.globl asmS9xSetByte