Sega emulator dgen compiled issues

IRIX/Nekoware development, porting and related topics.
Forum rules
Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.
User avatar
Posts: 305
Joined: Tue May 26, 2015 10:38 pm
Location: Boston

Sega emulator dgen compiled issues

Unread postby necron2600 » Mon Mar 28, 2016 12:47 pm

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
Current language: auto; currently c

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 |
pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp];
cpu.z80A -= bTemp;

I used dgen source version 1.23 from here:

I used a ROM from here: 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.


User avatar
Posts: 2781
Joined: Thu Feb 20, 2003 6:57 am
Location: Zoetermeer, The Netherlands

Re: Sega emulator dgen compiled issues

Unread postby dexter1 » Sat Apr 02, 2016 4:32 pm

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:

Return to “SGI: Development”

Who is online

Users browsing this forum: No registered users and 3 guests