SGI: Development

Sega emulator dgen compiled issues

I looked for a Sega genesis emulator for IRIX but with no luck (maybe I didnt look well enough?)

DGEN 1.23 (I couldnt get 1.3x to compile with MIPSPro (wierd error) or GCC)

dgen starts, shows SEGA logo.. then core dumps. No sound is heard when there should be a SEGA chime. But I do hear a sound (pop as it opens device?) when OpenGL is used. I can also disable sound in the dgenrc file but still core dumps. It may not be sound related.

So, to get something out of gdb, I edited all the Makefiles to ensure -g is added to CFLAGS and CPPFLAGS and recompiled.

GDB run of dgen:
[octane]:/data/dgen/dgen-sdl-1.23 $ gdb /data/dgen/dgen-sdl-1.23/dgen
GNU gdb 6.3
This GDB was configured as "mips-sgi-irix6.5"...
(gdb) run -G 640x480 SONIC1.SMD
Starting program: /data/dgen/dgen-sdl-1.23/dgen -G 640x480 SONIC1.SMD

Program received signal SIGSEGV, Segmentation fault.
0x10112c5c in mz80exec (dwCycles=762) at zz80.c:16214
16214 cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY
| Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY |
Current language: auto; currently c
(gdb)

Here are the contents of zz80.c around line 16214:
case 0xd6:
{
sdwCyclesRemaining -= 7;
bTemp = *pbPC++;
cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY |
Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp];
cpu.z80A -= bTemp;
break;
}

I used dgen source version 1.23 from here:
https://sourceforge.net/projects/dgen/files/dgen/1.23/

I used a Sonic_1.zip ROM from here: http://www.angelfire.com/games6/horsefacekilla/ That Sonic1 rom does work with dgen version 2.1 running on Windows

My GCC 4.7 build env
export CC=gcc
export CXX=g++
export CXXFLAGS="-mabi=n32 -I/usr/nekoware/include -I/usr/include"
export CPPFLAGS="-mabi=n32 -I/usr/nekoware/include -I/usr/include"
export PATH="/usr/nekoware/bin:$PATH"
export MANPATH="/usr/nekoware/man:$MANPATH"
export CFLAGS="-mabi=n32 -I/usr/nekoware/include -I/usr/include"
export LDFLAGS="-L/usr/nekoware/lib -L/usr/lib32"
export LD_LIBRARY_PATH="/usr/nekoware/lib:/usr/lib32"
export PATH=/usr/nekoware/gcc-4.7/bin:$PATH
export RANLIB=:

Source code edits:
1) I disabled joystick support as there are SDL errors for it during compile. A definition of JOYSTICK_SUPPORT=no (I edited configure to force -DJOYSTICK_SUPPORT=no)

2) I edited main.cpp to remove joystick ifdef bits.. they seemed to get in the way during compiling.

Any ideas on where I should start looking? Its starting to get out of my league to fix/debug.

Thanks
You seem to compile the code with the default optimization flag and not with any optimization or debug flag. Try to recreate the SIGSEGV by adding -g to CXXFLAGS.

I hardly believe the SIGSEGV is inside the Z80 emulator switch/case block, it must be something further up the chain stack.
:Crimson: :PI: :Indigo: :O2: :Indy: :Indigo2: :Indigo2IMP: :O200: :O2000: :Onyx2: