R. Belmont's changes to compile under MacOS and Linux.

This commit is contained in:
Bart Trzynadlowski 2011-08-10 04:24:15 +00:00
parent 06f6bf093b
commit 91c9b9869b
5 changed files with 98 additions and 15 deletions

View file

@ -25,6 +25,15 @@
# GNU Makefile for SDL port using GCC on Mac OS X. # GNU Makefile for SDL port using GCC on Mac OS X.
# #
###############################################################################
# Build Options
###############################################################################
#
# Include console-based debugger in emulator ('yes' or 'no')
#
ENABLE_DEBUGGER = no
############################################################################### ###############################################################################
# Required Libraries # Required Libraries
@ -54,11 +63,20 @@ OBJ_DIR = obj
CC = gcc CC = gcc
OCC = gcc OCC = gcc
LD = gcc LD = gcc
COMPILER_FLAGS = -ISrc/ -ISrc/OSD/SDL/ -ISrc/Pkgs/ -c -Wall -O3 -DUSE_FILE32API -DSUPERMODEL_OSX COMPILER_FLAGS = -I$(OBJ_DIR) -ISrc/ -ISrc/OSD -ISrc/OSD/SDL/ -ISrc/Pkgs/ -ISrc/CPU/68K/Musashi -ISrc/Sound/MPEG -DSUPERMODEL_SOUND -c -Wall -O3 -DUSE_FILE32API -DSUPERMODEL_OSX
CFLAGS = $(COMPILER_FLAGS) CFLAGS = $(COMPILER_FLAGS)
CPPFLAGS = $(COMPILER_FLAGS) CPPFLAGS = $(COMPILER_FLAGS)
LFLAGS = -o $(OUTFILE) $(SDL_LDFLAGS) -lz -lm -lstdc++ LFLAGS = -o $(OUTFILE) $(SDL_LDFLAGS) -lz -lm -lstdc++
#
# Build options...
#
# Add compiler flags for various options
ifeq ($(strip $(ENABLE_DEBUGGER)),yes)
COMPILER_FLAGS += -DSUPERMODEL_DEBUGGER
endif
############################################################################### ###############################################################################
# Build Instructions # Build Instructions
@ -69,7 +87,26 @@ LFLAGS = -o $(OUTFILE) $(SDL_LDFLAGS) -lz -lm -lstdc++
# #
HEADERS = Src/Supermodel.h Src/Games.h Src/OSD/SDL/Types.h HEADERS = Src/Supermodel.h Src/Games.h Src/OSD/SDL/Types.h
OBJ = $(OBJ_DIR)/INIFile.o $(OBJ_DIR)/BlockFile.o $(OBJ_DIR)/93C46.o $(OBJ_DIR)/ROMLoad.o $(OBJ_DIR)/unzip.o $(OBJ_DIR)/ioapi.o $(OBJ_DIR)/Error.o $(OBJ_DIR)/glew.o $(OBJ_DIR)/Shader.o $(OBJ_DIR)/Real3D.o $(OBJ_DIR)/Render3D.o $(OBJ_DIR)/Models.o $(OBJ_DIR)/Render2D.o $(OBJ_DIR)/TileGen.o $(OBJ_DIR)/Model3.o $(OBJ_DIR)/ppc.o $(OBJ_DIR)/Main.o $(OBJ_DIR)/IRQ.o $(OBJ_DIR)/53C810.o $(OBJ_DIR)/PCI.o $(OBJ_DIR)/RTC72421.o $(OBJ_DIR)/MPC10x.o $(OBJ_DIR)/PPCDisasm.o $(OBJ_DIR)/SDLMain_tmpl.o $(OBJ_DIR)/Games.o $(OBJ_DIR)/Inputs.o $(OBJ_DIR)/InputSource.o $(OBJ_DIR)/InputSystem.o $(OBJ_DIR)/InputTypes.o $(OBJ_DIR)/MultiInputSource.o $(OBJ_DIR)/SDLInputSystem.o OBJ = $(OBJ_DIR)/PPCDisasm.o $(OBJ_DIR)/Games.o $(OBJ_DIR)/INIFile.o $(OBJ_DIR)/BlockFile.o $(OBJ_DIR)/93C46.o \
$(OBJ_DIR)/ROMLoad.o $(OBJ_DIR)/unzip.o $(OBJ_DIR)/ioapi.o $(OBJ_DIR)/Error.o $(OBJ_DIR)/glew.o $(OBJ_DIR)/Shader.o \
$(OBJ_DIR)/Real3D.o $(OBJ_DIR)/Render3D.o $(OBJ_DIR)/Models.o $(OBJ_DIR)/Render2D.o $(OBJ_DIR)/TileGen.o \
$(OBJ_DIR)/Model3.o $(OBJ_DIR)/ppc.o $(OBJ_DIR)/Main.o $(OBJ_DIR)/Audio.o $(OBJ_DIR)/Thread.o $(OBJ_DIR)/SoundBoard.o \
$(OBJ_DIR)/SCSP.o $(OBJ_DIR)/SCSPDSP.o $(OBJ_DIR)/68K.o $(OBJ_DIR)/m68kcpu.o $(OBJ_DIR)/m68kopnz.o $(OBJ_DIR)/m68kopdm.o \
$(OBJ_DIR)/m68kopac.o $(OBJ_DIR)/m68kops.o $(OBJ_DIR)/DSB.o $(OBJ_DIR)/Z80.o \
$(OBJ_DIR)/IRQ.o $(OBJ_DIR)/53C810.o $(OBJ_DIR)/PCI.o $(OBJ_DIR)/RTC72421.o \
$(OBJ_DIR)/MPC10x.o $(OBJ_DIR)/Input.o $(OBJ_DIR)/Inputs.o $(OBJ_DIR)/InputSource.o $(OBJ_DIR)/InputSystem.o \
$(OBJ_DIR)/InputTypes.o $(OBJ_DIR)/MultiInputSource.o $(OBJ_DIR)/SDLInputSystem.o \
$(OBJ_DIR)/amp_audio.o $(OBJ_DIR)/amp_dump.o $(OBJ_DIR)/amp_getbits.o $(OBJ_DIR)/amp_getdata.o $(OBJ_DIR)/amp_huffman.o \
$(OBJ_DIR)/amp_layer2.o $(OBJ_DIR)/amp_layer3.o $(OBJ_DIR)/amp_misc2.o $(OBJ_DIR)/amp_position.o $(OBJ_DIR)/amp_transform.o \
$(OBJ_DIR)/amp_util.o $(OBJ_DIR)/SDLMain_tmpl.o
# If built-in debugger enabled, include all debugging classes
ifeq ($(strip $(ENABLE_DEBUGGER)),yes)
OBJ += $(OBJ_DIR)/Debugger.o $(OBJ_DIR)/ConsoleDebugger.o $(OBJ_DIR)/SupermodelDebugger.o $(OBJ_DIR)/CPUDebug.o \
$(OBJ_DIR)/AddressTable.o $(OBJ_DIR)/Breakpoint.o $(OBJ_DIR)/CodeAnalyser.o $(OBJ_DIR)/Exception.o \
$(OBJ_DIR)/Interrupt.o $(OBJ_DIR)/IO.o $(OBJ_DIR)/Label.o $(OBJ_DIR)/Register.o $(OBJ_DIR)/Watch.o \
$(OBJ_DIR)/PPCDebug.o
endif
# #
# Rules # Rules
@ -85,6 +122,34 @@ clean:
rm -f $(OUTFILE) rm -f $(OUTFILE)
rm -f $(OBJ_DIR)/*.o rm -f $(OBJ_DIR)/*.o
#
# Musashi 68K emulator
#
# All generated source files are emitted to the object directory. For MSVC,
# INLINE must be redefined as "static __inline", which is the syntax in C mode.
#
$(OBJ_DIR)/m68kmake: Src/CPU/68K/Musashi/m68kmake.c
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/m68kmake.o
$(LD) -o $(OBJ_DIR)/m68kmake $(ARCH_LIBS) $(OBJ_DIR)/m68kmake.o
$(OBJ_DIR)/m68kops.h: $(OBJ_DIR)/m68kmake Src/CPU/68K/Musashi/m68k_in.c
$(OBJ_DIR)/m68kmake $(OBJ_DIR) Src/CPU/68K/Musashi/m68k_in.c
$(OBJ_DIR)/m68kcpu.o: Src/CPU/68K/Musashi/m68kcpu.c $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/m68kcpu.o
$(OBJ_DIR)/m68kops.o: $(OBJ_DIR)/m68kops.c $(OBJ_DIR)/m68kmake $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/m68kops.o
$(OBJ_DIR)/m68kopac.o: $(OBJ_DIR)/m68kopac.c $(OBJ_DIR)/m68kmake $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/m68kopac.o
$(OBJ_DIR)/m68kopdm.o: $(OBJ_DIR)/m68kopdm.c $(OBJ_DIR)/m68kmake $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/m68kopdm.o
$(OBJ_DIR)/m68kopnz.o: $(OBJ_DIR)/m68kopnz.c $(OBJ_DIR)/m68kmake $(OBJ_DIR)/m68kops.h Src/CPU/68K/Musashi/m68k.h Src/CPU/68K/Musashi/m68kconf.h
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/m68kopnz.o
$(OBJ_DIR)/%.o: Src/%.cpp Src/%.h $(HEADERS) $(OBJ_DIR)/%.o: Src/%.cpp Src/%.h $(HEADERS)
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o $(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
@ -103,12 +168,30 @@ $(OBJ_DIR)/%.o: Src/Graphics/%.cpp Src/Graphics/%.h $(HEADERS)
$(OBJ_DIR)/%.o: Src/Graphics/%.cpp $(HEADERS) $(OBJ_DIR)/%.o: Src/Graphics/%.cpp $(HEADERS)
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o $(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
$(OBJ_DIR)/%.o: Src/Debugger/%.cpp Src/Debugger/%.h $(HEADERS)
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
$(OBJ_DIR)/%.o: Src/Debugger/CPU/%.cpp Src/Debugger/CPU/%.h $(HEADERS)
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
$(OBJ_DIR)/%.o: Src/CPU/PowerPC/%.cpp Src/CPU/PowerPC/%.h $(HEADERS) $(OBJ_DIR)/%.o: Src/CPU/PowerPC/%.cpp Src/CPU/PowerPC/%.h $(HEADERS)
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o $(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
$(OBJ_DIR)/%.o: Src/CPU/68K/%.cpp Src/CPU/68K/%.h $(HEADERS)
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
$(OBJ_DIR)/%.o: Src/CPU/Z80/%.cpp Src/CPU/Z80/%.h $(HEADERS)
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
$(OBJ_DIR)/%.o: Src/Inputs/%.cpp Src/Inputs/%.h $(HEADERS) $(OBJ_DIR)/%.o: Src/Inputs/%.cpp Src/Inputs/%.h $(HEADERS)
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o $(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
$(OBJ_DIR)/%.o: Src/Sound/%.cpp Src/Sound/%.h $(HEADERS)
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
$(OBJ_DIR)/%.o: Src/Sound/MPEG/%.cpp
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
$(OBJ_DIR)/%.o: Src/OSD/SDL/%.cpp $(HEADERS) $(OBJ_DIR)/%.o: Src/OSD/SDL/%.cpp $(HEADERS)
$(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o $(CC) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
@ -118,5 +201,6 @@ $(OBJ_DIR)/%.o: Src/OSD/SDL/%.m $(HEADERS)
$(OBJ_DIR)/%.o: Src/Pkgs/%.c Src/Pkgs/%.h $(OBJ_DIR)/%.o: Src/Pkgs/%.c Src/Pkgs/%.h
$(CC) $< $(CFLAGS) -o $(OBJ_DIR)/$(*F).o $(CC) $< $(CFLAGS) -o $(OBJ_DIR)/$(*F).o
$(OBJ_DIR)/%.o: Src/Pkgs/*.c $(OBJ_DIR)/%.o: Src/Pkgs/%.c
$(CC) $< $(CFLAGS) -o $(OBJ_DIR)/$(*F).o $(CC) $< $(CFLAGS) -o $(OBJ_DIR)/$(*F).o

View file

@ -82,7 +82,7 @@
* and m68k_read_pcrelative_xx() for PC-relative addressing. * and m68k_read_pcrelative_xx() for PC-relative addressing.
* If off, all read requests from the CPU will be redirected to m68k_read_xx() * If off, all read requests from the CPU will be redirected to m68k_read_xx()
*/ */
#define M68K_SEPARATE_READS OPT_OFF #define M68K_SEPARATE_READS OPT_ON // fixes Supermodel compilation on MacOS
/* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a /* If ON, the CPU will call m68k_write_32_pd() when it executes move.l with a
* predecrement destination EA mode instead of m68k_write_32(). * predecrement destination EA mode instead of m68k_write_32().

View file

@ -1,4 +1,3 @@
//TODO: MPEG_IsPlaying() -- must be saved to save state file so we don't continue playing when loading a silent state
//TODO: amp can print error messages -- change them to Supermodel error messages //TODO: amp can print error messages -- change them to Supermodel error messages
/** /**
** Supermodel ** Supermodel
@ -536,7 +535,7 @@ void CDSB1::LoadState(CBlockFile *StateFile)
MPEG_StopPlaying(); MPEG_StopPlaying();
} }
// Offsets of memory regions within DSB2's pool // Offsets of memory regions within DSB1's pool
#define DSB1_OFFSET_RAM 0 // 32KB Z80 RAM #define DSB1_OFFSET_RAM 0 // 32KB Z80 RAM
#define DSB1_OFFSET_MPEG_LEFT 0x8000 // 1604 bytes (48 KHz max., 1/60th second, 2 extra = 2*(48000/60+2)) left MPEG buffer #define DSB1_OFFSET_MPEG_LEFT 0x8000 // 1604 bytes (48 KHz max., 1/60th second, 2 extra = 2*(48000/60+2)) left MPEG buffer
#define DSB1_OFFSET_MPEG_RIGHT 0x8644 // 1604 bytes right MPEG buffer #define DSB1_OFFSET_MPEG_RIGHT 0x8644 // 1604 bytes right MPEG buffer
@ -920,7 +919,7 @@ void CDSB2::SendCommand(UINT8 data)
{ {
/* /*
* Commands are buffered in a FIFO. This probably does not actually exist * Commands are buffered in a FIFO. This probably does not actually exist
* on the real DSB but is necessary because the Z80 is not really synced * on the real DSB but is necessary because the 68K is not really synced
* up with the other CPUs and must process all commands it has received * up with the other CPUs and must process all commands it has received
* over the course of a frame at once. * over the course of a frame at once.
*/ */

