Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AltirraOS 3.41 ROMs and disable legacy config #109

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ SOURCES_C += \
# $(CORE_DIR)/atari800/src/videomode.c\
# $(CORE_DIR)/atari800/src/pal_blending.c \

SOURCES_C += \
$(CORE_DIR)/atari800/src/roms/altirraos_xl.c \
$(CORE_DIR)/atari800/src/roms/altirraos_800.c \
$(CORE_DIR)/atari800/src/roms/altirra_basic.c \
$(CORE_DIR)/atari800/src/roms/altirra_5200_os.c

ZLIB_INCFLAGS = -I$(DEPS_DIR)/zlib
ZLIB_SOURCES_C = \
$(DEPS_DIR)/zlib/adler32.c \
Expand Down
32 changes: 24 additions & 8 deletions atari800/src/atari.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
#endif
#if defined(__LIBRETRO__)
extern const char *retro_system_directory;
extern int legacy_configuration_file;
#endif /* __LIBRETRO__ */

int Atari800_machine_type = Atari800_MACHINE_XLXE;
Expand Down Expand Up @@ -308,7 +309,7 @@ static int load_roms(void)
int basic_ver, xegame_ver;
SYSROM_ChooseROMs(Atari800_machine_type, MEMORY_ram_size, Atari800_tv_mode, &Atari800_os_version, &basic_ver, &xegame_ver);
if (Atari800_os_version == -1
|| !Atari800_LoadImage(SYSROM_roms[Atari800_os_version].filename, MEMORY_os, SYSROM_roms[Atari800_os_version].size)) {
|| !SYSROM_LoadImage(Atari800_os_version, MEMORY_os)) {
/* Missing OS ROM. */
Atari800_os_version = -1;
if (Atari800_machine_type != Atari800_MACHINE_5200 && emuos_mode == 1)
Expand All @@ -319,15 +320,15 @@ static int load_roms(void)
}
else if (Atari800_machine_type != Atari800_MACHINE_5200) {
/* OS ROM found, try loading BASIC. */
MEMORY_have_basic = basic_ver != -1 && Atari800_LoadImage(SYSROM_roms[basic_ver].filename, MEMORY_basic, SYSROM_roms[basic_ver].size);
MEMORY_have_basic = basic_ver != -1 && SYSROM_LoadImage(basic_ver, MEMORY_basic);
if (!MEMORY_have_basic)
/* Missing BASIC ROM. Don't fail when it happens. */
Atari800_builtin_basic = FALSE;

if (Atari800_builtin_game) {
/* Try loading built-in XEGS game. */
if (xegame_ver == -1
|| !Atari800_LoadImage(SYSROM_roms[xegame_ver].filename, MEMORY_xegame, SYSROM_roms[xegame_ver].size))
|| !SYSROM_LoadImage(xegame_ver, MEMORY_xegame))
/* Missing XEGS game ROM. */
Atari800_builtin_game = FALSE;
}
Expand Down Expand Up @@ -427,18 +428,25 @@ int Atari800_Initialise(int *argc, char *argv[])
}
*argc = j;
}

//LIBRETRO HACK
//#ifndef ANDROID
#if !defined(ANDROID) || defined(__LIBRETRO__)
#if !defined(ANDROID) || defined(__LIBRETRO__)
#if defined(__LIBRETRO__)
if (legacy_configuration_file)
got_config = CFG_LoadConfig(rtconfig_filename);
else
got_config = FALSE;
#else
got_config = CFG_LoadConfig(rtconfig_filename);
#endif // __LIBRETRO__
#else
got_config = TRUE; /* pretend we got a config file -- not needed in Android */
#endif

//LIBRETRO HACK
/* try to find ROM images if the configuration file is not found
or it does not specify some ROM paths (blank paths count as specified) */
//LIBRETRO HACK
//#ifndef ANDROID


#if !defined(ANDROID) || defined(__LIBRETRO__)
#if defined(__LIBRETRO__)
SYSROM_FindInDir(retro_system_directory, TRUE);
Expand Down Expand Up @@ -476,7 +484,11 @@ SYSROM_FindInDir("fs:/vol/external01/retroarch/cores/system/atari800", TRUE);
SYSROM_SetDefaults();

