enhancement: cherry pick updates from x86 branch

Bring this branch closer to the NG version of Amiberry, currently in progress.
Mostly harmless updates, but will help with future merges until the two branches eventually become one.
This commit is contained in:
Dimitris Panokostas 2022-12-31 13:19:54 +01:00
parent f8545af3cd
commit 5d6911384f
81 changed files with 2469 additions and 1362 deletions

2
.gitignore vendored
View file

@ -217,3 +217,5 @@ Thumbs.db
cmake-build-debug
VSLinux/.vs
.vs
.flatpak-builder/
.flatpak/

View file

@ -54,6 +54,7 @@ LOCAL_SRC_FILES := src/akiko.cpp \
src/consolehook.cpp \
src/crc32.cpp \
src/custom.cpp \
src/debug.cpp \
src/def_icons.cpp \
src/devices.cpp \
src/disk.cpp \
@ -99,6 +100,7 @@ LOCAL_SRC_FILES := src/akiko.cpp \
src/traps.cpp \
src/uaeexe.cpp \
src/uaelib.cpp \
src/uaeserial.cpp \
src/uaenative.cpp \
src/uaeresource.cpp \
src/uaeserial.cpp \

View file

@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.16)
project(amiberry)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "-fno-pie -fno-PIE -no-pie")
# Needed so that cmake uses our find modules.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
@ -15,7 +16,7 @@ include_directories(
)
add_subdirectory(external/libguisan)
add_definitions(-DAMIBERRY)
add_definitions(-DAMIBERRY -D_FILE_OFFSET_BITS=64 -DUSE_RENDER_THREAD)
add_executable(${PROJECT_NAME}
src/akiko.cpp
@ -39,6 +40,7 @@ add_executable(${PROJECT_NAME}
src/consolehook.cpp
src/crc32.cpp
src/custom.cpp
src/debug.cpp
src/def_icons.cpp
src/devices.cpp
src/disk.cpp
@ -288,7 +290,7 @@ add_executable(${PROJECT_NAME}
INCLUDE(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
PKG_SEARCH_MODULE(SDL2 REQUIRED SDL2)
PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image>=2.0.0)
PKG_SEARCH_MODULE(SDL2TTF REQUIRED SDL2_ttf)
@ -297,9 +299,38 @@ find_package(mpg123 REQUIRED)
find_package(PNG REQUIRED)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS} ${SDL2IMAGE_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${SDL2_LIBRARIES} ${SDL2IMAGE_LIBRARIES} FLAC::FLAC PNG::PNG png_static)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${SDL2_LIBRARIES} ${SDL2IMAGE_LIBRARIES} ${SDL2TTF_LIBRARIES} FLAC::FLAC PNG::PNG mpg123 mpeg2convert mpeg2)
target_include_directories(${PROJECT_NAME} PRIVATE ./external/libguisan/include)
target_link_libraries(${PROJECT_NAME} PRIVATE guisan)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/abr $<TARGET_FILE_DIR:${PROJECT_NAME}>/abr)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/conf $<TARGET_FILE_DIR:${PROJECT_NAME}>/conf)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/controllers $<TARGET_FILE_DIR:${PROJECT_NAME}>/controllers)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/data $<TARGET_FILE_DIR:${PROJECT_NAME}>/data)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/inputrecordings $<TARGET_FILE_DIR:${PROJECT_NAME}>/inputrecordings)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/kickstarts $<TARGET_FILE_DIR:${PROJECT_NAME}>/kickstarts)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/nvram $<TARGET_FILE_DIR:${PROJECT_NAME}>/nvram)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/savestates $<TARGET_FILE_DIR:${PROJECT_NAME}>/savestates)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/screenshots $<TARGET_FILE_DIR:${PROJECT_NAME}>/screenshots)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/whdboot $<TARGET_FILE_DIR:${PROJECT_NAME}>/whdboot)

View file

@ -11,13 +11,12 @@
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"variables": []
"wslPath": "${defaultWSLPath}"
},
{
"name": "WSL-GCC-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeExecutable": "cmake",
@ -25,8 +24,7 @@
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"variables": []
"wslPath": "${defaultWSLPath}"
}
]
}

View file

@ -409,6 +409,7 @@ OBJS = \
src/consolehook.o \
src/crc32.o \
src/custom.o \
src/debug.o \
src/def_icons.o \
src/devices.o \
src/disk.o \
@ -589,7 +590,7 @@ OBJS += src/osdep/arm_helper.o
src/osdep/arm_helper.o: src/osdep/arm_helper.s
$(AS) $(CPUFLAGS) -o src/osdep/arm_helper.o -c src/osdep/arm_helper.s
else ifeq ($(PLATFORM),$(filter $(PLATFORM),osx-m1))
USE_JIT = 0
USE_JIT = 0
OBJS += src/osdep/aarch64_helper_osx.o
else ifeq ($(PLATFORM),$(filter $(PLATFORM),osx-x86))
USE_JIT = 0
@ -658,6 +659,9 @@ cleanprofile:
guisan:
$(MAKE) -C external/libguisan
gencpu:
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o gencpu src/cpudefs.cpp src/gencpu.cpp src/readcpu.cpp src/osdep/charset.cpp
capsimg:
cd external/capsimg && ./bootstrap && ./configure && $(MAKE)
cp external/capsimg/capsimg.so ./

View file

@ -470,6 +470,7 @@
<ClCompile Include="..\src\cpustbl.cpp" />
<ClCompile Include="..\src\crc32.cpp" />
<ClCompile Include="..\src\custom.cpp" />
<ClCompile Include="..\src\debug.cpp" />
<ClCompile Include="..\src\def_icons.cpp" />
<ClCompile Include="..\src\devices.cpp" />
<ClCompile Include="..\src\disk.cpp" />
@ -809,6 +810,8 @@
<ClInclude Include="..\src\include\cpu_prefetch.h" />
<ClInclude Include="..\src\include\crc32.h" />
<ClInclude Include="..\src\include\custom.h" />
<ClInclude Include="..\src\include\debug.h" />
<ClInclude Include="..\src\include\debugmem.h" />
<ClInclude Include="..\src\include\devices.h" />
<ClInclude Include="..\src\include\disk.h" />
<ClInclude Include="..\src\include\diskutil.h" />
@ -867,10 +870,14 @@
<ClInclude Include="..\src\include\uaenative.h" />
<ClInclude Include="..\src\include\uaeresource.h" />
<ClInclude Include="..\src\include\uaeserial.h" />
<ClInclude Include="..\src\include\uae\api.h" />
<ClInclude Include="..\src\include\uae\attributes.h" />
<ClInclude Include="..\src\include\uae\caps.h" />
<ClInclude Include="..\src\include\uae\cdrom.h" />
<ClInclude Include="..\src\include\uae\dlopen.h" />
<ClInclude Include="..\src\include\uae\likely.h" />
<ClInclude Include="..\src\include\uae\log.h" />
<ClInclude Include="..\src\include\uae\memory.h" />
<ClInclude Include="..\src\include\uae\mman.h" />
<ClInclude Include="..\src\include\uae\string.h" />
<ClInclude Include="..\src\include\uae\types.h" />

View file

@ -1215,6 +1215,9 @@
<ClCompile Include="..\src\osdep\gui\ControllerMap.cpp">
<Filter>src\osdep\gui</Filter>
</ClCompile>
<ClCompile Include="..\src\debug.cpp">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\archivers\7z\7zBuf.h">
@ -2099,6 +2102,24 @@
<ClInclude Include="..\src\include\uae\uae_pragmas.h">
<Filter>src\include\uae</Filter>
</ClInclude>
<ClInclude Include="..\src\include\debug.h">
<Filter>src\include</Filter>
</ClInclude>
<ClInclude Include="..\src\include\debugmem.h">
<Filter>src\include</Filter>
</ClInclude>
<ClInclude Include="..\src\include\uae\api.h">
<Filter>src\include\uae</Filter>
</ClInclude>
<ClInclude Include="..\src\include\uae\attributes.h">
<Filter>src\include\uae</Filter>
</ClInclude>
<ClInclude Include="..\src\include\uae\log.h">
<Filter>src\include\uae</Filter>
</ClInclude>
<ClInclude Include="..\src\include\uae\memory.h">
<Filter>src\include\uae</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Xml Include="..\abr\brainfile.xml">

View file

@ -38,7 +38,7 @@
<RemoteDebuggerWorkingDirectory>$(RemoteRootDir)/amiberry</RemoteDebuggerWorkingDirectory>
<DebuggerFlavor>LinuxDebugger</DebuggerFlavor>
<PreLaunchCommand>export DISPLAY=:0.0</PreLaunchCommand>
<RemoteTarget>402471865;pi400 (username=, port=22, authentication=Password)</RemoteTarget>
<RemoteTarget>-774427876;argon (username=, port=22, authentication=Password)</RemoteTarget>
<RemoteDebuggerCommandArguments>
</RemoteDebuggerCommandArguments>
</PropertyGroup>

View file

@ -163,7 +163,7 @@
#include "custom.h"
#include "newcpu.h"
#include "flashrom.h"
//#include "debug.h"
#include "debug.h"
#include "rommgr.h"
#include "devices.h"
@ -462,7 +462,7 @@ static smp_comm_pipe requests;
static volatile int akiko_thread_running;
static uae_sem_t akiko_sem = 0, sub_sem = 0, cda_sem = 0;
static void checkint (void)
static void checkint_akiko (void)
{
if (cdrom_intreq & cdrom_intena) {
irq ();
@ -485,13 +485,13 @@ static void set_status (uae_u32 status)
}
#endif
cdrom_intreq |= status;
checkint ();
checkint_akiko ();
cdrom_led ^= LED_CD_ACTIVE2;
}
static void rethink_akiko(void)
{
checkint ();
checkint_akiko ();
}
static void cdaudiostop_do (void)

View file