View file

@ -1,4 +1,3 @@
//TODO: must store actual value of bank register so we can save it to save states
/** /**
** Supermodel ** Supermodel
** A Sega Model 3 Arcade Emulator. ** A Sega Model 3 Arcade Emulator.
@ -450,11 +449,11 @@ void CSoundBoard::AttachDSB(CDSB *DSBPtr)
} }
// Offsets of memory regions within sound board's pool // Offsets of memory regions within sound board's pool
#define OFFSET_RAM1 0 // 1 MB SCSP1 RAM #define OFFSET_RAM1 (0) // 1 MB SCSP1 RAM
#define OFFSET_RAM2 0x100000 // 1 MB SCSP2 RAM #define OFFSET_RAM2 (0x100000) // 1 MB SCSP2 RAM
#define OFFSET_AUDIO_LEFT 0x200000 // 1470 bytes (16 bits, 44.1 KHz, 1/60th second) left audio channel #define OFFSET_AUDIO_LEFT (0x200000) // 1470 bytes (16 bits, 44.1 KHz, 1/60th second) left audio channel
#define OFFSET_AUDIO_RIGHT 0x2005BE // 1470 bytes right audio channel #define OFFSET_AUDIO_RIGHT (0x2005BE) // 1470 bytes right audio channel
#define MEMORY_POOL_SIZE (0x100000+0x100000+0x5BE+0x5BE) #define MEMORY_POOL_SIZE (0x100000 + 0x100000 + 0x5be + 0x5be)
BOOL CSoundBoard::Init(const UINT8 *soundROMPtr, const UINT8 *sampleROMPtr) BOOL CSoundBoard::Init(const UINT8 *soundROMPtr, const UINT8 *sampleROMPtr)
{ {

View file

@ -1,3 +1,4 @@
#include "Supermodel.h"
#include "SCSPDSP.h" #include "SCSPDSP.h"
#include <assert.h> #include <assert.h>
#include <memory.h> #include <memory.h>
@ -366,7 +367,7 @@ void SCSPDSP_Step(_SCSPDSP *DSP)
//if(Y&0x1000) //if(Y&0x1000)
// Y|=0xFFFFF000; // Y|=0xFFFFF000;
__int64 v=(((__int64) X*(__int64) Y)>>12); INT64 v=(((INT64) X*(INT64) Y)>>12);
ACC=(int) v+B; ACC=(int) v+B;
if(TWT) if(TWT)