/* if no configuration file read, try to save one with the defaults */
#if defined(__LIBRETRO__)
if (!got_config && legacy_configuration_file)
#else
if (!got_config)
#endif /* __LIBRETRO__*/
CFG_WriteConfig();

#endif /* __PLUS */
Expand Down Expand Up @@ -974,7 +986,11 @@ int Atari800_Exit(int run_monitor)
if (!restart) {
/* We'd better save the configuration before calling the *_Exit() functions -
there's a danger that they might change some emulator settings. */
#if defined(__LIBRETRO__)
if (CFG_save_on_exit && legacy_configuration_file)
#else
if (CFG_save_on_exit)
#endif
CFG_WriteConfig();

/* Cleanup functions, in reverse order as the init functions in
Expand Down
8 changes: 0 additions & 8 deletions atari800/src/cassette.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,6 @@ void CASSETTE_LeaderLoad(void)
CASSETTE_ToggleRecord();
CASSETTE_TapeMotor(TRUE);
cassette_gapdelay = 9600;
/* registers for SETVBV: third system timer, ~0.1 sec */
CPU_regA = 3;
CPU_regX = 0;
CPU_regY = 5;
}

/* indicates that a save leader is written by the OS */
Expand All @@ -425,10 +421,6 @@ void CASSETTE_LeaderSave(void)
CASSETTE_ToggleRecord();
CASSETTE_TapeMotor(TRUE);
cassette_gapdelay = 19200;
/* registers for SETVBV: third system timer, ~0.1 sec */
CPU_regA = 3;
CPU_regX = 0;
CPU_regY = 5;
}

int CASSETTE_ReadToMemory(UWORD dest_addr, int length)
Expand Down
6 changes: 6 additions & 0 deletions atari800/src/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -2440,6 +2440,12 @@ int Devices_PatchOS(void)
case SYSROM_CC01R4:
addr = 0xc3eb;
break;
case SYSROM_ALTIRRA_800:
addr = 0xefd4; /* labeled InitHandlerTable in OS sources */
break;
case SYSROM_ALTIRRA_XL:
addr = 0xee90; /* labeled InitHandlerTable in OS sources */
break;
default:
return FALSE;
}
Expand Down
70 changes: 60 additions & 10 deletions atari800/src/esc.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,42 @@ int ESC_enable_sio_patch = TRUE;
static UWORD esc_address[256];
static ESC_FunctionType esc_function[256];

/* Esc function that removes the wait loop when reading the tape leader. For
use with standard Atari OSes only. */
static void CassetteLeaderLoad(void)
{
CASSETTE_LeaderLoad();

/* registers for SETVBV: third system timer, ~0.1 sec */
CPU_regA = 3;
CPU_regX = 0;
CPU_regY = 5;
}

/* Esc function that removes the wait loop when writing the tape leader. For
use with standard Atari OSes only. */
static void CassetteLeaderSave(void)
{
CASSETTE_LeaderSave();

/* registers for SETVBV: third system timer, ~0.1 sec */
CPU_regA = 3;
CPU_regX = 0;
CPU_regY = 5;
}

/* Esc function that removes the wait loop in AltirraOS's "CassetteWait"
routine when reading or writing the tape leader. */
static void CassetteLeaderAltirra(void)
{
if (CPU_regX == 1)
CASSETTE_LeaderLoad();
else
CASSETTE_LeaderSave();
/* Routine expects Y = 1 on exit. */
CPU_regY = 1;
}

