Skip to content

Commit

Permalink
Sync with 'next'
Browse files Browse the repository at this point in the history
  • Loading branch information
lgblgblgb committed Aug 3, 2023
1 parent 2c06289 commit a27343c
Show file tree
Hide file tree
Showing 48 changed files with 1,532 additions and 652 deletions.
18 changes: 4 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,8 @@ matrix:
- master
- next
- dev
- vic
- hmw
- merger
after_deploy:
- build/deploy/discord-webhook.sh success "Ubuntu Linux DEB" ANY:DISCORD_XEMU_SERVER_TEST_CHANNEL_WEBHOOK master,hmw,next:DISCORD_MEGA65_SERVER_XEMU_CHANNEL_WEBHOOK || true
- build/deploy/discord-webhook.sh success "Ubuntu Linux DEB" ANY:DISCORD_XEMU_SERVER_TEST_CHANNEL_WEBHOOK master,next:DISCORD_MEGA65_SERVER_XEMU_CHANNEL_WEBHOOK || true
- name: Windows cross-compilation on Linux
os: linux
addons:
Expand Down Expand Up @@ -154,11 +151,8 @@ matrix:
- master
- next
- dev
- vic
- hmw
- merger
after_deploy:
- build/deploy/discord-webhook.sh success "Windows" ANY:DISCORD_XEMU_SERVER_TEST_CHANNEL_WEBHOOK master,hmw,next:DISCORD_MEGA65_SERVER_XEMU_CHANNEL_WEBHOOK || true
- build/deploy/discord-webhook.sh success "Windows" ANY:DISCORD_XEMU_SERVER_TEST_CHANNEL_WEBHOOK master,next:DISCORD_MEGA65_SERVER_XEMU_CHANNEL_WEBHOOK || true
- name: MacOS native compilation
os: osx
osx_image: xcode11
Expand All @@ -180,7 +174,7 @@ matrix:
- build/show-git-info
script:
- set -e
- make -j 2 RELEASE=yes OFFICIALBUILD=yes
- make -j 2 RELEASE=yes OFFICIALBUILD=yes MACMINVER=10.6
- set +e
- for a in build/bin/*.native ; do build/mangle_dylib_osx.sh $a ; strip $a ; done
- build/bin/xmega65.native --help || true
Expand All @@ -207,12 +201,8 @@ matrix:
- master
- next
- dev
- vic
- hmw
- discord
- merger
after_deploy:
- build/deploy/discord-webhook.sh success "MacOS(x86)" ANY:DISCORD_XEMU_SERVER_TEST_CHANNEL_WEBHOOK master,hmw,next:DISCORD_MEGA65_SERVER_XEMU_CHANNEL_WEBHOOK || true
- build/deploy/discord-webhook.sh success "MacOS(x86)" ANY:DISCORD_XEMU_SERVER_TEST_CHANNEL_WEBHOOK master,next:DISCORD_MEGA65_SERVER_XEMU_CHANNEL_WEBHOOK || true

env:
global:
Expand Down
7 changes: 6 additions & 1 deletion build/Makefile.common
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Collection of emulators of some 8 bits machines using SDL2 library,
## including the MEGA65, Commodore LCD and Commodore 65.
##
## Copyright (C)2016-2022 LGB (Gábor Lénárt) <[email protected]>
## Copyright (C)2016-2023 LGB (Gábor Lénárt) <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -64,6 +64,7 @@ DEBUG = no
RELEASE = no
OFFICIALBUILD = no
SUPERPICKY = no
MACMINVER = no

CFLAGS_TARGET = $(CFLAGS_TARGET_$(PRG_TARGET))
LDFLAGS_TARGET = $(LDFLAGS_TARGET_$(PRG_TARGET))
Expand Down Expand Up @@ -96,6 +97,10 @@ ifeq ($(STACKPROTECTOR), yes)
CONFIG_CFLAGS += -fstack-protector-strong
CONFIG_CFLAGS_LINK += -fstack-protector-strong
endif
ifneq ($(MACMINVER), no)
CONFIG_CFLAGS += -mmacosx-version-min=$(MACMINVER)
CONFIG_CFLAGS_LINK += -mmacosx-version-min=$(MACMINVER)
endif

CFLAGS = $(CONFIG_CFLAGS) $(CFLAGS_OPT) $(CFLAGS_TARGET) -I. -I$(TOPDIR) -include build/configure/config-$(ARCH).h
LDFLAGS = $(CONFIG_CFLAGS_LINK) $(LDFLAGS_TARGET) $(DLSYM_LIBS)
Expand Down
18 changes: 4 additions & 14 deletions build/configure/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## This file is part of the Xemu project: https://github.com/lgblgblgb/xemu
## Collection of various emulators of some 8 bits machines using SDL2 library.
##
## Copyright (C)2016-2022 LGB (Gábor Lénárt) <[email protected]>
## Copyright (C)2016-2023 LGB (Gábor Lénárt) <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -20,8 +20,6 @@

echo "*** Running xemu-configure ***"

MACOS_VERSION_MIN=10.6

###########################################################
# Check some basic common UNIX utilities if work, we need #
###########################################################
Expand Down Expand Up @@ -65,7 +63,7 @@ CC=""
WINDRES=""
SDL2_CONFIG=""
PKG_CONFIG=""
CFLAGS_USER="$val"
CFLAGS_USER=""
while [ "$1" != "" ] ; do
var="`echo $1 | cut -f1 -d=`"
val="`echo $1 | cut -f2- -d=`"
Expand Down Expand Up @@ -344,8 +342,7 @@ for a in \
PIPE_SUPPORTED_BY_CC:-pipe: \
O0_SUPPORTED_BY_CC:-O0: \
G_SUPPORTED_BY_CC:-g: \
FLTO_SUPPORTED_BY_CC:-flto \
MACOSVERMIN_SUPPORTED_BY_CC:-mmacosx-version-min=$MACOS_VERSION_MIN
FLTO_SUPPORTED_BY_CC:-flto
do
b="`echo $a | cut -f1 -d:`"
c="`echo $a | cut -f2 -d:`"
Expand Down Expand Up @@ -801,18 +798,11 @@ echo "XEMUGUI_CFLAGS=$XEMUGUI_CFLAGS" >> $OUTPUT_MAKEFILE
echo "XEMUGUI_LIBS=$XEMUGUI_LIBS" >> $OUTPUT_MAKEFILE


################
# MACOS target #
################

if [ $TARGET_IS_OSX = Y -a $MACOSVERMIN_SUPPORTED_BY_CC = Y ]; then
CFLAGS="$CFLAGS-mmacosx-version-min=$MACOS_VERSION_MIN "
fi

#########################################
# Windows target: check windres utility #
#########################################


if [ $TARGET_IS_WIN = Y -a "$WINDRES" != "" ]; then
cat > $SRC <<EOF
#include <winver.h>
Expand Down
5 changes: 3 additions & 2 deletions targets/c65/configdb.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* Test-case for simple, work-in-progress Commodore 65 emulator.
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
Copyright (C)2016-2021 LGB (Gábor Lénárt) <[email protected]>
Copyright (C)2016-2023 LGB (Gábor Lénárt) <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -67,4 +66,6 @@ void configdb_define_emulator_options ( void )
{ "dmarev", 2, "Revision of the DMAgic chip (0/1=F018A/B, 2=rom_auto, +512=modulo))", &configdb.dmarev, 0, 1000 },
{ "prgmode", 0, "Override auto-detect option for -prg (64 or 65 for C64/C65 modes, 0 = default, auto detect)", &configdb.prgmode, 0, 65 }
);
static const void *do_not_save_opts[] = { &configdb.prg, &configdb.go64, &configdb.autoload, NULL };
xemucfg_add_flags_to_options(do_not_save_opts, XEMUCFG_FLAG_NO_SAVE);
}
2 changes: 1 addition & 1 deletion targets/c65/configdb.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Test-case for simple, work-in-progress Commodore 65 emulator.
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
Copyright (C)2016-2021 LGB (Gábor Lénárt) <[email protected]>
Copyright (C)2016-2023 LGB (Gábor Lénárt) <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
5 changes: 5 additions & 0 deletions targets/c65/xemu-target.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define XEMU_CONFIGDB_SUPPORT
#define XEMU_OSD_SUPPORT
#define CONFIG_DROPFILE_CALLBACK

// Workaround for hang causes by trying fast-seriel-IEC by ROM
// These defines are used by xemu/cia6526.c
//#define CIA_IN_SDR_SETS_ICR_BIT3
#define CIA_OUT_SDR_SETS_ICR_BIT3
4 changes: 2 additions & 2 deletions targets/mega65/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## A work-in-progess MEGA65 (Commodore-65 clone origins) emulator
## Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
## Copyright (C)2016-2022 LGB (Gábor Lénárt) <[email protected]>
## Copyright (C)2016-2023 LGB (Gábor Lénárt) <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -20,7 +20,7 @@ TARGET = mega65
PRG_TARGET = xmega65
EMU_DESCRIPTION = MEGA65

SRCS_TARGET_xmega65 = configdb.c mega65.c sdcard.c uart_monitor.c hypervisor.c m65_snapshot.c memory_mapper.c io_mapper.c vic4.c vic4_palette.c ethernet65.c input_devices.c memcontent.c ui.c fat32.c sdcontent.c audio65.c inject.c dma65.c rom.c hdos.c matrix_mode.c
SRCS_TARGET_xmega65 = configdb.c mega65.c sdcard.c uart_monitor.c hypervisor.c m65_snapshot.c memory_mapper.c io_mapper.c vic4.c vic4_palette.c ethernet65.c input_devices.c memcontent.c ui.c fat32.c sdcontent.c audio65.c inject.c dma65.c rom.c hdos.c matrix_mode.c cart.c
SRCS_COMMON_xmega65 = emutools.c cpu65.c cia6526.c emutools_hid.c sid.c f011_core.c c64_kbd_mapping.c emutools_config.c emutools_snapshot.c emutools_files.c emutools_umon.c emutools_socketapi.c ethertap.c d81access.c emutools_gui.c basic_text.c opl3.c lodepng.c
CFLAGS_TARGET_xmega65 = $(SDL2_CFLAGS) $(MATH_CFLAGS) $(SOCKET_CFLAGS) $(XEMUGUI_CFLAGS)
LDFLAGS_TARGET_xmega65 = $(SDL2_LIBS) $(MATH_LIBS) $(SOCKET_LIBS) $(XEMUGUI_LIBS)
Expand Down
84 changes: 84 additions & 0 deletions targets/mega65/cart.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* A work-in-progess MEGA65 (Commodore 65 clone origins) emulator
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
Copyright (C)2016-2023 LGB (Gábor Lénárt) <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

#include "xemu/emutools.h"
#include "cart.h"
#include "xemu/emutools_files.h"

static Uint8 cart_mem[0x10000];
static int loaded = 0;


void cart_init ( void )
{
memset(cart_mem, 0xFF, sizeof cart_mem);
}


Uint8 cart_read_byte ( unsigned int addr )
{
Uint8 data = 0xFF;
if (addr < sizeof(cart_mem))
data = cart_mem[addr];
DEBUGPRINT("CART: reading byte ($%02X) at $%X" NL, data, addr + 0x4000000);
return data;
}


void cart_write_byte ( unsigned int addr, Uint8 data )
{
DEBUGPRINT("CART: writing byte ($%02X) at $%X" NL, data, addr + 0x4000000);
}


int cart_load_bin ( const char *fn, const unsigned int addr, const char *cry )
{
if (!fn || !*fn)
return 0;
loaded = 0;
if (addr >= sizeof(cart_mem)) {
if (cry)
ERROR_WINDOW("%s\nOutside of 64K range\n%s", cry, fn);
return -1;
}
const int ret = xemu_load_file(fn, cart_mem + addr, 1, sizeof(cart_mem) - addr, cry);
if (ret <= 0)
return -1;
DEBUGPRINT("CART: %d byte(s) loaded at offset $%04X from file %s" NL, ret, addr, fn);
loaded = 1;
return 0;
}


int cart_detect_id ( void )
{
static const Uint8 cart_id[] = {'M', '6', '5'};
return memcmp(cart_mem + 0x8007, cart_id, sizeof cart_id);
}


int cart_is_loaded ( void )
{
return loaded;
}


void cart_copy_from ( const Uint16 cart_addr, Uint8 *target, const Uint16 size )
{
memcpy(target, cart_mem + cart_addr, size);
}
30 changes: 30 additions & 0 deletions targets/mega65/cart.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* A work-in-progess MEGA65 (Commodore 65 clone origins) emulator
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
Copyright (C)2016-2023 LGB (Gábor Lénárt) <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

#ifndef XEMU_MEGA65_CART_H_INCLUDED
#define XEMU_MEGA65_CART_H_INCLUDED

extern void cart_init ( void );
extern Uint8 cart_read_byte ( unsigned int addr );
extern void cart_write_byte ( unsigned int addr, Uint8 data );
extern int cart_load_bin ( const char *fn, const unsigned int addr, const char *cry );
extern void cart_copy_from ( const Uint16 cart_addr, Uint8 *target, const Uint16 size );
extern int cart_detect_id ( void );
extern int cart_is_loaded ( void );

#endif
30 changes: 26 additions & 4 deletions targets/mega65/configdb.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* A work-in-progess MEGA65 (Commodore 65 clone origins) emulator
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
Copyright (C)2016-2022 LGB (Gábor Lénárt) <[email protected]>
Copyright (C)2016-2023 LGB (Gábor Lénárt) <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -50,6 +50,7 @@ static const struct xemutools_configdef_str_st str_options[] = {
{ "extfreezer", NULL, "Use external initial memory content for the Freezer", &configdb.extfreezer },
{ "hdosdir", NULL, "Set directory with HyppoDOS redirections", &configdb.hdosdir },
{ "defaultdir", NULL, "Set initial default directory for most file selector UIs", &configdb.defaultdir },
{ "hyperserialfile", NULL, "Use a file to write serial output into (no ASCII conversion, not even with -hyperserialascii)", &configdb.hyperserialfile },
{ "rom", NULL, "Override Hyppo's loaded ROM during booting.", &configdb.rom },
{ "prg", NULL, "Load a PRG file directly into the memory (/w C64/65 auto-detection on load address)", &configdb.prg },
{ "sdimg", SDCARD_NAME, "Override path of SD-image to be used (also see the -virtsd option!)", &configdb.sdimg },
Expand All @@ -73,6 +74,8 @@ static const struct xemutools_configdef_str_st str_options[] = {
{ "keymap", KEYMAP_USER_FILENAME, "Set keymap configuration file to be used", &configdb.keymap },
#endif
{ "gui", NULL, "Select GUI type for usage. Specify some insane str to get a list", &configdb.selectedgui },
{ "importbas", NULL, "Import and RUN BASIC65 program from TEXT file", &configdb.importbas },
{ "cartbin8000",NULL, "Load binary cartridge image from $8000", &configdb.cartbin8000 },
{ NULL }
};

Expand All @@ -97,22 +100,24 @@ static const struct xemutools_configdef_switch_st switch_options[] = {
#ifdef VIRTUAL_DISK_IMAGE_SUPPORT
{ "virtsd", "Interpret -sdimg option as a DIRECTORY to be fed onto the FAT32FS and use virtual-in-memory disk storage.", &configdb.virtsd },
#endif
#ifdef FAKE_TYPING_SUPPORT
{ "go64", "Go into C64 mode after start (with auto-typing, can be combined with -autoload)", &configdb.go64 },
{ "autoload", "Load and start the first program from disk (with auto-typing, can be combined with -go64)", &configdb.autoload },
#endif
{ "syscon", "Keep system console open (Windows-specific effect only)", &configdb.syscon },
{ "besure", "Skip asking \"are you sure?\" on RESET or EXIT", &i_am_sure_override },
{ "skipunhandledmem", "Do not even ask on unhandled memory access (hides problems!!)", &configdb.skip_unhandled_mem },
{ "fullborders", "Show non-clipped display borders", &configdb.fullborders },
{ "nosound", "Disables audio output generation", &configdb.nosound },
{ "noopl3", "Disables OPL3 emulation", &configdb.noopl3 },
{ "lockvideostd", "Lock video standard (programs cannot change it)", &configdb.lock_videostd },
{ "curskeyjoy", "Cursor keys as joystick [makes your emulator unsable to move cursor in BASIC/etc!]", &hid_joy_on_cursor_keys },
{ "showscanlines", "Show scanlines in V200 modes", &configdb.show_scanlines },
{ "allowscanlines", "Allow user programs to control scanline visibility", &configdb.allow_scanlines },
{ "fastboot", "Try to use sleepless emulation mode during booting", &configdb.fastboot },
{ NULL }
};

static const struct xemutools_configdef_num_st num_options[] = {
{ "model", 0xFF, "Emulated MEGA65 model (255=custom/Xemu)", &configdb.mega65_model, 0, 0xFF },
{ "model", 3, "Emulated MEGA65 model ID", &configdb.mega65_model, 0, 0xFF },
{ "hicked", 0x0, "Answer to HICKUP upgrade (128=ask user in a pop-up window)", &configdb.hicked, 0, 0xFF },
{ "prgmode", 0, "Override auto-detect option for -prg (64 or 65 for C64/C65 modes, 0 = default, auto detect)", &configdb.prgmode, 0, 65 },
{ "rtchofs", 0, "RTC (and CIA TOD) default hour offset to real-time -24 ... 24 (for testing!)", &configdb.rtc_hour_offset, -24, 24 },
Expand All @@ -126,6 +131,7 @@ static const struct xemutools_configdef_num_st num_options[] = {
{ "videostd", 0, "Use given video standard at startup/reset (0 = PAL, 1 = NTSC, -1 = Hyppo default)", &configdb.videostd, -1, 1 },
{ "sidmask", 15, "Enabled SIDs of the four, in form of a bitmask", &configdb.sidmask, 0, 15 },
{ "audiobuffersize", AUDIO_BUFFER_SAMPLES_DEFAULT, "Audio buffer size in BYTES", &configdb.audiobuffersize, AUDIO_BUFFER_SAMPLES_MIN, AUDIO_BUFFER_SAMPLES_MAX },
{ "coloureffect", 0, "Colour effect to be applied to the SDL output (0=none, 1=grayscale, 2=green-monitor, ...)", &configdb.colour_effect, 0, 255 },
{ NULL }
};

Expand All @@ -135,6 +141,21 @@ static const struct xemutools_configdef_float_st float_options[] = {
};


// Options (given by the value pointers!) which SHOULD NOT BE saved when user saves their config.
// The list MUST BE closed with a NULL.
// The intent: some options makes sense mostly from using the command line (testing, called from scripts,
// etc), however if the user saves the config in Xemu when started this way, it would also save these
// CLI-given options, which is not the thing he wants, 99.999999% of time, I guess ...

static const void *do_not_save_opts[] = {
&configdb.prg, &configdb.prgmode, &configdb.autoload, &configdb.go64, &configdb.hyperserialfile, &configdb.importbas,
&emu_is_sleepless, &emu_is_headless, &configdb.testing,
&configdb.dumpmem, &configdb.dumpscreen, &configdb.screenshot_and_exit,
&configdb.testing, &configdb.hyperdebug, &configdb.hyperdebugfreezer, &configdb.usestubrom, &configdb.useinitrom, &configdb.useutilmenu,
&configdb.cartbin8000,
NULL
};


void configdb_define_emulator_options ( size_t size )
{
Expand All @@ -144,4 +165,5 @@ void configdb_define_emulator_options ( size_t size )
xemucfg_define_switch_option_multi(switch_options);
xemucfg_define_num_option_multi(num_options);
xemucfg_define_float_option_multi(float_options);
xemucfg_add_flags_to_options(do_not_save_opts, XEMUCFG_FLAG_NO_SAVE);
}
Loading

0 comments on commit a27343c

Please sign in to comment.