@ -32,7 +32,7 @@
#include "uae.h"
#include "gui.h"
#include "xwin.h"
//#include "debug.h"
#include "debug.h"
//#include "sndboard.h"
#ifdef AVIOUTPUT
#include "avioutput.h"
@ -120,7 +120,7 @@ static float firmem[2 * FIR_WIDTH + 1];
struct audio_channel_data
{
unsigned int evtime;
uae_u32 evtime;
bool dmaenstore;
bool intreq2;
int irqcheck;
@ -218,7 +218,7 @@ static void namesplit (TCHAR *s)
{
int l;
l = _tcslen (s) - 1;
l = _tcslen(s) - 1;
while (l >= 0) {
if (s[l] == '.')
s[l] = 0;
@ -1406,7 +1406,7 @@ static void update_volume(int nr, uae_u16 v)
cdp->data.audvol = v;
}
uae_u16 audio_dmal (void)
uae_u16 audio_dmal(void)
{
uae_u16 dmal = 0;
for (int nr = 0; nr < AUDIO_CHANNELS_PAULA; nr++) {
@ -1420,9 +1420,9 @@ uae_u16 audio_dmal (void)
return dmal;
}
static int isirq (int nr)
static int isirq(int nr)
{
return INTREQR () & (0x80 << nr);
return INTREQR() & (0x80 << nr);
}
static void audio_setirq_event(uae_u32 nr)
@ -1430,7 +1430,7 @@ static void audio_setirq_event(uae_u32 nr)
INTREQ_0 (0x8000 | (0x80 << nr));
}
static void setirq (int nr, int which)
static void setirq(int nr, int which)
{
#if DEBUG_AUDIO > 0
struct audio_channel_data *cdp = audio_channel + nr;
@ -1445,16 +1445,16 @@ static void setirq (int nr, int which)
}
}
static void newsample (int nr, sample8_t sample)
static void newsample(int nr, sample8_t sample)
{
struct audio_channel_data *cdp = audio_channel + nr;
#if DEBUG_AUDIO > 0
if (!debugchannel (nr))
if (!debugchannel(nr))
sample = 0;
#endif
#if DEBUG_AUDIO > 2
if (debugchannel (nr))
write_log (_T("SAMPLE%d: %02x\n"), nr, sample & 0xff);
if (debugchannel(nr))
write_log(_T("SAMPLE%d: %02x\n"), nr, sample & 0xff);
#endif
if (!(audio_channel_mask & (1 << nr)))
sample = 0;
@ -1941,7 +1941,6 @@ static int sound_prefs_changed (void)
|| changed_prefs.sound_volume_board != currprefs.sound_volume_board
|| changed_prefs.sound_stereo_swap_paula != currprefs.sound_stereo_swap_paula
|| changed_prefs.sound_stereo_swap_ahi != currprefs.sound_stereo_swap_ahi
|| changed_prefs.sound_cdaudio != currprefs.sound_cdaudio
|| changed_prefs.sound_filter != currprefs.sound_filter
|| changed_prefs.sound_filter_type != currprefs.sound_filter_type)
return -1;
@ -1979,7 +1978,7 @@ void check_prefs_changed_audio (void)
ch = sound_prefs_changed ();
if (ch > 0) {
#ifdef AVIOUTPUT
AVIOutput_Restart ();
AVIOutput_Restart(true);
#endif
clear_sound_buffers ();
}
@ -2029,7 +2028,6 @@ void set_audio (void)
currprefs.sound_volume_master = changed_prefs.sound_volume_master;
currprefs.sound_volume_board = changed_prefs.sound_volume_board;
currprefs.sound_volume_cd = changed_prefs.sound_volume_cd;
currprefs.sound_cdaudio = changed_prefs.sound_cdaudio;
currprefs.sound_stereo_swap_paula = changed_prefs.sound_stereo_swap_paula;
currprefs.sound_stereo_swap_ahi = changed_prefs.sound_stereo_swap_ahi;
@ -2388,7 +2386,7 @@ static void audxdat_func(uae_u32 v)
cdp->dat_written = false;
}
void AUDxDAT (int nr, uae_u16 v, uaecptr addr)
void AUDxDAT(int nr, uae_u16 v, uaecptr addr)
{
struct audio_channel_data *cdp = audio_channel + nr;
int chan_ena = (dmacon & DMA_MASTER) && (dmacon & (1 << nr));
@ -2420,7 +2418,7 @@ void AUDxDAT (int nr, uae_u16 v, uaecptr addr)
}
uae_u32 vv = nr | (chan_ena ? 0x80 : 0) | (v << 8);
if (!currprefs.cachesize && (cdp->per < PERIOD_LOW * CYCLE_UNIT || currprefs.cpu_compatible)) {
int cyc;
int cyc = 0;
if (chan_ena) {
// AUDxLEN is processed after 2 cycle delay
cyc = 2 * CYCLE_UNIT;
@ -2438,12 +2436,12 @@ void AUDxDAT (int nr, uae_u16 v, uaecptr addr)
audxdat_func(vv);
}
}
void AUDxDAT (int nr, uae_u16 v)
void AUDxDAT(int nr, uae_u16 v)
{
AUDxDAT (nr, v, 0xffffffff);
AUDxDAT(nr, v, 0xffffffff);
}
uaecptr audio_getpt (int nr, bool reset)
uaecptr audio_getpt(int nr, bool reset)
{
struct audio_channel_data *cdp = audio_channel + nr;
uaecptr p = cdp->pt;
@ -2451,14 +2449,14 @@ uaecptr audio_getpt (int nr, bool reset)
if (reset)
cdp->pt = cdp->lc;
cdp->ptx_tofetch = false;
return p;
return p & ~1;
}
void AUDxLCH (int nr, uae_u16 v)
void AUDxLCH(int nr, uae_u16 v)
{
struct audio_channel_data *cdp = audio_channel + nr;
audio_activate ();
update_audio ();
audio_activate();
update_audio();
// someone wants to update PT but DSR has not yet been processed.
// too fast CPU and some tracker players: enable DMA, CPU delay, update AUDxPT with loop position
@ -2483,11 +2481,11 @@ void AUDxLCH (int nr, uae_u16 v)
}
}
void AUDxLCL (int nr, uae_u16 v)
void AUDxLCL(int nr, uae_u16 v)
{
struct audio_channel_data *cdp = audio_channel + nr;
audio_activate ();
update_audio ();
audio_activate();
update_audio();
if (usehacks() && ((cdp->ptx_tofetch && cdp->state == 1) || cdp->ptx_written)) {
static int warned = 100;
cdp->ptx = cdp->lc;

View file

@ -20,7 +20,7 @@
#include "newcpu.h"
#include "autoconf.h"
#include "traps.h"
//#include "debug.h"
#include "debug.h"
#include "threaddep/thread.h"
#include "native2amiga.h"
#include "inputdevice.h"
@ -387,16 +387,16 @@ uae_u8 dbg (uaecptr addr)
* backward. store pointer at current address
*/
uae_u32 ds_ansi (const uae_char *str)
uae_u32 ds_ansi(const uae_char *str)
{
int len;
if (!str)
return addr (rt_straddr);
len = strlen (str) + 1;
return addr(rt_straddr);
len = uaestrlen(str) + 1;
rt_straddr -= len;
strcpy ((uae_char*)rtarea_bank.baseaddr + rt_straddr, str);
return addr (rt_straddr);
strcpy((uae_char*)rtarea_bank.baseaddr + rt_straddr, str);
return addr(rt_straddr);
}
uae_u32 ds (const TCHAR *str)
@ -418,7 +418,7 @@ uae_u32 ds_bstr_ansi (const uae_char *str)
{
int len;
len = strlen (str) + 2;
len = uaestrlen(str) + 2;
rt_straddr -= len;
while (rt_straddr & 3)
rt_straddr--;

View file

@ -22,7 +22,7 @@
#include "blitter.h"
#include "blit.h"
#include "savestate.h"
//#include "debug.h"
#include "debug.h"
// 1 = logging
// 2 = no wait detection

View file

@ -29,11 +29,7 @@
int log_scsiemu = 0;
#ifdef AMIBERRY
#define PRE_INSERT_DELAY (10 * (currprefs.ntscmode ? 60 : 50))
#else
#define PRE_INSERT_DELAY (3 * (currprefs.ntscmode ? 60 : 50))
#endif
struct blkdevstate
{

View file

@ -179,7 +179,7 @@ static int do_read (struct cdunit *cdu, struct cdtoc *t, uae_u8 *data, int secto
}
if (audio && size == 2352)
type = CD_TRACK_AUDIO;
if (cdrom_read_data(cdu->chd_cdf, sector + (uint32_t)t->offset, tmpbuf, type, true)) {
if (cdrom_read_data(cdu->chd_cdf, sector + (uint32_t)t->offset, tmpbuf, type, false)) {
memcpy(data, tmpbuf + offset, size);
return 1;
}
@ -476,7 +476,6 @@ static bool cdda_play_func2 (struct cdunit *cdu, int *outpos)
int silentframes = 0;
bool foundsub;
int oldtrack = -1;
int mode = currprefs.sound_cdaudio;
bool restart = false;
bool first = true;
@ -490,7 +489,7 @@ static bool cdda_play_func2 (struct cdunit *cdu, int *outpos)
cdu->cda_bufon[0] = cdu->cda_bufon[1] = 0;
bufnum = 0;
cdu->cda = new cda_audio (CDDA_BUFFERS, 2352, 44100, mode != 0);
cdu->cda = new cda_audio (CDDA_BUFFERS, 2352, 44100);
while (cdu->cdda_play > 0) {
@ -594,16 +593,12 @@ static bool cdda_play_func2 (struct cdunit *cdu, int *outpos)
}
}
if (mode) {
while (cdu->cda_bufon[bufnum] && cdu->cdda_play > 0) {
if (cd_audio_mode_changed) {
restart = true;
goto end;
}
sleep_millis(10);
while (cdu->cda_bufon[bufnum] && cdu->cdda_play > 0) {
if (cd_audio_mode_changed) {
restart = true;
goto end;
}
} else {
cdu->cda->wait(bufnum);
sleep_millis(10);
}
cdu->cda_bufon[bufnum] = 0;
@ -703,22 +698,12 @@ static bool cdda_play_func2 (struct cdunit *cdu, int *outpos)
if (idleframes <= 0)
cdu->cd_last_pos = cdda_pos;
if (mode) {
if (cdu->cda_bufon[0] == 0 && cdu->cda_bufon[1] == 0) {
cdu->cda_bufon[bufnum] = 1;
next_cd_audio_buffer_callback(1 - bufnum, cdu);
}
audio_cda_volume(&cdu->cas, cdu->cdda_volume[0], cdu->cdda_volume[1]);
if (cdu->cda_bufon[0] == 0 && cdu->cda_bufon[1] == 0) {
cdu->cda_bufon[bufnum] = 1;
} else {
cdu->cda_bufon[bufnum] = 1;
cdu->cda->setvolume (cdu->cdda_volume[0], cdu->cdda_volume[1]);
if (!cdu->cda->play (bufnum)) {
if (cdu->cdda_play > 0)
setstate (cdu, AUDIO_STATUS_PLAY_ERROR, -1);
goto end;
}
next_cd_audio_buffer_callback(1 - bufnum, cdu);
}
audio_cda_volume(&cdu->cas, cdu->cdda_volume[0], cdu->cdda_volume[1]);
cdu->cda_bufon[bufnum] = 1;
if (first) {
first = false;
@ -749,14 +734,9 @@ static bool cdda_play_func2 (struct cdunit *cdu, int *outpos)
end:
*outpos = cdda_pos;
if (mode) {
next_cd_audio_buffer_callback(-1, cdu);
if (restart)
audio_cda_new_buffer(&cdu->cas, NULL, -1, -1, NULL, NULL);
} else {
cdu->cda->wait (0);
cdu->cda->wait (1);
}
next_cd_audio_buffer_callback(-1, cdu);
if (restart)
audio_cda_new_buffer(&cdu->cas, NULL, -1, -1, NULL, NULL);
while (cdimage_unpack_active == 1)
sleep_millis(10);

View file

@ -18,7 +18,7 @@
#include "zfile.h"
#include "cd32_fmv.h"
#include "uae.h"
//#include "debug.h"
#include "debug.h"
#include "custom.h"
#include "audio.h"
#include "devices.h"
@ -231,7 +231,6 @@ static uae_u16 cl450_threshold;
static int cl450_buffer_offset;
static int cl450_buffer_empty_cnt;
static int libmpeg_offset;
static bool audio_mode;
static uae_sem_t play_sem;
static volatile bool fmv_bufon[2];
static float fmv_syncadjust;
@ -401,11 +400,7 @@ static void l64111_setvolume(void)
return;
write_log(_T("L64111 mute %d\n"), volume ? 0 : 1);
if (cda) {
if (audio_mode) {
audio_cda_volume(&cas, volume, volume);
} else {
cda->setvolume(volume, volume);
}
audio_cda_volume(&cas, volume, volume);
}
}
@ -996,7 +991,6 @@ static void cl450_newcmd(void)
{
case CL_Play:
cl450_play = 1;
audio_mode = currprefs.sound_cdaudio;
write_log(_T("CL450 PLAY\n"));
break;
case CL_Pause:
@ -1062,7 +1056,6 @@ static void cl450_newcmd(void)
case CL_Reset:
write_log(_T("CL450 Reset\n"));
cl450_reset_cmd();
audio_mode = currprefs.sound_cdaudio;
break;
case CL_FlushBitStream:
write_log(_T("CL450 CL_FlushBitStream\n"));
@ -1414,13 +1407,10 @@ static void cd32_fmv_audio_handler(void)
if (cd_audio_mode_changed || (cl450_play && !cda)) {
cd_audio_mode_changed = false;
if (cl450_play) {
if (audio_mode) {
audio_cda_new_buffer(&cas, NULL, -1, -1, NULL, NULL);
}
audio_mode = currprefs.sound_cdaudio;
audio_cda_new_buffer(&cas, NULL, -1, -1, NULL, NULL);
fmv_bufon[0] = fmv_bufon[1] = 0;
delete cda;
cda = new cda_audio(PCM_SECTORS, KJMP2_SAMPLES_PER_FRAME * 4, 44100, audio_mode != 0);
cda = new cda_audio(PCM_SECTORS, KJMP2_SAMPLES_PER_FRAME * 4, 44100);
l64111_setvolume();
}
}
@ -1436,13 +1426,8 @@ static void cd32_fmv_audio_handler(void)
if (!cda || !(l64111_regs[A_CONTROL1] & 1))
return;
if (audio_mode) {
play0 = fmv_bufon[0];
play1 = fmv_bufon[1];
} else {
play0 = cda->isplaying(0);
play1 = cda->isplaying(1);
}
play0 = fmv_bufon[0];
play1 = fmv_bufon[1];
needsectors = PCM_SECTORS;
if (!play0 && !play1) {
needsectors *= 2;
@ -1466,15 +1451,11 @@ static void cd32_fmv_audio_handler(void)
memcpy(cda->buffers[bufnum] + i * KJMP2_SAMPLES_PER_FRAME * 4, pcmaudio[offset2].pcm, KJMP2_SAMPLES_PER_FRAME * 4);
pcmaudio[offset2].ready = false;
}
if (audio_mode) {
if (!play0 && !play1) {
fmv_bufon[bufnum] = 1;
fmv_next_cd_audio_buffer_callback(1 - bufnum, NULL);
}
if (!play0 && !play1) {
fmv_bufon[bufnum] = 1;
} else {
cda->play(bufnum);
fmv_next_cd_audio_buffer_callback(1 - bufnum, NULL);
}
fmv_bufon[bufnum] = 1;
offset += PCM_SECTORS;
offset &= l64111_cb_mask;
l64111_regs[A_CB_READ] = offset;
@ -1548,12 +1529,7 @@ static void cd32_fmv_free(void)
xfree(videoram);
videoram = NULL;
if (cda) {
if (audio_mode) {
fmv_next_cd_audio_buffer_callback(-1, NULL);
} else {
cda->wait(0);
cda->wait(1);
}
fmv_next_cd_audio_buffer_callback(-1, NULL);
delete cda;
}
cda = NULL;

View file

@ -23,7 +23,7 @@
#include "memory.h"
#include "custom.h"
#include "newcpu.h"
//#include "debug.h"
#include "debug.h"
#include "cdtv.h"
#include "blkdev.h"
#include "gui.h"
@ -598,8 +598,8 @@ static void cdrom_command_thread (uae_u8 b)
break;
case 0x83:
if (cdrom_command_cnt_in == 7) {
memcpy (cdrom_command_output, MODEL_NAME, strlen (MODEL_NAME));
cdrom_command_accepted (strlen (MODEL_NAME), s, &cdrom_command_cnt_in);
memcpy (cdrom_command_output, MODEL_NAME, uaestrlen(MODEL_NAME));
cdrom_command_accepted (uaestrlen(MODEL_NAME), s, &cdrom_command_cnt_in);
cd_finished = 1;
}
case 0x84:
@ -1085,7 +1085,7 @@ void cdtv_getdmadata (uae_u32 *acr)
*acr = dmac_acr;
}
static void checkint (void)
static void checkint_cdtv (void)
{
int irq = 0;
@ -1102,7 +1102,7 @@ static void checkint (void)
void cdtv_scsi_int (void)
{
checkint ();
checkint_cdtv ();
}
void cdtv_scsi_clear_int (void)
{
@ -1111,7 +1111,7 @@ void cdtv_scsi_clear_int (void)
static void rethink_cdtv (void)
{
checkint ();
checkint_cdtv ();
tp_check_interrupts ();
}
@ -1137,7 +1137,7 @@ static void CDTV_hsync_handler (void)
dma_finished = 0;
cdtv_hsync = -1;
}
checkint ();
checkint_cdtv ();
if (cdrom_command_done) {
cdrom_command_done = 0;
@ -1286,7 +1286,7 @@ static uae_u32 dmac_bget2 (uaecptr addr)
case 0x93:
//if (cdtvscsi) {
// v = wdscsi_get (&wd_cdtv->wc, wd_cdtv);
// checkint ();
// checkint_cdtv ();
//}
break;
case 0xa1:
@ -1389,13 +1389,13 @@ static void dmac_bput2 (uaecptr addr, uae_u32 b)
case 0x91:
//if (cdtvscsi) {
// wdscsi_sasr (&wd_cdtv->wc, b);
// checkint ();
// checkint_cdtv ();
//}
break;
case 0x93:
//if (cdtvscsi) {
// wdscsi_put (&wd_cdtv->wc, wd_cdtv, b);
// checkint ();
// checkint_cdtv ();
//}
break;
case 0xa1:
@ -1419,7 +1419,7 @@ static void dmac_bput2 (uaecptr addr, uae_u32 b)
case 0xe4:
case 0xe5:
dmac_istr = 0;
checkint ();
checkint_cdtv ();
break;
case 0xe8:
case 0xe9:

View file

@ -19,7 +19,7 @@
#include "options.h"
#include "memory.h"
#include "newcpu.h"
//#include "debug.h"
#include "debug.h"
#include "zfile.h"
#include "gui.h"
#include "cdtvcr.h"

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,7 @@
*
* Copyright 1995 Bernd Schmidt, Alessandro Bissacco
* Copyright 1996, 1997 Stefan Reinauer, Christian Schmitt
* Copyright 2022 Toni Wilen
*/
@ -32,7 +33,7 @@
//#include "parallel.h"
#include "akiko.h"
#include "cdtv.h"
//#include "debug.h"
#include "debug.h"
//#include "arcadia.h"
#include "audio.h"
#include "keyboard.h"
@ -41,7 +42,6 @@
#include "sampler.h"
#include "dongle.h"
#include "inputrecord.h"
#include "autoconf.h"
//#include "uae/ppc.h"
#include "rommgr.h"
#include "scsi.h"
@ -59,9 +59,36 @@
#define DONGLE_DEBUG 0
#define KB_DEBUG 0
#define CLOCK_DEBUG 0
#define CIA_EVERY_CYCLE_DEBUG 0
#define TOD_HACK
#define CIA_IRQ_PROCESS_DELAY 0
#define CR_START 1
#define CR_PBON 2
#define CR_OUTMODE 4
#define CR_RUNMODE 8
#define CR_LOAD 0x10
#define CR_INMODE 0x20
#define CR_INMODE1 0x40
#define CR_SPMODE 0x40
#define CR_ALARM 0x80
#define ICR_A 1
#define ICR_B 2
#define ICR_ALARM 4
#define ICR_SP 8
#define ICR_FLAG 0x10
#define ICR_MASK 0x1f
#define CIA_PIPE_ALL_BITS 2
#define CIA_PIPE_ALL_MASK ((1 << CIA_PIPE_ALL_BITS) - 1)
#define CIA_PIPE_INPUT 2
#define CIA_PIPE_CLR1 1
#define CIA_PIPE_CLR2 3
#define CIA_PIPE_OUTPUT 1
/* Akiko internal CIA differences:
- BFE101 and BFD100: reads 3F if data direction is in.

View file

@ -103,7 +103,7 @@ uaecptr consolehook_beginio(TrapContext *ctx, uaecptr request)
if (len == -1) {
dbuf = xmalloc(char, MAX_DPATH);
trap_get_string(ctx, dbuf, io_data, MAX_DPATH);
len = strlen(dbuf);
len = uaestrlen(dbuf);
} else {
dbuf = xmalloc(char, len);
trap_get_bytes(ctx, dbuf, io_data, len);

View file

@ -1,12 +1,14 @@
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "memory.h"
#include "custom.h"
#include "events.h"
#include "newcpu.h"
#include "cpu_prefetch.h"
#include "cputbl.h"
#define SET_ALWAYS_CFLG(x) SET_CFLG(x)
#define SET_ALWAYS_NFLG(x) SET_NFLG(x)
#ifdef CPUEMU_0
const struct cputbl op_smalltbl_0[] = {
{ op_0000_0_ff, 0x0000, 4, { 0, 0 }, 0 }, /* OR */

View file

@ -39,13 +39,14 @@
#include "drawing.h"
#include "savestate.h"
#include "ar.h"
//#include "debug.h"
#include "debug.h"
#include "akiko.h"
#if defined(ENFORCER)
#include "enforcer.h"
#endif
#include "threaddep/thread.h"
//#include "luascript.h"
#include "crc32.h"
#include "devices.h"
#include "rommgr.h"
//#include "specialmonitors.h"
@ -94,7 +95,8 @@ extern uae_u16 serper;
#endif
#ifdef AMIBERRY
int debug_sprite_mask = 0xff;
extern int debug_sprite_mask;
extern void memory_map_dump(void);
#endif
STATIC_INLINE bool nocustom (void)
@ -10601,7 +10603,6 @@ uae_u8 *restore_custom_extra(uae_u8 *src)
RL; // currprefs.cs_rtc_adjust = changed_prefs.cs_rtc_adjust = RL;
currprefs.cs_a1000ram = changed_prefs.cs_a1000ram = RBB;
currprefs.cs_slowmemisfast = changed_prefs.cs_slowmemisfast = RBB;
//currprefs.a2091rom.enabled = changed_prefs.a2091rom.enabled = RBB;
//currprefs.a4091rom.enabled = changed_prefs.a4091rom.enabled = RBB;
@ -10645,6 +10646,8 @@ uae_u8 *restore_custom_extra(uae_u8 *src)
currprefs.cs_ciatype[0] = changed_prefs.cs_ciatype[0] = RBB;
currprefs.cs_ciatype[1] = changed_prefs.cs_ciatype[1] = RBB;
currprefs.cs_memorypatternfill = changed_prefs.cs_memorypatternfill = RBB;
return src;
}
@ -10663,7 +10666,6 @@ uae_u8 *save_custom_extra(size_t *len, uae_u8 *dstptr)
SL(currprefs.cs_rtc_adjust);
SB(currprefs.cs_a1000ram ? 1 : 0);
SB(currprefs.cs_slowmemisfast ? 1 : 0);
SB(is_board_enabled(&currprefs, ROMTYPE_A2091, 0) ? 1 : 0);
SB(is_board_enabled(&currprefs, ROMTYPE_A4091, 0) ? 1 : 0);
@ -10704,6 +10706,7 @@ uae_u8 *save_custom_extra(size_t *len, uae_u8 *dstptr)
SB(currprefs.cs_romisslow ? 1 : 0);
SB(currprefs.cs_ciatype[0]);
SB(currprefs.cs_ciatype[1]);
SB(currprefs.cs_memorypatternfill);
*len = dst - dstbak;
return dstbak;
@ -10849,7 +10852,6 @@ void check_prefs_changed_custom(void)
currprefs.cs_deniserev = changed_prefs.cs_deniserev;
currprefs.cs_mbdmac = changed_prefs.cs_mbdmac;
currprefs.cs_df0idhw = changed_prefs.cs_df0idhw;
currprefs.cs_slowmemisfast = changed_prefs.cs_slowmemisfast;
currprefs.cs_denisenoehb = changed_prefs.cs_denisenoehb;
currprefs.cs_z3autoconfig = changed_prefs.cs_z3autoconfig;
currprefs.cs_bytecustomwritebug = changed_prefs.cs_bytecustomwritebug;
@ -10861,6 +10863,7 @@ void check_prefs_changed_custom(void)
currprefs.cs_eclocksync = changed_prefs.cs_eclocksync;
currprefs.cs_ciatype[0] = changed_prefs.cs_ciatype[0];
currprefs.cs_ciatype[1] = changed_prefs.cs_ciatype[1];
currprefs.cs_memorypatternfill = changed_prefs.cs_memorypatternfill;
if (currprefs.chipset_mask != changed_prefs.chipset_mask ||
currprefs.cs_dipagnus != changed_prefs.cs_dipagnus ||

221
src/debug.cpp Normal file
View file

@ -0,0 +1,221 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Debugger
*
* (c) 1995 Bernd Schmidt
* (c) 2006 Toni Wilen
*
*/
#include "sysconfig.h"
#include "sysdeps.h"
#include <ctype.h>
#include <signal.h>
#include "options.h"
#include "uae.h"
#include "memory.h"
#include "custom.h"
#include "newcpu.h"
#include "cpu_prefetch.h"
#include "debug.h"
//#include "disasm.h"
#include "debugmem.h"
#include "cia.h"
#include "xwin.h"
//#include "identify.h"
#include "audio.h"
#include "sounddep/sound.h"
#include "disk.h"
#include "savestate.h"
#include "autoconf.h"
#include "akiko.h"
#include "inputdevice.h"
#include "crc32.h"
#include "cpummu.h"
#include "rommgr.h"
#include "inputrecord.h"
#include "calc.h"
#include "cpummu.h"
#include "cpummu030.h"
#include "ar.h"
//#include "pci.h"
//#include "ppc/ppcd.h"
//#include "uae/io.h"
//#include "uae/ppc.h"
#include "drawing.h"
#include "devices.h"
#include "blitter.h"
#include "ini.h"
#include "readcpu.h"
#include "cputbl.h"
#include "keybuf.h"
int debug_sprite_mask = 0xff;
static uae_u8 *dump_xlate (uae_u32 addr)
{
if (!mem_banks[addr >> 16]->check (addr, 1))
return NULL;
return mem_banks[addr >> 16]->xlateaddr (addr);
}
static const TCHAR *bankmodes[] = { _T("F32"), _T("C16"), _T("C32"), _T("CIA"), _T("F16"), _T("F16X") };
static void memory_map_dump_3(UaeMemoryMap *map, int log)
{
bool imold;
int i, j, max;
addrbank *a1 = mem_banks[0];
TCHAR txt[256];
map->num_regions = 0;
imold = currprefs.illegal_mem;
currprefs.illegal_mem = false;
max = currprefs.address_space_24 ? 256 : 65536;
j = 0;
for (i = 0; i < max + 1; i++) {
addrbank *a2 = NULL;
if (i < max)
a2 = mem_banks[i];
if (a1 != a2) {
int k, mirrored, mirrored2, size, size_out;
TCHAR size_ext;
uae_u8 *caddr;
TCHAR tmp[MAX_DPATH];
const TCHAR *name = a1->name;
struct addrbank_sub *sb = a1->sub_banks;
int bankoffset = 0;
int region_size;
k = j;
caddr = dump_xlate (k << 16);
mirrored = caddr ? 1 : 0;
k++;
while (k < i && caddr) {
if (dump_xlate (k << 16) == caddr) {
mirrored++;
}
k++;
}
mirrored2 = mirrored;
if (mirrored2 == 0)
mirrored2 = 1;
while (bankoffset < 65536) {
int bankoffset2 = bankoffset;
if (sb) {
uaecptr daddr;
if (!sb->bank)
break;
daddr = (j << 16) | bankoffset;
a1 = get_sub_bank(&daddr);
name = a1->name;
for (;;) {
bankoffset2 += MEMORY_MIN_SUBBANK;
if (bankoffset2 >= 65536)
break;
daddr = (j << 16) | bankoffset2;
addrbank *dab = get_sub_bank(&daddr);
if (dab != a1)
break;
}
sb++;
size = (bankoffset2 - bankoffset) / 1024;
region_size = size * 1024;
} else {
size = (i - j) << (16 - 10);
region_size = ((i - j) << 16) / mirrored2;
}
if (name == NULL)
name = _T("<none>");
size_out = size;
size_ext = 'K';
if (j >= 256 && (size_out / mirrored2 >= 1024) && !((size_out / mirrored2) & 1023)) {
size_out /= 1024;
size_ext = 'M';
}
_stprintf (txt, _T("%08X %7d%c/%d = %7d%c %s%s%c %s %s"), (j << 16) | bankoffset, size_out, size_ext,
mirrored, mirrored ? size_out / mirrored : size_out, size_ext,
(a1->flags & ABFLAG_CACHE_ENABLE_INS) ? _T("I") : _T("-"),
(a1->flags & ABFLAG_CACHE_ENABLE_DATA) ? _T("D") : _T("-"),
a1->baseaddr == NULL ? ' ' : '*',
bankmodes[ce_banktype[j]],
name);
tmp[0] = 0;
if ((a1->flags & ABFLAG_ROM) && mirrored) {
TCHAR *p = txt + _tcslen (txt);
uae_u32 crc = 0xffffffff;
if (a1->check(((j << 16) | bankoffset), (size * 1024) / mirrored))
crc = get_crc32 (a1->xlateaddr((j << 16) | bankoffset), (size * 1024) / mirrored);
struct romdata *rd = getromdatabycrc (crc);
_stprintf (p, _T(" (%08X)"), crc);
if (rd) {
tmp[0] = '=';
getromname (rd, tmp + 1);
_tcscat (tmp, _T("\n"));
}
}
if (a1 != &dummy_bank) {
for (int m = 0; m < mirrored2; m++) {
if (map->num_regions >= UAE_MEMORY_REGIONS_MAX)
break;
UaeMemoryRegion *r = &map->regions[map->num_regions];
r->start = (j << 16) + bankoffset + region_size * m;
r->size = region_size;
r->flags = 0;
r->memory = NULL;
if (!(a1->flags & ABFLAG_PPCIOSPACE)) {
r->memory = dump_xlate((j << 16) | bankoffset);
if (r->memory)
r->flags |= UAE_MEMORY_REGION_RAM;
}
/* just to make it easier to spot in debugger */
r->alias = 0xffffffff;
if (m >= 0) {
r->alias = j << 16;
r->flags |= UAE_MEMORY_REGION_ALIAS | UAE_MEMORY_REGION_MIRROR;
}
_stprintf(r->name, _T("%s"), name);
_stprintf(r->rom_name, _T("%s"), tmp);
map->num_regions += 1;
}
}
_tcscat (txt, _T("\n"));
if (log > 0)
write_log (_T("%s"), txt);
else if (log == 0)
write_log (txt);
if (tmp[0]) {
if (log > 0)
write_log (_T("%s"), tmp);
else if (log == 0)
write_log (tmp);
}
if (!sb)
break;
bankoffset = bankoffset2;
}
j = i;
a1 = a2;
}
}
//pci_dump(log);
currprefs.illegal_mem = imold;
}
static void memory_map_dump_2 (int log)
{
UaeMemoryMap map;
memory_map_dump_3(&map, log);
}
void memory_map_dump (void)
{
memory_map_dump_2(1);
}

View file

@ -36,7 +36,7 @@ int disk_debug_track = -1;
//#include "execlib.h"
#include "savestate.h"
#include "cia.h"
//#include "debug.h"
#include "debug.h"
#ifdef FDI2RAW
#include "fdi2raw.h"
#endif
@ -199,6 +199,7 @@ typedef struct {
int num_tracks, write_num_tracks, num_secs, num_heads;
int hard_num_cyls;
bool dskeject;
int dskeject_time;
bool dskchange;
int dskchange_time;
bool dskready;
@ -238,6 +239,20 @@ typedef struct {
#define MIN_STEPLIMIT_CYCLE (CYCLE_UNIT * 140)
static const TCHAR *drivetypes[] = {
_T("none"),
_T("35dd"),
_T("35hd"),
_T("525sd"),
_T("35ddescom"),
_T("pc525_40"),
_T("pc525_80"),
_T("pc525_4080"),
_T("525dd"),
_T("floppybridge"),
NULL
};
static uae_u16 bigmfmbufw[0x4000 * DDHDMULT];
static drive floppy[MAX_FLOPPY_DRIVES];
static TCHAR dfxhistory[HISTORY_MAX][MAX_PREVIOUS_IMAGES][MAX_DPATH];
@ -288,8 +303,8 @@ static int dirhash (const uae_char *name)
uae_u32 hash;
int i;
hash = strlen(name);
for(i = 0; i < strlen(name); i++) {
hash = uaestrlen(name);
for(i = 0; i < uaestrlen(name); i++) {
hash = hash * 13;
hash = hash + toupper(name[i]);
hash = hash & 0x7ff;
@ -847,6 +862,7 @@ static void reset_drive (int num)
if (num == 0 && currprefs.floppyslots[num].dfxtype == 0)
drv->indexhackmode = 1;
drv->dskchange_time = 0;
drv->dskeject_time = 0;
drv->dskchange = false;
drv->dskready_down_time = 0;
drv->dskready_up_time = 0;
@ -1072,7 +1088,7 @@ static void saveimagecutfilepart(TCHAR *name)
int i;
_tcscpy(tmp, name);
i = _tcslen (tmp) - 1;
i = _tcslen(tmp) - 1;
while (i > 0) {
if (tmp[i] == '/' || tmp[i] == '\\') {
_tcscpy(name, tmp + i + 1);
@ -1733,8 +1749,11 @@ static void set_steplimit (drive *drv)
drv->steplimitcycle = get_cycles();
}
static bool drive_empty (drive * drv)
static bool drive_empty(drive * drv)
{
if (drv->dskeject_time > 0) {
return true;
}
#ifdef FLOPPYBRIDGE
if (drv->bridge) {
bool v = drv->bridge->isDiskInDrive();
@ -1748,7 +1767,7 @@ static bool drive_empty (drive * drv)
return drv->diskfile == 0 && drv->dskchange_time >= 0;
}
static void drive_step (drive *drv, int step_direction)
static void drive_step(drive *drv, int step_direction)
{
#ifdef CATWEASEL
if (drv->catweasel) {
@ -1824,7 +1843,7 @@ static void drive_step (drive *drv, int step_direction)
write_log (_T(" ->step %d"), drv->cyl);
}
static bool drive_track0 (drive * drv)
static bool drive_track0(drive * drv)
{
#ifdef FLOPPYBRIDGE
if (drv->bridge) {
@ -1841,6 +1860,9 @@ static bool drive_track0 (drive * drv)
static bool drive_diskchange(drive *drv)
{
if (drv->dskeject_time > 0 && drv->dskchange) {
return true;
}
#ifdef FLOPPYBRIDGE
if (drv->bridge) {
bool v = drv->bridge->hasDiskChanged();
@ -2944,7 +2966,7 @@ static void floppy_get_rootblock (uae_u8 *dst, int block, const TCHAR *disk_name
dst[12+3] = 0x48; // size of hash table
dst[312] = dst[313] = dst[314] = dst[315] = (uae_u8)0xff; // bitmap valid
dst[316+2] = (block + 1) >> 8; dst[316+3] = (block + 1) & 255; // bitmap pointer
char* s = ua((disk_name && disk_name[0] != '\0') ? disk_name : _T("empty"));
char *s = ua ((disk_name && disk_name[0] != '\0') ? disk_name : _T("empty"));
dst[432] = (uae_u8)strlen (s); // name length
strcpy ((char*)dst + 433, s); // name
xfree (s);
@ -3307,6 +3329,8 @@ static void DISK_check_change (void)
currprefs.floppy_read_only = changed_prefs.floppy_read_only;
for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) {
drive *drv = floppy + i;
bool dc = false;
if (drv->dskeject) {
drive_eject(drv);
/* set dskchange_time, disk_insert() will be
@ -3315,15 +3339,23 @@ static void DISK_check_change (void)
*/
setdskchangetime(drv, 2 * 50 * 312);
}
if (currprefs.floppyslots[i].dfxtype != changed_prefs.floppyslots[i].dfxtype) {
if (currprefs.floppyslots[i].dfxtype != changed_prefs.floppyslots[i].dfxtype ||
currprefs.floppyslots[i].dfxsubtype != changed_prefs.floppyslots[i].dfxsubtype) {
int old = currprefs.floppyslots[i].dfxtype;
currprefs.floppyslots[i].dfxtype = changed_prefs.floppyslots[i].dfxtype;
currprefs.floppyslots[i].dfxsubtype = changed_prefs.floppyslots[i].dfxsubtype;
_tcscpy(currprefs.floppyslots[i].dfxsubtypeid, changed_prefs.floppyslots[i].dfxsubtypeid);
#ifdef FLOPPYBRIDGE
if (old >= DRV_FB || currprefs.floppyslots[i].dfxtype >= DRV_FB) {
floppybridge_init(&currprefs);
}
dc = true;
}
#endif
reset_drive (i);
reset_drive(i);
if (dc) {
drv->dskeject_time = 2 * 50 * 312;
drv->dskchange = true;
}
#ifdef RETROPLATFORM
rp_floppy_device_enable (i, currprefs.floppyslots[i].dfxtype >= 0);
#endif
@ -3336,16 +3368,16 @@ static void DISK_check_change (void)
}
}
void DISK_vsync (void)
void DISK_vsync(void)
{
DISK_check_change ();
DISK_check_change();
for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) {
drive *drv = floppy + i;
if (drv->selected_delay > 0) {
drv->selected_delay--;
}
if (drv->dskchange_time == 0 && _tcscmp (currprefs.floppyslots[i].df, changed_prefs.floppyslots[i].df))
disk_insert (i, changed_prefs.floppyslots[i].df, changed_prefs.floppyslots[i].forcedwriteprotect);
disk_insert(i, changed_prefs.floppyslots[i].df, changed_prefs.floppyslots[i].forcedwriteprotect);
}
}
@ -4076,14 +4108,12 @@ static void wordsync_detected(bool startup)
static void disk_doupdate_read_reallynothing(int floppybits, bool state)
{
// Only because there is at least one demo that checks wrong bit
// and hangs unless DSKSYNC bit it set with zero DSKSYNC value...
if (INTREQR() & 0x1000)
return;
bool done = false;
while (floppybits >= get_floppy_speed()) {
bool skipbit = false;
word <<= 1;
word |= (state ? 1 : 0);
doreaddma();
// MSBSYNC
if (adkcon & 0x200) {
if ((word & 0x0001) == 0 && bitoffset == 0) {
@ -4099,8 +4129,11 @@ static void disk_doupdate_read_reallynothing(int floppybits, bool state)
dskbytr_val = word & 0xff;
dskbytr_val |= 0x8000;
}
if (!(adkcon & 0x200) && word == dsksync) {
// Only because there is at least one demo that checks wrong bit
// and hangs unless DSKSYNC bit it set with zero DSKSYNC value...
if (!(INTREQR() & 0x1000) && !done && !(adkcon & 0x200) && word == dsksync) {
INTREQ(0x8000 | 0x1000);
done = true;
}
bitoffset++;
bitoffset &= 15;
@ -4254,11 +4287,11 @@ static void disk_dma_debugmsg (void)
/* this is very unoptimized. DSKBYTR is used very rarely, so it should not matter. */
uae_u16 DSKBYTR (int hpos)
uae_u16 DSKBYTR(int hpos)
{
uae_u16 v;
DISK_update (hpos);
DISK_update(hpos);
v = dskbytr_val;
dskbytr_val &= ~0x8000;
if (word == dsksync && cycles_in_range(dsksync_cycles)) {
@ -4272,7 +4305,7 @@ uae_u16 DSKBYTR (int hpos)
if (dsklen & 0x4000)
v |= 0x2000;
if (disk_debug_logging > 2)
write_log (_T("DSKBYTR=%04X hpos=%d\n"), v, hpos);
write_log(_T("DSKBYTR=%04X PC=%08x\n"), v, M68K_GETPC);
for (int dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
drive *drv = &floppy[dr];
if (drv->motoroff)
@ -4286,9 +4319,11 @@ uae_u16 DSKBYTR (int hpos)
drv->track_access_done = true;
if (disk_debug_mode & DISK_DEBUG_PIO) {
if (disk_debug_track < 0 || disk_debug_track == 2 * drv->cyl + side) {
disk_dma_debugmsg ();
write_log (_T("DSKBYTR=%04X\n"), v);
//activate_debugger ();
disk_dma_debugmsg();
write_log(_T("DSKBYTR=%04X\n"), v);
#ifdef DEBUGGER
activate_debugger();
#endif
break;
}
}
@ -4297,7 +4332,7 @@ uae_u16 DSKBYTR (int hpos)
return v;
}
static void DISK_start (void)
static void DISK_start(void)
{
int dr;
@ -4305,10 +4340,15 @@ static void DISK_start (void)
dumpdisk(_T("DSKLEN"));
}
for (int i = 0; i < 3; i++)
for (int i = 0; i < 3; i++) {
fifo_inuse[i] = false;
}
fifo_filled = 0;
if (dskdmaen == DSKDMA_WRITE) {
word = 0;
}
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
drive *drv = &floppy[dr];
if (!((selected | disabled) & (1 << dr))) {
@ -4328,9 +4368,8 @@ static void DISK_start (void)
}
if (dskdmaen == DSKDMA_WRITE) {
word = 0;
drv->tracklen = floppy_writemode > 0 ? FLOPPY_WRITE_MAXLEN : FLOPPY_WRITE_LEN * drv->ddhd * 8 * 2;
drv->trackspeed = get_floppy_speed ();
drv->trackspeed = get_floppy_speed();
drv->skipoffset = -1;
updatemfmpos (drv);
}
@ -4383,14 +4422,17 @@ void DISK_hsync (void)
if (drv->dskready_up_time == 0 && !drv->motoroff)
drv->dskready = true;
}
if (drv->dskeject_time > 0) {
drv->dskeject_time--;
}
/* delay until new disk image is inserted */
if (drv->dskchange_time > 0) {
drv->dskchange_time--;
if (drv->dskchange_time == 0) {
drive_insert (drv, &currprefs, dr, drv->newname, false, drv->newnamewriteprotected);
drive_insert(drv, &currprefs, dr, drv->newname, false, drv->newnamewriteprotected);
if (disk_debug_logging > 0)
write_log (_T("delayed insert, drive %d, image '%s'\n"), dr, drv->newname);
update_drive_gui (dr, false);
write_log(_T("delayed insert, drive %d, image '%s'\n"), dr, drv->newname);
update_drive_gui(dr, false);
}
}
@ -4429,7 +4471,7 @@ void DISK_update (int tohpos)
int cycles;
if (disk_hpos < 0) {
disk_hpos = - disk_hpos;
disk_hpos = -disk_hpos;
return;
}
@ -4440,11 +4482,13 @@ void DISK_update (int tohpos)
if (tohpos != maxhpos || cycles / 256 != maxhpos)
write_log (_T("%d %d %d\n"), tohpos, cycles / 256, disk_hpos / 256);
#endif
if (cycles <= 0)
if (cycles <= 0) {
return;
}
disk_hpos += cycles;
if (disk_hpos >= (maxhpos << 8))
if (disk_hpos >= (maxhpos << 8)) {
disk_hpos %= 1 << 8;
}
for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
drive *drv = &floppy[dr];
@ -4496,14 +4540,17 @@ void DISK_update (int tohpos)
/* no active floppy (selected and motor active) found but DMA was active */
if (dskdmaen == DSKDMA_READ) {
disk_doupdate_read_nothing(cycles);
}
else if (dskdmaen == DSKDMA_WRITE) {
} else if (dskdmaen == DSKDMA_WRITE) {
disk_doupdate_write(cycles, get_floppy_speed());
}
}
/* no floppy selected and no DMA */
if ((selected | disabled) == 15 && dskdmaen < DSKDMA_WRITE) {
//disk_doupdate_read_reallynothing(cycles, true);
if ((selected | disabled) == 15) {
if (dskdmaen < DSKDMA_WRITE) {
disk_doupdate_read_reallynothing(cycles, false);
} else if (dskdmaen == DSKDMA_WRITE) {
disk_doupdate_write(cycles, get_floppy_speed());
}
}
}
@ -4607,7 +4654,9 @@ void DSKLEN (uae_u16 v, int hpos)
if (!(selected & (1 << dr))) {
if (disk_debug_track < 0 || disk_debug_track == 2 * drv->cyl + side) {
disk_dma_debugmsg ();
//activate_debugger ();
#ifdef DEBUGGER
activate_debugger ();
#endif
break;
}
}
@ -4815,34 +4864,35 @@ void DISK_update_adkcon (int hpos, uae_u16 v)
bitoffset = 0;
}
void DSKSYNC (int hpos, uae_u16 v)
void DSKSYNC(int hpos, uae_u16 v)
{
if (v == dsksync)
return;
DISK_update (hpos);
DISK_update(hpos);
dsksync = v;
}
STATIC_INLINE bool iswrite (void)
STATIC_INLINE bool iswrite(void)
{
return dskdmaen == DSKDMA_WRITE;
}
void DSKDAT (uae_u16 v)
void DSKDAT(uae_u16 v)
{
if (fifo_inuse[2]) {
write_log (_T("DSKDAT: FIFO overflow!\n"));
write_log(_T("DSKDAT: FIFO overflow!\n"));
return;
}
fifo_inuse[2] = fifo_inuse[1];
fifo[2] = fifo[1];
fifo_inuse[1] = fifo_inuse[0];
fifo[1] = fifo[0];
fifo_inuse[0] = iswrite () ? 2 : 1;
fifo_inuse[0] = iswrite() ? 2 : 1;
fifo[0] = v;
fifo_filled = 1;
}
uae_u16 DSKDATR (void)
uae_u16 DSKDATR(void)
{
int i;
uae_u16 v = 0;
@ -4854,51 +4904,61 @@ uae_u16 DSKDATR (void)
}
}
if (i < 0) {
write_log (_T("DSKDATR: FIFO underflow!\n"));
} else if (dskdmaen > 0 && dskdmaen < 3 && dsklength <= 0 && disk_fifostatus () < 0) {
disk_dmafinished ();
write_log(_T("DSKDATR: FIFO underflow!\n"));
} else if (dskdmaen > 0 && dskdmaen < 3 && dsklength <= 0 && disk_fifostatus() < 0) {
disk_dmafinished();
}
return v;
}
uae_u16 disk_dmal (void)
uae_u16 disk_dmal(void)
{
uae_u16 dmal = 0;
if (dskdmaen) {
if (dskdmaen == 3) {
if (dskdmaen == DSKDMA_WRITE) {
if (vpos == 123)
write_log("1");
dmal = (1 + 2) * (fifo_inuse[0] ? 1 : 0) + (4 + 8) * (fifo_inuse[1] ? 1 : 0) + (16 + 32) * (fifo_inuse[2] ? 1 : 0);
dmal ^= 63;
if (dsklength == 2)
dmal = (((dmal >> 4) & 3) << 0) | (((dmal >> 2) & 3) << 2) | (((dmal >> 0) & 3) << 4);
if (dsklength == 2) {
dmal &= ~(16 + 32);
if (dsklength == 1)
}
if (dsklength == 1 && dmal) {
dmal &= ~(16 + 32 + 4 + 8);
}
while (dmal && !(dmal & (1 + 2))) {
dmal >>= 2;
}
} else {
dmal = 16 * (fifo_inuse[0] ? 1 : 0) + 4 * (fifo_inuse[1] ? 1 : 0) + 1 * (fifo_inuse[2] ? 1 : 0);
}
}
return dmal;
}
uaecptr disk_getpt (void)
uaecptr disk_getpt(void)
{
uaecptr pt = dskpt;
dskpt += 2;
return pt;
}
void DSKPTH (uae_u16 v)
{
dskpt = (dskpt & 0xffff) | ((uae_u32) v << 16);
return pt & ~1;
}
void DSKPTL (uae_u16 v)
void DSKPTH(uae_u16 v)
{
dskpt = (dskpt & ~0xffff) | (v);
dskpt = (dskpt & 0x0000ffff) | ((uae_u32) v << 16);
}
void DISK_free (void)
void DSKPTL(uae_u16 v)
{
dskpt = (dskpt & 0xffff0000) | (v & 0x0000fffe);
}
void DISK_free(void)
{
for (int dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
drive *drv = &floppy[dr];
drive_image_free (drv);
drive_image_free(drv);
}
}

View file

@ -51,7 +51,7 @@ happening, all ports should restrict window widths to be multiples of 16 pixels.
#include "savestate.h"
#include "statusline.h"
#include "inputdevice.h"
//#include "debug.h"
#include "debug.h"
#ifdef CD32
#include "cd32_fmv.h"
#endif
@ -188,6 +188,7 @@ int xgreencolor_s, xgreencolor_b, xgreencolor_m;
int xbluecolor_s, xbluecolor_b, xbluecolor_m;
struct color_entry colors_for_drawing;
xcolnr fullblack;
static struct color_entry direct_colors_for_drawing;
static xcolnr *p_acolors;

View file

@ -34,7 +34,7 @@
//#include "ncr_scsi.h"
//#include "ncr9x_scsi.h"
#include "scsi.h"
//include "debug.h"
#include "debug.h"
#include "gayle.h"
//#include "idecontrollers.h"
#include "cpuboard.h"
@ -52,172 +52,7 @@
#include "devices.h"
#ifdef AMIBERRY
#include "crc32.h"
// This is original in debug.cpp, but since that is not implemented yet...
static uae_u8* dump_xlate(uae_u32 addr)
{
if (!mem_banks[addr >> 16]->check(addr, 1))
return NULL;
return mem_banks[addr >> 16]->xlateaddr(addr);
}
static const TCHAR* bankmodes[] = { _T("F32"), _T("C16"), _T("C32"), _T("CIA"), _T("F16"), _T("F16X") };
static void memory_map_dump_3(UaeMemoryMap* map, int log)
{
bool imold;
int i, j, max;
addrbank* a1 = mem_banks[0];
TCHAR txt[256];
map->num_regions = 0;
imold = currprefs.illegal_mem;
currprefs.illegal_mem = false;
max = currprefs.address_space_24 ? 256 : 65536;
j = 0;
for (i = 0; i < max + 1; i++) {
addrbank* a2 = NULL;
if (i < max)
a2 = mem_banks[i];
if (a1 != a2) {
int k, mirrored, mirrored2, size, size_out;
TCHAR size_ext;
uae_u8* caddr;
TCHAR tmp[MAX_DPATH];
const TCHAR* name = a1->name;
struct addrbank_sub* sb = a1->sub_banks;
int bankoffset = 0;
int region_size;
k = j;
caddr = dump_xlate(k << 16);
mirrored = caddr ? 1 : 0;
k++;
while (k < i && caddr) {
if (dump_xlate(k << 16) == caddr) {
mirrored++;
}
k++;
}
mirrored2 = mirrored;
if (mirrored2 == 0)
mirrored2 = 1;
while (bankoffset < 65536) {
int bankoffset2 = bankoffset;
if (sb) {
uaecptr daddr;
if (!sb->bank)
break;
daddr = (j << 16) | bankoffset;
a1 = get_sub_bank(&daddr);
name = a1->name;
for (;;) {
bankoffset2 += MEMORY_MIN_SUBBANK;
if (bankoffset2 >= 65536)
break;
daddr = (j << 16) | bankoffset2;
addrbank* dab = get_sub_bank(&daddr);
if (dab != a1)
break;
}
sb++;
size = (bankoffset2 - bankoffset) / 1024;
region_size = size * 1024;
}
else {
size = (i - j) << (16 - 10);
region_size = ((i - j) << 16) / mirrored2;
}
if (name == NULL)
name = _T("<none>");
size_out = size;
size_ext = 'K';
if (j >= 256 && (size_out / mirrored2 >= 1024) && !((size_out / mirrored2) & 1023)) {
size_out /= 1024;
size_ext = 'M';
}
_stprintf(txt, _T("%08X %7d%c/%d = %7d%c %s%s %s %s"), (j << 16) | bankoffset, size_out, size_ext,
mirrored, mirrored ? size_out / mirrored : size_out, size_ext,
(a1->flags & ABFLAG_CACHE_ENABLE_INS) ? _T("I") : _T("-"),
(a1->flags & ABFLAG_CACHE_ENABLE_DATA) ? _T("D") : _T("-"),
bankmodes[ce_banktype[j]],
name);
tmp[0] = 0;
if ((a1->flags & ABFLAG_ROM) && mirrored) {
TCHAR* p = txt + _tcslen(txt);
uae_u32 crc = 0xffffffff;
if (a1->check(((j << 16) | bankoffset), (size * 1024) / mirrored))
crc = get_crc32(a1->xlateaddr((j << 16) | bankoffset), (size * 1024) / mirrored);
struct romdata* rd = getromdatabycrc(crc);
_stprintf(p, _T(" (%08X)"), crc);
if (rd) {
tmp[0] = '=';
getromname(rd, tmp + 1);
_tcscat(tmp, _T("\n"));
}
}
if (a1 != &dummy_bank) {
for (int m = 0; m < mirrored2; m++) {
if (map->num_regions >= UAE_MEMORY_REGIONS_MAX)
break;
UaeMemoryRegion* r = &map->regions[map->num_regions];
r->start = (j << 16) + bankoffset + region_size * m;
r->size = region_size;
r->flags = 0;
r->memory = NULL;
if (!(a1->flags & ABFLAG_PPCIOSPACE)) {
r->memory = dump_xlate((j << 16) | bankoffset);
if (r->memory)
r->flags |= UAE_MEMORY_REGION_RAM;
}
/* just to make it easier to spot in debugger */
r->alias = 0xffffffff;
if (m >= 0) {
r->alias = j << 16;
r->flags |= UAE_MEMORY_REGION_ALIAS | UAE_MEMORY_REGION_MIRROR;
}
_stprintf(r->name, _T("%s"), name);
_stprintf(r->rom_name, _T("%s"), tmp);
map->num_regions += 1;
}
}
_tcscat(txt, _T("\n"));
if (log > 0)
write_log(_T("%s"), txt);
else if (log == 0)
write_log(txt);
if (tmp[0]) {
if (log > 0)
write_log(_T("%s"), tmp);
else if (log == 0)
write_log(tmp);
}
if (!sb)
break;
bankoffset = bankoffset2;
}
j = i;
a1 = a2;
}
}
//pci_dump(log);
currprefs.illegal_mem = imold;
}
static void memory_map_dump_2(int log)
{
UaeMemoryMap map;
memory_map_dump_3(&map, log);
}
void memory_map_dump(void)
{
memory_map_dump_2(1);
}
extern void memory_map_dump(void);
#endif
#define CARD_FLAG_CAN_Z3 1
@ -3842,6 +3677,7 @@ void expamem_reset (int hardreset)
chipdone = false;
expamem_init_clear();
allocate_expamem ();
expamem_bank.name = _T("Autoconfig [reset]");

View file

@ -38,7 +38,7 @@
#include "fsusage.h"
#include "native2amiga.h"
#include "scsidev.h"
//#include "uaeserial.h"
#include "uaeserial.h"
#include "fsdb.h"
#include "zfile.h"
#include "zarchive.h"
@ -51,7 +51,6 @@
#include "cdtv.h"
#include "sana2.h"
#include "bsdsocket.h"
#include "uaeserial.h"
#include "uaeresource.h"
#include "inputdevice.h"
#include "clipboard.h"
@ -68,16 +67,12 @@
#include "picasso96.h"
//#include "cpuboard.h"
#include "rommgr.h"
//#include "debug.h"
#include "debug.h"
//#include "debugmem.h"
#ifdef RETROPLATFORM
#include "rp.h"
#endif
#ifdef AMIBERRY
static int g_packet_delay = 0;
#endif
#define KS12_BOOT_HACK 1
#define UNIT_LED(unit) ((unit)->ui.unit_type == UNIT_CDFS ? LED_CD : LED_HD)
@ -749,13 +744,13 @@ static void striplength (TCHAR *s, int len)
return;
s[len] = 0;
}
static void fixcharset (TCHAR *s)
static void fixcharset(TCHAR *s)
{
char tmp[MAX_DPATH];
if (!s)
return;
ua_fs_copy (tmp, MAX_DPATH - 1, s, '_');
au_fs_copy (s, strlen (tmp) + 1, tmp);
ua_fs_copy(tmp, MAX_DPATH - 1, s, '_');
au_fs_copy(s, uaestrlen(tmp) + 1, tmp);
}
TCHAR *validatevolumename (TCHAR *s, const TCHAR *def)
@ -1790,7 +1785,7 @@ static void set_volume_name(Unit *unit, struct mytimeval *tv)
char *s;
s = ua_fs (unit->ui.volname, -1);
namelen = strlen (s);
namelen = uaestrlen(s);
if (namelen >= 58)
namelen = 58;
put_byte(unit->volume + 64, namelen);
@ -2400,6 +2395,14 @@ static void de_recycle_aino (Unit *unit, a_inode *aino)
unit->aino_cache_size--;
}
static void free_aino(a_inode *aino)
{
xfree(aino->aname);
xfree(aino->comment);
xfree(aino->nname);
xfree(aino);
}
static void dispose_aino (Unit *unit, a_inode **aip, a_inode *aino)
{
int hash = aino->uniq % MAX_AINO_HASH;
@ -2417,10 +2420,7 @@ static void dispose_aino (Unit *unit, a_inode **aip, a_inode *aino)
isofs_dispose_inode (unit->ui.cdfs_superblock, aino->uniq_external);
}
xfree (aino->aname);
xfree (aino->comment);
xfree (aino->nname);
xfree (aino);
free_aino(aino);
}
static void free_all_ainos (Unit *u, a_inode *parent)
@ -2705,7 +2705,7 @@ static TCHAR *get_nname (Unit *unit, a_inode *base, TCHAR *rel, TCHAR **modified
if (found == 0)
return found;
if (found == rel)
return build_nname (base->nname, rel);
return build_nname(base->nname, rel);
*modified_rel = found;
return build_nname (base->nname, found);
@ -2829,41 +2829,49 @@ static void init_child_aino (Unit *unit, a_inode *base, a_inode *aino)
aino_test (aino);
}
static a_inode *new_child_aino (Unit *unit, a_inode *base, TCHAR *rel)
static a_inode *new_child_aino(Unit *unit, a_inode *base, TCHAR *rel)
{
TCHAR *modified_rel;
TCHAR *nn;
a_inode *aino = NULL;
int isvirtual = unit->volflags & (MYVOLUMEINFO_ARCHIVE | MYVOLUMEINFO_CDFS);
if (!isvirtual)
aino = fsdb_lookup_aino_aname (base, rel);
if (aino == 0) {
uae_u64 uniq_ext = 0;
nn = get_nname (unit, base, rel, &modified_rel, &uniq_ext);
if (nn == 0)
return 0;
if (!isvirtual) {
aino = fsdb_lookup_aino_aname(base, rel);
}
aino = xcalloc (a_inode, 1);
if (aino == 0)
if (aino == NULL) {
uae_u64 uniq_ext = 0;
nn = get_nname(unit, base, rel, &modified_rel, &uniq_ext);
if (nn == NULL) {
xfree(modified_rel);
return 0;
}
aino = xcalloc(a_inode, 1);
if (aino == 0) {
xfree(modified_rel);
return 0;
}
aino->uniq_external = uniq_ext;
aino->aname = modified_rel ? modified_rel : my_strdup (rel);
aino->aname = modified_rel ? modified_rel : my_strdup(rel);
aino->nname = nn;
aino->comment = 0;
aino->has_dbentry = 0;
if (!fill_file_attrs (unit, base, aino)) {
xfree (aino);
if (!fill_file_attrs(unit, base, aino)) {
free_aino(aino);
return 0;
}
if (aino->dir && !isvirtual)
fsdb_clean_dir (aino);
if (aino->dir && !isvirtual) {
fsdb_clean_dir(aino);
}
}
init_child_aino (unit, base, aino);
init_child_aino(unit, base, aino);
recycle_aino (unit, aino);
recycle_aino(unit, aino);
return aino;
}
@ -2875,7 +2883,7 @@ static a_inode *create_child_aino (Unit *unit, a_inode *base, TCHAR *rel, int is
aino->nname = create_nname (unit, base, rel);
if (!aino->nname) {
free (aino);
free_aino(aino);
return 0;
}
aino->aname = my_strdup (rel);
@ -3206,13 +3214,7 @@ static void filesys_start_thread (UnitInfo *ui, int nr)
ui->back_pipe = xmalloc (smp_comm_pipe, 1);
init_comm_pipe (ui->unit_pipe, 400, 3);
init_comm_pipe (ui->back_pipe, 100, 1);
#ifdef AMIBERRY
if (!uae_deterministic_mode()) {
#endif
uae_start_thread (_T("filesys"), filesys_thread, (void *)ui, &ui->tid);
#ifdef AMIBERRY
}
#endif
uae_start_thread (_T("filesys"), filesys_thread, (void *)ui, &ui->tid);
}
#endif
if (isrestore ()) {
@ -3446,17 +3448,11 @@ static void do_info(TrapContext *ctx, Unit *unit, dpacket *packet, uaecptr info,
static void action_disk_info(TrapContext *ctx, Unit *unit, dpacket *packet)
{
#ifdef AMIBERRY
g_packet_delay = 10;
#endif
do_info(ctx, unit, packet, GET_PCK_ARG1 (packet) << 2, true);
}
static void action_info(TrapContext *ctx, Unit *unit, dpacket *packet)
{
#ifdef AMIBERRY
g_packet_delay = 10;
#endif
do_info(ctx, unit, packet, GET_PCK_ARG2 (packet) << 2, false);
}
@ -3720,10 +3716,6 @@ static void action_lock(TrapContext *ctx, Unit *unit, dpacket *packet)
mode = SHARED_LOCK;
}
#ifdef AMIBERRY
g_packet_delay = 2;
#endif
a = find_aino(ctx, unit, lock, bstr(ctx, unit, name), &err);
if (err == 0 && a->softlink) {
err = test_softlink (a);
@ -3915,9 +3907,6 @@ static void action_free_lock(TrapContext *ctx, Unit *unit, dpacket *packet)
{
uaecptr lock = GET_PCK_ARG1 (packet) << 2;
a_inode *a;
#ifdef AMIBERRY
g_packet_delay = 2;
#endif
a = aino_from_lock(ctx, unit, lock);
if (a == 0) {
@ -3964,9 +3953,6 @@ static uaecptr action_dup_lock_2(TrapContext *ctx, Unit *unit, dpacket *packet,
static void action_dup_lock(TrapContext *ctx, Unit *unit, dpacket *packet)
{
uaecptr lock = GET_PCK_ARG1 (packet) << 2;
#ifdef AMIBERRY
g_packet_delay = 2;
#endif
if (!lock) {
PUT_PCK_RES1 (packet, 0);
return;
@ -4061,7 +4047,7 @@ static void get_fileinfo(TrapContext *ctx, Unit *unit, dpacket *packet, uaecptr
put_long_host(buf + 120, entrytype);
x2 = x = ua_fs (xs, -1);
n = strlen (x);
n = uaestrlen(x);
if (n > 107)
n = 107;
if (n > abs(currprefs.filesys_max_name))
@ -4108,7 +4094,7 @@ static void get_fileinfo(TrapContext *ctx, Unit *unit, dpacket *packet, uaecptr
if (!xs)
xs= _T("");
x2 = x = ua_fs(xs, -1);
n = strlen(x);
n = uaestrlen(x);
if (n > 78)
n = 78;
put_byte_host(buf + i, n); i++;
@ -4255,9 +4241,6 @@ static int action_lock_record(TrapContext *ctx, Unit *unit, dpacket *packet, uae
bool exclusive = mode == REC_EXCLUSIVE || mode == REC_EXCLUSIVE_IMMED;
#ifdef AMIBERRY
g_packet_delay = 2;
#endif
write_log (_T("action_lock_record('%s',%d,%d,%d,%d)\n"), k ? k->aino->nname : _T("null"), pos, len, mode, timeout);
if (!k || mode > REC_SHARED_IMMED) {
@ -4394,7 +4377,7 @@ static int exalldo(TrapContext *ctx, uaecptr exalldata, uae_u32 exalldatasize, u
size2 = 4;
if (type >= 1) {
size2 += 4;
size += strlen (x) + 1;
size += uaestrlen(x) + 1;
size = (size + 3) & ~3;
}
if (type >= 2)
@ -4415,8 +4398,8 @@ static int exalldo(TrapContext *ctx, uaecptr exalldata, uae_u32 exalldatasize, u
commentx = _T("");
else
commentx = aino->comment;
comment = ua_fs (commentx, -1);
size += strlen (comment) + 1;
comment = ua_fs(commentx, -1);
size += uaestrlen(comment) + 1;
size = (size + 3) & ~3;
}
if (type >= 7) {
@ -5025,12 +5008,6 @@ static void do_find(TrapContext *ctx, Unit *unit, dpacket *packet, int mode, int
: O_RDWR)
| (create ? O_CREAT : 0)
| (create == 2 ? O_TRUNC : 0));
#ifdef AMIBERRY
if (openmode & O_CREAT) {
// this can be an expensive operation
g_packet_delay = 320;
}
#endif
fd = fs_openfile (unit, aino, openmode | O_BINARY);
if (fd == NULL) {
@ -5206,9 +5183,6 @@ static void action_read(TrapContext *ctx, Unit *unit, dpacket *packet)
/* PUT_PCK_RES2 (packet, EINVAL); */
return;
}
#ifdef AMIBERRY
g_packet_delay = 100;
#endif
gui_flicker_led (UNIT_LED(unit), unit->unit, 1);
@ -5335,9 +5309,6 @@ static void action_write(TrapContext *ctx, Unit *unit, dpacket *packet)
}
gui_flicker_led (UNIT_LED(unit), unit->unit, 2);
#ifdef AMIBERRY
g_packet_delay = 320;
#endif
if (is_writeprotected(unit) || k->aino->vfso) {
PUT_PCK_RES1 (packet, DOS_FALSE);
@ -5693,9 +5664,6 @@ static void action_create_dir(TrapContext *ctx, Unit *unit, dpacket *packet)
a_inode *aino;
int err;
#ifdef AMIBERRY
g_packet_delay = 320;
#endif
if (is_writeprotected(unit)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
@ -5768,9 +5736,6 @@ static void action_set_file_size(TrapContext *ctx, Unit *unit, dpacket *packet)
if (mode < 0)
whence = SEEK_SET;
#ifdef AMIBERRY
g_packet_delay = 100;
#endif
k = lookup_key (unit, GET_PCK_ARG1 (packet));
if (k == 0) {
@ -5880,9 +5845,6 @@ static void action_delete_object(TrapContext *ctx, Unit *unit, dpacket *packet)
a_inode *a;
int err;
#ifdef AMIBERRY
g_packet_delay = 320;
#endif
if (is_writeprotected(unit)) {
PUT_PCK_RES1 (packet, DOS_FALSE);
@ -6366,9 +6328,6 @@ static void action_get_file_size64(TrapContext *ctx, Unit *unit, dpacket *packet
PUT_PCK64_RES2 (packet, ERROR_INVALID_LOCK);
return;
}
#ifdef AMIBERRY
g_packet_delay = 50;
#endif
filesize = key_filesize(k);
if (filesize >= 0) {
@ -7138,20 +7097,8 @@ static void filesys_prepare_reset2 (void)
write_comm_pipe_int(uip[i].unit_pipe, 0, 0);
write_comm_pipe_int(uip[i].unit_pipe, 0, 0);
write_comm_pipe_int(uip[i].unit_pipe, 0, 1);
#ifdef AMIBERRY
if (uae_deterministic_mode()) {
while (comm_pipe_has_data(uip[i].unit_pipe)) {
// process remaining packets until all are done
filesys_hsync();
}
}
else {
#endif
uae_sem_wait(&uip[i].reset_sync_sem);
uae_end_thread(&uip[i].tid);
#ifdef AMIBERRY
}
#endif
uae_sem_wait (&uip[i].reset_sync_sem);
uae_end_thread (&uip[i].tid);
}
}
#endif
@ -8842,45 +8789,56 @@ static uae_u32 REGPARAM2 mousehack_done (TrapContext *ctx)
uaecptr ret = consolehook_beginio(ctx, trap_get_areg(ctx, 1));
trap_put_long(ctx, trap_get_areg(ctx, 7) + 4 * 4, ret);
} else if (mode == 200) {
//uae_u32 v;
//// a0 = data, d0 = length, a1 = task, d3 = stack size (in), stack ptr (out)
//// a2 = debugdata, d2 = debuglength
//// d4 = flags
//if ((trap_get_dreg(ctx, 4) & 3) != 1) {
// write_log(_T("unsupported uaedbg version\n"));
// return 0;
//}
//uae_u32 stack = trap_get_dreg(ctx, 3);
//v = debugmem_reloc(trap_get_areg(ctx, 0), trap_get_dreg(ctx, 0),
// trap_get_areg(ctx, 2), trap_get_dreg(ctx, 2),
// trap_get_areg(ctx, 1), &stack);
//trap_set_dreg(ctx, 2, stack);
//return v;
#ifdef DEBUGGER
uae_u32 v;
// a0 = data, d0 = length, a1 = task, d3 = stack size (in), stack ptr (out)
// a2 = debugdata, d2 = debuglength
// d4 = flags
if ((trap_get_dreg(ctx, 4) & 3) != 1) {
write_log(_T("unsupported uaedbg version\n"));
return 0;
}
uae_u32 stack = trap_get_dreg(ctx, 3);
v = debugmem_reloc(trap_get_areg(ctx, 0), trap_get_dreg(ctx, 0),
trap_get_areg(ctx, 2), trap_get_dreg(ctx, 2),
trap_get_areg(ctx, 1), &stack);
trap_set_dreg(ctx, 2, stack);
return v;
#endif
} else if (mode == 201) {
//debugmem_break(8);
#ifdef DEBUGGER
debugmem_break(8);
#endif
return 1;
} else if (mode == 202) {
// a0 = seglist, a1 = name, d2 = lock
//debugmem_addsegs(ctx, trap_get_areg(ctx, 0), trap_get_areg(ctx, 1), trap_get_dreg(ctx, 2), true);
#ifdef DEBUGGER
debugmem_addsegs(ctx, trap_get_areg(ctx, 0), trap_get_areg(ctx, 1), trap_get_dreg(ctx, 2), true);
#endif
return 1;
} else if (mode == 203) {
// a0 = seglist
//debugmem_remsegs(trap_get_areg(ctx, 0));
#ifdef DEBUGGER
debugmem_remsegs(trap_get_areg(ctx, 0));
#endif
return 1;
} else if (mode == 204 || mode == 206) {
// d0 = size, a1 = flags
//uae_u32 v = debugmem_allocmem(mode == 206, trap_get_dreg(ctx, 0), trap_get_areg(ctx, 1), trap_get_areg(ctx, 0));
//if (v) {
// trap_set_areg(ctx, 0, v);
// return v;
//}
//else {
// trap_set_areg(ctx, 0, 0);
// trap_set_dreg(ctx, 1, trap_get_areg(ctx, 1));
// return trap_get_dreg(ctx, 0);
//}
#ifdef DEBUGGER
uae_u32 v = debugmem_allocmem(mode == 206, trap_get_dreg(ctx, 0), trap_get_areg(ctx, 1), trap_get_areg(ctx, 0));
if (v) {
trap_set_areg(ctx, 0, v);
return v;
} else {
trap_set_areg(ctx, 0, 0);
trap_set_dreg(ctx, 1, trap_get_areg(ctx, 1));
return trap_get_dreg(ctx, 0);
}
#endif
} else if (mode == 205 || mode == 207) {
//return debugmem_freemem(mode == 207, trap_get_areg(ctx, 1), trap_get_dreg(ctx, 0), trap_get_areg(ctx, 0));
#ifdef DEBUGGER
return debugmem_freemem(mode == 207, trap_get_areg(ctx, 1), trap_get_dreg(ctx, 0), trap_get_areg(ctx, 0));
#endif
} else if (mode == 208) {
// segtrack: bit 0
// fsdebug: bit 1
@ -8891,28 +8849,31 @@ static uae_u32 REGPARAM2 mousehack_done (TrapContext *ctx)
return 0;
} else if (mode == 210) {
// debug trapcode
//debugmem_trap(trap_get_areg(ctx, 0));
#ifdef DEBUGGER
debugmem_trap(trap_get_areg(ctx, 0));
#endif
} else if (mode == 212) {
// a0 = seglist, a1 = name, d2 = lock
//debugmem_addsegs(ctx, trap_get_areg(ctx, 0), trap_get_areg(ctx, 1), trap_get_dreg(ctx, 2), false);
#ifdef DEBUGGER
debugmem_addsegs(ctx, trap_get_areg(ctx, 0), trap_get_areg(ctx, 1), trap_get_dreg(ctx, 2), false);
#endif
return 1;
} else if (mode == 213) {
// a0 = seglist
//debugmem_remsegs(trap_get_areg(ctx, 0));
#ifdef DEBUGGER
debugmem_remsegs(trap_get_areg(ctx, 0));
#endif
return 1;
} else if (mode == 299) {
//return debugmem_exit();
#ifdef DEBUGGER
return debugmem_exit();
#endif
} else {
write_log (_T("Unknown mousehack hook %d\n"), mode);
}
return 1;
}
#ifdef AMIBERRY // NL
static int g_hsync_line = 0;
#endif
void filesys_vsync (void)
{
TrapContext *ctx = NULL;
@ -9037,70 +8998,8 @@ void filesys_vsync (void)
setsystime_vblank ();
heartbeat_task &= ~1;
}
#ifdef AMIBERRY // NL
g_hsync_line = 0;
#endif
}
#ifdef AMIBERRY // NL
#ifdef UAE_FILESYS_THREADS
static void run_filesys_iterations(int max_count) {
UnitInfo *ui;
int count = 0;
while (count < max_count) {
int last_count = count;
for (int i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
ui = mountinfo.ui + i;
if (!ui->unit_pipe) {
continue;
}
if (!comm_pipe_has_data(ui->unit_pipe)) {
continue;
}
count++;
filesys_iteration(ui);
}
if (count == last_count) {
// no more packets were processed
break;
}
}
}
void filesys_hsync() {
if (!uae_deterministic_mode()) {
return;
}
//printf("%d\n", g_hsync_line++);
static uint64_t counter = 0;
static uint64_t next = 0;
while (counter == next) {
// set packet delay to default value of 10, which means to process
// one packet every other hsync.
g_packet_delay = 10;
run_filesys_iterations(1);
// g_packet_delay was possibly modified by packet handlers
if (g_packet_delay >= 100) {
// ok, for testing, if g_packet_delay is large we try to wait
// approximately one frame until processing next package
g_packet_delay = 320;
}
if (g_packet_delay < 0) {
// should not happen..
g_packet_delay = 1;
}
next = counter + g_packet_delay;
}
counter++;
}
#endif // UAE_FILESYS_THREADS
#endif // AMIBERRY
void filesys_cleanup(void)
{
filesys_free_handles();
@ -10082,12 +9981,12 @@ static uae_u32 filesys_shellexecute2_process(int mode, TrapContext *ctx)
se2->file = strdup(tmp);
}
int size = ShellExecute2_Struct_Start + ShellExecute2_Struct_Start2;
size += 2 * (strlen(se2->file) + 1);
size += 2 * (uaestrlen(se2->file) + 1);
if (oldks) {
size += 4 + strlen(se2->currentdir) + 2; // CD_""\n
size += 4 + uaestrlen(se2->currentdir) + 2; // CD_""\n
}
size += strlen(se2->currentdir) + 1;
size += 2 * (strlen(se2->parms) + 1);
size += uaestrlen(se2->currentdir) + 1;
size += 2 * (uaestrlen(se2->parms) + 1);
size += 32; // space for tmp_out
size += 256; // space for out buffer
size++;

View file

@ -16,7 +16,7 @@
#include "flashrom.h"
#include "memory.h"
#include "newcpu.h"
//#include "debug.h"
#include "debug.h"
#include "gui.h"
#define FLASH_LOG 0

View file

@ -22,7 +22,7 @@
#include "gayle.h"
#include "savestate.h"
#include "uae.h"
//#include "gui.h"
#include "gui.h"
#include "threaddep/thread.h"
//#include "a2091.h"
//#include "ncr_scsi.h"
@ -32,7 +32,7 @@
#include "ide.h"
//#include "idecontrollers.h"
//#include "pci_hw.h"
//#include "debug.h"
#include "debug.h"
#include "autoconf.h"
#include "rommgr.h"
#include "devices.h"

View file

@ -346,9 +346,9 @@ void alloc_colors_rgb (int rw, int gw, int bw, int rs, int gs, int bs, int aw, i
}
j += 256;
rc[i] = doColor (uae_gamma[j][0], rw, rs) | doAlpha (alpha, aw, as);
gc[i] = doColor (uae_gamma[j][1], gw, gs) | doAlpha (alpha, aw, as);
bc[i] = doColor (uae_gamma[j][2], bw, bs) | doAlpha (alpha, aw, as);
rc[i] = doColor(uae_gamma[j][0], rw, rs) | doAlpha(alpha, aw, as);
gc[i] = doColor(uae_gamma[j][1], gw, gs) | doAlpha(alpha, aw, as);
bc[i] = doColor(uae_gamma[j][2], bw, bs) | doAlpha(alpha, aw, as);
if (byte_swap) {
if (bpp <= 16) {
rc[i] = bswap_16 (rc[i]);
@ -405,6 +405,11 @@ void alloc_colors64k(int monid, int rw, int gw, int bw, int rs, int gs, int bs,
xcolors[i] |= xcolors[i] * 0x00010001;
}
}
fullblack = 0;
//if (gfx_hdr) {
// fullblack = doAlpha(1, aw, as);
//}
#if defined(AGA) || defined(GFXFILTER)
alloc_colors_rgb (rw, gw, bw, rs, gs, bs, aw, as, alpha, byte_swap, xredcolors, xgreencolors, xbluecolors);
/* copy original color table */

View file

@ -28,7 +28,7 @@
#include "execio.h"
#include "zfile.h"
#include "ide.h"
//#include "debug.h"
#include "debug.h"
#include "ini.h"
#include "rommgr.h"
#include "zarchive.h"

View file

@ -19,7 +19,7 @@
#include "memory.h"
#include "newcpu.h"
#include "threaddep/thread.h"
//#include "debug.h"
#include "debug.h"
#include "savestate.h"
#include "scsi.h"
#include "ide.h"
@ -330,8 +330,8 @@ static void ps (struct ide_hdf *ide, int offset, const TCHAR *src, int max)
int i, len;
char *s;
s = ua (src);
len = strlen (s);
s = ua(src);
len = uaestrlen(s);
for (i = 0; i < max; i += 2) {
char c1 = ' ';
if (i < len)

View file

@ -133,9 +133,6 @@ extern void filesys_flush_cache (void);
extern void filesys_free_handles (void);
extern void filesys_vsync (void);
extern bool filesys_heartbeat(void);
#ifdef AMIBERRY
extern void filesys_hsync(void);
#endif
extern void filesys_install (void);
extern void filesys_install_code (void);

View file

@ -276,6 +276,7 @@ extern uae_u8 cycle_line_slot[MAX_CHIPSETSLOTS + RGA_PIPELINE_ADJUST];
extern uae_u16 cycle_line_pipe[MAX_CHIPSETSLOTS + RGA_PIPELINE_ADJUST];
#define CYCLE_PIPE_CPUSTEAL 0x8000
#define CYCLE_PIPE_NONE 0x4000
#define CYCLE_PIPE_BLITTER 0x100
#define CYCLE_PIPE_COPPER 0x80
#define CYCLE_PIPE_SPRITE 0x40

324
src/include/debug.h Normal file
View file

@ -0,0 +1,324 @@
/*
* UAE - The Un*x Amiga Emulator
*
* Debugger
*
* (c) 1995 Bernd Schmidt
*
*/
#ifndef UAE_DEBUG_H
#define UAE_DEBUG_H
#include "uae/types.h"
#ifndef D
#define D
#endif
#ifndef bug
#define bug write_log
#endif
#ifdef DEBUGGER
#define MAX_HIST 500
#define MAX_LINEWIDTH 10000
extern int debugging;
extern int memwatch_enabled;
extern int exception_debugging;
extern int debug_copper;
extern int debug_dma, debug_heatmap;
extern int debug_sprite_mask;
extern int debug_bpl_mask, debug_bpl_mask_one;
extern int debugger_active;
extern int debug_illegal;
extern uae_u64 debug_illegal_mask;
extern int debugger_used;
extern void debug (void);
extern void debugger_change (int mode);
extern void activate_debugger(void);
extern void activate_debugger_new(void);
extern void activate_debugger_new_pc(uaecptr pc, int len);
extern void deactivate_debugger (void);
extern const TCHAR *debuginfo (int);
extern void record_copper (uaecptr addr, uaecptr nextaddr, uae_u16 word1, uae_u16 word2, int hpos, int vpos);
extern void record_copper_blitwait (uaecptr addr, int hpos, int vpos);
extern void record_copper_reset (void);
extern int mmu_init (int, uaecptr,uaecptr);
extern void mmu_do_hit (void);
extern void dump_aga_custom (void);
extern void memory_map_dump (void);
extern void debug_help (void);
extern uaecptr dumpmem2 (uaecptr addr, TCHAR *out, int osize);
extern void update_debug_info (void);
extern int instruction_breakpoint (TCHAR **c);
extern int debug_bankchange (int);
extern void log_dma_record (void);
extern void debug_parser (const TCHAR *cmd, TCHAR *out, uae_u32 outsize);
extern void mmu_disasm (uaecptr pc, int lines);
extern int debug_read_memory_16 (uaecptr addr);
extern int debug_peek_memory_16 (uaecptr addr);
extern int debug_read_memory_8 (uaecptr addr);
extern int debug_write_memory_16 (uaecptr addr, uae_u16 v);
extern int debug_write_memory_8 (uaecptr addr, uae_u8 v);
extern bool debug_enforcer(void);
extern int debug_safe_addr(uaecptr addr, int size);
extern void debug_invalid_reg(int reg, int size, uae_u16 val);
extern void debug_check_reg(uae_u32 addr, int write, uae_u16 v);
extern int memwatch_access_validator;
#define DEBUG_SPRINTF_ADDRESS 0xbfff00
extern bool debug_sprintf(uaecptr, uae_u32, int);
extern bool debug_get_prefetch(int idx, uae_u16 *opword);
extern void debug_hsync(void);
extern void debug_exception(int);
extern void debug_init_trainer(const TCHAR*);
extern void debug_trainer_match(void);
extern bool debug_opcode_watch;
extern bool debug_trainer_event(int evt, int state);
extern void debug_smc_clear(uaecptr addr, int size);
#define BREAKPOINT_TOTAL 20
#define BREAKPOINT_REG_Dx 0
#define BREAKPOINT_REG_Ax 8
#define BREAKPOINT_REG_PC 16
#define BREAKPOINT_REG_USP 17
#define BREAKPOINT_REG_MSP 18
#define BREAKPOINT_REG_ISP 19
#define BREAKPOINT_REG_VBR 20
#define BREAKPOINT_REG_SR 21
#define BREAKPOINT_REG_CCR 22
#define BREAKPOINT_REG_CACR 23
#define BREAKPOINT_REG_CAAR 24
#define BREAKPOINT_REG_SFC 25
#define BREAKPOINT_REG_DFC 26
#define BREAKPOINT_REG_TC 27
#define BREAKPOINT_REG_ITT0 28
#define BREAKPOINT_REG_ITT1 29
#define BREAKPOINT_REG_DTT0 30
#define BREAKPOINT_REG_DTT1 31
#define BREAKPOINT_REG_BUSC 32
#define BREAKPOINT_REG_PCR 33
#define BREAKPOINT_REG_END 34
#define BREAKPOINT_CMP_EQUAL 0
#define BREAKPOINT_CMP_NEQUAL 1
#define BREAKPOINT_CMP_SMALLER_EQUAL 2
#define BREAKPOINT_CMP_LARGER_EQUAL 3
#define BREAKPOINT_CMP_SMALLER 2
#define BREAKPOINT_CMP_LARGER 3
#define BREAKPOINT_CMP_RANGE 4
#define BREAKPOINT_CMP_NRANGE 5
struct breakpoint_node {
uae_u32 value1;
uae_u32 value2;
uae_u32 mask;
int type;
int oper;
int enabled;
int cnt;
};
extern struct breakpoint_node bpnodes[BREAKPOINT_TOTAL];
#define MW_MASK_CPU_I 0x00000001
#define MW_MASK_CPU_D_R 0x00000002
#define MW_MASK_CPU_D_W 0x00000004
#define MW_MASK_BLITTER_A 0x00000008
#define MW_MASK_BLITTER_B 0x00000010
#define MW_MASK_BLITTER_C 0x00000020
#define MW_MASK_BLITTER_D_N 0x00000040
#define MW_MASK_BLITTER_D_L 0x00000080
#define MW_MASK_BLITTER_D_F 0x00000100
#define MW_MASK_COPPER 0x00000200
#define MW_MASK_DISK 0x00000400
#define MW_MASK_AUDIO_0 0x00000800
#define MW_MASK_AUDIO_1 0x00001000
#define MW_MASK_AUDIO_2 0x00002000
#define MW_MASK_AUDIO_3 0x00004000
#define MW_MASK_BPL_0 0x00008000
#define MW_MASK_BPL_1 0x00010000
#define MW_MASK_BPL_2 0x00020000
#define MW_MASK_BPL_3 0x00040000
#define MW_MASK_BPL_4 0x00080000
#define MW_MASK_BPL_5 0x00100000
#define MW_MASK_BPL_6 0x00200000
#define MW_MASK_BPL_7 0x00400000
#define MW_MASK_SPR_0 0x00800000
#define MW_MASK_SPR_1 0x01000000
#define MW_MASK_SPR_2 0x02000000
#define MW_MASK_SPR_3 0x04000000
#define MW_MASK_SPR_4 0x08000000
#define MW_MASK_SPR_5 0x10000000
#define MW_MASK_SPR_6 0x20000000
#define MW_MASK_SPR_7 0x40000000
#define MW_MASK_NONE 0x80000000
#define MW_MASK_ALL (MW_MASK_NONE - 1)
#define MEMWATCH_TOTAL 20
struct memwatch_node {
uaecptr addr;
int size;
int rwi;
uae_u32 val, val_mask, access_mask;
int val_size, val_enabled;
int mustchange;
uae_u32 modval;
int modval_written;
int frozen;
uae_u32 reg;
uaecptr pc;
bool nobreak;
bool reportonly;
int bus_error;
};
extern struct memwatch_node mwnodes[MEMWATCH_TOTAL];
extern void memwatch_dump2 (TCHAR *buf, int bufsize, int num);
void debug_getpeekdma_chipram(uaecptr addr, uae_u32 mask, int reg, int ptrreg);
void debug_getpeekdma_value(uae_u32);
void debug_getpeekdma_value_long(uae_u32, int);
uae_u32 debug_putpeekdma_chipram(uaecptr addr, uae_u32 v, uae_u32 mask, int reg, int ptrreg);
uae_u32 debug_putpeekdma_chipset(uaecptr addr, uae_u32 v, uae_u32 mask, int reg);
void debug_lgetpeek(uaecptr addr, uae_u32 v);
void debug_wgetpeek(uaecptr addr, uae_u32 v);
void debug_bgetpeek(uaecptr addr, uae_u32 v);
void debug_bputpeek(uaecptr addr, uae_u32 v);
void debug_wputpeek(uaecptr addr, uae_u32 v);
void debug_lputpeek(uaecptr addr, uae_u32 v);
uae_u32 get_byte_debug (uaecptr addr);
uae_u32 get_word_debug (uaecptr addr);
uae_u32 get_long_debug (uaecptr addr);
uae_u32 get_ilong_debug (uaecptr addr);
uae_u32 get_iword_debug (uaecptr addr);
uae_u32 get_byte_cache_debug(uaecptr addr, bool *cached);
uae_u32 get_word_cache_debug(uaecptr addr, bool *cached);
uae_u32 get_long_cache_debug(uaecptr addr, bool *cached);
uae_u32 get_iword_cache_debug(uaecptr addr, bool *cached);
uae_u32 get_ilong_cache_debug(uaecptr addr, bool *cached);
enum debugtest_item { DEBUGTEST_BLITTER, DEBUGTEST_KEYBOARD, DEBUGTEST_FLOPPY, DEBUGTEST_MAX };
void debugtest (enum debugtest_item, const TCHAR *, ...);
struct peekdma
{
int type;
uaecptr addr;
uae_u32 v;
uae_u32 mask;
int reg;
int ptrreg;
};
extern struct peekdma peekdma_data;
struct dma_rec
{
uae_u16 reg;
uae_u64 dat;
uae_u16 size;
uae_u32 addr;
uae_u32 evt, evt2;
uae_u32 evtdata;
bool evtdataset;
uae_s16 type;
uae_u16 extra;
uae_s8 intlev, ipl, ipl2;
uae_u16 cf_reg, cf_dat, cf_addr;
int ciareg;
int ciamask;
bool ciarw;
int ciaphase;
uae_u16 ciavalue;
bool end;
};
extern struct dma_rec *last_dma_rec;
#define DMA_EVENT_BLITIRQ 1
#define DMA_EVENT_BLITFINALD 2
#define DMA_EVENT_BLITSTARTFINISH 4
#define DMA_EVENT_BPLFETCHUPDATE 8
#define DMA_EVENT_COPPERWAKE 16
#define DMA_EVENT_CPUIRQ 32
#define DMA_EVENT_INTREQ 64
#define DMA_EVENT_COPPERWANTED 128
#define DMA_EVENT_NOONEGETS 256
#define DMA_EVENT_CPUBLITTERSTEAL 512
#define DMA_EVENT_CPUBLITTERSTOLEN 1024
#define DMA_EVENT_COPPERSKIP 2048
#define DMA_EVENT_DDFSTRT 4096
#define DMA_EVENT_DDFSTOP 8192
#define DMA_EVENT_DDFSTOP2 16384
#define DMA_EVENT_SPECIAL 32768
#define DMA_EVENT_VB 0x00010000
#define DMA_EVENT_VS 0x00020000
#define DMA_EVENT_LOF 0x00040000
#define DMA_EVENT_LOL 0x00080000
#define DMA_EVENT_HBS 0x00100000
#define DMA_EVENT_HBE 0x00200000
#define DMA_EVENT_HDIWS 0x00400000
#define DMA_EVENT_HDIWE 0x00800000
#define DMA_EVENT_VDIW 0x01000000
#define DMA_EVENT_HSS 0x02000000
#define DMA_EVENT_HSE 0x04000000
#define DMA_EVENT_CIAA_IRQ 0x08000000
#define DMA_EVENT_CIAB_IRQ 0x10000000
#define DMA_EVENT_CPUSTOP 0x20000000
#define DMA_EVENT_CPUSTOPIPL 0x40000000
#define DMA_EVENT_CPUINS 0x80000000
#define DMA_EVENT2_IPL 0x00000001
#define DMA_EVENT2_IPLSAMPLE 0x00000002
#define DMA_EVENT2_COPPERUSE 0x00000004
#define DMARECORD_REFRESH 1
#define DMARECORD_CPU 2
#define DMARECORD_COPPER 3
#define DMARECORD_AUDIO 4
#define DMARECORD_BLITTER 5
#define DMARECORD_BITPLANE 6
#define DMARECORD_SPRITE 7
#define DMARECORD_DISK 8
#define DMARECORD_CONFLICT 9
#define DMARECORD_MAX 10
extern void record_dma_read(uae_u16 reg, uae_u32 addr, int hpos, int vpos, int type, int extra);
extern void record_dma_write(uae_u16 reg, uae_u32 v, uae_u32 addr, int hpos, int vpos, int type, int extra);
extern void record_dma_read_value(uae_u32 v);
extern void record_dma_read_value_pos(uae_u32 v, int hpos, int vpos);
extern void record_dma_read_value_wide(uae_u64 v, bool quad);
extern void record_dma_replace(int hpos, int vpos, int type, int extra);
extern void record_dma_reset(int);
extern void record_dma_event(uae_u32 evt, int hpos, int vpos);
extern void record_dma_event2(uae_u32 evt, int hpos, int vpos);
extern void record_dma_event_data(uae_u32 evt, int hpos, int vpos, uae_u32 data);
extern void record_dma_clear(int hpos, int vpos);
extern bool record_dma_check(int hpos, int vpos);
extern void record_dma_hsync(int);
extern void record_dma_vsync(int);
extern void record_cia_access(int r, int mask, uae_u16 value, bool rw, int hpos, int vpos, int phase);
extern void record_dma_ipl(int hpos, int vpos);
extern void record_dma_ipl_sample(int hpos, int vpos);
extern void debug_mark_refreshed(uaecptr);
extern void debug_draw(uae_u8 *buf, int bpp, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors);
#define TRACE_SKIP_INS 1
#define TRACE_MATCH_PC 2
#define TRACE_MATCH_INS 3
#define TRACE_RANGE_PC 4
#define TRACE_SKIP_LINE 5
#define TRACE_RAM_PC 6
#define TRACE_CHECKONLY 10
#else
STATIC_INLINE void activate_debugger (void) { };
#endif /* DEBUGGER */
#endif /* UAE_DEBUG_H */

33
src/include/debugmem.h Normal file
View file

@ -0,0 +1,33 @@
uaecptr debugmem_reloc(uaecptr exeaddress, uae_u32 len, uaecptr dbgaddress, uae_u32 dbglen, uaecptr task, uae_u32 *stack);
void debugmem_init(bool);
uaecptr debugmem_allocmem(int mode, uae_u32 size, uae_u32 flags, uae_u32 caller);
uae_u32 debugmem_freemem(int mode, uaecptr addr, uae_u32 size, uae_u32 caller);
void debugmem_trap(uaecptr addr);
void debugmem_addsegs(TrapContext *ctx, uaecptr seg, uaecptr name, uae_u32 lock, bool residentonly);
void debugmem_remsegs(uaecptr seg);
uae_u32 debugmem_exit(void);
bool debugmem_break(int);
bool debugmem_inhibit_break(int mode);
void debugmem_disable(void);
void debugmem_enable(void);
int debugmem_get_segment(uaecptr addr, bool *exact, bool *ext, TCHAR *out, TCHAR *name);
int debugmem_get_symbol(uaecptr addr, TCHAR *out, int maxsize);
bool debugmem_get_symbol_value(const TCHAR *name, uae_u32 *valp);
bool debugmem_list_segment(int mode, uaecptr addr);
int debugmem_get_sourceline(uaecptr addr, TCHAR *out, int maxsize);
bool debugmem_get_range(uaecptr*, uaecptr*);
bool debugmem_isactive(void);
bool debugger_load_libraries(void);
void debugger_scan_libraries(void);
bool debugger_get_library_symbol(uaecptr base, uaecptr addr, TCHAR *out);
bool debugmem_list_stackframe(bool super);
bool debugmem_break_stack_pop(void);
bool debugmem_break_stack_push(void);
bool debugmem_enable_stackframe(bool enable);
bool debugmem_illg(uae_u16);
void debugmem_flushcache(uaecptr, int);
extern uae_u32 debugmem_chiplimit;
extern uae_u32 debugmem_chiphit(uaecptr addr, uae_u32 v, int size);
extern bool debugmem_extinvalidmem(uaecptr addr, uae_u32 v, int size);

View file

@ -28,6 +28,7 @@ void free_shm (void);
bool preinit_shm (void);
extern bool canbang;
extern bool jit_direct_compatible_memory;
extern uaecptr highest_ram;
#define Z3BASE_UAE 0x10000000
#define Z3BASE_REAL 0x40000000
@ -49,7 +50,7 @@ typedef void (REGPARAM3 *mem_put_func)(uaecptr, uae_u32) REGPARAM;
typedef uae_u8 *(REGPARAM3 *xlate_func)(uaecptr) REGPARAM;
typedef int (REGPARAM3 *check_func)(uaecptr, uae_u32) REGPARAM;
extern uae_u32 max_z3fastmem;
extern uae_u32 max_z3fastmem, max_physmem;
extern uae_u32 wait_cpu_cycle_read (uaecptr addr, int mode);
extern void wait_cpu_cycle_write (uaecptr addr, int mode, uae_u32 v);

View file

@ -450,6 +450,7 @@ extern void exception2_fetch(uae_u32 opcode, int offset, int pcoffset);
extern void m68k_reset(void);
extern bool cpureset(void);
extern void cpu_halt(int id);
extern void cpu_inreset(void);
extern int cpu_sleep_millis(int ms);
extern void cpu_change(int newmodel);
extern void cpu_fallback(int mode);

View file

@ -16,7 +16,7 @@
#include "traps.h"
#define UAEMAJOR 5
#define UAEMINOR 4
#define UAEMINOR 5
#define UAESUBREV 0
#define MAX_AMIGADISPLAYS 1
@ -392,8 +392,13 @@ struct apmode
#define MAX_LUA_STATES 16
#define MAX_FILTERDATA 3
#define GF_NORMAL 0
#define GF_RTG 1
#define GF_INTERLACE 2
struct gfx_filterdata
{
int enable;
int gfx_filter;
TCHAR gfx_filtershader[2 * MAX_FILTERSHADERS + 1][MAX_DPATH];
TCHAR gfx_filtermask[2 * MAX_FILTERSHADERS + 1][MAX_DPATH];
@ -418,6 +423,7 @@ struct gfx_filterdata
int gfx_filter_autoscale;
int gfx_filter_integerscalelimit;
int gfx_filter_keep_autoscale_aspect;
bool changed;
};
#define MAX_DUPLICATE_EXPANSION_BOARDS 5
@ -451,9 +457,7 @@ struct boardromconfig
int device_order;
struct romconfig roms[MAX_BOARD_ROMS];
};
#define MAX_RTG_BOARDS 1
struct rtgboardconfig
{
int rtg_index;
@ -493,6 +497,7 @@ struct ramboard
bool readonly;
bool nodma;
bool force16bit;
bool chipramtiming;
struct boardloadfile lf;
};
struct expansion_params
@ -589,7 +594,6 @@ struct uae_prefs
bool sound_stereo_swap_paula;
bool sound_stereo_swap_ahi;
bool sound_auto;
bool sound_cdaudio;
bool sound_volcnt;
int sampler_freq;
@ -645,7 +649,7 @@ struct uae_prefs
int gfx_overscanmode;
int gfx_monitorblankdelay;
struct gfx_filterdata gf[2];
struct gfx_filterdata gf[3];
float rtg_horiz_zoom_mult;
float rtg_vert_zoom_mult;
@ -662,6 +666,9 @@ struct uae_prefs
int genlock_mix;
int genlock_scale;
int genlock_aspect;
int genlock_effects;
uae_u64 ecs_genlock_features_colorkey_mask[4];
uae_u8 ecs_genlock_features_plane_mask;
bool genlock_alpha;
TCHAR genlock_image_file[MAX_DPATH];
TCHAR genlock_video_file[MAX_DPATH];
@ -742,7 +749,6 @@ struct uae_prefs
int cs_mbdmac;
bool cs_cdtvcr;
bool cs_df0idhw;
bool cs_slowmemisfast;
bool cs_resetwarning;
bool cs_denisenoehb;
bool cs_dipagnus;
@ -763,6 +769,7 @@ struct uae_prefs
int cs_hvcsync;
int cs_eclockphase;
int cs_eclocksync;
bool cs_memorypatternfill;
struct boardromconfig expansionboard[MAX_EXPANSION_BOARDS];
@ -1003,7 +1010,7 @@ extern void cfgfile_target_write_bool(struct zfile* f, const TCHAR* option, bool
extern void cfgfile_target_dwrite_bool(struct zfile* f, const TCHAR* option, bool b);
extern void cfgfile_write_str(struct zfile* f, const TCHAR* option, const TCHAR* value);
extern void cfgfile_write_str_escape(struct zfile* f, const TCHAR* option, const TCHAR* value);
//extern void cfgfile_write_str_escape(struct zfile* f, const TCHAR* option, const TCHAR* value);
extern void cfgfile_dwrite_str(struct zfile* f, const TCHAR* option, const TCHAR* value);
extern void cfgfile_dwrite_str_escape(struct zfile* f, const TCHAR* option, const TCHAR* value);
extern void cfgfile_target_write_str(struct zfile* f, const TCHAR* option, const TCHAR* value);
@ -1081,7 +1088,7 @@ extern void fixup_cpu(struct uae_prefs* prefs);
extern void cfgfile_compatibility_romtype(struct uae_prefs* p);
extern void cfgfile_compatibility_rtg(struct uae_prefs* p);
extern bool cfgfile_detect_art(struct uae_prefs* p, TCHAR* path);
extern const TCHAR* cfgfile_getconfigdata(int* len);
extern const TCHAR *cfgfile_getconfigdata(size_t *len);
extern bool cfgfile_createconfigstore(struct uae_prefs* p);
extern void cfgfile_get_shader_config(struct uae_prefs* p, int rtg);

View file

@ -1,7 +1,7 @@
#ifndef UAE_ROMMGR_H
#define UAE_ROMMGR_H
#define MAX_ROMMGR_ROMS 300
#define MAX_ROMMGR_ROMS 310
extern int decode_cloanto_rom_do(uae_u8 *mem, int size, int real_size);

View file

@ -40,21 +40,54 @@ using namespace std;
#define UAE
#endif
#if defined(__x86_64__) || defined(_M_AMD64)
#if defined(__arm__) || defined(_M_ARM)
#define CPU_arm 1
#define ARM_ASSEMBLY 1
#elif defined(_M_ARM64) || defined(_M_ARM64EC) || defined(__aarch64__)
#define CPU_arm 1
#define CPU_64_BIT 1
#define ARM_ASSEMBLY 1
#elif defined(__x86_64__) || defined(_M_AMD64)
#define CPU_x86_64 1
#define CPU_64_BIT 1
#define X86_64_ASSEMBLY 1
#define SAHF_SETO_PROFITABLE
#elif defined(__i386__) || defined(_M_IX86)
#define CPU_i386 1
#elif defined(__arm__) || defined(_M_ARM) || defined(__aarch64__)
#define CPU_arm 1
#define CPU_64_BIT 1
#define X86_ASSEMBLY 1
#define SAHF_SETO_PROFITABLE
#elif defined(__powerpc__) || defined(_M_PPC)
#define CPU_powerpc 1
#else
#error unrecognized CPU type
#endif
#ifdef _WIN32
/* Parameters are passed in ECX, EDX for both x86 and x86-64 (RCX, RDX).
* For x86-64, __fastcall is the default, so it isn't really required. */
#define JITCALL __fastcall
#elif defined(CPU_x86_64)
/* Parameters are passed in RDI, RSI by default (System V AMD64 ABI). */
#define JITCALL
#elif defined(HAVE_FUNC_ATTRIBUTE_REGPARM)
/* Parameters are passed in EAX, EDX on x86 with regparm(2). */
#define JITCALL __attribute__((regparm(2)))
/* This was originally regparm(3), but as far as I can see only two register
* params are supported by the JIT code. It probably just worked anyway
* if all functions used max two arguments. */
#elif !defined(JIT)
#define JITCALL
#endif
#ifdef AMIBERRY
#define REGPARAM2
#define REGPARAM3
#define REGPARAM
#else
#define REGPARAM
#define REGPARAM2 JITCALL
#define REGPARAM3 JITCALL
#endif
#ifndef __STDC__
#ifndef _MSC_VER
#error "Your compiler is not ANSI. Get a real one."
@ -215,10 +248,6 @@ extern void to_upper (TCHAR *s, int len);
#define FILEFLAG_SCRIPT 0x20
#define FILEFLAG_PURE 0x40
#define REGPARAM2
#define REGPARAM3
#define REGPARAM
#define abort() \
do { \
printf ("Internal error; file %s, line %d\n", __FILE__, __LINE__); \
@ -302,7 +331,8 @@ extern void mallocemu_free (void *ptr);
#endif
#ifdef X86_ASSEMBLY
#define ASM_SYM_FOR_FUNC(a) __asm__(a)
//#define ASM_SYM_FOR_FUNC(a) __asm__(a)
#define ASM_SYM_FOR_FUNC(a)
#else
#define ASM_SYM_FOR_FUNC(a)
#endif
@ -441,6 +471,8 @@ STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) {
#endif
#define DBLEQU(f, i) (abs ((f) - (i)) < 0.000001)
#ifdef HAVE_VAR_ATTRIBUTE_UNUSED
#define NOWARN_UNUSED(x) __attribute__((unused)) x
#else

107
src/include/uae/api.h Normal file
View file

@ -0,0 +1,107 @@
/*
* Helpers used to export UAE functions for use with other modules
* Copyright (C) 2014 Frode Solheim
*
* Licensed under the terms of the GNU General Public License version 2.
* See the file 'COPYING' for full license text.
*/
#ifndef UAE_API_H
#define UAE_API_H
/* This file is intended to be included by external libraries as well,
* so don't pull in too much UAE-specific stuff. */
#include "uae/attributes.h"
/* Handy define so we can disable C++ name mangling without considering
* whether the source language is C or C++. */
#ifdef __cplusplus
#define UAE_EXTERN_C extern "C"
#else
#define UAE_EXTERN_C
#endif
/* UAE_EXPORT / UAE_IMPORT are mainly intended as helpers for UAEAPI
* defined below. */
#ifdef _WIN32
#define UAE_EXPORT __declspec(dllexport)
#define UAE_IMPORT __declspec(dllimport)
#else
#define UAE_EXPORT __attribute__((visibility("default")))
#define UAE_IMPORT
#endif
/* UAEAPI marks a function for export across library boundaries. You'll
* likely want to use this together with UAECALL. */
#ifdef UAE
#define UAEAPI UAE_EXTERN_C UAE_EXPORT
#else
#define UAEAPI UAE_EXTERN_C UAE_IMPORT
#endif
/* WinUAE (or external libs) might be compiled with fastcall by default,
* so we force all external functions to use cdecl calling convention. */
#ifdef _WIN32
#define UAECALL __cdecl
#else
#define UAECALL
#endif
/* Helpers to make it easy to import functions from plugins. */
#ifdef UAE
#define UAE_DECLARE_IMPORT_FUNCTION(return_type, function_name, ...) \
typedef return_type (UAECALL * function_name ## _function)(__VA_ARGS__); \
extern function_name ## _function function_name;
#define UAE_IMPORT_FUNCTION(handle, function_name) \
{ \
function_name = (function_name ## _function) uae_dlsym( \
handle, #function_name); \
if (function_name) { \
write_log("Imported " #function_name "\n"); \
} else { \
write_log("WARNING: Could not import " #function_name "\n"); \
} \
}
#define UAE_DECLARE_EXPORT_FUNCTION(return_type, function_name, ...) \
typedef return_type (UAECALL * function_name ## _function)(__VA_ARGS__); \
return_type UAECALL function_name(__VA_ARGS__);
#define UAE_EXPORT_FUNCTION(handle, function_name) \
{ \
void *ptr = uae_dlsym(handle, #function_name); \
if (ptr) { \
*((function_name ## _function *) ptr) = function_name; \
write_log("Exported " #function_name "\n"); \
} else { \
write_log("WARNING: Could not export " #function_name "\n"); \
} \
}
#else
#define UAE_DECLARE_IMPORT_FUNCTION(return_type, function_name, ...) \
return_type UAECALL function_name(__VA_ARGS__);
#define UAE_DECLARE_EXPORT_FUNCTION(return_type, function_name, ...) \
typedef return_type (UAECALL * function_name ## _function)(__VA_ARGS__); \
extern function_name ## _function function_name;
#endif
/**
* Used in both UAE and plugin code to define storage for the function
* imported from the other module.
*/
#define UAE_DEFINE_IMPORT_FUNCTION(function_name) \
function_name ## _function function_name = NULL;
#endif /* UAE_API_H */

View file

@ -0,0 +1,34 @@
/*
* Defines useful functions and variable attributes for UAE
* Copyright (C) 2014 Frode Solheim
*
* Licensed under the terms of the GNU General Public License version 2.
* See the file 'COPYING' for full license text.
*/
#ifndef UAE_ATTRIBUTES_H
#define UAE_ATTRIBUTES_H
/* This file is intended to be included by external libraries as well,
* so don't pull in too much UAE-specific stuff. */
#ifdef _WIN32
#define uae_cdecl __cdecl
#elif defined(__GNUC__) && defined(__i386__)
#define uae_cdecl __attribute__((cdecl))
#else
#define uae_cdecl
#endif
/* This attribute allows (some) compiles to emit warnings when incorrect
* arguments are used with the format string. */
#ifdef __GNUC__
#define UAE_PRINTF_FORMAT(f, a) __attribute__((format(printf, f, a)))
#else
#define UAE_PRINTF_FORMAT(f, a)
#endif
#define UAE_WPRINTF_FORMAT(f, a)
#endif /* UAE_ATTRIBUTES_H */

98
src/include/uae/log.h Normal file
View file

@ -0,0 +1,98 @@
/*
* Logging functions for use with UAE and external modules
* Copyright (C) 2014 Frode Solheim
*
* Licensed under the terms of the GNU General Public License version 2.
* See the file 'COPYING' for full license text.
*/
#ifndef UAE_LOG_H
#define UAE_LOG_H
/* This file is intended to be included by external libraries as well,
* so don't pull in too much UAE-specific stuff. */
#include "uae/api.h"
#include "uae/attributes.h"
#include "uae/types.h"
typedef void (UAECALL *uae_log_function)(const char *format, ...) UAE_PRINTF_FORMAT(1, 2);
#ifdef UAE
//UAEAPI void UAECALL uae_log(const char *format, ...) UAE_PRINTF_FORMAT(1, 2);
void UAECALL uae_log(const char *format, ...) UAE_PRINTF_FORMAT(1, 2);
#else
extern uae_log_function uae_log;
#endif
#if 0
void uae_warning(const char *format, ...) UAE_PRINTF_FORMAT(1, 2);
void uae_error(const char *format, ...) UAE_PRINTF_FORMAT(1, 2);
void uae_fatal(const char *format, ...) UAE_PRINTF_FORMAT(1, 2);
#endif
#define UAE_LOG_VA_ARGS(format, ap) \
{ \
char buffer[1024]; \
vsnprintf(buffer, 1024, format, ap); \
uae_log("%s", buffer); \
}
#define UAE_LOG_VA_ARGS_FULL(format) \
{ \
va_list ap; \
va_start(ap, format); \
UAE_LOG_VA_ARGS(format, ap); \
va_end(ap); \
}
/* Helpers to log use of stubbed functions */
#ifdef _MSC_VER
#define __func__ __FUNCTION__
#endif
#define UAE_LOG_STUB(format, ...) \
{ \
uae_log(" -- stub -- %s " format "\n", __func__, ##__VA_ARGS__); \
}
#define UAE_LOG_STUB_MAX(max, format, ...) \
{ \
static int log_stub_count = 0; \
if (log_stub_count < max) { \
LOG_STUB(format, ##__VA_ARGS__) \
if (++log_stub_count == max) { \
uae_log(" (ignoring further calls to %s)\n", __func__); \
} \
} \
}
#define UAE_STUB(format, ...) \
{ \
UAE_LOG_STUB(format, ##__VA_ARGS__) \
printf(" -- stub -- %s " format "\n", __func__, ##__VA_ARGS__); \
}
/* UAE-specific functions */
#ifdef UAE
void write_log (const char *, ...) UAE_PRINTF_FORMAT(1, 2);
#if SIZEOF_TCHAR != 1
void write_log (const TCHAR *, ...) UAE_WPRINTF_FORMAT(1, 2);
#endif
#endif
/* Deprecated defines */
#ifdef UAE
#define STUB UAE_STUB
#define LOG_STUB UAE_LOG_STUB
#define LOG_STUB_MAX UAE_LOG_STUB_MAX
#define VERBOSE_STUB STUB
#endif
#endif /* UAE_LOG_H */

2
src/include/uae/memory.h Normal file
View file

@ -0,0 +1,2 @@
#include "options.h"
#include "../memory.h"

View file

@ -22,7 +22,7 @@
#else
#define _istdigit SDL_isdigit
#define _istspace SDL_isspace
#define _istupper isupper
#define _istupper SDL_isupper
#define _sntprintf SDL_snprintf
#define _stprintf sprintf
#define _strtoui64 SDL_strtoll
@ -36,6 +36,7 @@
#define _tcsftime strftime
#define _tcsicmp stricmp
#define _tcslen SDL_strlen
#define uaestrlen SDL_strlen
#define _tcsncat strncat
#define _tcsncmp SDL_strncmp
#define _tcsncpy strncpy

View file

@ -18,6 +18,7 @@ typedef int (*allocfunc_type)(int, int, int, xcolnr*);
extern xcolnr xcolors[4096];
extern uae_u32 p96_rgbx16[65536];
extern xcolnr fullblack;
extern int graphics_setup(void);
extern int graphics_init(bool);
@ -161,6 +162,8 @@ struct amigadisplay
volatile bool picasso_requested_on;
bool picasso_requested_forced_on;
bool picasso_on;
bool interlace_on;
int gf_index;
int picasso_redraw_necessary;
int custom_frame_redraw_necessary;
int frame_redraw_necessary;

View file

@ -60,6 +60,7 @@ extern uae_s32 zfile_ftell32(struct zfile *z);
extern uae_s64 zfile_size(struct zfile *z);
extern uae_s32 zfile_size32(struct zfile *z);
extern size_t zfile_fread(void *b, size_t l1, size_t l2, struct zfile *z);
extern uae_s32 zfile_fread32(void *b, size_t l1, size_t l2, struct zfile *z);
extern size_t zfile_fwrite(const void *b, size_t l1, size_t l2, struct zfile *z);
extern TCHAR *zfile_fgets(TCHAR *s, int size, struct zfile *z);
extern char *zfile_fgetsa(char *s, int size, struct zfile *z);

View file

@ -38,7 +38,7 @@
#include "uae.h"
#include "picasso96.h"
//#include "catweasel.h"
//#include "debug.h"
#include "debug.h"
#include "ar.h"
#include "gui.h"
#include "disk.h"
@ -161,6 +161,7 @@ static struct teststore testmode_wait[TESTMODE_MAX];
static int bouncy;
static frame_time_t bouncy_cycles;
static int autopause;
static int keyboard_reset_seq;
#define HANDLE_IE_FLAG_CANSTOPPLAYBACK 1
#define HANDLE_IE_FLAG_PLAYBACKEVENT 2
@ -1006,6 +1007,8 @@ void write_inputdevice_config (struct uae_prefs *p, struct zfile *f)
cfgfile_dwrite_str (f, _T("input.keyboard_type"), kbtypes[p->input_keyboard_type]);
cfgfile_dwrite (f, _T("input.contact_bounce"), _T("%d"), p->input_contact_bounce);
cfgfile_dwrite (f, _T("input.devicematchflags"), _T("%d"), p->input_device_match_mask);
#ifndef AMIBERRY // not used in Amiberry
for (id = 0; id < MAX_INPUT_SETTINGS; id++) {
TCHAR tmp[MAX_DPATH];
if (id < GAMEPORT_INPUT_SETTINGS) {
@ -1020,6 +1023,7 @@ void write_inputdevice_config (struct uae_prefs *p, struct zfile *f)
write_kbr_config (f, id, i, &p->keyboard_settings[id][i], &idev[IDTYPE_KEYBOARD]);
write_config (f, id, 0, _T("internal"), &p->internalevent_settings[id][0], &idev[IDTYPE_INTERNALEVENT]);
}
#endif
}
static uae_u64 getqual (const TCHAR **pp)
@ -2985,8 +2989,7 @@ end:
}
x += (int)dx2;
y += (int)dy2;
}
else {
} else {
float dx, dy, mx, my;
getgfxoffset(monid, &dx, &dy, &mx, &my);
if (mx) {
@ -3000,8 +3003,7 @@ end:
}
if (!dmaen(DMA_SPRITE) && !ad->picasso_on) {
setmouseactivexy(0, x, y, 0);
}
else {
} else {
setmouseactivexy(0, x, y, dir);
}
}
@ -4161,7 +4163,9 @@ static bool inputdevice_handle_inputcode_immediate(int code, int state)
switch(code)
{
case AKS_ENTERDEBUGGER:
//activate_debugger ();
#ifdef DEBUGGER
activate_debugger ();
#endif
return true;
}
return false;
@ -4191,15 +4195,15 @@ void inputdevice_add_inputcode (int code, int state, const TCHAR *s)
}
}
void inputdevice_do_keyboard (int code, int state)
void inputdevice_do_keyboard(int code, int state)
{
#ifdef CDTV
if (code >= 0x72 && code <= 0x77) { // CDTV keys
if (cdtv_front_panel (-1)) {
if (cdtv_front_panel(-1)) {
// front panel active
if (!state)
return;
cdtv_front_panel (code - 0x72);
cdtv_front_panel(code - 0x72);
return;
}
}
@ -4207,24 +4211,47 @@ void inputdevice_do_keyboard (int code, int state)
if (code < 0x80) {
uae_u8 key = code | (state ? 0x00 : 0x80);
keybuf[key & 0x7f] = (key & 0x80) ? 0 : 1;
if (keyboard_reset_seq) {
if (!(keybuf[AK_CTRL] || keybuf[AK_RCTRL]) || !keybuf[AK_LAMI] || !keybuf[AK_RAMI]) {
memset(keybuf, 0, sizeof(keybuf));
send_internalevent(INTERNALEVENT_KBRESET);
if (keyboard_reset_seq >= 5 * 50) {
custom_reset(true, true);
uae_reset(1, 1);
} else {
if (currprefs.cs_resetwarning && resetwarning_do(0))
return;
custom_reset(false, true);
uae_reset(0, 1);
}
keyboard_reset_seq = 0;
}
}
if (key == AK_RESETWARNING) {
resetwarning_do (0);
resetwarning_do(0);
return;
} else if ((keybuf[AK_CTRL] || keybuf[AK_RCTRL]) && keybuf[AK_LAMI] && keybuf[AK_RAMI]) {
int r = keybuf[AK_LALT] | keybuf[AK_RALT];
if (!r && currprefs.cs_resetwarning && resetwarning_do (1))
return;
memset (keybuf, 0, sizeof (keybuf));
send_internalevent (INTERNALEVENT_KBRESET);
uae_reset (r, 1);
if (r) {
send_internalevent(INTERNALEVENT_KBRESET);
uae_reset(1, 1);
keyboard_reset_seq = 0;
} else {
keyboard_reset_seq = 1;
if (!currprefs.cs_resetwarning || !resetwarning_do(0)) {
custom_reset(false, true);
cpu_inreset();
}
}
}
if (record_key ((uae_u8)((key << 1) | (key >> 7)))) {
if (record_key((uae_u8)((key << 1) | (key >> 7)))) {
if (inputdevice_logging & 1)
write_log (_T("Amiga key %02X %d\n"), key & 0x7f, key >> 7);
write_log(_T("Amiga key %02X %d\n"), key & 0x7f, key >> 7);
}
return;
}
inputdevice_add_inputcode (code, state, NULL);
inputdevice_add_inputcode(code, state, NULL);
}
#ifdef AMIBERRY
@ -4417,7 +4444,17 @@ static bool inputdevice_handle_inputcode2(int monid, int code, int state, const
break;
#ifdef AVIOUTPUT
case AKS_VIDEORECORD:
AVIOutput_Toggle (newstate, true);
AVIOutput_Toggle(newstate, true);
break;
case AKS_VIDEORECORDFILE:
if (s) {
_tcsncpy(avioutput_filename_gui, s, MAX_DPATH);
avioutput_filename_gui[MAX_DPATH - 1] = 0;
set_config_changed();
} else {
gui_display (7);
setsystime ();
}
break;
#endif
#ifdef ACTION_REPLAY
@ -4604,7 +4641,9 @@ static bool inputdevice_handle_inputcode2(int monid, int code, int state, const
set_config_changed ();
break;
case AKS_ENTERDEBUGGER:
//activate_debugger ();
#ifdef DEBUGGER
activate_debugger ();
#endif
break;
case AKS_STATESAVEDIALOG:
if (s) {
@ -5362,6 +5401,9 @@ void inputdevice_vsync (void)
pausemode(1);
}
}
if (keyboard_reset_seq > 0) {
keyboard_reset_seq++;
}
input_frame++;
mouseupdate (0, true);
@ -8273,7 +8315,7 @@ static int put_event_data (const struct inputdevice_functions *id, int devnum, i
uid->flags[i][sub] = flags;
uid->port[i][sub] = port;
xfree (uid->custom[i][sub]);
uid->custom[i][sub] = custom && custom[0] != '\0' ? stripstrdup(custom) : NULL;
uid->custom[i][sub] = custom && custom[0] != '\0' ? stripstrdup (custom) : NULL;
ret = i;
} else if (type == IDEV_WIDGET_AXIS) {
i = num - id->get_widget_first (devnum, type) + ID_AXIS_OFFSET;
@ -8281,7 +8323,7 @@ static int put_event_data (const struct inputdevice_functions *id, int devnum, i
uid->flags[i][sub] = flags;
uid->port[i][sub] = port;
xfree (uid->custom[i][sub]);
uid->custom[i][sub] = custom && custom[0] != '\0' ? stripstrdup(custom) : NULL;
uid->custom[i][sub] = custom && custom[0] != '\0' ? stripstrdup (custom) : NULL;
ret = i;
} else if (type == IDEV_WIDGET_KEY) {
i = num - id->get_widget_first (devnum, type);
@ -8289,7 +8331,7 @@ static int put_event_data (const struct inputdevice_functions *id, int devnum, i
uid->flags[i][sub] = flags;
uid->port[i][sub] = port;
xfree (uid->custom[i][sub]);
uid->custom[i][sub] = custom && custom[0] != '\0' ? stripstrdup(custom) : NULL;
uid->custom[i][sub] = custom && custom[0] != '\0' ? stripstrdup (custom) : NULL;
ret = i;
}
if (ret < 0)

View file

@ -53,7 +53,7 @@ static frame_time_t lastcycle;
static uae_u32 cycleoffset;
static uae_u32 pcs[16];
static uae_u32 pcs2[16];
static uae_u64 pcs2[16];
extern void activate_debugger (void);
static int warned;
@ -236,7 +236,7 @@ static int inprec_pstart (uae_u8 type)
if (warned > 0) {
warned--;
for (int i = 0; i < 7; i++)
write_log (_T("%08x (%08x) "), pcs[i], pcs2[i]);
write_log (_T("%08x (%016llx) "), pcs[i], pcs2[i]);
write_log (_T("\n"));
}
cycleoffset = (uae_u32)(cycles - cycles2);
@ -644,10 +644,10 @@ void inprec_playdebug_cpu (int mode)
}
err = 1;
} else {
memmove (pcs + 1, pcs, 15 * 4);
memmove(pcs + 1, pcs, 15 * sizeof(uae_u32));
pcs[0] = pc1;
memmove (pcs2 + 1, pcs2, 15 * 4);
pcs2[0] = get_cycles ();
memmove(pcs2 + 1, pcs2, 15 * sizeof(uae_u64));
pcs2[0] = get_cycles();
}
if (v1 != v2) {
if (warned > 0) {
@ -871,7 +871,7 @@ static int savedisk (const TCHAR *path, const TCHAR *file, uae_u8 *data, uae_u8
char *fn = uutf8 (filename);
strcpy ((char*)outdata + 2, fn);
xfree (fn);
len = 2 + strlen ((char*)outdata + 2) + 1;
len = 2 + uaestrlen((char*)outdata + 2) + 1;
}
}
xfree (fname);

View file

@ -19,9 +19,11 @@
#define PART_8 1
#endif
#ifdef USE_JIT_FPU
extern void comp_fpp_opp();
extern void comp_fscc_opp();
extern void comp_fbcc_opp();
#endif
#ifdef PART_1
/* OR.B #<data>.B,Dn */

View file

@ -2,7 +2,7 @@
* compiler/compemu.h - Public interface and definitions
*
* Copyright (c) 2001-2004 Milan Jurik of ARAnyM dev team (see AUTHORS)
*
*
* Inspired by Christian Bauer's Basilisk II
*
* This file is part of the ARAnyM project which builds a new and powerful
@ -32,12 +32,19 @@
#ifndef COMPEMU_H
#define COMPEMU_H
#if defined(CPU_AARCH64)
#include "sysconfig.h"
#include "newcpu.h"
#ifdef UAE
#ifdef CPU_64_BIT
typedef uae_u64 uintptr;
typedef uae_s64 intptr;
#else
typedef uae_u32 uintptr;
#endif
/* FIXME: cpummu.cpp also checks for USE_JIT, possibly others */
#define USE_JIT
#endif
#define JITPTR (uae_u32)(uintptr)

View file

@ -2,10 +2,11 @@
#if defined(JIT)
#include "sysdeps.h"
#include "options.h"
#include "memory.h"
#include "uae/memory.h"
#include "readcpu.h"
#include "newcpu.h"
#include "custom.h"
#include "comptbl.h"
#include "debug.h"
extern const struct comptbl op_smalltbl_0_comp_ff[] = {
{ op_0_0_comp_ff, 0x00000002, 0 }, /* OR */
{ op_10_0_comp_ff, 0x00000002, 16 }, /* OR */

View file

@ -56,7 +56,7 @@ struct flag_struct {
* with a setto %AL instr and the other flags copied to AH with an
* lahf instr).
*
* The 68k CZNV flags are thus assinged in cznv as:
* The 68k CZNV flags are thus assigned in cznv as:
*
* <--AL--> <--AH-->
* 76543210 FEDCBA98 --------- ---------

View file

@ -9,6 +9,12 @@
#ifndef MACCESS_UAE_H
#define MACCESS_UAE_H
#ifdef CPU_64_BIT
#define ALIGN_POINTER_TO32(p) ((~(uae_u64)(p)) & 3)
#else
#define ALIGN_POINTER_TO32(p) ((~(uae_u32)(p)) & 3)
#endif
static __inline__ uint32_t do_get_mem_long(uint32_t* a)
{
uint8_t* b = (uint8_t*)a;
@ -51,8 +57,6 @@ static __inline__ void do_put_mem_byte(uint8_t* a, uint8_t v)
*a = v;
}
#define ALIGN_POINTER_TO32(p) ((~(unsigned long)(p)) & 3)
#define call_mem_get_func(func, addr) ((*func)(addr))
#define call_mem_put_func(func, addr, v) ((*func)(addr, v))

View file

@ -33,7 +33,7 @@
#endif
#include "newcpu.h"
#include "disk.h"
//#include "debug.h"
#include "debug.h"
#include "xwin.h"
#include "inputdevice.h"
#include "keybuf.h"
@ -48,7 +48,7 @@
#include "consolehook.h"
#include "gfxboard.h"
//#include "luascript.h"
//#include "uaenative.h"
#include "uaenative.h"
#include "tabletlibrary.h"
#include "cpuboard.h"
//#include "uae/ppc.h"
@ -87,22 +87,30 @@ static TCHAR optionsfile[MAX_DPATH];
static uae_u32 randseed;
static int oldhcounter;
static uae_u32 xorshiftstate = 1;
static uae_u32 xorshift32(void)
{
uae_u32 x = xorshiftstate;
x ^= x << 13;
x ^= x >> 17;
x ^= x << 5;
xorshiftstate = x;
return xorshiftstate;
}
uae_u32 uaesrand(uae_u32 seed)
{
oldhcounter = -1;
randseed = seed;
//randseed = 0x12345678;
//write_log (_T("seed=%08x\n"), randseed);
return randseed;
}
uae_u32 uaerand(void)
{
if (oldhcounter != hsync_counter) {
srand(hsync_counter ^ randseed);
xorshiftstate = (hsync_counter ^ randseed) | 1;
oldhcounter = hsync_counter;
}
uae_u32 r = rand();
//write_log (_T("rand=%08x\n"), r);
uae_u32 r = xorshift32();
return r;
}
uae_u32 uaerandgetseed(void)
@ -110,7 +118,7 @@ uae_u32 uaerandgetseed(void)
return randseed;
}
void my_trim (TCHAR *s)
void my_trim(TCHAR *s)
{
while (_tcslen (s) > 0 && _tcscspn (s, _T("\t \r\n")) == 0)
memmove (s, s + 1, (_tcslen (s + 1) + 1) * sizeof (TCHAR));
@ -240,7 +248,7 @@ void fixup_cpu (struct uae_prefs *p)
p->cpu_frequency = 0;
//if (p->cpu_model >= 68020 && p->cpuboard_type && p->address_space_24 && cpuboard_32bit(p)) {
// error_log (_T("24-bit address space is not supported with selected accelerator board configuration."));
// error_log(_T("24-bit address space is not supported with selected accelerator board configuration."));
// p->address_space_24 = 0;
//}
if (p->cpu_model >= 68040 && p->address_space_24) {
@ -255,15 +263,20 @@ void fixup_cpu (struct uae_prefs *p)
switch (p->cpu_model)
{
case 68000:
break;
case 68010:
break;
case 68020:
break;
case 68030:
break;
case 68040:
if (p->fpu_model)
p->fpu_model = 68040;
break;
default:
case 68060:
if (p->fpu_model)
p->fpu_model = 68060;
break;
}
@ -274,6 +287,9 @@ void fixup_cpu (struct uae_prefs *p)
if (p->cpu_model < 68020 && p->cachesize) {
p->cachesize = 0;
if (p->fpu_model == 0 && p->compfpu) {
p->compfpu = false;
}
error_log (_T("JIT requires 68020 or better CPU."));
}
@ -326,16 +342,20 @@ void fixup_cpu (struct uae_prefs *p)
p->cachesize = 0;
#endif
if (p->immediate_blits && p->waiting_blits) {
error_log (_T("Immediate blitter and waiting blits can't be enabled simultaneously.\n"));
p->waiting_blits = 0;
}
if (p->cpu_memory_cycle_exact && p->cpu_model <= 68010 && p->waiting_blits) {
error_log(_T("Wait for blitter is not available in 68000/68010 cycle exact modes.\n"));
p->waiting_blits = 0;
}
if (p->blitter_cycle_exact && !p->cpu_memory_cycle_exact) {
error_log(_T("Blitter cycle-exact requires at least CPU memory cycle-exact.\n"));
p->blitter_cycle_exact = 0;
}
if (p->cpu_memory_cycle_exact)
p->cpu_compatible = true;
@ -469,6 +489,25 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig)
error_log(_T("You can't use Zorro II RTG and more than 2MB chip at the same time."));
p->chipmem.size = 0x200000;
}
#ifndef AMIBERRY // custom gfx boards not implemented yet
if (rbc->rtgmem_type >= GFXBOARD_HARDWARE) {
if (gfxboard_get_vram_min(rbc) > 0 && rbc->rtgmem_size < gfxboard_get_vram_min (rbc)) {
error_log(_T("Graphics card memory size %d (0x%x) smaller than minimum hardware supported %d (0x%x)."),
rbc->rtgmem_size, rbc->rtgmem_size, gfxboard_get_vram_min(rbc), gfxboard_get_vram_min(rbc));
rbc->rtgmem_size = gfxboard_get_vram_min (rbc);
}
if (p->address_space_24 && gfxboard_get_configtype(rbc) == 3) {
rbc->rtgmem_type = GFXBOARD_UAE_Z2;
rbc->rtgmem_size = 0;
error_log (_T("Z3 RTG and 24-bit address space are not compatible."));
}
if (gfxboard_get_vram_max(rbc) > 0 && rbc->rtgmem_size > gfxboard_get_vram_max(rbc)) {
error_log(_T("Graphics card memory size %d (0x%x) larger than maximum hardware supported %d (0x%x)."),
rbc->rtgmem_size, rbc->rtgmem_size, gfxboard_get_vram_max(rbc), gfxboard_get_vram_max(rbc));
rbc->rtgmem_size = gfxboard_get_vram_max(rbc);
}
}
#endif
if (p->address_space_24 && rbc->rtgmem_size && rbc->rtgmem_type == GFXBOARD_UAE_Z3) {
error_log (_T("Z3 RTG and 24bit address space are not compatible."));
rbc->rtgmem_type = GFXBOARD_UAE_Z2;
@ -661,10 +700,12 @@ static int default_config;
void uae_reset (int hardreset, int keyboardreset)
{
//if (debug_dma) {
// record_dma_reset ();
// record_dma_reset ();
//}
#ifdef DEBUGGER
if (debug_dma) {
record_dma_reset(0);
record_dma_reset(0);
}
#endif
currprefs.quitstatefile[0] = changed_prefs.quitstatefile[0] = 0;
if (quit_program == 0) {
@ -679,7 +720,9 @@ void uae_reset (int hardreset, int keyboardreset)
void uae_quit (void)
{
//deactivate_debugger ();
#ifdef DEBUGGER
deactivate_debugger ();
#endif
if (quit_program != -UAE_QUIT)
quit_program = -UAE_QUIT;
target_quit ();
@ -758,8 +801,7 @@ static void parse_cmdline_2 (int argc, TCHAR **argv)
for (auto i = 1; i < argc; i++) {
if (_tcsncmp(argv[i], _T("-cfgparam="), 10) == 0) {
cfgfile_addcfgparam(argv[i] + 10);
} else if (_tcscmp(argv[i], _T("-cfgparam")) == 0)
{
} else if (_tcscmp(argv[i], _T("-cfgparam")) == 0) {
if (i + 1 == argc)
write_log (_T("Missing argument for '-cfgparam' option.\n"));
else
@ -1296,7 +1338,11 @@ static int real_main2 (int argc, TCHAR **argv)
gui_update ();
if (graphics_init (true)) {
#ifdef DEBUGGER
setup_brkhandler ();
if (currprefs.start_debugger && debuggable ())
activate_debugger ();
#endif
if (!init_audio ()) {
if (sound_available && currprefs.produce_sound > 1) {
write_log (_T("Sound driver unavailable: Sound output disabled\n"));

View file

@ -34,7 +34,7 @@
//#include "enforcer.h"
#include "threaddep/thread.h"
#include "gayle.h"
//#include "debug.h"
#include "debug.h"
//#include "debugmem.h"
#include "gfxboard.h"
#include "cpuboard.h"
@ -55,10 +55,11 @@ addrbank* get_mem_bank_real(uaecptr addr)
#endif
bool canbang = true;
uaecptr highest_ram;
static bool rom_write_enabled;
#ifdef JIT
/* Set by each memory handler that does not simply access real memory. */
int special_mem;
int special_mem, special_mem_default;
/* do not use get_n_addr */
int jit_n_addr_unsafe;
#endif
@ -130,12 +131,17 @@ __inline__ void byteput (uaecptr addr, uae_u32 b)
}
#endif
//extern bool debugmem_initialized;
#ifdef DEBUGGER
extern bool debugmem_initialized;
#endif
bool real_address_allowed(void)
{
//return debugmem_initialized == false;
#ifdef DEBUGGER
return debugmem_initialized == false;
#else
return true;
#endif
}
int addr_valid (const TCHAR *txt, uaecptr addr, uae_u32 len)
@ -233,10 +239,12 @@ static void dummylog(int rw, uaecptr addr, int size, uae_u32 val, int ins)
return;
if (addr >= 0x07f7fff0 && addr <= 0x07ffffff)
return;
//if (debugmem_extinvalidmem(addr, val, rw ? size : -size))
// return;
//if ((illegal_count >= MAX_ILG && MAX_ILG > 0) && !memwatch_access_validator)
// return;
#ifdef DEBUGGER
if (debugmem_extinvalidmem(addr, val, rw ? (1 << size) : -(1 << size)))
return;
if ((illegal_count >= MAX_ILG && MAX_ILG > 0) && !memwatch_access_validator)
return;
#endif
if (MAX_ILG >= 0)
illegal_count++;
if (ins) {
@ -853,38 +861,50 @@ STATIC_INLINE uae_u8* REGPARAM2 chipmem_xlate_bigmem (uaecptr addr)
STATIC_INLINE void REGPARAM2 chipmem_lput_debugmem(uaecptr addr, uae_u32 v)
{
//if (addr < debugmem_chiplimit)
// debugmem_chiphit(addr, v, 4);
#ifdef DEBUGGER
if (addr < debugmem_chiplimit)
debugmem_chiphit(addr, v, 4);
#endif
put_long(addr, v);
}
STATIC_INLINE void REGPARAM2 chipmem_wput_debugmem(uaecptr addr, uae_u32 v)
{
//if (addr < debugmem_chiplimit)
//debugmem_chiphit(addr, v, 2);
#ifdef DEBUGGER
if (addr < debugmem_chiplimit)
debugmem_chiphit(addr, v, 2);
#endif
put_word(addr, v);
}
STATIC_INLINE void REGPARAM2 chipmem_bput_debugmem(uaecptr addr, uae_u32 v)
{
//if (addr < debugmem_chiplimit)
//debugmem_chiphit(addr, v, 1);
#ifdef DEBUGGER
if (addr < debugmem_chiplimit)
debugmem_chiphit(addr, v, 1);
#endif
put_byte(addr, v);
}
STATIC_INLINE uae_u32 REGPARAM2 chipmem_lget_debugmem(uaecptr addr)
{
//if (addr < debugmem_chiplimit)
//return debugmem_chiphit(addr, 0, -4);
#ifdef DEBUGGER
if (addr < debugmem_chiplimit)
return debugmem_chiphit(addr, 0, -4);
#endif
return get_long(addr);
}
STATIC_INLINE uae_u32 REGPARAM2 chipmem_wget_debugmem(uaecptr addr)
{
//if (addr < debugmem_chiplimit)
//return debugmem_chiphit(addr, 0, -2);
#ifdef DEBUGGER
if (addr < debugmem_chiplimit)
return debugmem_chiphit(addr, 0, -2);
#endif
return get_word(addr);
}
STATIC_INLINE uae_u32 REGPARAM2 chipmem_bget_debugmem(uaecptr addr)
{
//if (addr < debugmem_chiplimit)
//return debugmem_chiphit(addr, 0, -1);
#ifdef DEBUGGER
if (addr < debugmem_chiplimit)
return debugmem_chiphit(addr, 0, -1);
#endif
return get_byte(addr);
}
STATIC_INLINE int REGPARAM2 chipmem_check_debugmem(uaecptr addr, uae_u32 size)
@ -907,7 +927,11 @@ uae_u8 *(REGPARAM2 *chipmem_xlate_indirect)(uaecptr);
void chipmem_setindirect(void)
{
#ifdef DEBUGGER
if (debugmem_bank.baseaddr && debugmem_chiplimit) {
#else
if (debugmem_bank.baseaddr && 0) {
#endif
chipmem_lget_indirect = chipmem_lget_debugmem;
chipmem_wget_indirect = chipmem_wget_debugmem;
chipmem_bget_indirect = chipmem_bget_debugmem;
@ -1175,6 +1199,7 @@ static void REGPARAM2 extendedkickmem2b_bput(uaecptr addr, uae_u32 b)
write_log(_T("Illegal extendedkickmem2b lput at %08x\n"), addr);
}
/* Default memory access functions */
int REGPARAM2 default_check (uaecptr a, uae_u32 b)
@ -1207,10 +1232,12 @@ uae_u8 *REGPARAM2 default_xlate (uaecptr addr)
uaecptr a2 = addr - 32;
uaecptr a3 = m68k_getpc () - 32;
write_log (_T("Your Amiga program just did something terribly stupid %08X PC=%08X\n"), addr, M68K_GETPC);
//if (debugging || DEBUG_STUPID) {
// activate_debugger ();
// m68k_dumpstate(NULL, 0xffffffff);
//}
#ifdef DEBUGGER
if (debugging || DEBUG_STUPID) {
activate_debugger ();
m68k_dumpstate(NULL, 0xffffffff);
}
#endif
for (i = 0; i < 10; i++) {
write_log (_T("%08X "), i >= 5 ? a3 : a2);
for (j = 0; j < 16; j += 2) {
@ -1220,7 +1247,9 @@ uae_u8 *REGPARAM2 default_xlate (uaecptr addr)
write_log (_T("\n"));
}
memory_map_dump();
//m68k_dumpstate(NULL, 0xffffffff);
#ifdef DEBUGGER
m68k_dumpstate(NULL, 0xffffffff);
#endif
}
if (0 || (gary_toenb && (gary_nonrange(addr) || (size > 1 && gary_nonrange(addr + size - 1))))) {
hardware_exception2(addr, 0, true, true, size);
@ -1494,23 +1523,23 @@ static void descramble_alg(uae_u8 *data, int size)
static const uae_char *kickstring = "exec.library";
static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksum, int noalias)
static int read_kickstart(struct zfile *f, uae_u8 *mem, int size, int dochecksum, int noalias)
{
uae_char buffer[11];
int i, j, oldpos;
int cr = 0, kickdisk = 0;
if (size < 0) {
zfile_fseek (f, 0, SEEK_END);
zfile_fseek(f, 0, SEEK_END);
size = zfile_ftell32(f) & ~0x3ff;
zfile_fseek (f, 0, SEEK_SET);
zfile_fseek(f, 0, SEEK_SET);
}
oldpos = zfile_ftell32(f);
i = zfile_fread (buffer, 1, sizeof(buffer), f);
i = zfile_fread32(buffer, 1, sizeof(buffer), f);
if (i < sizeof(buffer))
return 0;
if (!memcmp (buffer, "KICK", 4)) {
zfile_fseek (f, 512, SEEK_SET);
if (!memcmp(buffer, "KICK", 4)) {
zfile_fseek(f, 512, SEEK_SET);
kickdisk = 1;
#if 0
} else if (size >= ROM_SIZE_512 && !memcmp (buffer, "AMIG", 4)) {
@ -1518,14 +1547,14 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu
zfile_fseek (f, oldpos + 0x6c, SEEK_SET);
cr = 2;
#endif
} else if (memcmp ((uae_char*)buffer, "AMIROMTYPE1", 11) != 0) {
zfile_fseek (f, oldpos, SEEK_SET);
} else if (memcmp((uae_char*)buffer, "AMIROMTYPE1", 11) != 0) {
zfile_fseek(f, oldpos, SEEK_SET);
} else {
cloanto_rom = 1;
cr = 1;
}
memset (mem, 0, size);
memset(mem, 0, size);
if (size >= 131072) {
for (i = 0; i < 8; i++) {
mem[size - 16 + i * 2 + 1] = 0x18 + i;
@ -1536,7 +1565,7 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu
mem[size - 17] = size >> 0;
}
i = zfile_fread (mem, 1, size, f);
i = zfile_fread32(mem, 1, size, f);
if (kickdisk && i > ROM_SIZE_256)
i = ROM_SIZE_256;
@ -1547,17 +1576,17 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu
}
#endif
if (i < size - 20)
kickstart_fix_checksum (mem, size);
kickstart_fix_checksum(mem, size);
j = 1;
while (j < i)
j <<= 1;
i = j;
if (!noalias && i == size / 2)
memcpy (mem + size / 2, mem, size / 2);
memcpy(mem + size / 2, mem, size / 2);
if (cr) {
if (!decode_rom (mem, size, cr, i))
if (!decode_rom(mem, size, cr, i))
return 0;
}
@ -1567,26 +1596,26 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu
if (currprefs.cs_a1000ram && i < ROM_SIZE_256) {
int off = 0;
if (!a1000_bootrom)
a1000_bootrom = xcalloc (uae_u8, ROM_SIZE_256);
a1000_bootrom = xcalloc(uae_u8, ROM_SIZE_256);
while (off + i < ROM_SIZE_256) {
memcpy (a1000_bootrom + off, kickmem_bank.baseaddr, i);
memcpy(a1000_bootrom + off, kickmem_bank.baseaddr, i);
off += i;
}
memset (kickmem_bank.baseaddr, 0, kickmem_bank.allocated_size);
a1000_handle_kickstart (1);
memset(kickmem_bank.baseaddr, 0, kickmem_bank.allocated_size);
a1000_handle_kickstart(1);
dochecksum = 0;
i = ROM_SIZE_512;
}
for (j = 0; j < 256 && i >= ROM_SIZE_256; j++) {
if (!memcmp (mem + j, kickstring, strlen (kickstring) + 1))
if (!memcmp(mem + j, kickstring, strlen(kickstring) + 1))
break;
}
if (j == 256 || i < ROM_SIZE_256)
dochecksum = 0;
if (dochecksum)
kickstart_checksum (mem, size);
kickstart_checksum(mem, size);
return i;
}
@ -1700,7 +1729,7 @@ static bool load_kickstart_replacement(void)
if (!f)
return false;
#endif
extendedkickmem_bank.reserved_size = ROM_SIZE_512;
extendedkickmem_bank.mask = ROM_SIZE_512 - 1;
extendedkickmem_bank.label = _T("rom_e0");
@ -2248,20 +2277,27 @@ static void allocate_memory (void)
bogo_filepos = 0;
a3000lmem_filepos = 0;
a3000hmem_filepos = 0;
//cpuboard_init();
#ifndef AMIBERRY // support for CPU boards is not implemented yet
cpuboard_init();
#endif
}
static void setmemorywidth(struct ramboard *mb, addrbank *ab)
{
if (!ab || !ab->allocated_size)
return;
if (!mb->force16bit)
return;
for (int i = (ab->start >> 16); i < ((ab->start + ab->allocated_size) >> 16); i++) {
if (ce_banktype[i] == CE_MEMBANK_FAST32)
ce_banktype[i] = CE_MEMBANK_FAST16;
if (ce_banktype[i] == CE_MEMBANK_CHIP32)
ce_banktype[i] = CE_MEMBANK_CHIP16;
if (mb->force16bit) {
for (int i = (ab->start >> 16); i < ((ab->start + ab->allocated_size) >> 16); i++) {
if (ce_banktype[i] == CE_MEMBANK_FAST32)
ce_banktype[i] = CE_MEMBANK_FAST16;
if (ce_banktype[i] == CE_MEMBANK_CHIP32)
ce_banktype[i] = CE_MEMBANK_CHIP16;
}
}
if (mb->chipramtiming) {
for (int i = (ab->start >> 16); i < ((ab->start + ab->allocated_size) >> 16); i++) {
ce_banktype[i] = ce_banktype[0];
}
}
}
@ -2281,12 +2317,6 @@ static void fill_ce_banks (void)
ce_banktype[i] = (currprefs.cs_mbdmac || (currprefs.chipset_mask & CSMASK_AGA)) ? CE_MEMBANK_CHIP32 : CE_MEMBANK_CHIP16;
}
}
if (!currprefs.cs_slowmemisfast) {
for (i = (0xc00000 >> 16); i < (0xe00000 >> 16); i++)
ce_banktype[i] = ce_banktype[0];
for (i = (bogomem_bank.start >> 16); i < ((bogomem_bank.start + bogomem_bank.allocated_size) >> 16); i++)
ce_banktype[i] = ce_banktype[0];
}
for (i = (0xd00000 >> 16); i < (0xe00000 >> 16); i++) {
ce_banktype[i] = CE_MEMBANK_CHIP16;
}
@ -2372,20 +2402,20 @@ void map_overlay (int chip)
#endif
#endif
if (chip) {
map_banks (&dummy_bank, 0, size, 0);
if (!isdirectjit ()) {
map_banks(&dummy_bank, 0, size, 0);
if (!isdirectjit()) {
if ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) && bogomem_bank.allocated_size == 0) {
map_banks(cb, 0, size, chipmem_bank.allocated_size);
int start = chipmem_bank.allocated_size >> 16;
if (chipmem_bank.allocated_size < 0x100000) {
if (currprefs.cs_1mchipjumper) {
int dummy = (0x100000 - chipmem_bank.allocated_size) >> 16;
map_banks (&chipmem_dummy_bank, start, dummy, 0);
map_banks (&chipmem_dummy_bank, start + 16, dummy, 0);
map_banks(&chipmem_dummy_bank, start, dummy, 0);
map_banks(&chipmem_dummy_bank, start + 16, dummy, 0);
}
} else if (chipmem_bank.allocated_size < 0x200000 && chipmem_bank.allocated_size > 0x100000) {
int dummy = (0x200000 - chipmem_bank.allocated_size) >> 16;
map_banks (&chipmem_dummy_bank, start, dummy, 0);
map_banks(&chipmem_dummy_bank, start, dummy, 0);
}
} else {
int mapsize = 32;
@ -2394,28 +2424,88 @@ void map_overlay (int chip)
map_banks(cb, 0, mapsize, chipmem_bank.allocated_size);
}
} else {
map_banks (cb, 0, chipmem_bank.allocated_size >> 16, 0);
map_banks(cb, 0, chipmem_bank.allocated_size >> 16, 0);
}
} else {
addrbank *rb = NULL;
if (size < 32 && bogomem_aliasing == 0)
size = 32;
cb = get_mem_bank_real(0xf00000);
if (!rb && cb && (cb->flags & ABFLAG_ROM) && get_word (0xf00000) == 0x1114)
if (!rb && cb && (cb->flags & ABFLAG_ROM) && get_word(0xf00000) == 0x1114)
rb = cb;
cb = get_mem_bank_real(0xe00000);
if (!rb && cb && (cb->flags & ABFLAG_ROM) && get_word (0xe00000) == 0x1114)
if (!rb && cb && (cb->flags & ABFLAG_ROM) && get_word(0xe00000) == 0x1114)
rb = cb;
if (!rb)
rb = &kickmem_bank;
map_banks (rb, 0, size, 0x80000);
map_banks(rb, 0, size, 0x80000);
}
initramboard(&chipmem_bank, &currprefs.chipmem);
overlay_state = chip;
fill_ce_banks ();
//cpuboard_overlay_override();
if (!isrestore () && valid_address (regs.pc, 4))
m68k_setpc_normal (m68k_getpc ());
fill_ce_banks();
#ifndef AMIBERRY
cpuboard_overlay_override();
#endif
if (!isrestore() && valid_address(regs.pc, 4)) {
m68k_setpc_normal(m68k_getpc());
}
}
// Set a default pattern for uninitialized memory after hard reset.
// 0:even 1:odd on columns for even rows,
// 1:even 0:odd on columns for odd rows.
static void fillpattern(addrbank *ab)
{
if (currprefs.cs_memorypatternfill && aga_mode) {
uae_u32 fillval = 0;
for (int fillbank = 0; fillbank < ab->allocated_size / 2048; fillbank++) {
fillval = ~fillval;
for (int fillrow = fillbank * 2048; fillrow < (fillbank + 1) * 2048; fillrow += 4) {
// Chip emulated: NEC PD42S4260 (A1200 R1). Spec says 512x512x16.
*((uae_u32 *)(ab->baseaddr + fillrow)) = fillval;
if ((fillrow & 7) == 4) {
fillval = ~fillval;
}
}
}
} else if (currprefs.cs_memorypatternfill && (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) {
uae_u32 fillval = 0;
for (int fillbank = 0; fillbank < ab->allocated_size / 1024; fillbank++) {
fillval = ~fillval;
for (int fillrow = fillbank * 1024; fillrow < (fillbank + 1) * 1024; fillrow += 4) {
// Chip emulated: Generic 4256. 4 * 512x4.
*((uae_u32 *)(ab->baseaddr + fillrow)) = fillval;
if ((fillrow & 7) == 0) {
fillval = ~fillval;
}
}
}
} else if (currprefs.cs_memorypatternfill && !currprefs.cs_dipagnus) {
// OCS Agnus has swapped row and column compared to ECS and AGA.
uae_u16 fillval = 0;
for (int fillbank = 0; fillbank < ab->allocated_size / 256; fillbank++) {
fillval = ~fillval;
for (int fillrow = 0; fillrow < 256; fillrow += 2) {
// Chip emulated: Generic 4256. 16 * 512x1.
*((uae_u16 *)(ab->baseaddr + fillbank * 256 + fillrow)) = fillval;
}
}
} else if (currprefs.cs_memorypatternfill) {
// A1000
uae_u16 fillval = 0;
for (int fillbank = 0; fillbank < ab->allocated_size / 512; fillbank++) {
fillval = ~fillval;
for (int fillrow = 0; fillrow < 512; fillrow += 2) {
// Chip emulated: Generic 4256. 16 * 512x1.
*((uae_u16 *)(ab->baseaddr + fillbank * 512 + fillrow)) = fillval;
if (((fillrow >> 1) & 15) == 15) {
fillval = ~fillval;
}
}
}
} else {
memset(ab->baseaddr, 0, ab->allocated_size);
}
}
void memory_clear (void)
@ -2424,58 +2514,13 @@ void memory_clear (void)
if (savestate_state == STATE_RESTORE)
return;
// Set a default pattern for uninitialized memory after hard reset.
// 0:even 1:odd on columns for even rows,
// 1:even 0:odd on columns for odd rows.
if (chipmem_bank.baseaddr) {
if (aga_mode) {
uae_u32 fillval = 0;
for (int fillbank = 0; fillbank < chipmem_bank.allocated_size / 2048; fillbank++) {
for (int fillrow = fillbank * 2048; fillrow < (fillbank + 1) * 2048; fillrow += 4) {
// Chip emulated: NEC PD42S4260 (A1200 R1). Spec says 512x512x16.
*((uae_u32*)(chipmem_bank.baseaddr + fillrow)) = fillval;
fillval = ~fillval;
}
fillval = ~fillval;
}
} else {
uae_u16 fillval = 0;
for (int fillbank = 0; fillbank < chipmem_bank.allocated_size / 1024; fillbank++) {
for (int fillrow = fillbank * 1024; fillrow < (fillbank + 1) * 1024; fillrow += 2) {
// Chip emulated: Generic 4256. Should apply to both 512x512x1 and 512x512x4.
*((uae_u16*)(chipmem_bank.baseaddr + fillrow)) = fillval;
fillval = ~fillval;
}
fillval = ~fillval;
}
}
fillpattern(&chipmem_bank);
}
if (bogomem_bank.baseaddr) {
// NOTE: At reset, WinUAE maps "slow" memory to fast before later re-assigning to chip.
if (ce_banktype[0xC0] == CE_MEMBANK_FAST32) {
uae_u32 fillval = 0;
for (int fillbank = 0; fillbank < bogomem_bank.allocated_size / 2048; fillbank++) {
for (int fillrow = fillbank * 2048; fillrow < (fillbank + 1) * 2048; fillrow += 4) {
// Chip emulated: 512x512x16 (A1200 R1)
*((uae_u32*)(bogomem_bank.baseaddr + fillrow)) = fillval;
fillval = ~fillval;
}
fillval = ~fillval;
}
} else if (ce_banktype[0xC0] == CE_MEMBANK_FAST16) {
uae_u16 fillval = 0;
for (int fillbank = 0; fillbank < bogomem_bank.allocated_size / 1024; fillbank++) {
for (int fillrow = fillbank * 1024; fillrow < (fillbank + 1) * 1024; fillrow += 2) {
// Chip emulated: Generic 4256
*((uae_u16*)(bogomem_bank.baseaddr + fillrow)) = fillval;
fillval = ~fillval;
}
fillval = ~fillval;
}
} else {
memset(bogomem_bank.baseaddr, 0, bogomem_bank.allocated_size);
}
// TODO: slow RAM can have 16x chips even if Agnus is ECS.
fillpattern(&bogomem_bank);
}
if (mem25bit_bank.baseaddr)
@ -2485,7 +2530,9 @@ void memory_clear (void)
if (a3000hmem_bank.baseaddr)
memset(a3000hmem_bank.baseaddr, 0, a3000hmem_bank.allocated_size);
expansion_clear ();
//cpuboard_clear();
#ifndef AMIBERRY
cpuboard_clear();
#endif
}
static void restore_roms(void)
@ -2589,7 +2636,9 @@ void reload_roms(void)
void memory_restore(void)
{
last_address_space_24 = currprefs.address_space_24;
//cpuboard_map();
#ifndef AMIBERRY
cpuboard_map();
#endif
map_banks_set(&kickmem_bank, 0xF8, 8, 0);
}
@ -2598,6 +2647,7 @@ void memory_reset (void)
int bnk, bnk_end;
bool gayleorfatgary;
highest_ram = 0;
//alg_flag = 0;
need_hardreset = false;
rom_write_enabled = true;
@ -2628,7 +2678,9 @@ void memory_reset (void)
currprefs.cs_fatgaryrev = changed_prefs.cs_fatgaryrev;
currprefs.cs_ramseyrev = changed_prefs.cs_ramseyrev;
currprefs.cs_unmapped_space = changed_prefs.cs_unmapped_space;
//cpuboard_reset(mem_hardreset);
#ifndef AMIBERRY
cpuboard_reset(mem_hardreset);
#endif
gayleorfatgary = ((currprefs.chipset_mask & CSMASK_AGA) || currprefs.cs_pcmcia || currprefs.cs_ide > 0 || currprefs.cs_mbdmac) && !currprefs.cs_cd32cd;
@ -2727,12 +2779,16 @@ void memory_reset (void)
if (debugmem_bank.baseaddr) {
map_banks(&debugmem_bank, debugmem_bank.start >> 16, debugmem_bank.allocated_size >> 16, 0);
}
//cpuboard_map();
#ifndef AMIBERRY
cpuboard_map();
#endif
map_banks_set(&kickmem_bank, 0xF8, 8, 0);
//if (currprefs.maprom) {
// if (!cpuboard_maprom())
// map_banks_set(&kickram_bank, currprefs.maprom >> 16, extendedkickmem2a_bank.allocated_size ? 32 : (extendedkickmem_bank.allocated_size ? 16 : 8), 0);
//}
if (currprefs.maprom && _tcscmp(currprefs.romfile, _T(":AROS"))) {
#ifndef AMIBERRY
if (!cpuboard_maprom())
#endif
map_banks_set(&kickram_bank, currprefs.maprom >> 16, extendedkickmem2a_bank.allocated_size ? 32 : (extendedkickmem_bank.allocated_size ? 16 : 8), 0);
}
/* map beta Kickstarts at 0x200000/0xC00000/0xF00000 */
if (kickmem_bank.baseaddr[0] == 0x11 && kickmem_bank.baseaddr[2] == 0x4e && kickmem_bank.baseaddr[3] == 0xf9 && kickmem_bank.baseaddr[4] == 0x00) {
uae_u32 addr = kickmem_bank.baseaddr[5];
@ -2772,8 +2828,10 @@ void memory_reset (void)
break;
#endif
case EXTENDED_ROM_ALG:
// map_banks_set(&extendedkickmem_bank, 0xF0, 4, 0);
// alg_map_banks();
#ifndef AMIBERRY
map_banks_set(&extendedkickmem_bank, 0xF0, 4, 0);
alg_map_banks();
#endif
break;
}
@ -2882,7 +2940,9 @@ void memory_init (void)
}
_tcscpy (currprefs.romfile, _T("<none>"));
currprefs.romextfile[0] = 0;
//cpuboard_reset(1);
#ifndef AMIBERRY
cpuboard_reset(1);
#endif
#ifdef ACTION_REPLAY
action_replay_unload (0);
@ -2917,7 +2977,9 @@ void memory_cleanup (void)
custmem1_bank.baseaddr = NULL;
custmem2_bank.baseaddr = NULL;
//cpuboard_cleanup();
#ifndef AMIBERRY
cpuboard_cleanup();
#endif
#ifdef ACTION_REPLAY
action_replay_cleanup();
#endif
@ -3073,8 +3135,10 @@ static void map_banks2 (addrbank *bank, int start, int size, int realsize, int q
}
#endif
//if (quick <= 0)
//old = debug_bankchange(-1);
#ifdef DEBUGGER
if (quick <= 0)
old = debug_bankchange (-1);
#endif
flush_icache(3); /* Sure don't want to keep any old mappings around! */
#ifdef NATMEM_OFFSET
//if (!quick)
@ -3112,8 +3176,10 @@ static void map_banks2 (addrbank *bank, int start, int size, int realsize, int q
#endif
real_left--;
}
//if (quick <= 0)
//debug_bankchange(old);
#ifdef DEBUGGER
if (quick <= 0)
debug_bankchange (old);
#endif
return;
}
#endif
@ -3145,8 +3211,10 @@ static void map_banks2 (addrbank *bank, int start, int size, int realsize, int q
real_left--;
}
}
//if (quick <= 0)
//debug_bankchange(old);
#ifdef DEBUGGER
if (quick <= 0)
debug_bankchange (old);
#endif
fill_ce_banks ();
}
@ -3214,6 +3282,9 @@ void map_banks (addrbank *bank, int start, int size, int realsize)
#ifdef WITH_PPC
ppc_generate_map_banks(bank, start, size);
#endif
if ((bank->flags & ABFLAG_RAM) && !(bank->flags & ABFLAG_RTG) && ((start + size) << 16) > highest_ram) {
highest_ram = (start + size) << 16;
}
}
bool validate_banks_z3(addrbank *bank, int start, int size)
@ -3537,7 +3608,7 @@ void loadboardfile(addrbank *ab, struct boardloadfile * lf)
else if (lf->loadoffset + size > ab->allocated_size)
size = ab->allocated_size - lf->loadoffset;
if (size > 0) {
int total = zfile_fread(ab->baseaddr + lf->loadoffset, 1, size, zf);
int total = zfile_fread32(ab->baseaddr + lf->loadoffset, 1, size, zf);
write_log(_T("Expansion file '%s': load %u bytes, offset %u, start addr %08x\n"),
lf->loadfile, total, lf->loadoffset, ab->start + lf->loadoffset);
}

View file

@ -33,7 +33,7 @@
#include "cpu_prefetch.h"
#include "autoconf.h"
#include "traps.h"
//#include "debug.h"
#include "debug.h"
//#include "debugmem.h"
#include "gui.h"
#include "savestate.h"
@ -3508,6 +3508,19 @@ static void m68k_run_jit(void)
}
#endif /* JIT */
static void check_halt(void)
{
if (regs.halted)
do_specialties (0);
}
void cpu_inreset(void)
{
regs.s = 1;
regs.intmask = 7;
MakeSR();
}
void cpu_halt (int id)
{
// id < 0: m68k halted, PPC active.
@ -4422,11 +4435,13 @@ bool cpureset (void)
m68k_reset_delay = currprefs.reset_delay;
set_special(SPCFLAG_CHECK);
send_internalevent(INTERNALEVENT_CPURESET);
//if (cpuboard_forced_hardreset()) {
// custom_reset_cpu(false, false);
// m68k_reset();
// return true;
//}
#ifndef AMIBERRY
if (cpuboard_forced_hardreset()) {
custom_reset_cpu(false, false);
m68k_reset();
return true;
}
#endif
if ((currprefs.cpu_compatible || currprefs.cpu_memory_cycle_exact) && currprefs.cpu_model <= 68020) {
custom_reset_cpu(false, false);
return false;

View file

@ -1108,10 +1108,10 @@ void process_event(SDL_Event event)
return;
case SDL_JOYDEVICEADDED:
case SDL_CONTROLLERDEVICEADDED:
//case SDL_CONTROLLERDEVICEADDED:
case SDL_JOYDEVICEREMOVED:
case SDL_CONTROLLERDEVICEREMOVED:
write_log("SDL Controller/Joystick device added or removed! Re-running import joysticks...\n");
//case SDL_CONTROLLERDEVICEREMOVED:
write_log("SDL2 Controller/Joystick added or removed, re-running import joysticks...\n");
import_joysticks();
if (inputdevice_devicechange(&currprefs))
{
@ -1675,11 +1675,6 @@ void target_fixup_options(struct uae_prefs* p)
nosound = true;
nojoy = true;
}
if (p->rtg_hardwaresprite && !p->gfx_api) {
error_log(_T("Not RTG hardware sprite compatible."));
p->rtg_hardwaresprite = false;
}
#ifdef AMIBERRY
p->rtgboards[0].rtgmem_type = GFXBOARD_UAE_Z3;
@ -1720,10 +1715,6 @@ void target_fixup_options(struct uae_prefs* p)
p->rtg_hardwaresprite = false;
p->rtgmatchdepth = false;
p->color_mode = 5;
//if (p->ppc_model && !p->gfx_api) {
// error_log(_T("Graphics board and PPC: Direct3D enabled."));
// p->gfx_api = os_win7 ? 2 : 1;
//}
}
struct MultiDisplay* md = getdisplay(p, 0);
@ -1764,7 +1755,7 @@ void target_fixup_options(struct uae_prefs* p)
p->soundcard = 0;
}
}
#ifdef AMIBERRY
// Initialize Drawbridge if needed
for (const auto& floppyslot : p->floppyslots)
{
@ -1773,6 +1764,7 @@ void target_fixup_options(struct uae_prefs* p)
}
set_key_configs(p);
#endif
}
void target_default_options(struct uae_prefs* p, int type)
@ -1853,8 +1845,9 @@ void target_default_options(struct uae_prefs* p, int type)
p->picasso96_modeflags = RGBFF_CLUT | RGBFF_R5G6B5PC | RGBFF_R8G8B8A8;
//p->filesystem_mangle_reserved_names = true;
}
#ifdef AMIBERRY
p->fast_copper = 0;
#endif
p->multithreaded_drawing = amiberry_options.default_multithreaded_drawing;
p->kbd_led_num = -1; // No status on numlock
@ -1913,7 +1906,7 @@ void target_default_options(struct uae_prefs* p, int type)
}
else
{
// Single line mode (default)
// Single line mode
p->gfx_vresolution = VRES_NONDOUBLE;
p->gfx_pscanlines = 0;
}
@ -2030,6 +2023,7 @@ void target_save_options(struct zfile* f, struct uae_prefs* p)
cfgfile_target_dwrite_bool(f, _T("borderless"), p->borderless);
cfgfile_target_dwrite_bool(f, _T("blank_monitors"), p->blankmonitors);
cfgfile_target_dwrite_str(f, _T("uaescsimode"), scsimode[p->uaescsimode]);
cfgfile_target_write(f, _T("soundcard"), _T("%d"), p->soundcard);
if (p->soundcard >= 0 && p->soundcard < MAX_SOUND_DEVICES && sound_devices[p->soundcard])
cfgfile_target_write_str(f, _T("soundcardname"), sound_devices[p->soundcard]->cfgname);
if (p->samplersoundcard >= 0 && p->samplersoundcard < MAX_SOUND_DEVICES) {
@ -2082,6 +2076,8 @@ void target_restart(void)
TCHAR* target_expand_environment(const TCHAR* path, TCHAR* out, int maxlen)
{
if (!path)
return nullptr;
if (out == nullptr)
return strdup(path);
@ -2101,117 +2097,47 @@ int target_parse_option(struct uae_prefs* p, const char* option, const char* val
p->input_mouse_untrap &= ~MOUSEUNTRAP_MIDDLEBUTTON;
return 1;
}
if (cfgfile_yesno(option, value, _T("map_drives_auto"), &p->automount_removable))
if (cfgfile_yesno(option, value, _T("map_drives_auto"), &p->automount_removable)
|| cfgfile_yesno(option, value, _T("map_cd_drives"), &p->automount_cddrives)
|| cfgfile_yesno(option, value, _T("borderless"), &p->borderless)
|| cfgfile_yesno(option, value, _T("blank_monitors"), &p->blankmonitors)
|| cfgfile_yesno(option, value, _T("active_nocapture_pause"), &p->active_nocapture_pause)
|| cfgfile_yesno(option, value, _T("active_nocapture_nosound"), &p->active_nocapture_nosound)
|| cfgfile_yesno(option, value, _T("inactive_pause"), &p->inactive_pause)
|| cfgfile_yesno(option, value, _T("inactive_nosound"), &p->inactive_nosound)
|| cfgfile_intval(option, value, _T("inactive_input"), &p->inactive_input, 1)
|| cfgfile_yesno(option, value, _T("minimized_pause"), &p->minimized_pause)
|| cfgfile_yesno(option, value, _T("minimized_nosound"), &p->minimized_nosound)
|| cfgfile_intval(option, value, _T("minimized_input"), &p->minimized_input, 1)
|| cfgfile_yesno(option, value, _T("right_control_is_right_win"), &p->right_control_is_right_win_key)
|| cfgfile_yesno(option, value, _T("always_on_top"), &p->main_alwaysontop)
|| cfgfile_yesno(option, value, _T("gui_always_on_top"), &p->gui_alwaysontop)
|| cfgfile_intval(option, value, _T("drawbridge_driver"), &p->drawbridge_driver, 1)
|| cfgfile_yesno(option, value, _T("drawbridge_smartspeed"), &p->drawbridge_smartspeed)
|| cfgfile_yesno(option, value, _T("drawbridge_autocache"), &p->drawbridge_autocache)
|| cfgfile_yesno(option, value, _T("drawbridge_connected_drive_b"), &p->drawbridge_connected_drive_b)
|| cfgfile_yesno(option, value, _T("alt_tab_release"), &p->alt_tab_release)
|| cfgfile_yesno(option, value, _T("use_retroarch_quit"), &p->use_retroarch_quit)
|| cfgfile_yesno(option, value, _T("use_retroarch_menu"), &p->use_retroarch_menu)
|| cfgfile_yesno(option, value, _T("use_retroarch_reset"), &p->use_retroarch_reset)
|| cfgfile_intval(option, value, _T("sound_pullmode"), &p->sound_pullmode, 1)
|| cfgfile_intval(option, value, _T("samplersoundcard"), &p->samplersoundcard, 1)
|| cfgfile_intval(option, value, "kbd_led_num", &p->kbd_led_num, 1)
|| cfgfile_intval(option, value, "kbd_led_scr", &p->kbd_led_scr, 1)
|| cfgfile_intval(option, value, "kbd_led_cap", &p->kbd_led_cap, 1)
|| cfgfile_intval(option, value, "gfx_horizontal_offset", &p->gfx_horizontal_offset, 1)
|| cfgfile_intval(option, value, "gfx_vertical_offset", &p->gfx_vertical_offset, 1)
|| cfgfile_yesno(option, value, _T("gfx_auto_height"), &p->gfx_auto_crop)
|| cfgfile_yesno(option, value, _T("gfx_auto_crop"), &p->gfx_auto_crop)
|| cfgfile_intval(option, value, "gfx_correct_aspect", &p->gfx_correct_aspect, 1)
|| cfgfile_intval(option, value, "scaling_method", &p->scaling_method, 1)
|| cfgfile_string(option, value, "open_gui", p->open_gui, sizeof p->open_gui)
|| cfgfile_string(option, value, "quit_amiberry", p->quit_amiberry, sizeof p->quit_amiberry)
|| cfgfile_string(option, value, "action_replay", p->action_replay, sizeof p->action_replay)
|| cfgfile_string(option, value, "fullscreen_toggle", p->fullscreen_toggle, sizeof p->fullscreen_toggle)
|| cfgfile_string(option, value, "minimize", p->minimize, sizeof p->minimize)
|| cfgfile_intval(option, value, _T("cpu_idle"), &p->cpu_idle, 1))
return 1;
if (cfgfile_yesno(option, value, _T("map_cd_drives"), &p->automount_cddrives))
return 1;
if (cfgfile_intval(option, value, _T("drawbridge_driver"), &p->drawbridge_driver, 1))
return 1;
if (cfgfile_yesno(option, value, _T("drawbridge_smartspeed"), &p->drawbridge_smartspeed))
return 1;
if (cfgfile_yesno(option, value, _T("drawbridge_autocache"), &p->drawbridge_autocache))
return 1;
if (cfgfile_yesno(option, value, _T("drawbridge_connected_drive_b"), &p->drawbridge_connected_drive_b))
return 1;
if (cfgfile_yesno(option, value, _T("alt_tab_release"), &p->alt_tab_release))
return 1;
if (cfgfile_yesno(option, value, _T("use_retroarch_quit"), &p->use_retroarch_quit))
return 1;
if (cfgfile_yesno(option, value, _T("use_retroarch_menu"), &p->use_retroarch_menu))
return 1;
if (cfgfile_yesno(option, value, _T("use_retroarch_reset"), &p->use_retroarch_reset))
return 1;
if (cfgfile_intval(option, value, _T("sound_pullmode"), &p->sound_pullmode, 1))
return 1;
if (cfgfile_intval(option, value, _T("samplersoundcard"), &p->samplersoundcard, 1))
return 1;
if (cfgfile_intval(option, value, "kbd_led_num", &p->kbd_led_num, 1))
return 1;
if (cfgfile_intval(option, value, "kbd_led_scr", &p->kbd_led_scr, 1))
return 1;
if (cfgfile_intval(option, value, "kbd_led_cap", &p->kbd_led_cap, 1))
return 1;
if (cfgfile_intval(option, value, "gfx_horizontal_offset", &p->gfx_horizontal_offset, 1))
return 1;
if (cfgfile_intval(option, value, "gfx_vertical_offset", &p->gfx_vertical_offset, 1))
return 1;
if (cfgfile_yesno(option, value, _T("gfx_auto_height"), &p->gfx_auto_crop))
return 1;
if (cfgfile_yesno(option, value, _T("gfx_auto_crop"), &p->gfx_auto_crop))
return 1;
if (cfgfile_intval(option, value, "gfx_correct_aspect", &p->gfx_correct_aspect, 1))
return 1;
if (cfgfile_intval(option, value, "scaling_method", &p->scaling_method, 1))
return 1;
if (cfgfile_string(option, value, "open_gui", p->open_gui, sizeof p->open_gui))
return 1;
if (cfgfile_string(option, value, "quit_amiberry", p->quit_amiberry, sizeof p->quit_amiberry))
return 1;
if (cfgfile_string(option, value, "action_replay", p->action_replay, sizeof p->action_replay))
return 1;
if (cfgfile_string(option, value, "fullscreen_toggle", p->fullscreen_toggle, sizeof p->fullscreen_toggle))
return 1;
if (cfgfile_string(option, value, "minimize", p->minimize, sizeof p->minimize))
return 1;
if (cfgfile_intval(option, value, _T("cpu_idle"), &p->cpu_idle, 1))
return 1;
if (cfgfile_strval(option, value, _T("uaescsimode"), &p->uaescsimode, scsimode, 0)) {
// force SCSIEMU if pre 2.3 configuration
if (p->config_version < ((2 << 16) | (3 << 8)))
p->uaescsimode = UAESCSI_CDEMU;
return 1;
}
if (cfgfile_intval(option, value, _T("active_priority"), &p->active_capture_priority, 1))
{
p->active_nocapture_pause = false;
p->active_nocapture_nosound = false;
return 1;
}
if (cfgfile_yesno(option, value, _T("borderless"), &p->borderless))
return 1;
if (cfgfile_yesno(option, value, _T("blank_monitors"), &p->blankmonitors))
return 1;
if (cfgfile_yesno(option, value, _T("active_nocapture_pause"), &p->active_nocapture_pause))
return 1;
if (cfgfile_yesno(option, value, _T("active_nocapture_nosound"), &p->active_nocapture_nosound))
return 1;
if (cfgfile_intval(option, value, _T("inactive_priority"), &p->inactive_priority, 1))
return 1;
if (cfgfile_yesno(option, value, _T("inactive_pause"), &p->inactive_pause))
return 1;
if (cfgfile_yesno(option, value, _T("inactive_nosound"), &p->inactive_nosound))
return 1;
if (cfgfile_intval(option, value, _T("inactive_input"), &p->inactive_input, 1))
return 1;
if (cfgfile_intval(option, value, _T("minimized_priority"), &p->minimized_priority, 1))
return 1;
if (cfgfile_yesno(option, value, _T("minimized_pause"), &p->minimized_pause))
return 1;
if (cfgfile_yesno(option, value, _T("minimized_nosound"), &p->minimized_nosound))
return 1;
if (cfgfile_intval(option, value, _T("minimized_input"), &p->minimized_input, 1))
return 1;
if (cfgfile_yesno(option, value, _T("active_capture_automatically"), &p->capture_always))
return 1;
if (cfgfile_yesno(option, value, _T("inactive_minimize"), &p->minimize_inactive))
return 1;
if (cfgfile_yesno(option, value, _T("start_iconified"), &p->start_minimized))
return 1;
if (cfgfile_yesno(option, value, _T("start_not_captured"), &p->start_uncaptured))
return 1;
if (cfgfile_yesno(option, value, _T("right_control_is_right_win"), &p->right_control_is_right_win_key))
return 1;
if (cfgfile_yesno(option, value, _T("always_on_top"), &p->main_alwaysontop))
return 1;
if (cfgfile_yesno(option, value, _T("gui_always_on_top"), &p->gui_alwaysontop))
return 1;
if (cfgfile_string(option, value, _T("serial_port"), &p->sername[0], 256)) {
if (p->sername[0])
p->use_serial = true;
else
p->use_serial = false;
return 1;
}
if (cfgfile_string(option, value, _T("expansion_gui_page"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
TCHAR* p = _tcschr(tmpbuf, ',');
@ -2228,7 +2154,6 @@ int target_parse_option(struct uae_prefs* p, const char* option, const char* val
if (cfgfile_yesno(option, value, _T("rtg_match_depth"), &p->rtgmatchdepth))
return 1;
if (cfgfile_yesno(option, value, _T("rtg_scale_allow"), &p->rtgallowscaling))
return 1;
@ -2338,7 +2263,47 @@ int target_parse_option(struct uae_prefs* p, const char* option, const char* val
}
return 1;
}
if (cfgfile_strval(option, value, _T("uaescsimode"), &p->uaescsimode, scsimode, 0)) {
// force SCSIEMU if pre 2.3 configuration
if (p->config_version < ((2 << 16) | (3 << 8)))
p->uaescsimode = UAESCSI_CDEMU;
return 1;
}
if (cfgfile_intval(option, value, _T("active_priority"), &p->active_capture_priority, 1))
{
p->active_nocapture_pause = false;
p->active_nocapture_nosound = false;
return 1;
}
if (cfgfile_yesno(option, value, _T("active_capture_automatically"), &p->capture_always))
return 1;
if (cfgfile_intval(option, value, _T("inactive_priority"), &p->inactive_priority, 1)) {
return 1;
}
if (cfgfile_intval(option, value, _T("minimized_priority"), &p->minimized_priority, 1)) {
return 1;
}
if (cfgfile_yesno(option, value, _T("minimize_inactive"), &p->minimize_inactive))
return 1;
if (cfgfile_yesno(option, value, _T("start_minimized"), &p->start_minimized))
return 1;
if (cfgfile_yesno(option, value, _T("start_not_captured"), &p->start_uncaptured))
return 1;
if (cfgfile_string(option, value, _T("serial_port"), &p->sername[0], 256)) {
if (p->sername[0])
p->use_serial = true;
else
p->use_serial = false;
return 1;
}
return 0;
}
@ -3415,6 +3380,14 @@ const TCHAR** uaenative_get_library_dirs(void)
return nats;
}
bool data_dir_exists(char* directory)
{
if (directory == nullptr) return false;
std::string data_dir = "/data";
std::string check_for = directory + data_dir;
return my_existsdir(check_for.c_str());
}
int main(int argc, char* argv[])
{
struct sigaction action{};
@ -3423,10 +3396,15 @@ int main(int argc, char* argv[])
max_uae_height = 8192;
// Get startup path
auto env_dir = getenv("EXTERNAL_FILES_DIR");
if (env_dir != nullptr)
auto external_files_dir = getenv("EXTERNAL_FILES_DIR");
auto xdg_data_home = getenv("XDG_DATA_HOME");
if (external_files_dir != nullptr && data_dir_exists(external_files_dir))
{
strncpy(start_path_data, getenv("EXTERNAL_FILES_DIR"), MAX_DPATH - 1);
strncpy(start_path_data, external_files_dir, MAX_DPATH - 1);
}
else if (xdg_data_home != nullptr && data_dir_exists(xdg_data_home))
{
strncpy(start_path_data, xdg_data_home, MAX_DPATH -1);
}
else
{
@ -3456,7 +3434,7 @@ int main(int argc, char* argv[])
fix_trailing(savestate_dir);
snprintf(savestate_fname, sizeof savestate_fname, "%s/default.ads", savestate_dir);
logging_init();
#if defined (CPU_arm)
memset(&action, 0, sizeof action);
action.sa_sigaction = signal_segv;
action.sa_flags = SA_SIGINFO;
@ -3488,7 +3466,7 @@ int main(int argc, char* argv[])
printf("Failed to set signal handler (SIGTERM).\n");
abort();
}
#endif
alloc_AmigaMem();
RescanROMs();
uae_time_calibrate();

View file

@ -1168,6 +1168,22 @@ int check_prefs_changed_gfx()
c |= c2;
monitors[i] = true;
}
if (&AMonitors[i].screen_is_picasso) {
struct gfx_filterdata* gfc = &changed_prefs.gf[1];
if (gfc->changed) {
gfc->changed = false;
c |= 16;
}
}
else {
struct gfx_filterdata* gfc1 = &changed_prefs.gf[0];
struct gfx_filterdata* gfc2 = &changed_prefs.gf[2];
if (gfc1->changed || gfc2->changed) {
gfc1->changed = false;
gfc2->changed = false;
c |= 16;
}
}
}
monitors[0] = true;
@ -1185,10 +1201,11 @@ int check_prefs_changed_gfx()
c |= currprefs.gfx_api_options != changed_prefs.gfx_api_options ? (1 | 8 | 32) : 0;
c |= currprefs.lightboost_strobo != changed_prefs.lightboost_strobo ? (2 | 16) : 0;
for (int j = 0; j < 2; j++) {
for (int j = 0; j < MAX_FILTERDATA; j++) {
struct gfx_filterdata* gf = &currprefs.gf[j];
struct gfx_filterdata* gfc = &changed_prefs.gf[j];
c |= gf->gfx_filter != gfc->gfx_filter ? (2 | 8) : 0;
c |= gf->gfx_filter != gfc->gfx_filter ? (2 | 8) : 0;
for (int i = 0; i <= 2 * MAX_FILTERSHADERS; i++) {
@ -1315,7 +1332,7 @@ int check_prefs_changed_gfx()
display_change_requested = 0;
}
for (int j = 0; j < 2; j++) {
for (int j = 0; j < MAX_FILTERDATA; j++) {
struct gfx_filterdata* gf = &currprefs.gf[j];
struct gfx_filterdata* gfc = &changed_prefs.gf[j];
memcpy(gf, gfc, sizeof(struct gfx_filterdata));

View file

@ -698,7 +698,10 @@ void gui_led(int led, int on, int brightness)
temp_fd = open(TEMPERATURE, O_RDONLY);
if (temp_fd < 0)
write_log("TEMPERATURE: Could not open %s for reading\n", TEMPERATURE);
{
write_log("TEMPERATURE: Could not open %s for reading, disabling feature\n", TEMPERATURE);
want_temp = 0;
}
}
ioctl(0, KDGETLED, &kbd_led_status);

View file

@ -562,6 +562,7 @@ void protect_roms(bool protect)
// allowing JIT direct to think it is directly accessible VRAM.
void mman_set_barriers(bool disable)
{
#ifndef AMIBERRY // not implemented yet
addrbank *abprev = NULL;
for (int i = 0; i < MEMORY_BANKS; i++) {
uaecptr addr = i * 0x10000;
@ -579,7 +580,7 @@ void mman_set_barriers(bool disable)
size += 0x10000;
}
abprev = ab;
#ifndef AMIBERRY // not implemented yet
if (ab && ab->baseaddr == NULL && (ab->flags & ABFLAG_ALLOCINDIRECT)) {
DWORD old;
if (disable || !currprefs.cachesize || currprefs.comptrustbyte || currprefs.comptrustword || currprefs.comptrustlong) {
@ -604,8 +605,8 @@ void mman_set_barriers(bool disable)
}
}
}
#endif
}
#endif
}
static int doinit_shm(void)

View file

@ -42,7 +42,7 @@ cda_audio::~cda_audio()
}
}
cda_audio::cda_audio(int num_sectors, int sectorsize, int samplerate, bool internalmode)
cda_audio::cda_audio(int num_sectors, int sectorsize, int samplerate)
{
active = false;
playing = false;
@ -55,9 +55,6 @@ cda_audio::cda_audio(int num_sectors, int sectorsize, int samplerate, bool inter
}
this->num_sectors = num_sectors;
if (internalmode)
return;
auto devname = sound_devices[currprefs.soundcard]->name;
const Uint8 channels = 2;
SDL_AudioSpec cdda_want, cdda_have;

View file

@ -11,14 +11,13 @@ private:
int num_sectors;
int sectorsize;
int volume[2];
bool playing;
bool active;
public:
uae_u8* buffers[2];
cda_audio(int num_sectors, int sectorsize, int samplerate, bool internalmode);
cda_audio(int num_sectors, int sectorsize, int samplerate);
~cda_audio();
void setvolume(int left, int right);
bool play(int bufnum);

View file

@ -654,13 +654,13 @@ void check_input()
break;
case SDL_JOYDEVICEADDED:
case SDL_CONTROLLERDEVICEADDED:
//case SDL_CONTROLLERDEVICEADDED:
case SDL_JOYDEVICEREMOVED:
case SDL_CONTROLLERDEVICEREMOVED:
write_log("SDL Controller/Joystick device added or removed! Re-running import joysticks...\n");
//case SDL_CONTROLLERDEVICEREMOVED:
write_log("GUI: SDL2 Controller/Joystick added or removed, re-running import joysticks...\n");
import_joysticks();
if (inputdevice_devicechange(&currprefs))
{
import_joysticks();
joystick_refresh_needed = true;
RefreshPanelInput();
}

View file

@ -611,12 +611,12 @@ static void setupcursor(void)
#ifdef AMIBERRY
#else
uae_u8* dptr;
uae_u8 *dptr;
int bpp = 4;
int pitch;
struct rtgboardconfig *rbc = &currprefs.rtgboards[0];
if (rbc->rtgmem_type >= GFXBOARD_HARDWARE || !currprefs.gfx_api)
if (rbc->rtgmem_type >= GFXBOARD_HARDWARE || D3D_setcursor == NULL)
return;
gfx_lock ();
setupcursor_needed = 1;
@ -649,8 +649,6 @@ static void disablemouse (void)
cursordeactivate = 0;
if (!hwsprite)
return;
//if (!currprefs.gfx_api)
//return;
#ifdef AMIBERRY
if (p96_cursor)
SDL_FreeCursor(p96_cursor);
@ -664,6 +662,8 @@ static void mouseupdate(struct AmigaMonitor *mon)
struct picasso96_state_struct *state = &picasso96_state[mon->monitor_id];
int x = newcursor_x;
int y = newcursor_y;
float mx = currprefs.gf[1].gfx_filter_horiz_zoom_mult;
float my = currprefs.gf[1].gfx_filter_vert_zoom_mult;
int forced = 0;
if (!hwsprite)
@ -676,16 +676,15 @@ static void mouseupdate(struct AmigaMonitor *mon)
}
}
//if (!currprefs.gfx_api)
//return;
#ifdef AMIBERRY
SDL_WarpMouseInWindow(mon->sdl_window, x, y);
#else
if (currprefs.gf[1].gfx_filter_autoscale == RTG_MODE_CENTER) {
D3D_setcursor(mon->monitor_id, x, y, WIN32GFX_GetWidth(mon), WIN32GFX_GetHeight(mon), cursorvisible, mon->scalepicasso == 2);
} else {
D3D_setcursor(mon->monitor_id, x, y, state->Width, state->Height, cursorvisible, false);
}
if (D3D_setcursor) {
if (currprefs.gf[1].gfx_filter_autoscale == RTG_MODE_CENTER) {
D3D_setcursor(mon->monitor_id, x, y, WIN32GFX_GetWidth(mon), WIN32GFX_GetHeight(mon), mx, my, cursorvisible, mon->scalepicasso == 2);
} else {
D3D_setcursor(mon->monitor_id, x, y, state->Width, state->Height, mx, my, cursorvisible, false);
}
#endif
}
@ -1681,7 +1680,7 @@ STATIC_INLINE void putmousepixel (uae_u8 *d, int bpp, int idx)
#ifdef AMIBERRY
#else
static void putwinmousepixel(HDC andDC, HDC xorDC, int x, int y, int c, uae_u32* ct)
static void putwinmousepixel (HDC andDC, HDC xorDC, int x, int y, int c, uae_u32 *ct)
{
if (c == 0) {
SetPixel (andDC, x, y, RGB (255, 255, 255));
@ -1885,7 +1884,7 @@ int picasso_setwincursor(int monid)
return 1;
}
#else
struct amigadisplay* ad = &adisplays[monid];
struct amigadisplay *ad = &adisplays[monid];
if (wincursor) {
SetCursor(wincursor);
return 1;
@ -2491,7 +2490,7 @@ static void inituaegfx(TrapContext *ctx, uaecptr ABI)
if (0) {
// FIXME: fix hardware sprite via OpenGL?
#else
if (currprefs.gfx_api && D3D_goodenough() > 0 && D3D_setcursor(0, -1, -1, -1, -1, false, false) && USE_HARDWARESPRITE && currprefs.rtg_hardwaresprite) {
if (D3D_setcursor && D3D_setcursor(0, -1, -1, -1, -1, 0, 0, false, false) && USE_HARDWARESPRITE && currprefs.rtg_hardwaresprite) {
#endif
hwsprite = 1;
flags |= BIF_HARDWARESPRITE;
@ -2522,6 +2521,7 @@ static void inituaegfx(TrapContext *ctx, uaecptr ABI)
if (USE_DACSWITCH && currprefs.rtg_dacswitch) {
flags |= BIF_DACSWITCH;
}
trap_put_long(ctx, ABI + PSSO_BoardInfo_Flags, flags);
trap_put_word(ctx, ABI + PSSO_BoardInfo_MaxHorResolution + 0, planar.width);
@ -2870,11 +2870,9 @@ static void init_picasso_screen(int monid)
}
init_picasso_screen_called = 1;
#ifdef AMIBERRY
// printf("FIXME: not calling mman_ResetWatch (p96ram_start + natmem_offset, gfxmem_bank.allocated);\n");
#else
//mman_ResetWatch (gfxmem_bank.start + natmem_offset, gfxmem_bank.allocated_size);
if (ResetWriteWatch(gfxmem_bank.start + regs.natmem_offset, gfxmem_bank.allocated_size))
write_log(_T("ResetWriteWatch() failed, %d\n"), GetLastError());
mman_ResetWatch (gfxmem_bank.start + natmem_offset, gfxmem_bank.allocated_size);
#endif
}
@ -3022,7 +3020,7 @@ static uae_u32 picasso_SetSplitPosition(TrapContext *ctx)
}
#if defined (CPU_AARCH64) || defined (__x86_64__)
static void do_xor8 (uae_u8* p, int w, uae_u32 v)
static void do_xor8(uae_u8 *p, int w, uae_u32 v)
{
while (ALIGN_POINTER_TO32(p) != 7 && w) {
*p ^= v;
@ -3409,7 +3407,7 @@ STATIC_INLINE void PixelWrite(uae_u8 *mem, int bits, uae_u32 fgpen, int Bpp, uae
* always 16 pixels (one word) and the height is calculated as 2^Size. The data must be shifted up
* and to the left by XOffset and YOffset pixels at the beginning.
*/
static uae_u32 REGPARAM2 picasso_BlitPattern (TrapContext *ctx)
static uae_u32 REGPARAM2 picasso_BlitPattern(TrapContext *ctx)
{
uaecptr rinf = trap_get_areg(ctx, 1);
uaecptr pinf = trap_get_areg(ctx, 2);
@ -5447,11 +5445,11 @@ static void picasso_flushpixels(int index, uae_u8 *src, int off, bool render)
dstp = gfx_lock_picasso(monid, false);
}
if (dstp) {
maxy = vidinfo->height;
if (miny > vidinfo->height - TD_TOTAL_HEIGHT)
miny = vidinfo->height - TD_TOTAL_HEIGHT;
picasso_statusline(monid, dstp);
}
maxy = vidinfo->height;
if (miny > vidinfo->height - TD_TOTAL_HEIGHT)
miny = vidinfo->height - TD_TOTAL_HEIGHT;
}
if (maxy >= 0) {
if (doskip () && p96skipmode == 4) {

View file

@ -36,7 +36,7 @@
#endif
#include "uae.h"
#if !defined (__MACH__) && !defined (CPU_AMD64) && !defined (__x86_64__)
#if !defined(__MACH__) && !defined(CPU_AMD64) && !defined(__x86_64__)
#include <asm/sigcontext.h>
#else
#include <sys/ucontext.h>
@ -545,7 +545,7 @@ void signal_buserror(int signum, siginfo_t* info, void* ptr)
exit(1);
}
#else
#elif defined(__arm__)
enum {
ARM_REG_PC = 15,

View file

@ -96,10 +96,6 @@
#define WITH_THREADED_CPU
#define FLOPPYBRIDGE
/* #define CUSTOM_SIMPLE */ /* simplified custom chipset emulation */
/* #define CPUEMU_68000_ONLY */ /* drop 68010+ commands from CPUEMU_0 */
/* #define ADDRESS_SPACE_24BIT */
/* #define WITH_SCSI_IOCTL */
/* #define WITH_SCSI_SPTI */
@ -120,13 +116,7 @@
#include <stdint.h>
#if defined(__x86_64__) || defined(CPU_AARCH64) || defined CPU_AMD64
#define CPU_64_BIT 1
#else
#undef CPU_64_BIT
#endif
#if defined(__x86_64__) || defined(CPU_AARCH64) || defined CPU_AMD64
#if defined(__x86_64__) || defined(CPU_AARCH64) || defined(CPU_AMD64)
#define SIZEOF_VOID_P 8
#else
#define SIZEOF_VOID_P 4
@ -273,7 +263,7 @@ typedef int32_t uae_atomic;
#define SIZEOF_INT 4
/* The number of bytes in a long. */
#if defined(__x86_64__) || defined(CPU_AARCH64) || defined CPU_AMD64
#if defined(__x86_64__) || defined(CPU_AARCH64) || defined(CPU_AMD64)
#define SIZEOF_LONG 8
#else
#define SIZEOF_LONG 4
@ -584,4 +574,4 @@ typedef char TCHAR;
#define _wunlink(x) unlink(x)
#define _istalnum(x) isalnum(x)
#define USE_SDL

View file

@ -134,11 +134,9 @@ extern bool setpaused(int priority);
extern void unsetminimized(int monid);
extern void setminimized(int monid);
extern void setpriority(int prio);
void init_colors(int monid);
#include <vector>
#include <string>
@ -187,19 +185,19 @@ STATIC_INLINE int max(int x, int y)
#if defined(CPU_AARCH64)
STATIC_INLINE void atomic_and(volatile uae_atomic *p, uae_u32 v)
STATIC_INLINE void atomic_and(volatile uae_atomic* p, uae_u32 v)
{
__atomic_and_fetch(p, v, __ATOMIC_SEQ_CST);
}
STATIC_INLINE void atomic_or(volatile uae_atomic *p, uae_u32 v)
STATIC_INLINE void atomic_or(volatile uae_atomic* p, uae_u32 v)
{
__atomic_or_fetch(p, v, __ATOMIC_SEQ_CST);
}
STATIC_INLINE uae_atomic atomic_inc(volatile uae_atomic *p)
STATIC_INLINE uae_atomic atomic_inc(volatile uae_atomic* p)
{
return __atomic_add_fetch(p, 1, __ATOMIC_SEQ_CST);
}
STATIC_INLINE uae_atomic atomic_dec(volatile uae_atomic *p)
STATIC_INLINE uae_atomic atomic_dec(volatile uae_atomic* p)
{
return __atomic_sub_fetch(p, 1, __ATOMIC_SEQ_CST);
}
@ -315,4 +313,3 @@ static inline int uae_deterministic_mode()
// Only returns 1 if using netplay mode (not implemented yet)
return 0;
}

View file

@ -714,6 +714,11 @@ out2:
if (destmode == Areg && sz == sz_byte)
goto nomatch;
#if 0
if (sz == sz_byte && (destmode == Aipi || destmode == Apdi)) {
dstgather = 0;
}
#endif
endofline:
/* now, we have a match */
//if (table68k[opc].mnemo != i_ILLG)
@ -767,6 +772,13 @@ endofline:
table68k[opc].clocks = id.clocks;
table68k[opc].fetchmode = id.fetchmode;
#if 0
for (i = 0; i < 5; i++) {
table68k[opc].flaginfo[i].flagset = id.flaginfo[i].flagset;
table68k[opc].flaginfo[i].flaguse = id.flaginfo[i].flaguse;
}
#endif
// Fix flags used information for Scc, Bcc, TRAPcc, DBcc instructions
if (table68k[opc].mnemo == i_Scc
|| table68k[opc].mnemo == i_Bcc

View file

@ -97,7 +97,7 @@ struct romdata *getromdatabypath (const TCHAR *path)
return NULL;
}
#define NEXT_ROM_ID 298
#define NEXT_ROM_ID 301
#if NEXT_ROM_ID >= MAX_ROMMGR_ROMS
#error Increase MAX_ROMMGR_ROMS!
@ -447,14 +447,18 @@ static struct romdata roms[] = {
{ _T("A4091 v40.13"), 40, 13, 40, 13, _T("A4091\0"), 32768, 58, 0, 0, ROMTYPE_A4091, 0, 0, _T("391592-02"),
0x54cb9e85, 0x3CE66919,0xF6FD6797,0x4923A12D,0x91B730F1,0xFFB4A7BA },
{ _T("SupraDrive AMAB6"), 3, 8, 3, 8, _T("SUPRA\0"), 16384, 121, 0, 0, ROMTYPE_SUPRA, 0, 0, _T("AMAB6"),
0xf40bd349, 0x82168556,0x07525067,0xe9263431,0x1fb9c347,0xe737f247 },
{ _T("SupraDrive AMAB5"), 3, 0, 3, 0, _T("SUPRA\0"), 16384, 134, 0, 0, ROMTYPE_SUPRA, 0, 0, _T("AMAB5"),
0x75e1b343, 0xf15de74b,0x4e2a9c99,0xa6dc4f6c,0x33f64c76,0x8c043d1c },
{ _T("SupraDrive AMAB6"), 3, 8, 3, 8, _T("SUPRA\0"), 8192, 121, 0, 0, ROMTYPE_SUPRA, 0, 0, _T("AMAB6"),
0x7ce693c2, 0x2f220f99,0xf4c61a81,0x915f04cc,0x8464d8d2,0xa15c65bc },
{ _T("SupraDrive AMAB5"), 3, 0, 3, 0, _T("SUPRA\0"), 8192, 134, 0, 0, ROMTYPE_SUPRA, 0, 0, _T("AMAB5"),
0xfac9a231, 0xa52290fb,0x56873c55,0x667c608e,0x8fe330ed,0xdefa1669 },
{ _T("SupraDrive AMAB4"), 0, 0, 0, 0, _T("SUPRA\0"), 8192, 135, 0, 0, ROMTYPE_SUPRA, 0, 0, _T("AMAB4"),
0xde7f3f1c, 0xc0acbfc8,0x6641a6c1,0x024870cc,0x519f8c4c,0xbdfe8c64 },
{ _T("SupraDrive AMAB3"), 0, 0, 0, 0, _T("SUPRA\0"), 8192, 136, 0, 0, ROMTYPE_SUPRA, 0, 0, _T("AMAB3"),
0x3ead39aa, 0x02fe79ee,0xef423098,0xec6add8c,0xb92f849f,0xc64bcd41 },
{ _T("SupraDrive AMAB2"), 0, 0, 0, 0, _T("SUPRA\0"), 8192, 299, 0, 0, ROMTYPE_SUPRA, 0, 0, _T("AMAB2"),
0x297c99f3, 0x8e5e8ea9,0xa203c3ad,0x6dd35e57,0xb1b01f38,0x9b31edda },
{ _T("SupraDrive 2000DMA (44-25B)"), 0, 0, 0, 0, _T("SUPRADMA\0"), 8192, 298, 0, 0, ROMTYPE_SUPRA, 0, 0, _T("44-25B"),
0x0f040976, 0x9faa3201,0xd09e57bf,0xb0e95b45,0x4fff3b90,0xdf219105 },
{ _T("Blizzard 1230-I/II"), 0, 0, 0, 0, _T("B1230MKII\0"), 32768, 163, 0, 0, ROMTYPE_CB_B1230MK2, 0, 0, NULL,
0xf307cd34, 0xd2f0bfe5, 0x6e84e9f2, 0x2dc11583, 0x30702fd7, 0xd59584ee },
@ -741,7 +745,9 @@ static struct romdata roms[] = {
0x9cf8a7b7, 0x3df4667c,0xd3436367,0x7896da65,0x94994769,0x13bc6746, NULL, NULL },
{ _T("M.A.S.T. Fireball"), 0, 0, 0, 0, _T("MASTFB\0"), 8192, 265, 0, 0, ROMTYPE_MASTFB, 0, 0, NULL,
0xb475ff5f, 0x63609553,0x98b06812,0x23ade9ac,0x6ee31364,0x5375fce3, NULL, NULL },
{ _T("Hardital Synthesis"), 0, 0, 0, 0, _T("SYNTHESIS\0"), 32768, 266, 0, 0, ROMTYPE_SYNTHESIS, 0, 0, NULL,
{ _T("Hardital Synthesis v48.5"), 48, 5, 48, 5, _T("SYNTHESIS\0"), 32768, 300, 0, 0, ROMTYPE_SYNTHESIS, 0, 0, NULL,
0x9bd8065a, 0x1e886634,0x44d191eb,0x268ac86a,0x0f9fc99f,0x3e91b9dc, NULL, NULL },
{ _T("Hardital Synthesis v53.1"), 53, 1, 53, 1, _T("SYNTHESIS\0"), 32768, 266, 0, 0, ROMTYPE_SYNTHESIS, 0, 0, NULL,
0x667c7616, 0x0eb1cb38,0x3133f070,0x7cb57944,0xc516f236,0xbad4d4f6, NULL, NULL },
{ _T("Combitec HD20A/HD40A"), 0, 0, 0, 0, _T("HD20A\0"), 32768, 267, 0, 0, ROMTYPE_HD20A, 0, 0, NULL,
0x0e7391b4, 0x7c365adb,0x3496c479,0x5e94a166,0xd834254a,0x6112d91c, NULL, NULL },
@ -1032,7 +1038,7 @@ void romlist_clear (void)
}
/* remove rom entries that need 2 or more roms but not everything required is present */
static void romlist_cleanup (void)
static void romlist_cleanup(void)
{
int i = 0;
while (roms[i].name) {
@ -1042,26 +1048,29 @@ static void romlist_cleanup (void)
int j = i;
int k = i;
while (rd->name && (rd->group >> 16) == grp && grp > 0) {
struct romlist *rl = romlist_getrl (rd);
struct romlist *rl = romlist_getrl(rd);
if (!rl)
ok = 0;
rd++;
j++;
}
if (ok == 0) {
while (i < j) {
struct romlist *rl2 = romlist_getrl (&roms[i]);
while (i < j && roms[i].name) {
struct romlist *rl2 = romlist_getrl(&roms[i]);
if (rl2) {
int cnt = romlist_cnt - (rl2 - rl) - 1;
write_log (_T("%s '%s' removed from romlist\n"), roms[k].name, rl2->path);
xfree (rl2->path);
size_t cnt = romlist_cnt - (rl2 - rl) - 1;
write_log(_T("%s '%s' removed from romlist\n"), roms[k].name, rl2->path);
xfree(rl2->path);
if (cnt > 0)
memmove (rl2, rl2 + 1, cnt * sizeof (struct romlist));
memmove(rl2, rl2 + 1, cnt * sizeof (struct romlist));
romlist_cnt--;
}
i++;
}
}
if (!roms[i].name) {
break;
}
i++;
}
#if 0
@ -1294,22 +1303,22 @@ void addkeyfile (const TCHAR *path)
zfile_fclose (f);
}
void addkeydir (const TCHAR *path)
void addkeydir(const TCHAR *path)
{
TCHAR tmp[MAX_DPATH];
_tcscpy (tmp, path);
if (zfile_exists (tmp)) {
_tcscpy(tmp, path);
if (zfile_exists(tmp)) {
int i;
for (i = _tcslen (tmp) - 1; i > 0; i--) {
for (i = _tcslen(tmp) - 1; i > 0; i--) {
if (tmp[i] == '\\' || tmp[i] == '/')
break;
}
tmp[i] = 0;
}
_tcscat (tmp, _T("/"));
_tcscat (tmp, _T("rom.key"));
addkeyfile (tmp);
_tcscat(tmp, _T("/"));
_tcscat(tmp, _T("rom.key"));
addkeyfile(tmp);
}
int get_keyring (void)
@ -2231,7 +2240,7 @@ struct zfile *read_rom_name_guess (const TCHAR *filename, TCHAR *out)
struct zfile *f;
const TCHAR *name;
for (i = _tcslen (filename) - 1; i >= 0; i--) {
for (i = _tcslen(filename) - 1; i >= 0; i--) {
if (filename[i] == '/' || filename[i] == '\\')
break;
}
@ -2241,13 +2250,13 @@ struct zfile *read_rom_name_guess (const TCHAR *filename, TCHAR *out)
for (i = 0; i < romlist_cnt; i++) {
TCHAR *n = rl[i].path;
for (j = _tcslen (n) - 1; j >= 0; j--) {
for (j = _tcslen(n) - 1; j >= 0; j--) {
if (n[j] == '/' || n[j] == '\\')
break;
}
if (j < 0)
continue;
if (!_tcsicmp (name, n + j)) {
if (!_tcsicmp(name, n + j)) {
struct romdata *rd = rl[i].rd;
f = read_rom (rd);
if (f) {
@ -2294,6 +2303,17 @@ int kickstart_checksum (uae_u8 *mem, int size)
return 1;
}
static void clean_path(TCHAR *s)
{
for (;;) {
size_t v = _tcscspn(s, _T("?:\t\r\n"));
if (s[v] == 0) {
break;
}
memmove(s + v, s + v + 1, (_tcslen(s + v + 1) + 1) * sizeof(TCHAR));
}
}
int configure_rom (struct uae_prefs *p, const int *rom, int msg)
{
struct romdata *rd;
@ -2338,11 +2358,13 @@ int configure_rom (struct uae_prefs *p, const int *rom, int msg)
if (rd->type & (ROMTYPE_ARCADIAGAME | ROMTYPE_ALG)) {
get_nvram_path(p->flashfile, sizeof(p->flashfile) / sizeof(TCHAR));
_stprintf(p->flashfile + _tcslen(p->flashfile), _T("%s.nvr"), rd->name);
clean_path(p->flashfile);
}
#ifndef AMIBERRY
if (rd->type & ROMTYPE_ALG) {
get_video_path(p->genlock_video_file, sizeof(p->genlock_video_file) / sizeof(TCHAR));
_stprintf(p->genlock_video_file + _tcslen(p->genlock_video_file), _T("%s.avi"), rd->name);
clean_path(p->genlock_video_file);
}
#endif
return 1;

View file

@ -12,8 +12,6 @@
#include "custom.h"
#include "sampler.h"
//#include "dxwrap.h"
#include <sounddep/sound.h>
#include <math.h>
@ -139,7 +137,7 @@ static void capture_free (void)
samplebuffer = nullptr;
}
static evt oldcycles;
static evt_t oldcycles;
static int oldoffset;
uae_u8 sampler_getsample (int channel)

View file

@ -264,7 +264,7 @@ TCHAR *restore_string_func (uae_u8 **dstp)
char *top, *to;
TCHAR *s;
len = strlen ((char*)dst) + 1;
len = uaestrlen((char*)dst) + 1;
top = to = xmalloc (char, len);
do {
v = *dst++;
@ -799,8 +799,10 @@ void restore_state (const TCHAR *filename)
#endif
else if (!_tcsncmp (name, _T("EXPB"), 4))
end = restore_expansion_boards(chunk);
//else if (!_tcsncmp (name, _T("DMWP"), 4))
// end = restore_debug_memwatch (chunk);
#ifdef DEBUGGER
else if (!_tcsncmp (name, _T("DMWP"), 4))
end = restore_debug_memwatch (chunk);
#endif
else if (!_tcsncmp(name, _T("PIC0"), 4))
end = chunk + len;
@ -867,7 +869,9 @@ bool savestate_restore_finish(void)
#ifdef ACTION_REPLAY
restore_ar_finish();
#endif
//restore_debug_memwatch_finish ();
#ifdef DEBUGGER
restore_debug_memwatch_finish();
#endif
savestate_state = 0;
init_hz_normal();
audio_activate();
@ -1179,11 +1183,13 @@ static int save_state_internal (struct zfile *f, const TCHAR *description, int c
}
}
//dst = save_debug_memwatch (&len, NULL);
//if (dst) {
// save_chunk (f, dst, len, _T("DMWP"), 0);
// xfree(dst);
//}
#ifdef DEBUGGER
dst = save_debug_memwatch (&len, NULL);
if (dst) {
save_chunk (f, dst, len, _T("DMWP"), 0);
xfree(dst);
}
#endif
//dst = save_screenshot(0, &len);
//if (dst) {

View file

@ -3,7 +3,7 @@
*
* SCSI and SASI emulation (not uaescsi.device)
*
* Copyright 2007-2015 Toni Wilen
* Copyright 2007-2022 Toni Wilen
*
*/
@ -14,7 +14,7 @@
#include "filesys.h"
#include "blkdev.h"
#include "zfile.h"
//#include "debug.h"
#include "debug.h"
#include "memory.h"
#include "scsi.h"
#include "autoconf.h"
@ -3094,8 +3094,10 @@ static uae_u32 ncr80_bget2(struct soft_scsi *ncr, uaecptr addr, int size)
if (ncr->subtype == 4) {
if ((addr & 0xc000) == 0xc000) {
v = read_684xx_dma(ncr, addr);
} else if (addr & 0x8000) {
addresstype = (addr & 1) ? 0 : 1;
} else if ((addr & 0x8001) == 0x8001) {
addresstype = 0;
} else if ((addr & 0x8001) == 0x0000) {
addresstype = 1;
}
} else if (ncr->subtype == 3) {
if ((addr & 0x8000) && !(addr & 1))
@ -3111,7 +3113,7 @@ static uae_u32 ncr80_bget2(struct soft_scsi *ncr, uaecptr addr, int size)
}
if (addresstype == 1) {
v = ncr->rom[addr & 0x7fff];
v = ncr->rom[addr & 0x3fff];
} else if (addresstype == 0) {
reg = supra_reg(ncr, addr, false);
if (reg >= 0)
@ -4372,7 +4374,7 @@ bool supra_init(struct autoconfig_info *aci)
uae_u8 b = ert->subtypes[aci->rc->subtype].autoconfig[i];
ew(scsi, i * 4, b);
}
load_rom_rc(aci->rc, ROMTYPE_SUPRA, 16384, 0, scsi->rom, 32768, LOADROM_EVENONLY_ODDONE | LOADROM_FILL);
load_rom_rc(aci->rc, ROMTYPE_SUPRA, 8192, 0, scsi->rom, 16384, LOADROM_EVENONLY_ODDONE);
}
aci->addrbank = scsi->bank;
return true;

View file

@ -75,4 +75,4 @@ void uae_set_thread_priority(uae_thread_id* id, int pri)
SDL_threadID uae_thread_get_id()
{
return SDL_GetThreadID(nullptr);
}
}

View file

@ -13,6 +13,8 @@
#include "sysconfig.h"
#include "sysdeps.h"
#define NEW_TRAP_DEBUG 0
#include "options.h"
#include "memory.h"
#include "custom.h"
@ -21,7 +23,7 @@
#include "autoconf.h"
#include "traps.h"
#include "uae.h"
//#include "debug.h"
#include "debug.h"
/*
* Traps are the mechanism via which 68k code can call emulator code
@ -305,10 +307,11 @@ static int trap_thread (void *arg)
/* Good bye, cruel world... */
/* dummy return value */
/* dummy return value */
return 0;
}
/*
* Set up extended trap context and call handler function
*/
@ -339,6 +342,10 @@ static void trap_HandleExtendedTrap(TrapHandler handler_func, int has_retval)
* It'll do this when the trap handler is done - or when
* the handler wants to call 68k code. */
uae_sem_wait(&context->switch_to_emu_sem);
if (trace_traps) {
write_log(_T("Exit extended trap PC=%08x\n"), m68k_getpc());
}
}
}
@ -375,6 +382,10 @@ static uae_u32 trap_Call68k(TrapContext *ctx, uaecptr func_addr)
m68k_setpc(m68k_call_trapaddr);
fill_prefetch();
if (trace_traps) {
write_log(_T("Calling m68k PC=%08x %08x\n"), func_addr, m68k_call_trapaddr);
}
/* Switch to emulator context. */
uae_sem_post(&ctx->switch_to_emu_sem);
@ -435,6 +446,11 @@ static uae_u32 REGPARAM2 m68k_return_handler(TrapContext *dummy_ctx)
TrapContext *context;
uae_u32 sp;
if (trace_traps) {
write_log(_T("m68k_return_handler\n"));
}
/* One trap returning at a time, please! */
uae_sem_wait(&trap_mutex);
@ -468,6 +484,10 @@ static uae_u32 REGPARAM2 exit_trap_handler(TrapContext *dummy_ctx)
{
TrapContext *context = current_context;
if (trace_traps) {
write_log(_T("exit_trap_handler waiting PC=%08x\n"), context->saved_regs.pc);
}
/* Wait for trap context thread to exit. */
uae_wait_thread(&context->thread);
@ -804,10 +824,10 @@ void init_traps(void)
{
trap_count = 0;
if (!trap_thread_id[0] && trap_is_indirect()) {
for (int i = 0; i < TRAP_THREADS; i++) {
for (size_t i = 0; i < TRAP_THREADS; i++) {
init_comm_pipe(&trap_thread_pipe[i], 100, 1);
hardware_trap_kill[i] = 1;
uae_start_thread_fast(hardware_trap_thread, (void*)(intptr_t)i, &trap_thread_id[i]);
uae_start_thread_fast(hardware_trap_thread, (void *)i, &trap_thread_id[i]);
}
}
}
@ -844,9 +864,11 @@ void init_extended_traps (void)
exit_trap_trapaddr = here();
calltrap (deftrap2 (exit_trap_handler, TRAPFLAG_NO_RETVAL, _T("exit_trap")));
#ifdef AMIBERRY
if(trap_mutex != 0)
uae_sem_destroy(&trap_mutex);
trap_mutex = 0;
#endif
uae_sem_init (&trap_mutex, 0, 1);
}

View file

@ -23,7 +23,7 @@
#include "autoconf.h"
#include "traps.h"
#include "disk.h"
//#include "debug.h"
#include "debug.h"
#include "gensound.h"
#include "picasso96.h"
#include "filesys.h"

View file

@ -83,6 +83,9 @@ int log_uaeserial = 0;
#define io_SerFlags 0x4f /* UBYTE see SerFlags bit definitions below */
#define io_Status 0x50 /* UWORD */
#define SEXTF_MSPON 2
#define SEXTF_MARK 1
#define IOExtSerSize 82
/* status of serial port, as follows:
@ -448,15 +451,13 @@ void uaeser_signal(void* vdev, int sigmask)
io_actual += size;
io_data += size;
io_length -= size;
}
else if (status == 0) {
} else if (status == 0) {
if (io_actual == 0)
io_done = 0;
break;
}
}
}
else if (sigmask & 4) {
} else if (sigmask & 4) {
io_done = 1;
io_error = SerErr_DetectedBreak;
}
@ -503,8 +504,9 @@ void uaeser_signal(void* vdev, int sigmask)
static void cmd_reset(TrapContext* ctx, struct devstruct* dev, uae_u8* req)
{
while (dev->ar)
while (dev->ar) {
abort_async(ctx, dev, dev->ar->arequest);
}
put_long_host(req + io_RBufLen, 8192);
put_long_host(req + io_ExtFlags, 0);
put_long_host(req + io_Baud, 57600);
@ -554,8 +556,7 @@ static int dev_do_io(TrapContext* ctx, struct devstruct* dev, uae_u8* request, u
case SDCMD_BREAK:
if (get_byte_host(request + io_SerFlags) & SERF_QUEUEDBRK) {
async = 1;
}
else {
} else {
uaeser_break(dev->sysdata, get_long_host(request + io_BrkTime));
}
break;
@ -614,8 +615,7 @@ static uae_u32 REGPARAM2 dev_beginio(TrapContext* ctx)
if (dev_do_io(ctx, dev, request, arequest, 1))
write_log(_T("device %s:%d command %d bug with IO_QUICK\n"), getdevname(), dev->unit, command);
err = get_byte_host(request + 31);
}
else {
} else {
put_byte_host(request + 30, get_byte_host(request + 30) & ~1);
trap_put_bytes(ctx, request + 8, arequest + 8, IOExtSerSize - 8);
uae_sem_wait(&pipe_sem);
@ -650,15 +650,12 @@ static int dev_thread(void* devs)
uae_sem_post(&dev->sync_sem);
uae_sem_post(&change_sem);
return 0;
}
else if (get_async_request(dev, request, 1)) {
} else if (get_async_request(dev, request, 1)) {
uae_ReplyMsg(request);
release_async_request(dev, request);
}
else if (dev_do_io(ctx, dev, iobuf, request, 0) == 0) {
} else if (dev_do_io(ctx, dev, iobuf, request, 0) == 0) {
uae_ReplyMsg(request);
}
else {
} else {
add_async_request(dev, iobuf, request);
uaeser_trigger(dev->sysdata);
}
@ -722,8 +719,7 @@ uaecptr uaeserialdev_startup(TrapContext* ctx, uaecptr resaddr)
trap_put_long(ctx, resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */
if (kickstart_version >= 37) {
trap_put_long(ctx, resaddr + 0xA, 0x84010300 | AFTERDOS_PRI); /* RTF_AUTOINIT, RT_VERSION NT_LIBRARY, RT_PRI */
}
else {
} else {
trap_put_long(ctx, resaddr + 0xA, 0x81010305); /* RTF_AUTOINIT, RT_VERSION NT_LIBRARY, RT_PRI */
}
trap_put_long(ctx, resaddr + 0xE, ROM_uaeserialdev_resname);

View file

@ -132,52 +132,6 @@ int uae_vm_page_size(void)
return page_size;
}
static void *try_alloc_32bit(uae_u32 size, int native_flags, int native_protect,
uae_u8 *p, uae_u8 *p_end)
{
if (p_end <= p) {
return NULL;
}
if ((uintptr_t) p % uae_vm_page_size() != 0) {
/* Round up to the nearest page size */
p += uae_vm_page_size() - (uintptr_t) p % uae_vm_page_size();
}
void *address = NULL;
int step = uae_vm_page_size();
if (size > 1024 * 1024) {
/* Reserve some space for smaller allocations */
p += 32 * 1024 * 1024;
step = 1024 * 1024;
}
#ifdef HAVE_MAP_32BIT
address = mmap(0, size, native_protect, native_flags | MAP_32BIT, -1, 0);
if (address == MAP_FAILED) {
address = NULL;
}
#endif
while (address == NULL) {
if (p > p_end) {
break;
}
#ifdef _WIN32
address = VirtualAlloc(p, size, native_flags, native_protect);
#else
address = mmap(p, size, native_protect, native_flags, -1, 0);
#ifdef LOG_ALLOCATIONS
write_log("VM: trying %p step is 0x%x = %p\n", p, step, address);
#endif
if (address == MAP_FAILED) {
address = NULL;
} else if (((uintptr_t) address) + size > (uintptr_t) 0xffffffff) {
munmap(address, size);
address = NULL;
}
#endif
p += step;
}
return address;
}
static void *uae_vm_alloc_with_flags(uae_u32 size, int flags, int protect)
{
void *address = NULL;
@ -193,14 +147,14 @@ static void *uae_vm_alloc_with_flags(uae_u32 size, int flags, int protect)
#endif
#ifdef _WIN32
int native_flags = MEM_COMMIT | MEM_RESERVE;
int va_type = MEM_COMMIT | MEM_RESERVE;
if (flags & UAE_VM_WRITE_WATCH) {
native_flags |= MEM_WRITE_WATCH;
va_type |= MEM_WRITE_WATCH;
}
int native_protect = protect_to_native(protect);
int va_protect = protect_to_native(protect);
#else
int native_flags = MAP_PRIVATE | MAP_ANON;
int native_protect = protect_to_native(protect);
int mmap_flags = MAP_PRIVATE | MAP_ANON;
int mmap_prot = protect_to_native(protect);
#endif
#if defined(__x86_64__) || defined(CPU_AARCH64) || defined CPU_AMD64
@ -209,32 +163,43 @@ static void *uae_vm_alloc_with_flags(uae_u32 size, int flags, int protect)
if (flags & UAE_VM_32BIT) {
/* Stupid algorithm to find available space, but should
* work well enough when there is not a lot of allocations. */
/* FIXME: Consider allocating a bigger chunk of memory, and manually
* keep track of allocations. */
if (!address) {
address = try_alloc_32bit(
size, native_flags, native_protect,
(uae_u8 *) 0x40000000, natmem_reserved - size);
int step = uae_vm_page_size();
uae_u8 *p = (uae_u8 *) 0x40000000;
uae_u8 *p_end = natmem_reserved - size;
if (size > 1024 * 1024) {
/* Reserve some space for smaller allocations */
p += 32 * 1024 * 1024;
step = 1024 * 1024;
}
if (!address && natmem_reserved < (uae_u8 *) 0x60000000) {
address = try_alloc_32bit(
size, native_flags, native_protect,
(uae_u8 *) natmem_reserved + natmem_reserved_size,
(uae_u8 *) 0xffffffff - size + 1);
#ifdef HAVE_MAP_32BIT
address = mmap(0, size, mmap_prot, mmap_flags | MAP_32BIT, -1, 0);
if (address == MAP_FAILED) {
address = NULL;
}
if (!address) {
address = try_alloc_32bit(
size, native_flags, native_protect,
(uae_u8 *) 0x20000000,
min((uae_u8 *) 0x40000000, natmem_reserved - size));
#endif
while (address == NULL) {
if (p > p_end) {
break;
}
#ifdef _WIN32
address = VirtualAlloc(p, size, va_type, va_protect);
#else
address = mmap(p, size, mmap_prot, mmap_flags, -1, 0);
// write_log("VM: trying %p step is 0x%x = %p\n", p, step, address);
if (address == MAP_FAILED) {
address = NULL;
} else if (((uintptr_t) address) + size > (uintptr_t) 0xffffffff) {
munmap(address, size);
address = NULL;
}
#endif
p += step;
}
} else {
#ifdef _WIN32
address = VirtualAlloc(NULL, size, native_flags, native_protect);
address = VirtualAlloc(NULL, size, va_type, va_protect);
#else
address = mmap(0, size, native_protect, native_flags, -1, 0);
address = mmap(0, size, mmap_prot, mmap_flags, -1, 0);
if (address == MAP_FAILED) {
address = NULL;
}
@ -375,7 +340,7 @@ void *uae_vm_reserve(uae_u32 size, int flags)
#else
if (true) {
#endif
uintptr_t try_addr = 0xffffffff - size + 1;
uintptr_t try_addr = 0x80000000;
while (address == NULL) {
address = try_reserve(try_addr, size, flags);
if (address == NULL) {

View file

@ -2094,11 +2094,13 @@ struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, const uae_u8 *d
return NULL;
}
l = zfile_create (NULL, name);
l->name = my_strdup (name ? name : _T(""));
l->data = xmalloc (uae_u8, (size_t)size);
l->size = size;
l->datasize = size;
memcpy (l->data, data, (size_t)size);
if (l) {
l->name = my_strdup(name ? name : _T(""));
l->data = xmalloc(uae_u8, (size_t)size);
l->size = size;
l->datasize = size;
memcpy(l->data, data, (size_t)size);
}
return l;
}
@ -2234,6 +2236,15 @@ uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode)
return 1;
}
uae_s32 zfile_fread32(void *b, size_t l1, size_t l2, struct zfile *z)
{
size_t s = zfile_fread(b, l1, l2, z);
if (s >= (1 << 31)) {
return 0;
}
return (int)s;
}
size_t zfile_fread(void *b, size_t l1, size_t l2, struct zfile *z)
{
if (z->zfileread)
@ -2370,9 +2381,9 @@ TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z)
p++;
}
*p = 0;
if (size > strlen (s2) + 1)
size = strlen (s2) + 1;
au_copy (s, size, s2);
if (size > uaestrlen(s2) + 1)
size = uaestrlen(s2) + 1;
au_copy(s, size, s2);
return s + size;
} else {
bool alloc = false;
@ -2393,9 +2404,9 @@ TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z)
}
return NULL;
}
if (size > strlen (s2) + 1)
size = strlen (s2) + 1;
au_copy (s, size, s2);
if (size > uaestrlen(s2) + 1)
size = uaestrlen(s2) + 1;
au_copy(s, size, s2);
if (alloc) {
xfree(s2);
}

View file

@ -1177,7 +1177,7 @@ struct zvolume *archive_directory_plain (struct zfile *z)
char *an = ua (zai.name);
char *data = xmalloc (char, 1 + strlen (an) + 1 + 1 + 1);
sprintf (data, "\"%s\"\n", an);
zn = addfile (zv, z, _T("s/startup-sequence"), (uae_u8*)data, strlen (data));
zn = addfile (zv, z, _T("s/startup-sequence"), (uae_u8*)data, uaestrlen (data));
xfree (data);
xfree (an);
}