void ESC_ClearAll(void)
{
int i;
Expand Down Expand Up @@ -124,6 +160,7 @@ void ESC_PatchOS(void)
UWORD addr_s;
UBYTE check_s_0;
UBYTE check_s_1;
int altirra = FALSE;
/* patch Open() of C: so we know when a leader is processed */
switch (Atari800_os_version) {
case SYSROM_A_NTSC:
Expand Down Expand Up @@ -167,19 +204,32 @@ void ESC_PatchOS(void)
check_s_0 = 0xa9;
check_s_1 = 0x03;
break;
case SYSROM_ALTIRRA_800:
altirra = TRUE;
addr_l = 0xef91; /* points to CassetteWait */
/* Fall through. */
case SYSROM_ALTIRRA_XL:
altirra = TRUE;
addr_l = 0xee4a; /* points to CassetteWait */
break;
default:
return;
}
/* don't hurt non-standard OSes that may not support cassette at all */
if (MEMORY_dGetByte(addr_l) == 0xa9 && MEMORY_dGetByte(addr_l + 1) == 0x03
&& MEMORY_dGetByte(addr_l + 2) == 0x8d && MEMORY_dGetByte(addr_l + 3) == 0x2a
&& MEMORY_dGetByte(addr_l + 4) == 0x02
&& MEMORY_dGetByte(addr_s) == check_s_0
&& MEMORY_dGetByte(addr_s + 1) == check_s_1
&& MEMORY_dGetByte(addr_s + 2) == 0x20 && MEMORY_dGetByte(addr_s + 3) == 0x5c
&& MEMORY_dGetByte(addr_s + 4) == 0xe4) {
ESC_Add(addr_l, ESC_COPENLOAD, CASSETTE_LeaderLoad);
ESC_Add(addr_s, ESC_COPENSAVE, CASSETTE_LeaderSave);
if (altirra)
ESC_AddEscRts(addr_l, ESC_COPENLOAD, CassetteLeaderAltirra);
else
{
/* don't hurt non-standard OSes that may not support cassette at all */
if (MEMORY_dGetByte(addr_l) == 0xa9 && MEMORY_dGetByte(addr_l + 1) == 0x03
&& MEMORY_dGetByte(addr_l + 2) == 0x8d && MEMORY_dGetByte(addr_l + 3) == 0x2a
&& MEMORY_dGetByte(addr_l + 4) == 0x02
&& MEMORY_dGetByte(addr_s) == check_s_0
&& MEMORY_dGetByte(addr_s + 1) == check_s_1
&& MEMORY_dGetByte(addr_s + 2) == 0x20 && MEMORY_dGetByte(addr_s + 3) == 0x5c
&& MEMORY_dGetByte(addr_s + 4) == 0xe4) {
ESC_Add(addr_l, ESC_COPENLOAD, CassetteLeaderLoad);
ESC_Add(addr_s, ESC_COPENSAVE, CassetteLeaderSave);
}
}
ESC_AddEscRts(0xe459, ESC_SIOV, SIO_Handler);
patched = TRUE;
Expand Down
8 changes: 4 additions & 4 deletions atari800/src/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "antic.h"
#include "cpu.h"
#include "cartridge.h"
#include "emuos.h"
#include "roms/altirra_5200_os.h"
#include "esc.h"
#include "gtia.h"
#include "log.h"
Expand Down Expand Up @@ -1403,9 +1403,9 @@ void MEMORY_CartA0bfEnable(void)
void MEMORY_GetCharset(UBYTE *cs)
{
/* copy font, but change screencode order to ATASCII order */
memcpy(cs, emuos_h + 0x200, 0x100); /* control chars */
memcpy(cs + 0x100, emuos_h, 0x200); /* !"#$..., uppercase letters */
memcpy(cs + 0x300, emuos_h + 0x300, 0x100); /* lowercase letters */
memcpy(cs, ROM_altirra_5200_os + 0x200, 0x100); /* control chars */
memcpy(cs + 0x100, ROM_altirra_5200_os, 0x200); /* !"#$..., uppercase letters */
memcpy(cs + 0x300, ROM_altirra_5200_os + 0x300, 0x100); /* lowercase letters */
}

#ifndef PAGED_MEM
Expand Down
8 changes: 8 additions & 0 deletions atari800/src/roms/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Altirra - Atari 800/800XL emulator
Kernel ROM replacement
Copyright (C) 2008-2020 Avery Lee

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty.
Loading