Add support for the Funkey-S.

(There are also minor changes to decrease int i to uint8_t i)
This commit is contained in:
gameblabla 2021-03-23 07:20:20 +01:00
parent b9a8289264
commit 0018a3a829
No known key found for this signature in database
GPG Key ID: 55F5ECF22285E516
4 changed files with 1274 additions and 3 deletions

82
Makefile.funkey Normal file
View File

@ -0,0 +1,82 @@
PRGNAME = sms_sdl
CC = /opt/funkey-toolchain/bin/arm-linux-gcc
# Possible choices : rs97, k3s (PAP K3S), sdl, amini, fbdev
PORT = funkey
# Possible choices : alsa, pulse (pulseaudio), oss, sdl12 (SDL 1.2 sound output), portaudio, libao
SOUND_OUTPUT = alsa
# Possible choices : crabemu_sn76489 (less accurate, GPLv2), maxim_sn76489 (somewhat problematic license but good accuracy)
SOUND_ENGINE = maxim_sn76489
# Possible choices : z80 (accurate), eighty (EightyZ80's core, GPLv2)
Z80_CORE = z80
SCALE2X_UPSCALER = 1
PROFILE = 0
ZIP_SUPPORT = 1
SRCDIR = ./source ./source/cpu_cores/$(Z80_CORE) ./source/sound ./source/unzip
SRCDIR += ./source/scalers ./source/ports/$(PORT) ./source/sound/$(SOUND_ENGINE) ./source/sound_output/$(SOUND_OUTPUT)
VPATH = $(SRCDIR)
SRC_C = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.c))
SRC_CP = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.cpp))
OBJ_C = $(notdir $(patsubst %.c, %.o, $(SRC_C)))
OBJ_CP = $(notdir $(patsubst %.cpp, %.o, $(SRC_CP)))
OBJS = $(OBJ_C) $(OBJ_CP)
CFLAGS = -Wall -Wextra -Ofast -fsingle-precision-constant -fno-PIC -flto -fno-common
CFLAGS += -std=gnu99
CFLAGS += -DNOBLANKING_LEFTCOLUM
CFLAGS += -DLSB_FIRST -std=gnu99
CFLAGS += -Isource -Isource/cpu_cores/$(Z80_CORE) -Isource/scalers -Isource/ports/$(PORT) -I./source/sound -Isource/unzip -Isource/sdl -Isource/sound/$(SOUND_ENGINE) -Isource/sound_output
SRCDIR += ./source/text/fb
CFLAGS += -Isource/text/fb
ifeq ($(PROFILE), YES)
CFLAGS += -fprofile-generate=/mnt/smsplusgx_profile
endif
ifeq ($(PROFILE), APPLY)
CFLAGS += -fprofile-use
endif
ifeq ($(SOUND_ENGINE), maxim_sn76489)
CFLAGS += -DMAXIM_PSG
endif
ifeq ($(ZIP_SUPPORT), 0)
CFLAGS += -DNOZIP_SUPPORT
endif
ifeq ($(SCALE2X_UPSCALER), 1)
CFLAGS += -DSCALE2X_UPSCALER
CFLAGS += -Isource/scale2x
SRCDIR += ./source/scale2x
endif
CFLAGS += -march=armv7-a+neon-vfpv4 -mtune=cortex-a7 -mfpu=neon-vfpv4
CFLAGS += -fdata-sections -ffunction-sections -fsingle-precision-constant -freorder-functions -fno-math-errno -fgcse-las -fgcse-sm -fmerge-all-constants
CXXFLAGS = $(CFLAGS) -ftree-vectorize -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-enforce-eh-specs -fstrict-enums -std=gnu++11
LDFLAGS = -nodefaultlibs -lc -lgcc -lm -lSDL -lasound -lz -pthread -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,-O1,--sort-common,--as-needed,--gc-sections -flto -no-pie -s
ifeq ($(SOUND_OUTPUT), portaudio)
LDFLAGS += -lportaudio
endif
ifeq ($(SOUND_OUTPUT), libao)
LDFLAGS += -lao
endif
ifeq ($(SOUND_OUTPUT), alsa)
LDFLAGS += -lasound
endif
ifeq ($(SOUND_OUTPUT), pulse)
LDFLAGS += -lpulse -lpulse-simple
endif
# Rules to make executable
$(PRGNAME): $(OBJS)
$(CC) $(CFLAGS) -o $(PRGNAME) $^ $(LDFLAGS)
$(OBJ_C) : %.o : %.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f $(PRGNAME) *.o

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
#ifndef SMSPLUS_H
#define SMSPLUS_H
#include <SDL/SDL.h>
#define HOST_WIDTH_RESOLUTION 240
#define HOST_HEIGHT_RESOLUTION 240
#define VIDEO_WIDTH_SMS 256
#define VIDEO_HEIGHT_SMS 192
#define VIDEO_WIDTH_GG 160
#define VIDEO_HEIGHT_GG 144
/* Input defines for custom remapping */
#define CONFIG_BUTTON_UP 0
#define CONFIG_BUTTON_DOWN 1
#define CONFIG_BUTTON_LEFT 2
#define CONFIG_BUTTON_RIGHT 3
#define CONFIG_BUTTON_BUTTON1 4
#define CONFIG_BUTTON_BUTTON2 5
#define CONFIG_BUTTON_START 6
/* Colecovision specific */
#define CONFIG_BUTTON_DOLLARS 7
#define CONFIG_BUTTON_ASTERISK 8
#define CONFIG_BUTTON_ONE 9
#define CONFIG_BUTTON_TWO 10
#define CONFIG_BUTTON_THREE 11
#define CONFIG_BUTTON_FOUR 12
#define CONFIG_BUTTON_FIVE 13
#define CONFIG_BUTTON_SIX 14
#define CONFIG_BUTTON_SEVEN 15
#define CONFIG_BUTTON_EIGHT 16
#define CONFIG_BUTTON_NINE 17
/* End of Defines for input remapping */
extern SDL_Surface* sms_bitmap;
#define LOCK_VIDEO SDL_LockSurface(sms_bitmap);
#define UNLOCK_VIDEO SDL_UnlockSurface(sms_bitmap);
typedef struct {
char gamename[256];
char sramdir[256];
char sramfile[256];
char stdir[256];
char scrdir[256];
char biosdir[256];
} gamedata_t;
void smsp_state(uint8_t slot_number, uint8_t mode);
#define SOUND_FREQUENCY 44100
#endif

View File

@ -229,7 +229,7 @@ void sms_shutdown(void)
void sms_reset(void)
{
int32_t i;
uint_fast8_t i;
/* reset Z80 state */
CPUZ80_Reset();
@ -440,7 +440,7 @@ void sms_reset(void)
void mapper_8k_w(uint16_t address, uint8_t data)
{
int32_t i;
uint_fast8_t i;
/* cartridge ROM page (8k) index */
uint16_t page = data % (slot.pages << 1);
@ -480,7 +480,7 @@ void mapper_8k_w(uint16_t address, uint8_t data)
void mapper_16k_w(uint16_t address, uint8_t data)
{
extern uint8_t gaiden_hack;
int32_t i;
uint_fast8_t i;
/* cartridge ROM page (16k) index */
uint16_t page = data % slot.pages;