mirror of
https://github.com/libretro/fbalpha2012_neogeo.git
synced 2024-11-27 02:30:30 +00:00
Cleanups
This commit is contained in:
parent
dc973ec25c
commit
1bdb32ba0c
@ -44,7 +44,7 @@ GRIFFIN_DIR = griffin-libretro
|
||||
|
||||
# TARGET
|
||||
TARGET_NAME := fbalpha2012_neogeo
|
||||
FBA_DEFINES += -DTARGET=\"\ Neo\ Geo\" -DNEOGEO_ONLY
|
||||
FBA_DEFINES += -DTARGET=\"\ Neo\ Geo\"
|
||||
|
||||
SPACE :=
|
||||
SPACE := $(SPACE) $(SPACE)
|
||||
|
@ -101,21 +101,4 @@
|
||||
|
||||
#define BIT(x,n) (((x)>>(n))&1)
|
||||
|
||||
/* ----- macros for accessing bytes and words within larger chunks ----- */
|
||||
#ifdef MSB_FIRST
|
||||
#define BYTE_XOR_BE(a) (a)
|
||||
#define BYTE_XOR_LE(a) ((a) ^ 1) /* read/write a byte to a 16-bit space */
|
||||
#define BYTE4_XOR_BE(a) (a)
|
||||
#define BYTE4_XOR_LE(a) ((a) ^ 3) /* read/write a byte to a 32-bit space */
|
||||
#define WORD_XOR_BE(a) (a)
|
||||
#define WORD_XOR_LE(a) ((a) ^ 2) /* read/write a word to a 32-bit space */
|
||||
#else
|
||||
#define BYTE_XOR_BE(a) ((a) ^ 1) /* read/write a byte to a 16-bit space */
|
||||
#define BYTE_XOR_LE(a) (a)
|
||||
#define BYTE4_XOR_BE(a) ((a) ^ 3) /* read/write a byte to a 32-bit space */
|
||||
#define BYTE4_XOR_LE(a) (a)
|
||||
#define WORD_XOR_BE(a) ((a) ^ 2) /* read/write a word to a 32-bit space */
|
||||
#define WORD_XOR_LE(a) (a)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -19,7 +19,6 @@ bool bBurnUseASMCPUEmulation = false;
|
||||
|
||||
UINT32 nCurrentFrame; // Framecount for emulated game
|
||||
|
||||
bool bForce60Hz = false;
|
||||
INT32 nBurnFPS = 6000;
|
||||
INT32 nBurnCPUSpeedAdjust = 0x0100; // CPU speed adjustment (clock * nBurnCPUSpeedAdjust / 0x0100)
|
||||
|
||||
@ -119,7 +118,6 @@ INT32 BurnGetZipName(char** pszName, UINT32 i)
|
||||
// ----------------------------------------------------------------------------
|
||||
// Static functions which forward to each driver's data and functions
|
||||
|
||||
INT32 BurnStateMAMEScan(INT32 nAction, INT32* pnMin);
|
||||
void BurnStateExit();
|
||||
INT32 BurnStateInit();
|
||||
|
||||
@ -539,45 +537,8 @@ extern "C" INT32 BurnDrvInit()
|
||||
{
|
||||
INT32 nReturnValue;
|
||||
|
||||
if (nBurnDrvActive >= nBurnDrvCount) {
|
||||
if (nBurnDrvActive >= nBurnDrvCount)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined (FBA_DEBUG)
|
||||
{
|
||||
TCHAR szText[1024] = _T("");
|
||||
TCHAR* pszPosition = szText;
|
||||
TCHAR* pszName = BurnDrvGetText(DRV_FULLNAME);
|
||||
INT32 nName = 1;
|
||||
|
||||
while ((pszName = BurnDrvGetText(DRV_NEXTNAME | DRV_FULLNAME)) != NULL) {
|
||||
nName++;
|
||||
}
|
||||
|
||||
// Print the title
|
||||
|
||||
bprintf(PRINT_IMPORTANT, _T("*** Starting emulation of %s - %s.\n"), BurnDrvGetText(DRV_NAME), BurnDrvGetText(DRV_FULLNAME));
|
||||
|
||||
// Then print the alternative titles
|
||||
|
||||
if (nName > 1) {
|
||||
bprintf(PRINT_IMPORTANT, _T(" Alternative %s "), (nName > 2) ? _T("titles are") : _T("title is"));
|
||||
pszName = BurnDrvGetText(DRV_FULLNAME);
|
||||
nName = 1;
|
||||
while ((pszName = BurnDrvGetText(DRV_NEXTNAME | DRV_FULLNAME)) != NULL) {
|
||||
if (pszPosition + _tcslen(pszName) - 1022 > szText) {
|
||||
break;
|
||||
}
|
||||
if (nName > 1) {
|
||||
bprintf(PRINT_IMPORTANT, _T(SEPERATOR_1));
|
||||
}
|
||||
bprintf(PRINT_IMPORTANT, _T("%s"), pszName);
|
||||
nName++;
|
||||
}
|
||||
bprintf(PRINT_IMPORTANT, _T(".\n"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
BurnSetRefreshRate(60.0);
|
||||
|
||||
@ -604,10 +565,6 @@ extern "C" INT32 BurnDrvExit()
|
||||
INT32 nRet = pDriver[nBurnDrvActive]->Exit(); // Forward to drivers function
|
||||
|
||||
BurnExitMemoryManager();
|
||||
#if defined FBA_DEBUG
|
||||
DebugTrackerExit();
|
||||
#endif
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
@ -615,31 +572,22 @@ INT32 (__cdecl* BurnExtCartridgeSetupCallback)(BurnCartrigeCommand nCommand) = N
|
||||
|
||||
INT32 BurnDrvCartridgeSetup(BurnCartrigeCommand nCommand)
|
||||
{
|
||||
if (nBurnDrvActive >= nBurnDrvCount || BurnExtCartridgeSetupCallback == NULL) {
|
||||
if (nBurnDrvActive >= nBurnDrvCount || BurnExtCartridgeSetupCallback == NULL)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (nCommand == CART_EXIT) {
|
||||
if (nCommand == CART_EXIT)
|
||||
return pDriver[nBurnDrvActive]->Exit();
|
||||
}
|
||||
|
||||
if (nCommand != CART_INIT_END && nCommand != CART_INIT_START) {
|
||||
if (nCommand != CART_INIT_END && nCommand != CART_INIT_START)
|
||||
return 1;
|
||||
}
|
||||
|
||||
BurnExtCartridgeSetupCallback(CART_INIT_END);
|
||||
|
||||
#if defined FBA_DEBUG
|
||||
bprintf(PRINT_NORMAL, _T(" * Loading"));
|
||||
#endif
|
||||
|
||||
if (BurnExtCartridgeSetupCallback(CART_INIT_START)) {
|
||||
if (BurnExtCartridgeSetupCallback(CART_INIT_START))
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (nCommand == CART_INIT_START) {
|
||||
if (nCommand == CART_INIT_START)
|
||||
return pDriver[nBurnDrvActive]->Init();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -690,10 +638,7 @@ INT32 BurnUpdateProgress(double fProgress, const TCHAR* pszText, bool bAbs)
|
||||
|
||||
INT32 BurnSetRefreshRate(double dFrameRate)
|
||||
{
|
||||
if (!bForce60Hz) {
|
||||
nBurnFPS = (INT32)(100.0 * dFrameRate);
|
||||
}
|
||||
|
||||
nBurnFPS = (INT32)(100.0 * dFrameRate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -724,48 +669,10 @@ UINT32 (__cdecl *BurnHighCol) (INT32 r, INT32 g, INT32 b, INT32 i) = BurnHighCol
|
||||
static INT32 __cdecl DefAcb (struct BurnArea* /* pba */) { return 1; }
|
||||
INT32 (__cdecl *BurnAcb) (struct BurnArea* pba) = DefAcb;
|
||||
|
||||
// Scan driver data
|
||||
INT32 BurnAreaScan(INT32 nAction, INT32* pnMin)
|
||||
{
|
||||
INT32 nRet = 0;
|
||||
|
||||
// Handle any MAME-style variables
|
||||
if (nAction & ACB_DRIVER_DATA) {
|
||||
nRet = BurnStateMAMEScan(nAction, pnMin);
|
||||
}
|
||||
|
||||
// Forward to the driver
|
||||
if (pDriver[nBurnDrvActive]->AreaScan) {
|
||||
nRet |= pDriver[nBurnDrvActive]->AreaScan(nAction, pnMin);
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Wrappers for MAME-specific function calls
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Wrapper for MAME logerror calls
|
||||
|
||||
#if defined (FBA_DEBUG) && defined (MAME_USE_LOGERROR)
|
||||
void logerror(char* szFormat, ...)
|
||||
{
|
||||
static char szLogMessage[1024];
|
||||
|
||||
va_list vaFormat;
|
||||
va_start(vaFormat, szFormat);
|
||||
|
||||
_vsnprintf(szLogMessage, 1024, szFormat, vaFormat);
|
||||
|
||||
va_end(vaFormat);
|
||||
|
||||
bprintf(PRINT_ERROR, _T("%hs"), szLogMessage);
|
||||
}
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Wrapper for MAME state_save_register_* calls
|
||||
|
||||
@ -775,21 +682,68 @@ static BurnStateEntry* pStateEntryAnchor = NULL;
|
||||
typedef void (*BurnPostloadFunction)();
|
||||
static BurnPostloadFunction BurnPostload[8];
|
||||
|
||||
static INT32 BurnStateMAMEScan(INT32 nAction, INT32* pnMin)
|
||||
{
|
||||
if (nAction & ACB_VOLATILE)
|
||||
{
|
||||
if (pnMin && *pnMin < 0x029418) // Return minimum compatible version
|
||||
*pnMin = 0x029418;
|
||||
|
||||
if (pStateEntryAnchor)
|
||||
{
|
||||
struct BurnArea ba;
|
||||
BurnStateEntry* pCurrentEntry = pStateEntryAnchor;
|
||||
|
||||
do {
|
||||
ba.Data = pCurrentEntry->pValue;
|
||||
ba.nLen = pCurrentEntry->nSize;
|
||||
ba.nAddress = 0;
|
||||
ba.szName = pCurrentEntry->szName;
|
||||
BurnAcb(&ba);
|
||||
|
||||
} while ((pCurrentEntry = pCurrentEntry->pNext) != 0);
|
||||
}
|
||||
|
||||
if (nAction & ACB_WRITE)
|
||||
{
|
||||
for (INT32 i = 0; i < 8; i++)
|
||||
{
|
||||
if (BurnPostload[i])
|
||||
BurnPostload[i]();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Scan driver data
|
||||
INT32 BurnAreaScan(INT32 nAction, INT32* pnMin)
|
||||
{
|
||||
INT32 nRet = 0;
|
||||
// Handle any MAME-style variables
|
||||
if (nAction & ACB_DRIVER_DATA)
|
||||
nRet = BurnStateMAMEScan(nAction, pnMin);
|
||||
// Forward to the driver
|
||||
if (pDriver[nBurnDrvActive]->AreaScan)
|
||||
nRet |= pDriver[nBurnDrvActive]->AreaScan(nAction, pnMin);
|
||||
return nRet;
|
||||
}
|
||||
|
||||
static void BurnStateRegister(const char* module, INT32 instance, const char* name, void* val, UINT32 size)
|
||||
{
|
||||
// Allocate new node
|
||||
BurnStateEntry* pNewEntry = (BurnStateEntry*)malloc(sizeof(BurnStateEntry));
|
||||
if (pNewEntry == NULL) {
|
||||
if (pNewEntry == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
memset(pNewEntry, 0, sizeof(BurnStateEntry));
|
||||
|
||||
// Link the new node
|
||||
pNewEntry->pNext = pStateEntryAnchor;
|
||||
if (pStateEntryAnchor) {
|
||||
if (pStateEntryAnchor)
|
||||
pStateEntryAnchor->pPrev = pNewEntry;
|
||||
}
|
||||
pStateEntryAnchor = pNewEntry;
|
||||
|
||||
sprintf(pNewEntry->szName, "%s:%s %i", module, name, instance);
|
||||
@ -798,74 +752,41 @@ static void BurnStateRegister(const char* module, INT32 instance, const char* na
|
||||
pNewEntry->nSize = size;
|
||||
}
|
||||
|
||||
void BurnStateExit()
|
||||
void BurnStateExit(void)
|
||||
{
|
||||
if (pStateEntryAnchor) {
|
||||
BurnStateEntry* pCurrentEntry = pStateEntryAnchor;
|
||||
BurnStateEntry* pNextEntry;
|
||||
if (pStateEntryAnchor)
|
||||
{
|
||||
BurnStateEntry* pCurrentEntry = pStateEntryAnchor;
|
||||
BurnStateEntry* pNextEntry;
|
||||
|
||||
do {
|
||||
pNextEntry = pCurrentEntry->pNext;
|
||||
if (pCurrentEntry) {
|
||||
free(pCurrentEntry);
|
||||
}
|
||||
} while ((pCurrentEntry = pNextEntry) != 0);
|
||||
}
|
||||
do {
|
||||
pNextEntry = pCurrentEntry->pNext;
|
||||
if (pCurrentEntry)
|
||||
free(pCurrentEntry);
|
||||
} while ((pCurrentEntry = pNextEntry) != 0);
|
||||
}
|
||||
|
||||
pStateEntryAnchor = NULL;
|
||||
|
||||
for (INT32 i = 0; i < 8; i++) {
|
||||
for (INT32 i = 0; i < 8; i++)
|
||||
BurnPostload[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
INT32 BurnStateInit()
|
||||
INT32 BurnStateInit(void)
|
||||
{
|
||||
BurnStateExit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT32 BurnStateMAMEScan(INT32 nAction, INT32* pnMin)
|
||||
{
|
||||
if (nAction & ACB_VOLATILE) {
|
||||
|
||||
if (pnMin && *pnMin < 0x029418) { // Return minimum compatible version
|
||||
*pnMin = 0x029418;
|
||||
}
|
||||
|
||||
if (pStateEntryAnchor) {
|
||||
struct BurnArea ba;
|
||||
BurnStateEntry* pCurrentEntry = pStateEntryAnchor;
|
||||
|
||||
do {
|
||||
ba.Data = pCurrentEntry->pValue;
|
||||
ba.nLen = pCurrentEntry->nSize;
|
||||
ba.nAddress = 0;
|
||||
ba.szName = pCurrentEntry->szName;
|
||||
BurnAcb(&ba);
|
||||
|
||||
} while ((pCurrentEntry = pCurrentEntry->pNext) != 0);
|
||||
}
|
||||
|
||||
if (nAction & ACB_WRITE) {
|
||||
for (INT32 i = 0; i < 8; i++) {
|
||||
if (BurnPostload[i]) {
|
||||
BurnPostload[i]();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// wrapper functions
|
||||
|
||||
extern "C" void state_save_register_func_postload(void (*pFunction)())
|
||||
{
|
||||
for (INT32 i = 0; i < 8; i++) {
|
||||
if (BurnPostload[i] == NULL) {
|
||||
for (INT32 i = 0; i < 8; i++)
|
||||
{
|
||||
if (BurnPostload[i] == NULL)
|
||||
{
|
||||
BurnPostload[i] = pFunction;
|
||||
break;
|
||||
}
|
||||
|
@ -26,47 +26,6 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
extern TCHAR szAppSamplesPath[MAX_PATH];
|
||||
|
||||
// Enable the MAME logerror() function in debug builds
|
||||
// #define MAME_USE_LOGERROR
|
||||
|
||||
// Give access to the CPUID function for various compilers
|
||||
#if defined (__GNUC__)
|
||||
#define CPUID(f,ra,rb,rc,rd) __asm__ __volatile__ ("cpuid" \
|
||||
: "=a" (ra), "=b" (rb), "=c" (rc), "=d" (rd) \
|
||||
: "a" (f) \
|
||||
);
|
||||
#elif defined (_MSC_VER)
|
||||
#define CPUID(f,ra,rb,rc,rd) __asm { __asm mov eax, f \
|
||||
__asm cpuid \
|
||||
__asm mov ra, eax \
|
||||
__asm mov rb, ebx \
|
||||
__asm mov rc, ecx \
|
||||
__asm mov rd, edx }
|
||||
#else
|
||||
#define CPUID(f,ra,rb,rc,rd)
|
||||
#endif
|
||||
|
||||
#ifndef BUILD_X86_ASM
|
||||
#undef CPUID
|
||||
#define CPUID(f,ra,rb,rc,rd)
|
||||
#endif
|
||||
|
||||
#ifdef _UNICODE
|
||||
#define SEPERATOR_1 " \u2022 "
|
||||
#define SEPERATOR_2 " \u25E6 "
|
||||
#else
|
||||
#define SEPERATOR_1 " ~ "
|
||||
#define SEPERATOR_2 " ~ "
|
||||
#endif
|
||||
|
||||
#ifdef _UNICODE
|
||||
#define WRITE_UNICODE_BOM(file) { UINT16 BOM[] = { 0xFEFF }; fwrite(BOM, 2, 1, file); }
|
||||
#else
|
||||
#define WRITE_UNICODE_BOM(file)
|
||||
#endif
|
||||
|
||||
typedef unsigned char UINT8;
|
||||
typedef signed char INT8;
|
||||
typedef unsigned short UINT16;
|
||||
@ -175,8 +134,6 @@ struct BurnDIPInfo {
|
||||
|
||||
extern bool bBurnUseASMCPUEmulation;
|
||||
|
||||
extern bool bForce60Hz;
|
||||
|
||||
extern INT32 nBurnFPS;
|
||||
extern INT32 nBurnCPUSpeedAdjust;
|
||||
|
||||
@ -206,10 +163,6 @@ extern INT32 nFMInterpolation; // Desired interpolation level for FM sound
|
||||
#define PRINT_IMPORTANT (2)
|
||||
#define PRINT_ERROR (3)
|
||||
|
||||
#ifndef bprintf
|
||||
extern INT32 (__cdecl *bprintf) (INT32 nStatus, TCHAR* szFormat, ...);
|
||||
#endif
|
||||
|
||||
INT32 BurnLibInit();
|
||||
INT32 BurnLibExit();
|
||||
|
||||
@ -267,9 +220,6 @@ INT32 BurnDrvGetFamilyFlags();
|
||||
INT32 BurnDrvGetSampleInfo(struct BurnSampleInfo *pri, UINT32 i);
|
||||
INT32 BurnDrvGetSampleName(char** pszName, UINT32 i, INT32 nAka);
|
||||
|
||||
extern bool bDoIpsPatch;
|
||||
void IpsApplyPatches(UINT8* base, char* rom_name);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Flags used with the Burndriver structure
|
||||
|
||||
|
@ -50,10 +50,16 @@ static INT32 eeprom_command_match(const char *buf, const char *cmd, INT32 len)
|
||||
{
|
||||
case '0':
|
||||
case '1':
|
||||
if (b == c) { cmd++; }
|
||||
else { buf++; len--; }
|
||||
if (b == c)
|
||||
cmd++;
|
||||
else
|
||||
{
|
||||
buf++;
|
||||
len--;
|
||||
}
|
||||
break;
|
||||
default: return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -67,67 +73,57 @@ INT32 EEPROMAvailable(void)
|
||||
|
||||
void EEPROMInit(const eeprom_interface *interface)
|
||||
{
|
||||
intf = interface;
|
||||
|
||||
if ((1 << intf->address_bits) * intf->data_bits / 8 > MEMORY_SIZE)
|
||||
{
|
||||
bprintf(0, _T("EEPROM larger than eeprom allows"));
|
||||
}
|
||||
char output[128];
|
||||
#ifdef _WIN32
|
||||
char slash = '\\';
|
||||
#else
|
||||
char slash = '/';
|
||||
#endif
|
||||
intf = interface;
|
||||
|
||||
memset(eeprom_data,0xff,(1 << intf->address_bits) * intf->data_bits / 8);
|
||||
serial_count = 0;
|
||||
latch = 0;
|
||||
reset_line = EEPROM_ASSERT_LINE;
|
||||
clock_line = EEPROM_ASSERT_LINE;
|
||||
serial_count = 0;
|
||||
latch = 0;
|
||||
reset_line = EEPROM_ASSERT_LINE;
|
||||
clock_line = EEPROM_ASSERT_LINE;
|
||||
eeprom_read_address = 0;
|
||||
sending = 0;
|
||||
if (intf->cmd_unlock) locked = 1;
|
||||
else locked = 0;
|
||||
|
||||
char output[128];
|
||||
#ifdef __LIBRETRO__
|
||||
#ifdef _WIN32
|
||||
char slash = '\\';
|
||||
#else
|
||||
char slash = '/';
|
||||
#endif
|
||||
sending = 0;
|
||||
if (intf->cmd_unlock)
|
||||
locked = 1;
|
||||
else
|
||||
locked = 0;
|
||||
snprintf (output, sizeof(output), "%s%c%s.nv", g_save_dir, slash, BurnDrvGetTextA(DRV_NAME));
|
||||
#else
|
||||
snprintf (output, sizeof(output), "config/games/%s.nv", BurnDrvGetTextA(DRV_NAME));
|
||||
#endif
|
||||
|
||||
neeprom_available = 0;
|
||||
neeprom_available = 0;
|
||||
|
||||
INT32 len = ((1 << intf->address_bits) * (intf->data_bits >> 3)) & (MEMORY_SIZE-1);
|
||||
|
||||
FILE *fz = fopen(output, "rb");
|
||||
if (fz != NULL) {
|
||||
if (fz != NULL)
|
||||
{
|
||||
neeprom_available = 1;
|
||||
fread (eeprom_data, len, 1, fz);
|
||||
fclose (fz);
|
||||
}
|
||||
}
|
||||
|
||||
void EEPROMExit()
|
||||
void EEPROMExit(void)
|
||||
{
|
||||
char output[128];
|
||||
#ifdef __LIBRETRO__
|
||||
#ifdef _WIN32
|
||||
char slash = '\\';
|
||||
#else
|
||||
char slash = '/';
|
||||
#endif
|
||||
snprintf (output, sizeof(output), "%s%c%s.nv", g_save_dir, slash, BurnDrvGetTextA(DRV_NAME));
|
||||
#else
|
||||
snprintf (output, sizeof(output), "config/games/%s.nv", BurnDrvGetTextA(DRV_NAME));
|
||||
#endif
|
||||
|
||||
neeprom_available = 0;
|
||||
|
||||
INT32 len = ((1 << intf->address_bits) * (intf->data_bits >> 3)) & (MEMORY_SIZE-1);
|
||||
|
||||
FILE *fz = fopen(output, "wb");
|
||||
if (fz) {
|
||||
if (fz)
|
||||
{
|
||||
fwrite (eeprom_data, len, 1, fz);
|
||||
fclose (fz);
|
||||
}
|
||||
@ -136,10 +132,7 @@ void EEPROMExit()
|
||||
static void eeprom_write(INT32 bit)
|
||||
{
|
||||
if (serial_count >= SERIAL_BUFFER_LENGTH-1)
|
||||
{
|
||||
bprintf(0, _T("error: EEPROM serial buffer overflow\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
serial_buffer[serial_count++] = (bit ? '1' : '0');
|
||||
serial_buffer[serial_count] = 0;
|
||||
@ -310,11 +303,10 @@ void EEPROMScan(INT32 nAction, INT32* pnMin)
|
||||
{
|
||||
struct BurnArea ba;
|
||||
|
||||
if (nAction & ACB_DRIVER_DATA) {
|
||||
|
||||
if (pnMin && *pnMin < 0x020902) {
|
||||
if (nAction & ACB_DRIVER_DATA)
|
||||
{
|
||||
if (pnMin && *pnMin < 0x020902)
|
||||
*pnMin = 0x029705;
|
||||
}
|
||||
|
||||
memset(&ba, 0, sizeof(ba));
|
||||
ba.Data = serial_buffer;
|
||||
@ -333,17 +325,4 @@ void EEPROMScan(INT32 nAction, INT32* pnMin)
|
||||
SCAN_VAR(locked);
|
||||
SCAN_VAR(reset_delay);
|
||||
}
|
||||
|
||||
// if (nAction & ACB_NVRAM) {
|
||||
//
|
||||
// if (pnMin && (nAction & ACB_TYPEMASK) == ACB_NVRAM) {
|
||||
// *pnMin = 0x02705;
|
||||
// }
|
||||
//
|
||||
// memset(&ba, 0, sizeof(ba));
|
||||
// ba.Data = eeprom_data;
|
||||
// ba.nLen = MEMORY_SIZE;
|
||||
// ba.szName = "EEPROM memory";
|
||||
// BurnAcb(&ba);
|
||||
// }
|
||||
}
|
||||
|
@ -71,12 +71,6 @@ enum {
|
||||
|
||||
typedef UINT8 (*read8_handler)(UINT32 offset);
|
||||
typedef void (*write8_handler)(UINT32 offset, UINT32 data);
|
||||
|
||||
#ifdef MAME_USE_LOGERROR
|
||||
void __cdecl logerror(char* szFormat, ...);
|
||||
#else
|
||||
#define logerror
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -3,11 +3,6 @@
|
||||
#include "neogeo.h"
|
||||
#include "bitswap.h"
|
||||
|
||||
#if !defined ROM_VERIFY
|
||||
// enable to match Neo Geo BIOS to MAME's (also affects dipswitches -- leaves only the MVS BIOS option)
|
||||
// #define ROM_VERIFY
|
||||
#endif
|
||||
|
||||
static struct BurnRomInfo emptyRomDesc[] = {
|
||||
{ "", 0, 0, 0 },
|
||||
};
|
||||
@ -17,7 +12,6 @@ static struct BurnRomInfo emptyRomDesc[] = {
|
||||
|
||||
static struct BurnInputInfo neogeoInputList[] = {
|
||||
{"P1 Coin", BIT_DIGITAL, NeoButton2 + 0, "p1 coin"}, // 0
|
||||
// {"P1 Coin 2", BIT_DIGITAL, NeoButton2 + 3, "p1 coin 2"},
|
||||
{"P1 Start", BIT_DIGITAL, NeoButton1 + 0, "p1 start"}, // 1
|
||||
{"P1 Select", BIT_DIGITAL, NeoButton1 + 1, "p1 select"}, // 2
|
||||
|
||||
@ -31,7 +25,6 @@ static struct BurnInputInfo neogeoInputList[] = {
|
||||
{"P1 Button D", BIT_DIGITAL, NeoJoy1 + 7, "p1 fire 4"}, // A
|
||||
|
||||
{"P2 Coin", BIT_DIGITAL, NeoButton2 + 1, "p2 coin"}, // B
|
||||
// {"P2 Coin 2", BIT_DIGITAL, NeoButton2 + 4, "p2 coin 2"},
|
||||
{"P2 Start", BIT_DIGITAL, NeoButton1 + 2, "p2 start"}, // C
|
||||
{"P2 Select", BIT_DIGITAL, NeoButton1 + 3, "p2 select"}, // D
|
||||
|
||||
@ -61,7 +54,6 @@ STDINPUTINFO(neogeo)
|
||||
|
||||
static struct BurnInputInfo neoMVSInputList[] = {
|
||||
{"P1 Coin", BIT_DIGITAL, NeoButton2 + 0, "p1 coin"}, // 0
|
||||
// {"P1 Coin 2", BIT_DIGITAL, NeoButton2 + 3, "p1 coin 2"},
|
||||
{"P1 Start", BIT_DIGITAL, NeoButton1 + 0, "p1 start"}, // 1
|
||||
{"P1 Select", BIT_DIGITAL, NeoButton1 + 1, "p1 select"}, // 2
|
||||
|
||||
@ -75,7 +67,6 @@ static struct BurnInputInfo neoMVSInputList[] = {
|
||||
{"P1 Button D", BIT_DIGITAL, NeoJoy1 + 7, "p1 fire 4"}, // A
|
||||
|
||||
{"P2 Coin", BIT_DIGITAL, NeoButton2 + 1, "p2 coin"}, // B
|
||||
// {"P2 Coin 2", BIT_DIGITAL, NeoButton2 + 4, "p2 coin 2"},
|
||||
{"P2 Start", BIT_DIGITAL, NeoButton1 + 2, "p2 start"}, // C
|
||||
{"P2 Select", BIT_DIGITAL, NeoButton1 + 3, "p2 select"}, // D
|
||||
|
||||
@ -846,19 +837,6 @@ static struct BurnDIPInfo neoCDDIPList[] = {
|
||||
{0x00, 0x01, 0x03, 0x01, "USA"},
|
||||
{0x00, 0x01, 0x03, 0x02, "Europe"},
|
||||
{0x00, 0x01, 0x03, 0x03, "Portugese"},
|
||||
|
||||
#if 0
|
||||
|
||||
// Memory card
|
||||
{0, 0xFD, 0, 2, "Memory card"},
|
||||
{0x00, 0x01, 0x80, 0x80, "Writable"},
|
||||
{0x00, 0x01, 0x80, 0x00, "Write-protected"},
|
||||
{0, 0xFD, 0, 2, "New card type"},
|
||||
{0x00, 0x01, 0x40, 0x40, "1 Megabit"},
|
||||
{0x00, 0x01, 0x40, 0x00, "Normal"},
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
STDDIPINFO(neoCD)
|
||||
@ -932,15 +910,9 @@ static struct BurnRomInfo neogeoRomDesc[] = {
|
||||
{ "sp1.jipan.1024", 0x20000, 0x9fb0abe4, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 7 MVS Japan ver. 3 (4 slot)
|
||||
{ "sp-45.sp1", 0x80000, 0x03cc9f6a, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 8 NEO-MVH MV1C
|
||||
{ "japan-j3.bin", 0x20000, 0xdff6d41f, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 9 MVS Japan (J3)
|
||||
#if !defined (ROM_VERIFY)
|
||||
{ "neo-po.bin", 0x20000, 0x16d0c132, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 10 AES Japan
|
||||
{ "neo-epo.bin", 0x20000, 0xd27a71f1, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 11 AES Asia
|
||||
{ "neodebug.bin", 0x20000, 0x698ebb7d, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 12 Development Kit
|
||||
#else
|
||||
{ "", 0x00000, 0x00000000, 0 }, // 10
|
||||
{ "", 0x00000, 0x00000000, 0 }, // 11
|
||||
{ "", 0x00000, 0x00000000, 0 }, // 12
|
||||
#endif
|
||||
{ "sp-1v1_3db8c.bin", 0x20000, 0x162f0ebe, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 13 Deck ver. 6 (Git Ver 1.3)
|
||||
{ "uni-bios_4_0.rom", 0x20000, 0xa7aab458, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 14 Universe BIOS ver. 4.0
|
||||
{ "uni-bios_3_3.rom", 0x20000, 0x24858466, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 15 Universe BIOS ver. 3.3
|
||||
@ -957,11 +929,7 @@ static struct BurnRomInfo neogeoRomDesc[] = {
|
||||
{ "uni-bios_1_2o.rom", 0x20000, 0xe19d3ce9, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 26 Universe BIOS ver. 1.2 (alt)
|
||||
{ "uni-bios_1_1.rom", 0x20000, 0x5dda0d84, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 27 Universe BIOS ver. 1.1
|
||||
{ "uni-bios_1_0.rom", 0x20000, 0x0ce453a0, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 28 Universe BIOS ver. 1.0
|
||||
#if !defined (ROM_VERIFY)
|
||||
{ "neopen.sp1", 0x20000, 0xcb915e76, BRF_ESS | BRF_PRG | BRF_BIOS | BRF_SELECT | BRF_OPT }, // 29 NeoOpen BIOS v0.1 beta
|
||||
#else
|
||||
{ "", 0x00000, 0x00000000, 0 }, // 29
|
||||
#endif
|
||||
{ "", 0x00000, 0x00000000, 0 }, // 30 Trackball BIOS loaded here
|
||||
{ "", 0x00000, 0x00000000, 0 }, // 31 PCB BIOS loaded here
|
||||
|
||||
@ -1236,26 +1204,17 @@ void NeoSMABankswitch()
|
||||
// Extra protection
|
||||
UINT16 __fastcall neogeoReadWordSMA9A37(UINT32 sekAddress)
|
||||
{
|
||||
// bprintf(PRINT_NORMAL, " -- SMA9A37 0x%08X (word)\n", sekAddress);
|
||||
|
||||
if (sekAddress == 0x2FE446) {
|
||||
if (sekAddress == 0x2FE446)
|
||||
return 0x9A37;
|
||||
}
|
||||
|
||||
return *((UINT16*)(Neo68KROMActive + nNeo68KROMBank + sekAddress - 0x200000));
|
||||
}
|
||||
|
||||
UINT8 __fastcall neogeoReadByteSMA9A37(UINT32 sekAddress)
|
||||
{
|
||||
// bprintf(PRINT_NORMAL, " -- SMA9A37 0x%08X (byte)\n", sekAddress);
|
||||
|
||||
if (sekAddress == 0x2FE446) {
|
||||
if (sekAddress == 0x2FE446)
|
||||
return 0x9A;
|
||||
}
|
||||
if (sekAddress == 0x2FE447) {
|
||||
if (sekAddress == 0x2FE447)
|
||||
return 0x37;
|
||||
}
|
||||
|
||||
return Neo68KROMActive[(nNeo68KROMBank + sekAddress - 0x200000) ^ 1];
|
||||
}
|
||||
|
||||
@ -1321,8 +1280,6 @@ INT32 NeoSMAScan(INT32 nAction, INT32* /*pnMin*/)
|
||||
|
||||
static void NeoSMAInstallHanders()
|
||||
{
|
||||
// bprintf(PRINT_NORMAL, _T(" Installing handlers for slot %i\n"), nNeoActiveSlot);
|
||||
|
||||
SekMapHandler(8, 0x2FFC00, 0x2FFFFF, SM_WRITE); // Bankswitch
|
||||
|
||||
SekSetWriteWordHandler(8, pSMABankswitchHandler[nNeoActiveSlot]);
|
||||
@ -3591,10 +3548,8 @@ static INT32 prot_data;
|
||||
UINT8 __fastcall fatfury2ReadByteProtection(UINT32 sekAddress)
|
||||
{
|
||||
UINT16 res = (prot_data >> 24) & 0xFF;
|
||||
|
||||
// bprintf(PRINT_NORMAL, _T(" - prot 0x%06X read byte (PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
||||
|
||||
switch (sekAddress) {
|
||||
switch (sekAddress)
|
||||
{
|
||||
case 0x255551:
|
||||
case 0x2FFFF1:
|
||||
case 0x200001:
|
||||
@ -3602,16 +3557,11 @@ UINT8 __fastcall fatfury2ReadByteProtection(UINT32 sekAddress)
|
||||
|
||||
case 0x236001:
|
||||
case 0x236009:
|
||||
// bprintf(PRINT_NORMAL, _T(" - prot read byte: 0x%02X (PC: 0x%06X)\n"), res, SekGetPC(-1));
|
||||
return res;
|
||||
|
||||
case 0x236005:
|
||||
case 0x23600D:
|
||||
// bprintf(PRINT_NORMAL, _T(" - prot read byte: 0x%02X (PC: 0x%06X)\n"), ((res & 0xF0) >> 4) | ((res & 0x0F) << 4), SekGetPC(-1));
|
||||
return ((res & 0xF0) >> 4) | ((res & 0x0F) << 4);
|
||||
|
||||
// default:
|
||||
// bprintf(PRINT_NORMAL, _T(" - prot 0x%06X read byte (PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -3620,10 +3570,8 @@ UINT8 __fastcall fatfury2ReadByteProtection(UINT32 sekAddress)
|
||||
UINT16 __fastcall fatfury2ReadWordProtection(UINT32 sekAddress)
|
||||
{
|
||||
UINT16 res = (prot_data >> 24) & 0xFF;
|
||||
|
||||
// bprintf(PRINT_NORMAL, _T(" - prot 0x%06X read word (PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
||||
|
||||
switch (sekAddress) {
|
||||
switch (sekAddress)
|
||||
{
|
||||
case 0x255550:
|
||||
case 0x2FFFF0:
|
||||
case 0x200000:
|
||||
@ -3631,16 +3579,11 @@ UINT16 __fastcall fatfury2ReadWordProtection(UINT32 sekAddress)
|
||||
|
||||
case 0x236000:
|
||||
case 0x236008:
|
||||
// bprintf(PRINT_NORMAL, _T(" - prot read word: 0x%02X (PC: 0x%06X)\n"), res, SekGetPC(-1));
|
||||
return res;
|
||||
|
||||
case 0x236004:
|
||||
case 0x23600C:
|
||||
// bprintf(PRINT_NORMAL, _T(" - prot read word: 0x%02X (PC: 0x%06X)\n"), ((res & 0xF0) >> 4) | ((res & 0x0F) << 4), SekGetPC(-1));
|
||||
return ((res & 0xF0) >> 4) | ((res & 0x0F) << 4);
|
||||
|
||||
// default:
|
||||
// bprintf(PRINT_NORMAL, _T(" - prot 0x%06X read word (PC: 0x%06X)\n"), sekAddress, SekGetPC(-1));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -3648,9 +3591,8 @@ UINT16 __fastcall fatfury2ReadWordProtection(UINT32 sekAddress)
|
||||
|
||||
void __fastcall fatfury2WriteByteProtection(UINT32 sekAddress, UINT8 /*byteValue*/)
|
||||
{
|
||||
// bprintf(PRINT_NORMAL, _T(" - prot 0x%06X -> 0x%02X (PC: 0x%06X)\n"), sekAddress, byteValue, SekGetPC(-1));
|
||||
|
||||
switch (sekAddress) {
|
||||
switch (sekAddress)
|
||||
{
|
||||
case 0x255551:
|
||||
case 0x2FFFF1:
|
||||
case 0x2FF001:
|
||||
@ -3661,50 +3603,23 @@ void __fastcall fatfury2WriteByteProtection(UINT32 sekAddress, UINT8 /*byteValue
|
||||
case 0x23600D:
|
||||
prot_data <<= 8;
|
||||
break;
|
||||
|
||||
// default:
|
||||
// bprintf(PRINT_NORMAL, _T(" - prot 0x%06X -> 0x%02X\n"), sekAddress, byteValue);
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall fatfury2WriteWordProtection(UINT32 sekAddress, UINT16 /*wordValue*/)
|
||||
{
|
||||
// bprintf(PRINT_NORMAL, _T(" - prot 0x%06X -> 0x%04X (PC: 0x%06X)\n"), sekAddress, wordValue, SekGetPC(-1));
|
||||
|
||||
switch (sekAddress) {
|
||||
switch (sekAddress)
|
||||
{
|
||||
case 0x211112: // data = 0x1111, expects 0xFF000000 back
|
||||
prot_data = 0xFF000000;
|
||||
/*
|
||||
prot_data = (wordValue & 0x1000) << 19;
|
||||
prot_data |= (wordValue & 0x0100) << 22;
|
||||
prot_data |= (wordValue & 0x0010) << 25;
|
||||
prot_data |= (wordValue & 0x0001) << 28;
|
||||
|
||||
prot_data |= prot_data >> 4;
|
||||
*/
|
||||
// bprintf(PRINT_NORMAL, _T(" prot data -> 0x%08X\n"), prot_data);
|
||||
break;
|
||||
|
||||
case 0x233332: // data = 0x3333, expects 0x0000FFFF back
|
||||
prot_data = 0x0000FFFF;
|
||||
/*
|
||||
prot_data = wordValue << 0;
|
||||
prot_data |= wordValue << 2;
|
||||
*/
|
||||
// bprintf(PRINT_NORMAL, _T(" prot data -> 0x%08X\n"), prot_data);
|
||||
break;
|
||||
|
||||
case 0x244442: // data = 0x4444, expects 0x00FF0000 back
|
||||
prot_data = 0x00FF0000;
|
||||
/*
|
||||
prot_data = (wordValue & 0x4000) << 9;
|
||||
prot_data |= (wordValue & 0x0400) << 12;
|
||||
prot_data |= (wordValue & 0x0040) << 15;
|
||||
prot_data |= (wordValue & 0x0004) << 18;
|
||||
|
||||
prot_data |= prot_data >> 4;
|
||||
*/
|
||||
// bprintf(PRINT_NORMAL, _T(" prot data -> 0x%08X\n"), prot_data);
|
||||
break;
|
||||
|
||||
case 0x255552: // data == 0x5555; read back from 55550, ffff0, 00000, ff000
|
||||
@ -3718,9 +3633,6 @@ void __fastcall fatfury2WriteWordProtection(UINT32 sekAddress, UINT16 /*wordValu
|
||||
case 0x242812: // data == 0x1824; read back from 36008 *or* 3600c
|
||||
prot_data = 0x81422418;
|
||||
break;
|
||||
|
||||
// default:
|
||||
// bprintf(PRINT_NORMAL, _T(" - prot 0x%06X -> 0x%02X\n"), sekAddress, wordValue);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6534,9 +6446,6 @@ static void mslug3SMADecrypt()
|
||||
|
||||
void __fastcall mslug3WriteWordBankswitch(UINT32 sekAddress, UINT16 wordValue)
|
||||
{
|
||||
|
||||
// bprintf(PRINT_NORMAL, " -- bankswitch: 0x%08X -> 0x%04X\n", sekAddress, wordValue);
|
||||
|
||||
if (sekAddress == 0x2FFFE4) {
|
||||
static UINT32 bankoffset[64] = {
|
||||
0x100000, 0x120000, 0x140000, 0x160000, // 00
|
||||
|
@ -445,35 +445,26 @@ const UINT8 kof2000_address_0_7_xor[256] =
|
||||
0x32, 0x3e, 0x45, 0xaf, 0x1e, 0x43, 0x44, 0x8c, 0x53, 0x86, 0x6b, 0xee, 0xa8, 0x8a, 0x8f, 0x17,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void NeoCMCExtractSData(UINT8* rom, UINT8* sdata, INT32 rom_size, INT32 sdata_size)
|
||||
{
|
||||
#if 0
|
||||
/* the S data comes from the end fo the C data */
|
||||
rom += rom_size - sdata_size;
|
||||
|
||||
for (INT32 i = 0; i < sdata_size; i++) {
|
||||
sdata[i] = rom[(i & ~0x1F) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
|
||||
}
|
||||
#endif
|
||||
INT32 i;
|
||||
// the S data comes from the end fo the C data
|
||||
if (sdata_size == 0x100000) {
|
||||
if (sdata_size == 0x100000)
|
||||
{
|
||||
// 1 MB of data, special for kf2k3pcb
|
||||
rom += rom_size - sdata_size /2;
|
||||
for (i = 0; i < sdata_size / 2; i++) {
|
||||
sdata[i + 0] = rom[(i & ~0x1F) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) - 0x1000000 ];
|
||||
for (i = 0; i < sdata_size / 2; i++)
|
||||
{
|
||||
sdata[i + 0] = rom[(i & ~0x1F) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) - 0x1000000 ];
|
||||
sdata[i + sdata_size / 2] = rom[(i & ~0x1F) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal data extraction
|
||||
rom += rom_size - sdata_size;
|
||||
for (i = 0; i < sdata_size; i++) {
|
||||
for (i = 0; i < sdata_size; i++)
|
||||
sdata[i] = rom[(i & ~0x1F) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -485,19 +476,19 @@ inline static void cmc_xor(UINT8 *r0, UINT8 *r1,
|
||||
INT32 invert)
|
||||
|
||||
{
|
||||
UINT8 c0, c1, tmp, xor0, xor1;
|
||||
UINT8 tmp = table1[(base & 0xff) ^ address_0_7_xor[(base >> 8) & 0xff]];
|
||||
UINT8 xor0 = (table0hi[(base >> 8) & 0xff] & 0xfe) | (tmp & 0x01);
|
||||
UINT8 xor1 = (tmp & 0xfe) | (table0lo[(base >> 8) & 0xff] & 0x01);
|
||||
UINT8 c0 = *r0;
|
||||
UINT8 c1 = *r1;
|
||||
|
||||
tmp = table1[(base & 0xff) ^ address_0_7_xor[(base >> 8) & 0xff]];
|
||||
xor0 = (table0hi[(base >> 8) & 0xff] & 0xfe) | (tmp & 0x01);
|
||||
xor1 = (tmp & 0xfe) | (table0lo[(base >> 8) & 0xff] & 0x01);
|
||||
|
||||
c0 = *r0;
|
||||
c1 = *r1;
|
||||
|
||||
if (invert) {
|
||||
if (invert)
|
||||
{
|
||||
*r0 = c1 ^ xor0;
|
||||
*r1 = c0 ^ xor1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
*r0 = c0 ^ xor0;
|
||||
*r1 = c1 ^ xor1;
|
||||
}
|
||||
@ -548,7 +539,7 @@ void NeoCMCDecrypt(INT32 extra_xor, UINT8* rom, UINT8* buf, INT32 offset, INT32
|
||||
}
|
||||
|
||||
/* CMC42 protection chip */
|
||||
void NeoCMC42Init()
|
||||
void NeoCMC42Init(void)
|
||||
{
|
||||
type0_t03 = kof99_type0_t03;
|
||||
type0_t12 = kof99_type0_t12;
|
||||
@ -562,7 +553,7 @@ void NeoCMC42Init()
|
||||
}
|
||||
|
||||
/* CMC50 protection chip */
|
||||
void NeoCMC50Init()
|
||||
void NeoCMC50Init(void)
|
||||
{
|
||||
type0_t03 = kof2000_type0_t03;
|
||||
type0_t12 = kof2000_type0_t12;
|
||||
@ -618,9 +609,8 @@ static UINT16 generate_cs16(UINT8 *rom, INT32 size)
|
||||
{
|
||||
UINT16 cs16;
|
||||
cs16 = 0x0000;
|
||||
for (INT32 i = 0; i < size; i++) {
|
||||
for (INT32 i = 0; i < size; i++)
|
||||
cs16 += rom[i];
|
||||
}
|
||||
return cs16 & 0xffff;
|
||||
}
|
||||
|
||||
@ -656,7 +646,7 @@ static INT32 m1_address_scramble(INT32 address, UINT16 key)
|
||||
return (block << 16) | aux;
|
||||
}
|
||||
|
||||
void neogeo_cmc50_m1_decrypt()
|
||||
void neogeo_cmc50_m1_decrypt(void)
|
||||
{
|
||||
UINT8 *rom = NeoZ80ROMActive;
|
||||
UINT8 *buffer = (UINT8*)BurnMalloc(0x80000);
|
||||
@ -670,4 +660,3 @@ void neogeo_cmc50_m1_decrypt()
|
||||
memcpy(rom, buffer, 0x80000);
|
||||
BurnFree(buffer);
|
||||
}
|
||||
|
||||
|
@ -10,15 +10,14 @@ static UINT16* NeoPaletteCopy[2] = {NULL, NULL};
|
||||
|
||||
UINT8 NeoRecalcPalette;
|
||||
|
||||
INT32 NeoInitPalette()
|
||||
INT32 NeoInitPalette(void)
|
||||
{
|
||||
for (INT32 i = 0; i < 2; i++) {
|
||||
if (NeoPaletteData[i]) {
|
||||
for (INT32 i = 0; i < 2; i++)
|
||||
{
|
||||
if (NeoPaletteData[i])
|
||||
BurnFree(NeoPaletteData[i]);
|
||||
}
|
||||
if (NeoPaletteCopy[i]) {
|
||||
if (NeoPaletteCopy[i])
|
||||
BurnFree(NeoPaletteCopy[i]);
|
||||
}
|
||||
NeoPaletteData[i] = (UINT32*)BurnMalloc(4096 * sizeof(UINT32));
|
||||
NeoPaletteCopy[i] = (UINT16*)BurnMalloc(4096 * sizeof(UINT16));
|
||||
}
|
||||
@ -28,9 +27,10 @@ INT32 NeoInitPalette()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NeoExitPalette()
|
||||
void NeoExitPalette(void)
|
||||
{
|
||||
for (INT32 i = 0; i < 2; i++) {
|
||||
for (INT32 i = 0; i < 2; i++)
|
||||
{
|
||||
BurnFree(NeoPaletteData[i]);
|
||||
BurnFree(NeoPaletteCopy[i]);
|
||||
}
|
||||
@ -52,17 +52,20 @@ inline static UINT32 CalcCol(UINT16 nColour)
|
||||
return BurnHighCol(r, g, b, 0);
|
||||
}
|
||||
|
||||
INT32 NeoUpdatePalette()
|
||||
INT32 NeoUpdatePalette(void)
|
||||
{
|
||||
if (NeoRecalcPalette) {
|
||||
if (NeoRecalcPalette)
|
||||
{
|
||||
INT32 i;
|
||||
UINT16* ps;
|
||||
UINT16* pc;
|
||||
UINT32* pd;
|
||||
|
||||
// Update both palette banks
|
||||
for (INT32 j = 0; j < 2; j++) {
|
||||
for (i = 0, ps = (UINT16*)NeoPalSrc[j], pc = NeoPaletteCopy[j], pd = NeoPaletteData[j]; i < 4096; i++, ps++, pc++, pd++) {
|
||||
for (INT32 j = 0; j < 2; j++)
|
||||
{
|
||||
for (i = 0, ps = (UINT16*)NeoPalSrc[j], pc = NeoPaletteCopy[j], pd = NeoPaletteData[j]; i < 4096; i++, ps++, pc++, pd++)
|
||||
{
|
||||
*pc = *ps;
|
||||
*pd = CalcCol(BURN_ENDIAN_SWAP_INT16(*ps));
|
||||
}
|
||||
@ -75,7 +78,7 @@ INT32 NeoUpdatePalette()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NeoSetPalette()
|
||||
void NeoSetPalette(void)
|
||||
{
|
||||
NeoPalette = NeoPaletteData[nNeoPaletteBank];
|
||||
}
|
||||
@ -106,4 +109,3 @@ void __fastcall NeoPalWriteWord(UINT32 nAddress, UINT16 wordValue)
|
||||
NeoPaletteData[nNeoPaletteBank][nAddress] = CalcCol(wordValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -43,19 +43,17 @@ static UINT16 BankAttrib01, BankAttrib02, BankAttrib03;
|
||||
// Include the tile rendering functions
|
||||
#include "neo_sprite_func.h"
|
||||
|
||||
INT32 NeoRenderSprites()
|
||||
INT32 NeoRenderSprites(void)
|
||||
{
|
||||
if (nLastBPP != nBurnBpp ) {
|
||||
if (nLastBPP != nBurnBpp )
|
||||
{
|
||||
nLastBPP = nBurnBpp;
|
||||
|
||||
RenderBank = RenderBankNormal[nBurnBpp - 2];
|
||||
}
|
||||
|
||||
if (!NeoSpriteROMActive || !(nBurnLayer & 1)) {
|
||||
if (!NeoSpriteROMActive || !(nBurnLayer & 1))
|
||||
return 0;
|
||||
}
|
||||
|
||||
// UINT16 BankAttrib01, BankAttrib02, BankAttrib03;
|
||||
|
||||
nNeoSpriteFrame04 = nNeoSpriteFrame & 3;
|
||||
nNeoSpriteFrame08 = nNeoSpriteFrame & 7;
|
||||
@ -93,8 +91,6 @@ INT32 NeoRenderSprites()
|
||||
|
||||
nBankYZoom = BankAttrib01 & 0xFF;
|
||||
nBankSize = BankAttrib02 & 0x3F;
|
||||
|
||||
// if (nBankSize > 0x10 && nSliceStart == 0x10) bprintf(PRINT_NORMAL, _T("bank: %04X, x: %04X, y: %04X, zoom: %02X, size: %02X.\n"), zBank, nBankXPos, nBankYPos, nBankYZoom, nBankSize);
|
||||
}
|
||||
|
||||
if (nBankSize) {
|
||||
@ -114,8 +110,6 @@ INT32 NeoRenderSprites()
|
||||
}
|
||||
}
|
||||
|
||||
// bprintf(PRINT_NORMAL, _T("\n"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -494,9 +494,6 @@ static void FUNCTIONNAME(BPP,XZOOM,CLIP,OPACITY)()
|
||||
while (nLinesDone <= nLinesTotal) {
|
||||
nLine = (nBankYPos + nLinesDone) & 0x01FF;
|
||||
nYPos = nLine;
|
||||
|
||||
// bprintf(PRINT_NORMAL, _T(" - s:%i l:%i y:%i %i z:%i\n"), nLinesTotal, nLinesDone, nYPos, nBankYPos, nBankYZoom);
|
||||
|
||||
// Skip everything above the part of the display we need to render
|
||||
if (nYPos < nSliceStart) {
|
||||
nLinesDone += nSliceStart - nYPos;
|
||||
|
@ -146,121 +146,112 @@ void uPD4990AScan(INT32 nAction, INT32* pnMin)
|
||||
|
||||
void uPD4990AWrite(UINT8 CLK, UINT8 STB, UINT8 DATA)
|
||||
{
|
||||
// bprintf(PRINT_NORMAL, _T(" - uPD4990A written: CLK: %i, STB: %i DATA IN: %i (PC: %06X).\n"), CLK ? 1 : 0, STB ? 1 : 0, DATA ? 1 : 0, SekGetPC(-1));
|
||||
if (STB && uPD4990A.nPrevSTB == 0) // Process command
|
||||
{
|
||||
switch (uPD4990A.nCommand & 0x0F)
|
||||
{
|
||||
case 0x00: // Register hold
|
||||
uPD4990A.nMode = 0;
|
||||
|
||||
if (STB && uPD4990A.nPrevSTB == 0) { // Process command
|
||||
uPD4990A.nTPMode = 0;
|
||||
uPD4990A.nInterval = nOneSecond / 64;
|
||||
uPD4990A.nTPCount %= uPD4990A.nInterval;
|
||||
break;
|
||||
case 0x01: // Register shift
|
||||
uPD4990A.nMode = 1;
|
||||
break;
|
||||
case 0x02: // Time set & counter hold
|
||||
uPD4990A.nMode = 2;
|
||||
// Convert BCD values to normal numbers
|
||||
uPD4990A.nSeconds = ((uPD4990A.nRegister[0] >> 0) & 0x0F);
|
||||
uPD4990A.nSeconds += ((uPD4990A.nRegister[0] >> 4) & 0x0F) * 10;
|
||||
uPD4990A.nMinutes = ((uPD4990A.nRegister[0] >> 8) & 0x0F);
|
||||
uPD4990A.nMinutes += ((uPD4990A.nRegister[0] >> 12) & 0x0F) * 10;
|
||||
uPD4990A.nHours = ((uPD4990A.nRegister[0] >> 16) & 0x0F);
|
||||
uPD4990A.nHours += ((uPD4990A.nRegister[0] >> 20) & 0x0F) * 10;
|
||||
uPD4990A.nDay = ((uPD4990A.nRegister[0] >> 24) & 0x0F);
|
||||
uPD4990A.nDay += ((uPD4990A.nRegister[0] >> 28) & 0x0F) * 10;
|
||||
uPD4990A.nWeekDay = ((uPD4990A.nRegister[1] >> 0) & 0x0F);
|
||||
uPD4990A.nMonth = ((uPD4990A.nRegister[1] >> 4) & 0x0F);
|
||||
uPD4990A.nYear = ((uPD4990A.nRegister[1] >> 8) & 0x0F);
|
||||
uPD4990A.nYear += ((uPD4990A.nRegister[1] >> 12) & 0x0F) * 10;
|
||||
break;
|
||||
case 0x03: // Time read
|
||||
uPD4990A.nMode = 0;
|
||||
|
||||
// bprintf(PRINT_NORMAL, _T(" - Command sent: %02X.\n"), nCommand & 0x0F);
|
||||
// Convert normal numbers to BCD values
|
||||
uPD4990A.nRegister[0] = (uPD4990A.nSeconds % 10) << 0;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nSeconds / 10) << 4;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nMinutes % 10) << 8;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nMinutes / 10) << 12;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nHours % 10) << 16;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nHours / 10) << 20;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nDay % 10) << 24;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nDay / 10) << 28;
|
||||
uPD4990A.nRegister[1] = (uPD4990A.nWeekDay ) << 0;
|
||||
uPD4990A.nRegister[1] |= (uPD4990A.nMonth ) << 4;
|
||||
uPD4990A.nRegister[1] |= (uPD4990A.nYear % 10) << 8;
|
||||
uPD4990A.nRegister[1] |= (uPD4990A.nYear / 10) << 12;
|
||||
break;
|
||||
|
||||
switch (uPD4990A.nCommand & 0x0F) {
|
||||
case 0x00: // Register hold
|
||||
uPD4990A.nMode = 0;
|
||||
case 0x04:
|
||||
case 0x05:
|
||||
case 0x06:
|
||||
case 0x07: { // TP = nn Hz
|
||||
INT32 n[4] = { 64, 256, 2048, 4096 };
|
||||
|
||||
uPD4990A.nTPMode = 0;
|
||||
uPD4990A.nInterval = nOneSecond / 64;
|
||||
uPD4990A.nTPCount %= uPD4990A.nInterval;
|
||||
break;
|
||||
case 0x01: // Register shift
|
||||
uPD4990A.nMode = 1;
|
||||
break;
|
||||
case 0x02: // Time set & counter hold
|
||||
uPD4990A.nMode = 2;
|
||||
uPD4990A.nTPMode = 0;
|
||||
uPD4990A.nInterval = nOneSecond / n[uPD4990A.nCommand & 3];
|
||||
uPD4990A.nTPCount %= uPD4990A.nInterval;
|
||||
}
|
||||
break;
|
||||
case 0x08:
|
||||
case 0x09:
|
||||
case 0x0A:
|
||||
case 0x0B: { // TP = nn s interval set (counter reset & start)
|
||||
INT32 n[4] = { 1, 10, 30, 60 };
|
||||
|
||||
// bprintf(PRINT_NORMAL, _T("Time set: %08X %08X.\n"), nRegister[0], nRegister[1]);
|
||||
uPD4990A.nTPMode = 0;
|
||||
uPD4990A.nInterval = n[uPD4990A.nCommand & 3] * nOneSecond;
|
||||
uPD4990A.nTPCount = 0;
|
||||
}
|
||||
break;
|
||||
case 0x0C: // Interval reset
|
||||
uPD4990A.nTPMode = 1;
|
||||
uPD4990A.TP = 1;
|
||||
break;
|
||||
case 0x0D: // interval start
|
||||
uPD4990A.nTPMode = 0;
|
||||
break;
|
||||
case 0x0E: // Interval stop
|
||||
uPD4990A.nTPMode = 2;
|
||||
break;
|
||||
|
||||
// Convert BCD values to normal numbers
|
||||
uPD4990A.nSeconds = ((uPD4990A.nRegister[0] >> 0) & 0x0F);
|
||||
uPD4990A.nSeconds += ((uPD4990A.nRegister[0] >> 4) & 0x0F) * 10;
|
||||
uPD4990A.nMinutes = ((uPD4990A.nRegister[0] >> 8) & 0x0F);
|
||||
uPD4990A.nMinutes += ((uPD4990A.nRegister[0] >> 12) & 0x0F) * 10;
|
||||
uPD4990A.nHours = ((uPD4990A.nRegister[0] >> 16) & 0x0F);
|
||||
uPD4990A.nHours += ((uPD4990A.nRegister[0] >> 20) & 0x0F) * 10;
|
||||
uPD4990A.nDay = ((uPD4990A.nRegister[0] >> 24) & 0x0F);
|
||||
uPD4990A.nDay += ((uPD4990A.nRegister[0] >> 28) & 0x0F) * 10;
|
||||
uPD4990A.nWeekDay = ((uPD4990A.nRegister[1] >> 0) & 0x0F);
|
||||
uPD4990A.nMonth = ((uPD4990A.nRegister[1] >> 4) & 0x0F);
|
||||
uPD4990A.nYear = ((uPD4990A.nRegister[1] >> 8) & 0x0F);
|
||||
uPD4990A.nYear += ((uPD4990A.nRegister[1] >> 12) & 0x0F) * 10;
|
||||
break;
|
||||
case 0x03: // Time read
|
||||
uPD4990A.nMode = 0;
|
||||
|
||||
// Convert normal numbers to BCD values
|
||||
uPD4990A.nRegister[0] = (uPD4990A.nSeconds % 10) << 0;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nSeconds / 10) << 4;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nMinutes % 10) << 8;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nMinutes / 10) << 12;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nHours % 10) << 16;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nHours / 10) << 20;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nDay % 10) << 24;
|
||||
uPD4990A.nRegister[0] |= (uPD4990A.nDay / 10) << 28;
|
||||
uPD4990A.nRegister[1] = (uPD4990A.nWeekDay ) << 0;
|
||||
uPD4990A.nRegister[1] |= (uPD4990A.nMonth ) << 4;
|
||||
uPD4990A.nRegister[1] |= (uPD4990A.nYear % 10) << 8;
|
||||
uPD4990A.nRegister[1] |= (uPD4990A.nYear / 10) << 12;
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
case 0x05:
|
||||
case 0x06:
|
||||
case 0x07: { // TP = nn Hz
|
||||
INT32 n[4] = { 64, 256, 2048, 4096 };
|
||||
|
||||
uPD4990A.nTPMode = 0;
|
||||
uPD4990A.nInterval = nOneSecond / n[uPD4990A.nCommand & 3];
|
||||
uPD4990A.nTPCount %= uPD4990A.nInterval;
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x08:
|
||||
case 0x09:
|
||||
case 0x0A:
|
||||
case 0x0B: { // TP = nn s interval set (counter reset & start)
|
||||
INT32 n[4] = { 1, 10, 30, 60 };
|
||||
|
||||
uPD4990A.nTPMode = 0;
|
||||
uPD4990A.nInterval = n[uPD4990A.nCommand & 3] * nOneSecond;
|
||||
uPD4990A.nTPCount = 0;
|
||||
break;
|
||||
}
|
||||
case 0x0C: // Interval reset
|
||||
uPD4990A.nTPMode = 1;
|
||||
uPD4990A.TP = 1;
|
||||
break;
|
||||
case 0x0D: // interval start
|
||||
uPD4990A.nTPMode = 0;
|
||||
break;
|
||||
case 0x0E: // Interval stop
|
||||
uPD4990A.nTPMode = 2;
|
||||
break;
|
||||
|
||||
case 0x0F: // Test mode set (not implemented)
|
||||
break;
|
||||
}
|
||||
case 0x0F: // Test mode set (not implemented)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (STB == 0 && CLK && uPD4990A.nPrevCLK == 0) {
|
||||
if (STB == 0 && CLK && uPD4990A.nPrevCLK == 0)
|
||||
{
|
||||
// Shift a new bit into the register
|
||||
if (uPD4990A.nMode == 1)
|
||||
{
|
||||
uPD4990A.nRegister[0] >>= 1;
|
||||
if (uPD4990A.nRegister[1] & 1)
|
||||
uPD4990A.nRegister[0] |= (1 << 31);
|
||||
uPD4990A.nRegister[1] >>= 1;
|
||||
uPD4990A.nRegister[1] &= 0x7FFF;
|
||||
if (uPD4990A.nCommand & 1)
|
||||
uPD4990A.nRegister[1] |= (1 << 15);
|
||||
}
|
||||
|
||||
// Shift a new bit into the register
|
||||
if (uPD4990A.nMode == 1) {
|
||||
uPD4990A.nRegister[0] >>= 1;
|
||||
if (uPD4990A.nRegister[1] & 1) {
|
||||
uPD4990A.nRegister[0] |= (1 << 31);
|
||||
}
|
||||
uPD4990A.nRegister[1] >>= 1;
|
||||
uPD4990A.nRegister[1] &= 0x7FFF;
|
||||
if (uPD4990A.nCommand & 1) {
|
||||
uPD4990A.nRegister[1] |= (1 << 15);
|
||||
}
|
||||
}
|
||||
|
||||
// Shift a new bit into the command
|
||||
uPD4990A.nCommand >>= 1;
|
||||
uPD4990A.nCommand &= 7;
|
||||
if (DATA) {
|
||||
uPD4990A.nCommand |= 8;
|
||||
}
|
||||
}
|
||||
// Shift a new bit into the command
|
||||
uPD4990A.nCommand >>= 1;
|
||||
uPD4990A.nCommand &= 7;
|
||||
if (DATA)
|
||||
uPD4990A.nCommand |= 8;
|
||||
}
|
||||
|
||||
uPD4990A.nPrevCLK = CLK;
|
||||
uPD4990A.nPrevSTB = STB;
|
||||
@ -272,13 +263,10 @@ UINT8 uPD4990ARead(UINT32 nTicks)
|
||||
|
||||
uPD4990AUpdate(nTicks);
|
||||
|
||||
if (uPD4990A.nMode == 0) { // 1Hz pulse appears at output
|
||||
if (uPD4990A.nMode == 0) // 1Hz pulse appears at output
|
||||
OUT = (uPD4990A.nCount >= (nOneSecond >> 1));
|
||||
} else { // LSB of the shift register appears at output
|
||||
else // LSB of the shift register appears at output
|
||||
OUT = uPD4990A.nRegister[0] & 1;
|
||||
}
|
||||
|
||||
// bprintf(PRINT_NORMAL, _T(" - uPD4990A read: OUT %i, TP %i.\n"), OUT, uPD4990A.TP);
|
||||
|
||||
return (OUT << 1) | uPD4990A.TP;
|
||||
}
|
||||
|
@ -10,60 +10,58 @@ INT32 NeoLoadCode(INT32 nOffset, INT32 nNum, UINT8* pDest)
|
||||
{
|
||||
struct BurnRomInfo ri;
|
||||
|
||||
for (INT32 i = 0; i < nNum; i++) {
|
||||
ri.nLen = 0;
|
||||
BurnDrvGetRomInfo(&ri, nOffset + i);
|
||||
for (INT32 i = 0; i < nNum; i++)
|
||||
{
|
||||
ri.nLen = 0;
|
||||
BurnDrvGetRomInfo(&ri, nOffset + i);
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_P32) && (i == 0))
|
||||
{
|
||||
if (BurnLoadRom(pDest + 0, nOffset + i + 0, 2)) return 1;
|
||||
if (BurnLoadRom(pDest + 1, nOffset + i + 1, 2)) return 1;
|
||||
|
||||
for (UINT32 j = 0; j < ri.nLen << 1; j+=4)
|
||||
BurnByteswap(pDest + j + 1, 2);
|
||||
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_P32) && (i == 0))
|
||||
{
|
||||
if (BurnLoadRom(pDest + 0, nOffset + i + 0, 2)) return 1;
|
||||
if (BurnLoadRom(pDest + 1, nOffset + i + 1, 2)) return 1;
|
||||
|
||||
i++;
|
||||
pDest += ri.nLen << 1;
|
||||
continue;
|
||||
}
|
||||
for (UINT32 j = 0; j < ri.nLen << 1; j+=4)
|
||||
BurnByteswap(pDest + j + 1, 2);
|
||||
|
||||
if (BurnLoadRom(pDest, nOffset + i, 1)) {
|
||||
return 1;
|
||||
}
|
||||
i++;
|
||||
pDest += ri.nLen << 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPP) && (i == 0)) {
|
||||
for (UINT32 j = 0; j < (ri.nLen / 2); j++) {
|
||||
INT32 k = pDest[j];
|
||||
pDest[j] = pDest[j + (ri.nLen / 2)];
|
||||
pDest[j + (ri.nLen / 2)] = k;
|
||||
}
|
||||
}
|
||||
if (BurnLoadRom(pDest, nOffset + i, 1)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
pDest += ri.nLen;
|
||||
}
|
||||
if ((BurnDrvGetHardwareCode() & HARDWARE_SNK_SWAPP) && (i == 0)) {
|
||||
for (UINT32 j = 0; j < (ri.nLen / 2); j++) {
|
||||
INT32 k = pDest[j];
|
||||
pDest[j] = pDest[j + (ri.nLen / 2)];
|
||||
pDest[j + (ri.nLen / 2)] = k;
|
||||
}
|
||||
}
|
||||
|
||||
pDest += ri.nLen;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void NeoSVCAddressDecrypt(UINT8* src, UINT8* dst, INT32 start, INT32 end)
|
||||
{
|
||||
for (INT32 i = start / 4; i < end / 4; i++) {
|
||||
for (INT32 i = start / 4; i < end / 4; i++)
|
||||
((UINT32*)dst)[i] = ((UINT32*)src)[(i & 0xFFE00000) | (0x0C8923 ^ BITSWAP24((i & 0x1FFFFF), 0x17, 0x16, 0x15, 0x04, 0x0B, 0x0E, 0x08, 0x0C, 0x10, 0x00, 0x0a, 0x13, 0x03, 0x06, 0x02, 0x07, 0x0D, 0x01, 0x11, 0x09, 0x14, 0x0f, 0x12, 0x05))];
|
||||
}
|
||||
}
|
||||
|
||||
static void NeoKOFAddressDecrypt(UINT8* src, UINT8* dst, INT32 start, INT32 end)
|
||||
{
|
||||
for (INT32 i = start; i < end; i += 0x100) {
|
||||
for (INT32 i = start; i < end; i += 0x100)
|
||||
memcpy(dst + i, src + ((i & 0xFF800000) | BURN_ENDIAN_SWAP_INT16((BITSWAP16((i >> 8) & 0x7FFF, 0x0F, 0x0A, 0x0E, 0x0C, 0x0B, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x0D, 0x01, 0x00)) << 8)), 0x100);
|
||||
}
|
||||
}
|
||||
|
||||
static void NeoPCBDataDecrypt(UINT8* dst, INT32 size)
|
||||
{
|
||||
for (INT32 i = 0; i < size / 4; i++) {
|
||||
for (INT32 i = 0; i < size / 4; i++)
|
||||
((UINT32*)dst)[i] = BURN_ENDIAN_SWAP_INT32(BITSWAP32(0xE9C42134 ^ BURN_ENDIAN_SWAP_INT32(((UINT32*)dst)[i]), 0x09, 0x0D, 0x13, 0x00, 0x17, 0x0F, 0x03, 0x05, 0x04, 0x0C, 0x11, 0x1E, 0x12, 0x15, 0x0B, 0x06, 0x1B, 0x0A, 0x1A, 0x1C, 0x14, 0x02, 0x0e, 0x1D, 0x18, 0x08, 0x01, 0x10, 0x19, 0x1F, 0x07, 0x16));
|
||||
}
|
||||
}
|
||||
|
||||
// This function loads and pre-processes the sprite data
|
||||
@ -78,8 +76,6 @@ INT32 NeoLoadSprites(INT32 nOffset, INT32 nNum, UINT8* pDest, UINT32 nSpriteSize
|
||||
UINT8* pBuf1 = NULL;
|
||||
UINT8* pBuf2 = NULL;
|
||||
|
||||
// double dProgress = 1.0 / ((double)((nSpriteSize > 0x04000000) ? 0x05000000 : nSpriteSize) / 0x400000 * 1.5);
|
||||
|
||||
BurnDrvGetRomInfo(&ri, nOffset);
|
||||
nRomSize = ri.nLen;
|
||||
|
||||
@ -92,66 +88,66 @@ INT32 NeoLoadSprites(INT32 nOffset, INT32 nNum, UINT8* pDest, UINT32 nSpriteSize
|
||||
}
|
||||
|
||||
pBuf1 = (UINT8*)BurnMalloc(nRomSize * 2);
|
||||
if (pBuf1 == NULL) {
|
||||
if (pBuf1 == NULL)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) {
|
||||
// dProgress *= 0.75;
|
||||
|
||||
if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB)
|
||||
{
|
||||
pBuf2 = (UINT8*)BurnMalloc(nRomSize * 2);
|
||||
if (pBuf2 == NULL) {
|
||||
if (pBuf2 == NULL)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (INT32 i = 0; i < (nNum >> 1); i++) {
|
||||
for (INT32 i = 0; i < (nNum >> 1); i++)
|
||||
{
|
||||
if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) {
|
||||
if (nRomSize == 0x02000000) {
|
||||
|
||||
if (nRomSize == 0x02000000)
|
||||
{
|
||||
// The ROM chips are 32-bit
|
||||
|
||||
BurnLoadRom(pBuf2 + 0 * nRomSize, nOffset + (i << 1), 1);
|
||||
BurnLoadRom(pBuf2 + 1 * nRomSize, nOffset + 1 + (i << 1), 1);
|
||||
} else {
|
||||
|
||||
// The ROM chips are 16-bit and need to be interleaved
|
||||
|
||||
BurnLoadRom(pBuf1, nOffset + (i << 1), 1);
|
||||
for (UINT32 j = 0; j < nRomSize / 2; j++) {
|
||||
((UINT16*)pBuf2)[(j << 1) + 0] = ((UINT16*)pBuf1)[j];
|
||||
}
|
||||
BurnLoadRom(pBuf1, nOffset + 1 + (i << 1), 1);
|
||||
for (UINT32 j = 0; j < nRomSize / 2; j++) {
|
||||
((UINT16*)pBuf2)[(j << 1) + 1] = ((UINT16*)pBuf1)[j];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
else
|
||||
{
|
||||
// The ROM chips are 16-bit and need to be interleaved
|
||||
|
||||
BurnLoadRom(pBuf1, nOffset + (i << 1), 1);
|
||||
for (UINT32 j = 0; j < nRomSize / 2; j++)
|
||||
((UINT16*)pBuf2)[(j << 1) + 0] = ((UINT16*)pBuf1)[j];
|
||||
BurnLoadRom(pBuf1, nOffset + 1 + (i << 1), 1);
|
||||
for (UINT32 j = 0; j < nRomSize / 2; j++)
|
||||
((UINT16*)pBuf2)[(j << 1) + 1] = ((UINT16*)pBuf1)[j];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BurnLoadRom(pBuf1 + 0, nOffset + (i << 1), 2);
|
||||
BurnLoadRom(pBuf1 + 1, nOffset + 1 + (i << 1), 2);
|
||||
}
|
||||
|
||||
// BurnUpdateProgress(0.0, _T("Decrypting graphics...")/*, BST_DECRYPT_GRA*/ , 0);
|
||||
BurnUpdateProgress(1.0 / ((double)(nSpriteSize/0x800000) * 8.0 / (nRomSize / 0x400000) / 3.0), _T("Decrypting graphics..."), 0);
|
||||
|
||||
if ((i * nRomSize * 2) < 0x04000000) {
|
||||
for (UINT32 j = 0; j < nRomSize * 2; j += 0x400000) {
|
||||
if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) {
|
||||
// BurnUpdateProgress(dProgress / 2.0, NULL/*, 0*/, 0);
|
||||
if ((i * nRomSize * 2) < 0x04000000)
|
||||
{
|
||||
for (UINT32 j = 0; j < nRomSize * 2; j += 0x400000)
|
||||
{
|
||||
if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB)
|
||||
{
|
||||
(BurnDrvGetHardwareCode() & HARDWARE_SNK_KOF2K3) ? NeoKOFAddressDecrypt(pBuf2, pBuf1, j, j + 0x400000) : NeoSVCAddressDecrypt(pBuf2, pBuf1, j, j + 0x400000);
|
||||
NeoPCBDataDecrypt(pBuf1 + j, 0x400000);
|
||||
}
|
||||
// BurnUpdateProgress(dProgress, NULL/*, 0*/, 0);
|
||||
NeoCMCDecrypt(nNeoProtectionXor, pDest, pBuf1 + j, i * (nRomSize * 2) + j, 0x400000, nSpriteSize);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// The kof2k3 PCB has 96MB of graphics ROM, however the last 16MB are unused, and the protection/decryption hardware does not see them
|
||||
|
||||
for (UINT32 j = 0; j < nRomSize; j += 0x400000) {
|
||||
// BurnUpdateProgress(dProgress / 2.0, NULL/*, 0*/, 0);
|
||||
for (UINT32 j = 0; j < nRomSize; j += 0x400000)
|
||||
{
|
||||
NeoKOFAddressDecrypt(pBuf2, pBuf1, j, j + 0x400000);
|
||||
NeoPCBDataDecrypt(pBuf1 + j, 0x400000);
|
||||
// BurnUpdateProgress(dProgress, NULL, /*0,*/ 0);
|
||||
NeoCMCDecrypt(nNeoProtectionXor, pDest + 0x4000000, pBuf1 + j, j, 0x400000, 0x1000000);
|
||||
}
|
||||
}
|
||||
@ -231,88 +227,53 @@ INT32 NeoLoadSprites(INT32 nOffset, INT32 nNum, UINT8* pDest, UINT32 nSpriteSize
|
||||
|
||||
void NeoDecodeSprites(UINT8* pDest, INT32 nSize)
|
||||
{
|
||||
// double dProgress = 0.0;
|
||||
|
||||
// if (nSize > 0x04000000) {
|
||||
// nSize = 0x04000000;
|
||||
// }
|
||||
|
||||
/* if ((BurnDrvGetHardwareCode() & HARDWARE_PUBLIC_MASK) == HARDWARE_SNK_DEDICATED_PCB) {
|
||||
dProgress = 1.0 / 32.0;
|
||||
} else if (BurnDrvGetHardwareCode() & (HARDWARE_SNK_CMC42 | HARDWARE_SNK_CMC50)) {
|
||||
dProgress = 1.0 / 24.0;
|
||||
} else {
|
||||
dProgress = 1.0 / 8.0;
|
||||
}*/
|
||||
|
||||
for (INT32 i = 0; i < 8; i++) {
|
||||
|
||||
UINT8* pStart = pDest + i * (nSize >> 3);
|
||||
UINT8* pEnd = pStart + (nSize >> 3);
|
||||
|
||||
// BurnUpdateProgress(dProgress, i ? NULL : _T("Preprocessing graphics...")/*, BST_PROCESS_GRA*/, 0);
|
||||
|
||||
INT32 nStep = 8;
|
||||
if (BurnDrvGetHardwareCode() & (HARDWARE_SNK_CMC42 | HARDWARE_SNK_CMC50)) {
|
||||
if (BurnDrvGetHardwareCode() & (HARDWARE_SNK_CMC42 | HARDWARE_SNK_CMC50))
|
||||
nStep *= 4;
|
||||
}
|
||||
BurnUpdateProgress(1.0 / nStep, i ? NULL : _T("Preprocessing graphics..."), 0);
|
||||
|
||||
// Pre-process the sprite graphics
|
||||
for (UINT8* pTile = pStart; pTile < pEnd; pTile += 128) {
|
||||
UINT32 data[32];
|
||||
for (UINT8* pTile = pStart; pTile < pEnd; pTile += 128)
|
||||
{
|
||||
UINT32 data[32];
|
||||
|
||||
for (INT32 y = 0; y < 16; y++) {
|
||||
UINT32 n = 0;
|
||||
for (INT32 x = 0; x < 8; x++) {
|
||||
UINT32 m = ((pTile[67 + (y << 2)] >> x) & 1) << 3;
|
||||
m |= ((pTile[65 + (y << 2)] >> x) & 1) << 2;
|
||||
m |= ((pTile[66 + (y << 2)] >> x) & 1) << 1;
|
||||
m |= ((pTile[64 + (y << 2)] >> x) & 1) << 0;
|
||||
for (INT32 y = 0; y < 16; y++)
|
||||
{
|
||||
UINT32 n = 0;
|
||||
for (INT32 x = 0; x < 8; x++)
|
||||
{
|
||||
UINT32 m = ((pTile[67 + (y << 2)] >> x) & 1) << 3;
|
||||
m |= ((pTile[65 + (y << 2)] >> x) & 1) << 2;
|
||||
m |= ((pTile[66 + (y << 2)] >> x) & 1) << 1;
|
||||
m |= ((pTile[64 + (y << 2)] >> x) & 1) << 0;
|
||||
|
||||
n |= m << (x << 2);
|
||||
}
|
||||
data[(y << 1) + 0] = n;
|
||||
n |= m << (x << 2);
|
||||
}
|
||||
data[(y << 1) + 0] = n;
|
||||
|
||||
n = 0;
|
||||
for (INT32 x = 0; x < 8; x++) {
|
||||
UINT32 m = ((pTile[3 + (y << 2)] >> x) & 1) << 3;
|
||||
m |= ((pTile[1 + (y << 2)] >> x) & 1) << 2;
|
||||
m |= ((pTile[2 + (y << 2)] >> x) & 1) << 1;
|
||||
m |= ((pTile[0 + (y << 2)] >> x) & 1) << 0;
|
||||
n = 0;
|
||||
for (INT32 x = 0; x < 8; x++)
|
||||
{
|
||||
UINT32 m = ((pTile[3 + (y << 2)] >> x) & 1) << 3;
|
||||
m |= ((pTile[1 + (y << 2)] >> x) & 1) << 2;
|
||||
m |= ((pTile[2 + (y << 2)] >> x) & 1) << 1;
|
||||
m |= ((pTile[0 + (y << 2)] >> x) & 1) << 0;
|
||||
|
||||
n |= m << (x << 2);
|
||||
}
|
||||
data[(y << 1) + 1] = n;
|
||||
}
|
||||
for (INT32 n = 0; n < 32; n++) {
|
||||
((UINT32*)pTile)[n] = data[n];
|
||||
}
|
||||
}
|
||||
n |= m << (x << 2);
|
||||
}
|
||||
data[(y << 1) + 1] = n;
|
||||
}
|
||||
for (INT32 n = 0; n < 32; n++)
|
||||
((UINT32*)pTile)[n] = data[n];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void NeoDecodeText(UINT8* pDest, INT32 nSize)
|
||||
{
|
||||
// Pre-process the text layer graphics
|
||||
for (UINT8* pTile = pDest; pTile < (pDest + nSize); pTile += 32) {
|
||||
UINT8 data[32];
|
||||
for (INT32 n = 0; n < 8; n++) {
|
||||
data[0 + n * 4] = pTile[16 + n];
|
||||
data[1 + n * 4] = pTile[24 + n];
|
||||
data[2 + n * 4] = pTile[ 0 + n];
|
||||
data[3 + n * 4] = pTile[ 8 + n];
|
||||
}
|
||||
|
||||
for (INT32 n = 0; n < 32; n++) {
|
||||
pTile[n] = data[n] << 4;
|
||||
pTile[n] |= data[n] >> 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Graphics decoding for Neo CD
|
||||
#ifdef WANT_NEOGEOCD
|
||||
@ -364,65 +325,65 @@ INT32 NeoLoadADPCM(INT32 nOffset, INT32 nNum, UINT8* pDest)
|
||||
|
||||
BurnDrvGetRomInfo(&ri, nOffset);
|
||||
|
||||
for (INT32 i = 0; i < nNum; i++) {
|
||||
for (INT32 i = 0; i < nNum; i++)
|
||||
BurnLoadRom(pDest + ri.nLen * i, nOffset + i, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This function fills the screen with the first palette entry
|
||||
void NeoClearScreen()
|
||||
void NeoClearScreen(void)
|
||||
{
|
||||
UINT32 nColour = NeoPalette[0x0FFF];
|
||||
UINT32 nColour = NeoPalette[0x0FFF];
|
||||
|
||||
if (nColour) {
|
||||
switch (nBurnBpp) {
|
||||
case 4: {
|
||||
UINT32* pClear = (UINT32*)pBurnDraw;
|
||||
for (INT32 i = 0; i < nNeoScreenWidth * 224 / 8; i++) {
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (nColour)
|
||||
{
|
||||
switch (nBurnBpp)
|
||||
{
|
||||
case 4: {
|
||||
UINT32* pClear = (UINT32*)pBurnDraw;
|
||||
for (INT32 i = 0; i < nNeoScreenWidth * 224 / 8; i++) {
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: {
|
||||
UINT8* pClear = pBurnDraw;
|
||||
UINT8 r = nColour;
|
||||
UINT8 g = (nColour >> 8) & 0xFF;
|
||||
UINT8 b = (nColour >> 16) & 0xFF;
|
||||
for (INT32 i = 0; i < nNeoScreenWidth * 224; i++) {
|
||||
*pClear++ = r;
|
||||
*pClear++ = g;
|
||||
*pClear++ = b;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
UINT8* pClear = pBurnDraw;
|
||||
UINT8 r = nColour;
|
||||
UINT8 g = (nColour >> 8) & 0xFF;
|
||||
UINT8 b = (nColour >> 16) & 0xFF;
|
||||
for (INT32 i = 0; i < nNeoScreenWidth * 224; i++) {
|
||||
*pClear++ = r;
|
||||
*pClear++ = g;
|
||||
*pClear++ = b;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
UINT32* pClear = (UINT32*)pBurnDraw;
|
||||
nColour |= nColour << 16;
|
||||
for (INT32 i = 0; i < nNeoScreenWidth * 224 / 16; i++) {
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
memset(pBurnDraw, 0, nNeoScreenWidth * 224 * nBurnBpp);
|
||||
}
|
||||
case 2: {
|
||||
UINT32* pClear = (UINT32*)pBurnDraw;
|
||||
nColour |= nColour << 16;
|
||||
for (INT32 i = 0; i < nNeoScreenWidth * 224 / 16; i++) {
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
*pClear++ = nColour;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
memset(pBurnDraw, 0, nNeoScreenWidth * 224 * nBurnBpp);
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ INT32 BurnLoadRom(UINT8 *Dest, INT32 i, INT32 nGap)
|
||||
|
||||
// Load in the file
|
||||
nRet=BurnExtLoadRom(Load,&nLoadLen,i);
|
||||
if (bDoIpsPatch) IpsApplyPatches(Load, RomName);
|
||||
if (nRet!=0) { if (Load) { free(Load); Load = NULL; } return 1; }
|
||||
|
||||
if (nLoadLen<0) nLoadLen=0;
|
||||
@ -61,7 +60,6 @@ INT32 BurnLoadRom(UINT8 *Dest, INT32 i, INT32 nGap)
|
||||
{
|
||||
// If no XOR, and gap of 1, just copy straight in
|
||||
nRet=BurnExtLoadRom(Dest,NULL,i);
|
||||
if (bDoIpsPatch) IpsApplyPatches(Dest, RomName);
|
||||
if (nRet!=0) return 1;
|
||||
}
|
||||
|
||||
|
@ -73,11 +73,8 @@ struct AY8910
|
||||
#define AY_PORTA (14)
|
||||
#define AY_PORTB (15)
|
||||
|
||||
|
||||
static struct AY8910 AYPSG[MAX_8910]; /* array of PSG's */
|
||||
|
||||
|
||||
|
||||
static void _AYWriteReg(INT32 n, INT32 r, INT32 v)
|
||||
{
|
||||
struct AY8910 *PSG = &AYPSG[n];
|
||||
@ -228,26 +225,14 @@ static void _AYWriteReg(INT32 n, INT32 r, INT32 v)
|
||||
{
|
||||
if (PSG->PortAwrite)
|
||||
(*PSG->PortAwrite)(0, PSG->Regs[AY_PORTA]);
|
||||
// else
|
||||
// logerror("PC %04x: warning - write %02x to 8910 #%d Port A\n",activecpu_get_pc(),PSG->Regs[AY_PORTA],n);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// logerror("warning: write to 8910 #%d Port A set as input - ignored\n",n);
|
||||
// }
|
||||
break;
|
||||
case AY_PORTB:
|
||||
if (PSG->Regs[AY_ENABLE] & 0x80)
|
||||
{
|
||||
if (PSG->PortBwrite)
|
||||
(*PSG->PortBwrite)(0, PSG->Regs[AY_PORTB]);
|
||||
// else
|
||||
// logerror("PC %04x: warning - write %02x to 8910 #%d Port B\n",activecpu_get_pc(),PSG->Regs[AY_PORTB],n);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// logerror("warning: write to 8910 #%d Port B set as input - ignored\n",n);
|
||||
// }
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -256,51 +241,43 @@ static void _AYWriteReg(INT32 n, INT32 r, INT32 v)
|
||||
/* write a register on AY8910 chip number 'n' */
|
||||
static void AYWriteReg(INT32 chip, INT32 r, INT32 v)
|
||||
{
|
||||
if (r > 15) return;
|
||||
if (r < 14)
|
||||
{
|
||||
struct AY8910 *PSG = &AYPSG[chip];
|
||||
if (r > 15) return;
|
||||
if (r < 14)
|
||||
{
|
||||
struct AY8910 *PSG = &AYPSG[chip];
|
||||
|
||||
if (r == AY_ESHAPE || PSG->Regs[r] != v)
|
||||
{
|
||||
// /* update the output buffer before changing the register */
|
||||
// stream_update(PSG->Channel,0);
|
||||
AYStreamUpdate();
|
||||
}
|
||||
}
|
||||
if (r == AY_ESHAPE || PSG->Regs[r] != v)
|
||||
{
|
||||
// /* update the output buffer before changing the register */
|
||||
// stream_update(PSG->Channel,0);
|
||||
AYStreamUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
_AYWriteReg(chip,r,v);
|
||||
_AYWriteReg(chip,r,v);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static UINT8 AYReadReg(INT32 n, INT32 r)
|
||||
{
|
||||
struct AY8910 *PSG = &AYPSG[n];
|
||||
struct AY8910 *PSG = &AYPSG[n];
|
||||
|
||||
|
||||
if (r > 15) return 0;
|
||||
if (r > 15) return 0;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case AY_PORTA:
|
||||
// if ((PSG->Regs[AY_ENABLE] & 0x40) != 0)
|
||||
// logerror("warning: read from 8910 #%d Port A set as output\n",n);
|
||||
/*
|
||||
even if the port is set as output, we still need to return the external
|
||||
data. Some games, like kidniki, need this to work.
|
||||
*/
|
||||
if (PSG->PortAread) PSG->Regs[AY_PORTA] = (*PSG->PortAread)(0);
|
||||
// else logerror("PC %04x: warning - read 8910 #%d Port A\n",activecpu_get_pc(),n);
|
||||
break;
|
||||
case AY_PORTB:
|
||||
// if ((PSG->Regs[AY_ENABLE] & 0x80) != 0)
|
||||
// logerror("warning: read from 8910 #%d Port B set as output\n",n);
|
||||
if (PSG->PortBread) PSG->Regs[AY_PORTB] = (*PSG->PortBread)(0);
|
||||
// else logerror("PC %04x: warning - read 8910 #%d Port B\n",activecpu_get_pc(),n);
|
||||
break;
|
||||
}
|
||||
return PSG->Regs[r];
|
||||
switch (r)
|
||||
{
|
||||
case AY_PORTA:
|
||||
/*
|
||||
even if the port is set as output, we still need to return the external
|
||||
data. Some games, like kidniki, need this to work.
|
||||
*/
|
||||
if (PSG->PortAread) PSG->Regs[AY_PORTA] = (*PSG->PortAread)(0);
|
||||
break;
|
||||
case AY_PORTB:
|
||||
if (PSG->PortBread) PSG->Regs[AY_PORTB] = (*PSG->PortBread)(0);
|
||||
break;
|
||||
}
|
||||
return PSG->Regs[r];
|
||||
}
|
||||
|
||||
void AY8910Write(INT32 chip, INT32 a, INT32 data)
|
||||
|
@ -106,13 +106,8 @@
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifndef __RAINE__
|
||||
#include "driver.h" /* use M.A.M.E. */
|
||||
#include "state.h"
|
||||
#else
|
||||
#include "deftypes.h" /* use RAINE */
|
||||
#include "support.h" /* use RAINE */
|
||||
#endif
|
||||
|
||||
#include "ay8910.h"
|
||||
#include "fm.h"
|
||||
@ -724,16 +719,6 @@ static INT32 out_delta[4]; /* channel output NONE,LEFT,RIGHT or CENTER for YM260
|
||||
static UINT32 LFO_AM; /* runtime LFO calculations helper */
|
||||
static INT32 LFO_PM; /* runtime LFO calculations helper */
|
||||
|
||||
/* log output level */
|
||||
#define LOG_ERR 3 /* ERROR */
|
||||
#define LOG_WAR 2 /* WARNING */
|
||||
#define LOG_INF 1 /* INFORMATION */
|
||||
#define LOG_LEVEL LOG_INF
|
||||
|
||||
#ifndef __RAINE__
|
||||
#define LOG(n,x) if( (n)>=LOG_LEVEL ) logerror x
|
||||
#endif
|
||||
|
||||
/* limitter */
|
||||
#define Limit(val, max,min) { \
|
||||
if ( val > max ) val = max; \
|
||||
@ -1638,20 +1623,12 @@ static void init_timetables( FM_ST *ST , const UINT8 *dttable )
|
||||
int i,d;
|
||||
double rate;
|
||||
|
||||
#if 0
|
||||
logerror("FM.C: samplerate=%8i chip clock=%8i freqbase=%f \n",
|
||||
ST->rate, ST->clock, ST->freqbase );
|
||||
#endif
|
||||
|
||||
/* DeTune table */
|
||||
for (d = 0;d <= 3;d++){
|
||||
for (i = 0;i <= 31;i++){
|
||||
rate = ((double)dttable[d*32 + i]) * SIN_LEN * ST->freqbase * (1<<FREQ_SH) / ((double)(1<<20));
|
||||
ST->dt_tab[d][i] = (INT32) rate;
|
||||
ST->dt_tab[d+4][i] = -ST->dt_tab[d][i];
|
||||
#if 0
|
||||
logerror("FM.C: DT [%2i %2i] = %8x \n", d, i, ST->dt_tab[d][i] );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1713,16 +1690,7 @@ static int init_tables(void)
|
||||
tl_tab[ x*2+0 + i*2*TL_RES_LEN ] = tl_tab[ x*2+0 ]>>i;
|
||||
tl_tab[ x*2+1 + i*2*TL_RES_LEN ] = -tl_tab[ x*2+0 + i*2*TL_RES_LEN ];
|
||||
}
|
||||
#if 0
|
||||
logerror("tl %04i", x);
|
||||
for (i=0; i<13; i++)
|
||||
logerror(", [%02i] %4x", i*2, tl_tab[ x*2 /*+1*/ + i*2*TL_RES_LEN ]);
|
||||
logerror("\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*logerror("FM.C: TL_TAB_LEN = %i elements (%i bytes)\n",TL_TAB_LEN, (int)sizeof(tl_tab));*/
|
||||
|
||||
|
||||
for (i=0; i<SIN_LEN; i++)
|
||||
{
|
||||
@ -1745,12 +1713,8 @@ static int init_tables(void)
|
||||
n = n>>1;
|
||||
|
||||
sin_tab[ i ] = n*2 + (m>=0.0? 0: 1 );
|
||||
/*logerror("FM.C: sin [%4i]= %4i (tl_tab value=%5i)\n", i, sin_tab[i],tl_tab[sin_tab[i]]);*/
|
||||
}
|
||||
|
||||
/*logerror("FM.C: ENV_QUIET= %08x\n",ENV_QUIET );*/
|
||||
|
||||
|
||||
/* build LFO PM modulation table */
|
||||
for(i = 0; i < 8; i++) /* 8 PM depths */
|
||||
{
|
||||
@ -1779,13 +1743,6 @@ static int init_tables(void)
|
||||
lfo_pm_table[(fnum*32*8) + (i*32) + step +16] = -value;
|
||||
lfo_pm_table[(fnum*32*8) + (i*32) +(step^7)+24] = -value;
|
||||
}
|
||||
#if 0
|
||||
logerror("LFO depth=%1x FNUM=%04x (<<4=%4x): ", i, fnum, fnum<<4);
|
||||
for (step=0; step<16; step++) /* dump only positive part of waveforms */
|
||||
logerror("%02x ", lfo_pm_table[(fnum*32*8) + (i*32) + step] );
|
||||
logerror("\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1894,11 +1851,6 @@ static void OPNSetPres(FM_OPN *OPN , int pres , int TimerPres, int SSGpres)
|
||||
/* frequency base */
|
||||
OPN->ST.freqbase = (OPN->ST.rate) ? ((double)OPN->ST.clock / OPN->ST.rate) / pres : 0;
|
||||
|
||||
#if 0
|
||||
OPN->ST.rate = (double)OPN->ST.clock / pres;
|
||||
OPN->ST.freqbase = 1.0;
|
||||
#endif
|
||||
|
||||
OPN->eg_timer_add = (1<<EG_SH) * OPN->ST.freqbase;
|
||||
OPN->eg_timer_overflow = ( 3 ) * (1<<EG_SH);
|
||||
|
||||
@ -1915,31 +1867,19 @@ static void OPNSetPres(FM_OPN *OPN , int pres , int TimerPres, int SSGpres)
|
||||
/* there are 2048 FNUMs that can be generated using FNUM/BLK registers
|
||||
but LFO works with one more bit of a precision so we really need 4096 elements */
|
||||
/* calculate fnumber -> increment counter table */
|
||||
/* freq table for octave 7 */
|
||||
/* OPN phase increment counter = 20bit */
|
||||
for(i = 0; i < 4096; i++)
|
||||
{
|
||||
/* freq table for octave 7 */
|
||||
/* OPN phase increment counter = 20bit */
|
||||
OPN->fn_table[i] = (UINT32)( (double)i * 32 * OPN->ST.freqbase * (1<<(FREQ_SH-10)) ); /* -10 because chip works with 10.10 fixed point, while we use 16.16 */
|
||||
#if 0
|
||||
logerror("FM.C: fn_table[%4i] = %08x (dec=%8i)\n",
|
||||
i, OPN->fn_table[i]>>6,OPN->fn_table[i]>>6 );
|
||||
#endif
|
||||
}
|
||||
|
||||
/* maximal frequency is required for Phase overflow calculation, register size is 17 bits (Nemesis) */
|
||||
OPN->fn_max = (UINT32)( (double)0x20000 * OPN->ST.freqbase * (1<<(FREQ_SH-10)) );
|
||||
|
||||
/* LFO freq. table */
|
||||
/* Amplitude modulation: 64 output levels (triangle waveform); 1 level lasts for one of "lfo_samples_per_step" samples */
|
||||
/* Phase modulation: one entry from lfo_pm_output lasts for one of 4 * "lfo_samples_per_step" samples */
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
/* Amplitude modulation: 64 output levels (triangle waveform); 1 level lasts for one of "lfo_samples_per_step" samples */
|
||||
/* Phase modulation: one entry from lfo_pm_output lasts for one of 4 * "lfo_samples_per_step" samples */
|
||||
OPN->lfo_freq[i] = (1.0 / lfo_samples_per_step[i]) * (1<<LFO_SH) * OPN->ST.freqbase;
|
||||
#if 0
|
||||
logerror("FM.C: lfo_freq[%i] = %08x (dec=%8i)\n",
|
||||
i, OPN->lfo_freq[i],OPN->lfo_freq[i] );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2309,12 +2249,6 @@ INLINE void ADPCMA_calc_chan( YM2610 *F2610, ADPCM_CH *ch )
|
||||
F2610->adpcm_arrivedEndAddress |= ch->flagMask;
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
if ( ch->now_addr > (pcmsizeA<<1) ) {
|
||||
LOG(LOG_WAR,("YM2610: Attempting to play past adpcm rom size!\n" ));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if ( ch->now_addr&1 )
|
||||
data = ch->now_data & 0x0f;
|
||||
else
|
||||
@ -2371,19 +2305,12 @@ static void FM_ADPCMAWrite(YM2610 *F2610,int r,int v)
|
||||
adpcm[c].adpcm_out = 0;
|
||||
adpcm[c].flag = 1;
|
||||
|
||||
if(F2610->pcmbuf==NULL){ /* Check ROM Mapped */
|
||||
logerror("YM2608-YM2610: ADPCM-A rom not mapped\n");
|
||||
if(F2610->pcmbuf==NULL) /* Check ROM Mapped */
|
||||
adpcm[c].flag = 0;
|
||||
} else{
|
||||
if(adpcm[c].end >= F2610->pcm_size){ /* Check End in Range */
|
||||
logerror("YM2610: ADPCM-A end out of range: $%08x\n",adpcm[c].end);
|
||||
/*adpcm[c].end = F2610->pcm_size-1;*/ /* JB: DO NOT uncomment this, otherwise you will break the comparison in the ADPCM_CALC_CHA() */
|
||||
}
|
||||
else
|
||||
{
|
||||
if(adpcm[c].start >= F2610->pcm_size) /* Check Start in Range */
|
||||
{
|
||||
logerror("YM2608-YM2610: ADPCM-A start out of range: $%08x\n",adpcm[c].start);
|
||||
adpcm[c].flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2513,15 +2440,6 @@ void YM2610UpdateOne(int num, INT16 **buffer, int length)
|
||||
pcmsizeA = F2610->pcm_size;
|
||||
|
||||
}
|
||||
#ifdef YM2610B_WARNING
|
||||
#define FM_KEY_IS(SLOT) ((SLOT)->key)
|
||||
#define FM_MSG_YM2610B "YM2610-%d.CH%d is playing,Check whether the type of the chip is YM2610B\n"
|
||||
/* Check YM2610B warning message */
|
||||
if( FM_KEY_IS(&F2610->CH[0].SLOT[3]) )
|
||||
LOG(LOG_WAR,(FM_MSG_YM2610B,num,0));
|
||||
if( FM_KEY_IS(&F2610->CH[3].SLOT[3]) )
|
||||
LOG(LOG_WAR,(FM_MSG_YM2610B,num,3));
|
||||
#endif
|
||||
|
||||
/* refresh PG and EG */
|
||||
refresh_fc_eg_chan( OPN, cch[0] );
|
||||
@ -3051,40 +2969,39 @@ int YM2610Write(int n, int a, UINT8 v)
|
||||
YM2610UpdateReq(n);
|
||||
|
||||
switch(addr)
|
||||
{
|
||||
case 0x10: /* control 1 */
|
||||
case 0x11: /* control 2 */
|
||||
case 0x12: /* start address L */
|
||||
case 0x13: /* start address H */
|
||||
case 0x14: /* stop address L */
|
||||
case 0x15: /* stop address H */
|
||||
{
|
||||
case 0x10: /* control 1 */
|
||||
case 0x11: /* control 2 */
|
||||
case 0x12: /* start address L */
|
||||
case 0x13: /* start address H */
|
||||
case 0x14: /* stop address L */
|
||||
case 0x15: /* stop address H */
|
||||
|
||||
case 0x19: /* delta-n L */
|
||||
case 0x1a: /* delta-n H */
|
||||
case 0x1b: /* volume */
|
||||
{
|
||||
YM_DELTAT_ADPCM_Write(&F2610->deltaT,addr-0x10,v);
|
||||
}
|
||||
break;
|
||||
case 0x19: /* delta-n L */
|
||||
case 0x1a: /* delta-n H */
|
||||
case 0x1b: /* volume */
|
||||
{
|
||||
YM_DELTAT_ADPCM_Write(&F2610->deltaT,addr-0x10,v);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x1c: /* FLAG CONTROL : Extend Status Clear/Mask */
|
||||
{
|
||||
UINT8 statusmask = ~v;
|
||||
/* set arrived flag mask */
|
||||
for(ch=0;ch<6;ch++)
|
||||
F2610->adpcm[ch].flagMask = statusmask&(1<<ch);
|
||||
case 0x1c: /* FLAG CONTROL : Extend Status Clear/Mask */
|
||||
{
|
||||
UINT8 statusmask = ~v;
|
||||
/* set arrived flag mask */
|
||||
for(ch=0;ch<6;ch++)
|
||||
F2610->adpcm[ch].flagMask = statusmask&(1<<ch);
|
||||
|
||||
F2610->deltaT.status_change_EOS_bit = statusmask & 0x80; /* status flag: set bit7 on End Of Sample */
|
||||
F2610->deltaT.status_change_EOS_bit = statusmask & 0x80; /* status flag: set bit7 on End Of Sample */
|
||||
|
||||
/* clear arrived flag */
|
||||
F2610->adpcm_arrivedEndAddress &= statusmask;
|
||||
}
|
||||
break;
|
||||
/* clear arrived flag */
|
||||
F2610->adpcm_arrivedEndAddress &= statusmask;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
logerror("YM2610: write to unknown deltat register %02x val=%02x\n",addr,v);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 0x20: /* Mode Register */
|
||||
|
@ -12,8 +12,6 @@
|
||||
#define BUILD_YM2610B (HAS_YM2610B) /* build YM2610B(OPNB?)emulator */
|
||||
#define BUILD_YM2612 (HAS_YM2612 || HAS_YM3438) /* build YM2612(OPN2) emulator */
|
||||
|
||||
//#define BUILD_YM2151 (HAS_YM2151) /* build YM2151(OPM) emulator */
|
||||
|
||||
/* select bit size of output : 8 or 16 */
|
||||
#define FM_SAMPLE_BITS 16
|
||||
|
||||
@ -76,32 +74,12 @@ void BurnYM2610UpdateRequest(void);
|
||||
void BurnYM2612UpdateRequest(void);
|
||||
#define YM2612UpdateReq(chip) BurnYM2612UpdateRequest()
|
||||
#endif
|
||||
#if 0 //BUILD_YM2151
|
||||
/* in 2151intf.c */
|
||||
#define YM2151UpdateReq(chip) YM2151UpdateRequest(chip);
|
||||
#endif
|
||||
|
||||
/* compiler dependence */
|
||||
#if 0
|
||||
#ifndef OSD_CPU_H
|
||||
#define OSD_CPU_H
|
||||
typedef unsigned char UINT8; /* unsigned 8bit */
|
||||
typedef unsigned short UINT16; /* unsigned 16bit */
|
||||
typedef unsigned int UINT32; /* unsigned 32bit */
|
||||
typedef signed char INT8; /* signed 8bit */
|
||||
typedef signed short INT16; /* signed 16bit */
|
||||
typedef signed int INT32; /* signed 32bit */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef INLINE
|
||||
#define INLINE static __inline__
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if (FM_SAMPLE_BITS==16)
|
||||
typedef INT16 FMSAMPLE;
|
||||
#endif
|
||||
@ -217,25 +195,4 @@ unsigned char YM2612Read(int n,int a);
|
||||
int YM2612TimerOver(int n, int c );
|
||||
#endif /* BUILD_YM2612 */
|
||||
|
||||
#if 0 //BUILD_YM2151
|
||||
/* -------------------- YM2151(OPM) Interface -------------------- */
|
||||
int OPMInit(int num, int baseclock, int rate,
|
||||
FM_TIMERHANDLER TimerHandler,FM_IRQHANDLER IRQHandler);
|
||||
void OPMShutdown(void);
|
||||
void OPMResetChip(int num);
|
||||
|
||||
void OPMUpdateOne(int num, INT16 **buffer, int length );
|
||||
/* ---- set callback hander when port CT0/1 write ----- */
|
||||
/* CT.bit0 = CT0 , CT.bit1 = CT1 */
|
||||
/*
|
||||
typedef void (*write8_handler)(int offset,int data);
|
||||
*/
|
||||
void OPMSetPortHander(int n,write8_handler PortWrite);
|
||||
/* JB 981119 - so it will match MAME's memory write functions scheme*/
|
||||
|
||||
int YM2151Write(int n,int a,unsigned char v);
|
||||
unsigned char YM2151Read(int n,int a);
|
||||
int YM2151TimerOver(int n,int c);
|
||||
#endif /* BUILD_YM2151 */
|
||||
|
||||
#endif /* _H_FM_FM_ */
|
||||
|
@ -88,18 +88,6 @@ const INT32 ym_deltat_decode_tableB2[16] = {
|
||||
57, 57, 57, 57, 77, 102, 128, 153
|
||||
};
|
||||
|
||||
#if 0
|
||||
void YM_DELTAT_BRDY_callback(YM_DELTAT *DELTAT)
|
||||
{
|
||||
logerror("BRDY_callback reached (flag set) !\n");
|
||||
|
||||
/* set BRDY bit in status register */
|
||||
if(DELTAT->status_set_handler)
|
||||
if(DELTAT->status_change_BRDY_bit)
|
||||
(DELTAT->status_set_handler)(DELTAT->status_change_which_chip, DELTAT->status_change_BRDY_bit);
|
||||
}
|
||||
#endif
|
||||
|
||||
UINT8 YM_DELTAT_ADPCM_Read(YM_DELTAT *DELTAT)
|
||||
{
|
||||
UINT8 v = 0;
|
||||
@ -120,8 +108,6 @@ UINT8 YM_DELTAT_ADPCM_Read(YM_DELTAT *DELTAT)
|
||||
{
|
||||
v = DELTAT->memory[DELTAT->now_addr>>1];
|
||||
|
||||
/*logerror("YM Delta-T memory read $%08x, v=$%02x\n", DELTAT->now_addr >> 1, v);*/
|
||||
|
||||
DELTAT->now_addr+=2; /* two nibbles at a time */
|
||||
|
||||
/* reset BRDY bit in status register, which means we are reading the memory now */
|
||||
@ -227,20 +213,15 @@ value: START, REC, MEMDAT, REPEAT, SPOFF, x,x,RESET meaning:
|
||||
/* if yes, then let's check if ADPCM memory is mapped and big enough */
|
||||
if(DELTAT->memory == 0)
|
||||
{
|
||||
logerror("YM Delta-T ADPCM rom not mapped\n");
|
||||
DELTAT->portstate = 0x00;
|
||||
DELTAT->PCM_BSY = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( DELTAT->end >= DELTAT->memory_size ) /* Check End in Range */
|
||||
{
|
||||
logerror("YM Delta-T ADPCM end out of range: $%08x\n", DELTAT->end);
|
||||
DELTAT->end = DELTAT->memory_size - 1;
|
||||
}
|
||||
if( DELTAT->start >= DELTAT->memory_size ) /* Check Start in Range */
|
||||
{
|
||||
logerror("YM Delta-T ADPCM start out of range: $%08x\n", DELTAT->start);
|
||||
DELTAT->portstate = 0x00;
|
||||
DELTAT->PCM_BSY = 0;
|
||||
}
|
||||
@ -298,13 +279,11 @@ value: START, REC, MEMDAT, REPEAT, SPOFF, x,x,RESET meaning:
|
||||
case 0x02: /* Start Address L */
|
||||
case 0x03: /* Start Address H */
|
||||
DELTAT->start = (DELTAT->reg[0x3]*0x0100 | DELTAT->reg[0x2]) << (DELTAT->portshift - DELTAT->DRAMportshift);
|
||||
/*logerror("DELTAT start: 02=%2x 03=%2x addr=%8x\n",DELTAT->reg[0x2], DELTAT->reg[0x3],DELTAT->start );*/
|
||||
break;
|
||||
case 0x04: /* Stop Address L */
|
||||
case 0x05: /* Stop Address H */
|
||||
DELTAT->end = (DELTAT->reg[0x5]*0x0100 | DELTAT->reg[0x4]) << (DELTAT->portshift - DELTAT->DRAMportshift);
|
||||
DELTAT->end += (1 << (DELTAT->portshift-DELTAT->DRAMportshift) ) - 1;
|
||||
/*logerror("DELTAT end : 04=%2x 05=%2x addr=%8x\n",DELTAT->reg[0x4], DELTAT->reg[0x5],DELTAT->end );*/
|
||||
break;
|
||||
case 0x06: /* Prescale L (ADPCM and Record frq) */
|
||||
case 0x07: /* Prescale H */
|
||||
@ -333,8 +312,6 @@ value: START, REC, MEMDAT, REPEAT, SPOFF, x,x,RESET meaning:
|
||||
DELTAT->memread = 0;
|
||||
}
|
||||
|
||||
/*logerror("YM Delta-T memory write $%08x, v=$%02x\n", DELTAT->now_addr >> 1, v);*/
|
||||
|
||||
if ( DELTAT->now_addr != (DELTAT->end<<1) )
|
||||
{
|
||||
DELTAT->memory[DELTAT->now_addr>>1] = v;
|
||||
@ -383,7 +360,6 @@ value: START, REC, MEMDAT, REPEAT, SPOFF, x,x,RESET meaning:
|
||||
case 0x0a: /* DELTA-N H */
|
||||
DELTAT->delta = (DELTAT->reg[0xa]*0x0100 | DELTAT->reg[0x9]);
|
||||
DELTAT->step = (UINT32)( (double)(DELTAT->delta /* *(1<<(YM_DELTAT_SHIFT-16)) */ ) * (DELTAT->freqbase) );
|
||||
/*logerror("DELTAT deltan:09=%2x 0a=%2x\n",DELTAT->reg[0x9], DELTAT->reg[0xa]);*/
|
||||
break;
|
||||
case 0x0b: /* Output level control (volume, linear) */
|
||||
{
|
||||
@ -395,17 +371,13 @@ value: START, REC, MEMDAT, REPEAT, SPOFF, x,x,RESET meaning:
|
||||
* v * ((1<<23)>>8) >> 15;
|
||||
* v * (1<<15) >> 15;
|
||||
*/
|
||||
/*logerror("DELTAT vol = %2x\n",v&0xff);*/
|
||||
if( oldvol != 0 )
|
||||
{
|
||||
DELTAT->adpcml = (int)((double)DELTAT->adpcml / (double)oldvol * (double)DELTAT->volume);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x0c: /* Limit Address L */
|
||||
case 0x0d: /* Limit Address H */
|
||||
DELTAT->limit = (DELTAT->reg[0xd]*0x0100 | DELTAT->reg[0xc]) << (DELTAT->portshift - DELTAT->DRAMportshift);
|
||||
/*logerror("DELTAT limit: 0c=%2x 0d=%2x addr=%8x\n",DELTAT->reg[0xc], DELTAT->reg[0xd],DELTAT->limit );*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -6,20 +6,14 @@
|
||||
#define YM_DELTAT_EMULATION_MODE_NORMAL 0
|
||||
#define YM_DELTAT_EMULATION_MODE_YM2610 1
|
||||
|
||||
|
||||
typedef void (*STATUS_CHANGE_HANDLER)(UINT8 which_chip, UINT8 status_bits);
|
||||
|
||||
|
||||
/* DELTA-T (adpcm type B) struct */
|
||||
typedef struct deltat_adpcm_state { /* AT: rearranged and tigntened structure */
|
||||
UINT8 *memory;
|
||||
INT32 *output_pointer;/* pointer of output pointers */
|
||||
INT32 *pan; /* pan : &output_pointer[pan] */
|
||||
double freqbase;
|
||||
#if 0
|
||||
double write_time; /* Y8950: 10 cycles of main clock; YM2608: 20 cycles of main clock */
|
||||
double read_time; /* Y8950: 8 cycles of main clock; YM2608: 18 cycles of main clock */
|
||||
#endif
|
||||
UINT32 memory_size;
|
||||
int output_range;
|
||||
UINT32 now_addr; /* current address */
|
||||
|
@ -15,7 +15,6 @@
|
||||
#define MAKE_STRING_2(s) #s
|
||||
#define MAKE_STRING(s) MAKE_STRING_2(s)
|
||||
|
||||
#include "title.h"
|
||||
#include "burn.h"
|
||||
#include "burner_libretro.h"
|
||||
|
||||
@ -35,20 +34,6 @@ extern INT32 nFireButtons;
|
||||
extern bool bStreetFighterLayout;
|
||||
extern bool bLeftAltkeyMapped;
|
||||
|
||||
INT32 GameInpInit();
|
||||
INT32 GameInpExit();
|
||||
TCHAR* InputCodeDesc(INT32 c);
|
||||
TCHAR* InpToDesc(struct GameInp* pgi);
|
||||
TCHAR* InpMacroToDesc(struct GameInp* pgi);
|
||||
INT32 GameInpBlank(INT32 bDipSwitch);
|
||||
INT32 GameInputAutoIni(INT32 nPlayer, TCHAR* lpszFile, bool bOverWrite);
|
||||
INT32 ConfigGameLoadHardwareDefaults();
|
||||
INT32 GameInpDefault();
|
||||
INT32 GameInpWrite(FILE* h);
|
||||
INT32 GameInpRead(TCHAR* szVal, bool bOverWrite);
|
||||
INT32 GameInpMacroRead(TCHAR* szVal, bool bOverWrite);
|
||||
INT32 GameInpCustomRead(TCHAR* szVal, bool bOverWrite);
|
||||
|
||||
// inp_interface.cpp
|
||||
extern INT32 nAutoFireRate;
|
||||
|
||||
@ -65,12 +50,6 @@ extern UINT8 macroSystemUNDOState;
|
||||
|
||||
// cong.cpp
|
||||
extern const INT32 nConfigMinVersion; // Minimum version of application for which input files are valid
|
||||
extern bool bSaveInputs;
|
||||
INT32 ConfigGameLoad(bool bOverWrite); // char* lpszName = NULL
|
||||
INT32 ConfigGameSave(bool bSave);
|
||||
|
||||
// conc.cpp
|
||||
INT32 ConfigCheatLoad();
|
||||
|
||||
// gamc.cpp
|
||||
INT32 GamcMisc(struct GameInp* pgi, char* szi, INT32 nPlayer);
|
||||
@ -85,17 +64,8 @@ INT32 QuoteRead(TCHAR** ppszQuote, TCHAR** ppszEnd, TCHAR* pszSrc); // Read
|
||||
TCHAR* LabelCheck(TCHAR* s, TCHAR* pszLabel);
|
||||
|
||||
TCHAR* ExtractFilename(TCHAR* fullname);
|
||||
TCHAR* DriverToName(UINT32 nDrv);
|
||||
UINT32 NameToDriver(TCHAR* szName);
|
||||
|
||||
extern INT32 bDoGamma;
|
||||
extern INT32 bHardwareGammaOnly;
|
||||
extern double nGamma;
|
||||
|
||||
INT32 SetBurnHighCol(INT32 nDepth);
|
||||
char* DecorateGameName(UINT32 nBurnDrv);
|
||||
TCHAR* DecorateGenreInfo();
|
||||
void ComputeGammaLUT();
|
||||
|
||||
// state.cpp
|
||||
INT32 BurnStateLoadEmbed(FILE* fp, INT32 nOffset, INT32 bAll, INT32 (*pLoadGame)());
|
||||
|
@ -4,13 +4,8 @@
|
||||
#include "gameinp.h"
|
||||
#include "input/inp_keys.h"
|
||||
|
||||
extern int bDrvOkay;
|
||||
extern int bRunPause;
|
||||
extern bool bAlwaysProcessKeyboardInput;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define snprintf _snprintf
|
||||
#define ANSIToTCHAR(str, foo, bar) (str)
|
||||
#endif
|
||||
|
||||
extern void InpDIPSWResetDIPs (void);
|
||||
|
@ -125,8 +125,6 @@ UINT8 *BurnMalloc(INT32 size)
|
||||
}
|
||||
}
|
||||
|
||||
bprintf (0, _T("BurnMalloc called too many times!\n"));
|
||||
|
||||
return NULL; // Freak out!
|
||||
}
|
||||
|
||||
@ -160,10 +158,8 @@ void BurnExitMemoryManager(void)
|
||||
void* tmp;
|
||||
for (INT32 i = 0; i < MAX_MEM_PTR; i++)
|
||||
{
|
||||
if (memptr[i] != NULL) {
|
||||
#if defined FBA_DEBUG
|
||||
bprintf(PRINT_ERROR, _T("BurnExitMemoryManager had to free mem pointer %i\n"), i);
|
||||
#endif
|
||||
if (memptr[i] != NULL)
|
||||
{
|
||||
if(!memsize[i])
|
||||
free(memptr[i]);
|
||||
else
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -322,10 +322,8 @@ static void NeoCDList_iso9660_CheckDirRecord(FILE* fp, int nSector)
|
||||
// Check the specified ISO, and proceed accordingly
|
||||
static int NeoCDList_CheckISO(TCHAR* pszFile)
|
||||
{
|
||||
if(!pszFile) {
|
||||
// error
|
||||
if(!pszFile)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Make sure we have a valid ISO file extension...
|
||||
if(_tcsstr(pszFile, _T(".iso")) || _tcsstr(pszFile, _T(".ISO")) )
|
||||
@ -357,7 +355,6 @@ static int NeoCDList_CheckISO(TCHAR* pszFile)
|
||||
// Verify that we have indeed a valid ISO9660 MODE1/2048
|
||||
if(!memcmp(IsoCheck, "CD001", 5))
|
||||
{
|
||||
//bprintf(PRINT_NORMAL, _T(" Standard ISO9660 Identifier Found. \n"));
|
||||
iso9660_VDH vdh;
|
||||
|
||||
// Get Volume Descriptor Header
|
||||
@ -368,29 +365,6 @@ static int NeoCDList_CheckISO(TCHAR* pszFile)
|
||||
// Check for a valid Volume Descriptor Type
|
||||
if(vdh.vdtype == 0x01)
|
||||
{
|
||||
#if 0
|
||||
// This will fail on 64-bit due to differing variable sizes in the pvd struct
|
||||
// Get Primary Volume Descriptor
|
||||
iso9660_PVD pvd;
|
||||
memset(&pvd, 0, sizeof(pvd));
|
||||
//memcpy(&pvd, iso9660_ReadOffset(fp, (2048 * 16), sizeof(pvd)), sizeof(pvd));
|
||||
iso9660_ReadOffset((unsigned char*)&pvd, fp, 2048 * 16, 1, sizeof(pvd));
|
||||
|
||||
// ROOT DIRECTORY RECORD
|
||||
|
||||
// Handle Path Table Location
|
||||
char szRootSector[32];
|
||||
unsigned int nRootSector = 0;
|
||||
|
||||
sprintf(szRootSector, "%02X%02X%02X%02X",
|
||||
pvd.root_directory_record.location_of_extent[4],
|
||||
pvd.root_directory_record.location_of_extent[5],
|
||||
pvd.root_directory_record.location_of_extent[6],
|
||||
pvd.root_directory_record.location_of_extent[7]);
|
||||
|
||||
// Convert HEX string to Decimal
|
||||
sscanf(szRootSector, "%X", &nRootSector);
|
||||
#else
|
||||
// Just read from the file directly at the correct offset (0x8000 + 0x9e for the start of the root directory record)
|
||||
unsigned char buffer[8];
|
||||
char szRootSector[4];
|
||||
@ -400,9 +374,7 @@ static int NeoCDList_CheckISO(TCHAR* pszFile)
|
||||
fread(buffer, 1, 8, fp);
|
||||
|
||||
sprintf(szRootSector, "%02x%02x%02x%02x", buffer[4], buffer[5], buffer[6], buffer[7]);
|
||||
|
||||
sscanf(szRootSector, "%x", &nRootSector);
|
||||
#endif
|
||||
|
||||
// Process the Root Directory Records
|
||||
NeoCDList_iso9660_CheckDirRecord(fp, nRootSector);
|
||||
@ -410,62 +382,46 @@ static int NeoCDList_CheckISO(TCHAR* pszFile)
|
||||
// Path Table Records are not processed, since NeoGeo CD should not have subdirectories
|
||||
// ...
|
||||
}
|
||||
} else {
|
||||
|
||||
//bprintf(PRINT_NORMAL, _T(" Standard ISO9660 Identifier Not Found, cannot continue. \n"));
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
|
||||
//bprintf(PRINT_NORMAL, _T(" Couldn't open %s \n"), GetIsoPath());
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
if(fp) fclose(fp);
|
||||
|
||||
} else {
|
||||
|
||||
//bprintf(PRINT_NORMAL, _T(" File doesn't have a valid ISO extension [ .iso / .ISO ] \n"));
|
||||
return 0;
|
||||
if(fp)
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// This will do everything
|
||||
int GetNeoGeoCD_Identifier()
|
||||
int GetNeoGeoCD_Identifier(void)
|
||||
{
|
||||
if(!GetIsoPath() || !IsNeoGeoCD()) {
|
||||
if(!GetIsoPath() || !IsNeoGeoCD())
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Make sure we have a valid ISO file extension...
|
||||
if(_tcsstr(GetIsoPath(), _T(".iso")) || _tcsstr(GetIsoPath(), _T(".ISO")) )
|
||||
{
|
||||
if(_tfopen(GetIsoPath(), _T("rb")))
|
||||
{
|
||||
// Read ISO and look for 68K ROM standard program header, ID is always there
|
||||
// Note: This function works very quick, doesn't compromise performance :)
|
||||
// it just read each sector first 264 bytes aproximately only.
|
||||
NeoCDList_CheckISO(GetIsoPath());
|
||||
|
||||
} else {
|
||||
|
||||
bprintf(PRINT_NORMAL, _T(" Couldn't open %s \n"), GetIsoPath());
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
bprintf(PRINT_NORMAL, _T(" File doesn't have a valid ISO extension [ .iso / .ISO ] \n"));
|
||||
{
|
||||
if(!fopen(GetIsoPath(), "rb"))
|
||||
return 0;
|
||||
// Read ISO and look for 68K ROM standard program header, ID is always there
|
||||
// Note: This function works very quick, doesn't compromise performance :)
|
||||
// it just read each sector first 264 bytes aproximately only.
|
||||
NeoCDList_CheckISO(GetIsoPath());
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int NeoCDInfo_Init()
|
||||
int NeoCDInfo_Init(void)
|
||||
{
|
||||
NeoCDInfo_Exit();
|
||||
return GetNeoGeoCD_Identifier();
|
||||
@ -473,30 +429,29 @@ int NeoCDInfo_Init()
|
||||
|
||||
TCHAR* NeoCDInfo_Text(int nText)
|
||||
{
|
||||
if(!game || !IsNeoGeoCD() || !bDrvOkay) return NULL;
|
||||
if(!game || !IsNeoGeoCD()) return NULL;
|
||||
|
||||
switch(nText)
|
||||
{
|
||||
case DRV_NAME: return game->pszName;
|
||||
case DRV_NAME: return game->pszName;
|
||||
case DRV_FULLNAME: return game->pszTitle;
|
||||
case DRV_MANUFACTURER: return game->pszCompany;
|
||||
case DRV_DATE: return game->pszYear;
|
||||
case DRV_DATE: return game->pszYear;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int NeoCDInfo_ID()
|
||||
int NeoCDInfo_ID(void)
|
||||
{
|
||||
if(!game || !IsNeoGeoCD() || !bDrvOkay) return 0;
|
||||
if(!game || !IsNeoGeoCD()) return 0;
|
||||
return game->id;
|
||||
}
|
||||
|
||||
void NeoCDInfo_Exit()
|
||||
void NeoCDInfo_Exit(void)
|
||||
{
|
||||
if(game) {
|
||||
if(game)
|
||||
free(game);
|
||||
game = NULL;
|
||||
}
|
||||
game = NULL;
|
||||
}
|
||||
#endif
|
||||
|
@ -39,7 +39,6 @@ typedef struct { int x, y, width, height; } RECT;
|
||||
#undef _fastcall
|
||||
#define __fastcall /*what does this correspond to?*/
|
||||
#define _fastcall /*same as above - what does this correspond to?*/
|
||||
#define ANSIToTCHAR(str, foo, bar) (str)
|
||||
|
||||
/* for Windows / Xbox 360 (below VS2010) - typedefs for missing stdint.h types such as uintptr_t?*/
|
||||
|
||||
@ -47,13 +46,8 @@ typedef struct { int x, y, width, height; } RECT;
|
||||
#define PUF_TEXT_NO_TRANSLATE (0)
|
||||
#define PUF_TYPE_ERROR (1)
|
||||
|
||||
extern TCHAR szAppBurnVer[16];
|
||||
|
||||
typedef int HWND;
|
||||
|
||||
extern int bDrvOkay;
|
||||
extern int bRunPause;
|
||||
extern bool bAlwaysProcessKeyboardInput;
|
||||
extern HWND hScrnWnd; // Handle to the screen window
|
||||
|
||||
extern void InpDIPSWResetDIPs (void);
|
||||
|
@ -153,19 +153,13 @@ static PTE* StorePTE(PTEG pteg, u32 virtual, u32 physical, u8 WIMG, u8 PP, int s
|
||||
|
||||
for (i=0; i < 8; i++)
|
||||
{
|
||||
if (pteg[i].data[0] == p.data[0])
|
||||
{
|
||||
// printf("Error: address %08x already had a PTE entry\n", virtual);
|
||||
// abort();
|
||||
}
|
||||
if (pteg[i].data[0] == p.data[0]) { }
|
||||
else if (pteg[i].valid)
|
||||
continue;
|
||||
|
||||
asm volatile("tlbie %0" : : "r"(virtual));
|
||||
pteg[i].data[1] = p.data[1];
|
||||
pteg[i].data[0] = p.data[0];
|
||||
// if (i || secondary)
|
||||
// printf("PTE for address %08x/%08x in PTEG %p index %d (%s)\n", virtual, physical, pteg, i, secondary ? "secondary" : "primary");
|
||||
return pteg+i;
|
||||
}
|
||||
|
||||
@ -200,9 +194,6 @@ static PTE* insert_pte(u16 index, u32 physical, u8 WIMG, u8 PP)
|
||||
return pte;
|
||||
}
|
||||
|
||||
// printf("Failed to insert PTE for %p\n", VM_Base+index);
|
||||
// abort();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -247,8 +238,6 @@ void* VM_Init(size_t VMSize, size_t MEMSize)
|
||||
VM_Base = (vm_page*)(0x80000000 - VMSize);
|
||||
pmap_max = MEMSize / PAGE_SIZE + 16;
|
||||
|
||||
// printf("VMSize %08x MEMSize %08x VM_Base %p pmap_max %u\n", VMSize, MEMSize, VM_Base, pmap_max);
|
||||
|
||||
if (VMSize <= MEMSize)
|
||||
{
|
||||
errno = EINVAL;
|
||||
@ -275,8 +264,6 @@ void* VM_Init(size_t VMSize, size_t MEMSize)
|
||||
MEMSize += PTE_SIZE;
|
||||
MEM_Base = (vm_page*)memalign(PAGE_SIZE, MEMSize);
|
||||
|
||||
// printf("MEM_Base: %p\n", MEM_Base);
|
||||
|
||||
if (MEM_Base==NULL)
|
||||
{
|
||||
ISFS_Close(pagefile_fd);
|
||||
@ -287,7 +274,6 @@ void* VM_Init(size_t VMSize, size_t MEMSize)
|
||||
tlbia();
|
||||
DCZeroRange(MEM_Base, MEMSize);
|
||||
HTABORG = (PTE*)(((u32)MEM_Base+0xFFFF)&~0xFFFF);
|
||||
// printf("HTABORG: %p\n", HTABORG);
|
||||
|
||||
/* Attempt to make the pagefile the correct size.
|
||||
* it's not enough to just check for free space;
|
||||
@ -295,39 +281,11 @@ void* VM_Init(size_t VMSize, size_t MEMSize)
|
||||
* plus we need to be able to quickly seek to any page
|
||||
* within the file.
|
||||
*/
|
||||
// We'll write the pagefile later. Improves loading time.
|
||||
// No difference in speed.
|
||||
#if 0
|
||||
printf("Creating Nand page\n");
|
||||
ISFS_Seek(pagefile_fd, 0, SEEK_SET);
|
||||
for (i=0; i<VMSize;)
|
||||
{
|
||||
u32 to_write = VMSize - i;
|
||||
if (to_write > MEMSize)
|
||||
to_write = MEMSize;
|
||||
|
||||
float percent = (float)i / VMSize * 100.0;
|
||||
printf("%d%% done\r", (int)percent);
|
||||
|
||||
if (ISFS_Write(pagefile_fd, MEM_Base, to_write) != to_write)
|
||||
{
|
||||
free(MEM_Base);
|
||||
ISFS_Close(pagefile_fd);
|
||||
errno = ENOSPC;
|
||||
return NULL;
|
||||
}
|
||||
// printf("Wrote %u bytes to offset %u\n", to_write, i);
|
||||
i += to_write;
|
||||
|
||||
}
|
||||
printf("100%% done\r");
|
||||
#endif
|
||||
// initial commit: map pmap_max pages to fill PTEs with valid RPNs
|
||||
for (index=0,v_index=0; index<pmap_max; ++index,++v_index)
|
||||
{
|
||||
if ((PTE*)(MEM_Base+index) == HTABORG)
|
||||
{
|
||||
// printf("p_map hole: %u -> %u\n", index, index+(PTE_SIZE/PAGE_SIZE));
|
||||
for (i=0; i<(PTE_SIZE/PAGE_SIZE); ++i,++index)
|
||||
phys_map[index].valid = 0;
|
||||
|
||||
@ -355,7 +313,6 @@ void* VM_Init(size_t VMSize, size_t MEMSize)
|
||||
|
||||
// set SDR1
|
||||
mtspr(25, MEM_VIRTUAL_TO_PHYSICAL(HTABORG)|HTABMASK);
|
||||
// printf("SDR1: %08x\n", MEM_VIRTUAL_TO_PHYSICAL(HTABORG));
|
||||
// enable SR
|
||||
asm volatile("mtsrin %0,%1" :: "r"(VM_VSID), "r"(VM_Base));
|
||||
// hook DSI
|
||||
@ -436,8 +393,6 @@ void VM_InvalidateAll(void)
|
||||
|
||||
_CPU_ISR_Restore(irq);
|
||||
|
||||
// printf("VM was invalidated\n");
|
||||
|
||||
LWP_MutexUnlock(vm_mutex);
|
||||
}
|
||||
|
||||
@ -507,7 +462,6 @@ int vm_dsi_handler(frame_context* state, u32 DSISR)
|
||||
|
||||
ISFS_Seek(pagefile_fd, flush_v_index*PAGE_SIZE, SEEK_SET);
|
||||
ISFS_Write(pagefile_fd, MEM_Base+phys_index, PAGE_SIZE*pages_to_flush);
|
||||
// printf("VM page %d was purged (%d)\n", phys_map[phys_index].page_index, pages_to_flush);
|
||||
}
|
||||
|
||||
// fetch virtual_index if it has been previously committed
|
||||
@ -515,13 +469,10 @@ int vm_dsi_handler(frame_context* state, u32 DSISR)
|
||||
{
|
||||
ISFS_Seek(pagefile_fd, virt_index*PAGE_SIZE, SEEK_SET);
|
||||
ISFS_Read(pagefile_fd, MEM_Base+phys_index, PAGE_SIZE);
|
||||
// printf("VM page %d was fetched\n", virt_index);
|
||||
}
|
||||
else
|
||||
DCZeroRange(MEM_Base+phys_index, PAGE_SIZE);
|
||||
|
||||
// printf("VM page %u (0x%08x) replaced page %u (%p) @ %p\n", virt_index, state->DAR, phys_map[phys_index].page_index, VM_Base+phys_map[phys_index].page_index, MEM_Base+phys_index);
|
||||
|
||||
virt_map[virt_index].p_map_index = phys_index;
|
||||
phys_map[phys_index].page_index = virt_index;
|
||||
phys_map[phys_index].pte_index = insert_pte(virt_index, MEM_VIRTUAL_TO_PHYSICAL(MEM_Base+phys_index), 0, 0b10) - HTABORG;
|
||||
|
@ -1,9 +0,0 @@
|
||||
// Define macros for appliction title and description
|
||||
#ifdef FBA_DEBUG
|
||||
#define APP_TITLE "FB Alpha [DEBUG]"
|
||||
#else
|
||||
#define APP_TITLE "FB Alpha"
|
||||
#endif
|
||||
|
||||
#define APP_DESCRIPTION "Emulator for arcade games"
|
||||
|
@ -433,15 +433,6 @@ void Immediate8(void)
|
||||
fprintf(fp, "\t\t dec ecx ; Move range down\n");
|
||||
fprintf(fp, "\t\t and ecx,byte 7 ; Mask out lower bits\n");
|
||||
fprintf(fp, "\t\t inc ecx ; correct range\n");
|
||||
|
||||
|
||||
/* This takes 2 cycles, 10 bytes but has a memory read */
|
||||
/* I don't know timing for the mov command - assumed 1 */
|
||||
|
||||
#if 0
|
||||
fprintf(fp, "\t\t and ecx,byte 7\n");
|
||||
fprintf(fp, "\t\t mov ecx,[ImmTable+ECX*4]\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -477,36 +468,6 @@ void MemoryBanking(int BaseCode)
|
||||
/* Mask to n bits */
|
||||
fprintf(fp, "\t\t and esi,[%smem_amask]\n", PREF);
|
||||
|
||||
#if 0
|
||||
#ifdef KEEPHIGHPC
|
||||
fprintf(fp, "\t\t mov [FullPC],ESI\n");
|
||||
#endif
|
||||
|
||||
/* Mask to 24 bits */
|
||||
// fprintf(fp, "\t\t and esi,0ffffffh\n");
|
||||
|
||||
#ifdef ASMBANK
|
||||
/* Assembler bank switch */
|
||||
|
||||
fprintf(fp, "\t\t mov eax,esi\n");
|
||||
/* LVR - use a variable bank size */
|
||||
fprintf(fp, "\t\t shr eax," ASMBANK "\n");
|
||||
fprintf(fp, "\t\t cmp [asmbank],eax\n");
|
||||
fprintf(fp, "\t\t je OP%d_%5.5x_Bank\n",CPU,BaseCode);
|
||||
|
||||
fprintf(fp, "\t\t mov [asmbank],eax\n");
|
||||
#else
|
||||
/* This code is same as macro used by C core */
|
||||
|
||||
fprintf(fp, "\t\t mov ecx,esi\n");
|
||||
fprintf(fp, "\t\t mov ebx,[_cur_mrhard]\n");
|
||||
fprintf(fp, "\t\t shr ecx,9\n");
|
||||
fprintf(fp, "\t\t mov al,byte [_opcode_entry]\n");
|
||||
fprintf(fp, "\t\t cmp al,[ecx+ebx]\n");
|
||||
fprintf(fp, "\t\t je OP%d_%5.5x_Bank\n",CPU,BaseCode);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Call Banking Routine */
|
||||
|
||||
if (SavedRegs[ESI] == '-')
|
||||
@ -605,25 +566,6 @@ void Completed(void)
|
||||
fprintf(fp, "\t\t jle near MainExit\n\n");
|
||||
}
|
||||
FlagProcess = 0;
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
|
||||
/* Check for Debug Active */
|
||||
|
||||
fprintf(fp, "\n\t\t test byte [%smame_debug],byte 0xff\n", PREF);
|
||||
fprintf(fp, "\t\t jnz near MainExit\n\n");
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef FBA_DEBUG
|
||||
|
||||
fprintf(fp, "\n\t\t test byte [%smame_debug],byte 0xff\n", PREF);
|
||||
fprintf(fp, "\t\t jns near .NoDebug\n");
|
||||
fprintf(fp, "\t\t call near FBADebugActive\n\n");
|
||||
fprintf(fp, ".NoDebug\n");
|
||||
|
||||
#endif
|
||||
|
||||
if (CheckInterrupt)
|
||||
{
|
||||
fprintf(fp,"; Check for Interrupt waiting\n\n");
|
||||
@ -4806,90 +4748,7 @@ void chk(void)
|
||||
}
|
||||
}
|
||||
|
||||
void chk2(void)
|
||||
{
|
||||
#if 0
|
||||
int mode,sreg,size ;
|
||||
int Opcode, BaseCode ;
|
||||
int Dest ;
|
||||
char * Label ;
|
||||
|
||||
char *allow = "--2--56789a-----" ;
|
||||
|
||||
for (size = 0 ; size < 2; size++)
|
||||
for (mode = 0 ; mode < 8; mode++)
|
||||
for (sreg = 0 ; sreg < 8; sreg++)
|
||||
{
|
||||
Opcode = 0x00c0 | (size<<9) | (mode<<3) | sreg;
|
||||
BaseCode = Opcode & 0xfff8 ;
|
||||
|
||||
if (mode == 7)
|
||||
{
|
||||
BaseCode |= sreg ;
|
||||
}
|
||||
|
||||
Dest = EAtoAMN(Opcode, FALSE);
|
||||
|
||||
if (allow[Dest&0xf] != '-')
|
||||
{
|
||||
if (OpcodeArray[BaseCode] == -2)
|
||||
{
|
||||
Align();
|
||||
Label = GenerateLabel(BaseCode,0);
|
||||
fprintf(fp, "%s:\n", Label );
|
||||
fprintf(fp, "\t\t add esi,byte 2\n\n");
|
||||
|
||||
TimingCycles += 10;
|
||||
|
||||
fprintf(fp, "\t\t mov ebx,ecx\n");
|
||||
fprintf(fp, "\t\t shr ebx,byte 9\n");
|
||||
fprintf(fp, "\t\t and ebx,byte 7\n");
|
||||
|
||||
if (Dest < 7)
|
||||
fprintf(fp, "\t\t and ecx,byte 7\n");
|
||||
|
||||
EffectiveAddressRead(Dest,'W',ECX,EAX,"----S-B",FALSE);
|
||||
|
||||
if (size == 0) /* word */
|
||||
{
|
||||
fprintf(fp, "\t\t movsx ebx,word [%s+EBX*4]\n",REG_DAT);
|
||||
fprintf(fp, "\t\t movsx eax,ax\n");
|
||||
}
|
||||
else /* long */
|
||||
fprintf(fp, "\t\t mov ebx,[%s+EBX*4]\n",REG_DAT);
|
||||
|
||||
fprintf(fp, "\t\t test ebx,ebx\n"); /* is word bx < 0 */
|
||||
fprintf(fp, "\t\t jl near OP%d_%4.4x_Trap_minus\n",CPU,BaseCode);
|
||||
|
||||
fprintf(fp, "\t\t cmp ebx,eax\n");
|
||||
fprintf(fp, "\t\t jg near OP%d_%4.4x_Trap_over\n",CPU,BaseCode);
|
||||
Completed();
|
||||
|
||||
/* N is set if data less than zero */
|
||||
|
||||
Align();
|
||||
fprintf(fp, "OP%d_%4.4x_Trap_minus:\n",CPU,BaseCode);
|
||||
fprintf(fp, "\t\t or edx,0x0080\n"); /* N flag = 80H */
|
||||
fprintf(fp, "\t\t jmp short OP%d_%4.4x_Trap_Exception\n",CPU,BaseCode);
|
||||
|
||||
/* N is cleared if greated than compared number */
|
||||
|
||||
Align();
|
||||
fprintf(fp, "OP%d_%4.4x_Trap_over:\n",CPU,BaseCode);
|
||||
fprintf(fp, "\t\t and edx,0x007f\n"); /* N flag = 80H */
|
||||
|
||||
fprintf(fp, "OP%d_%4.4x_Trap_Exception:\n",CPU,BaseCode);
|
||||
fprintf(fp, "\t\t mov al,6\n");
|
||||
Exception(-1,0x10000+BaseCode);
|
||||
Completed();
|
||||
|
||||
}
|
||||
|
||||
OpcodeArray[Opcode] = BaseCode ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void chk2(void) { }
|
||||
|
||||
/*
|
||||
* Load Effective Address
|
||||
@ -5826,15 +5685,6 @@ void illegal_opcode(void)
|
||||
fprintf(fp, "\t\t mov [%sillegal_op],ecx\n", PREF);
|
||||
fprintf(fp, "\t\t mov [%sillegal_pc],esi\n", PREF);
|
||||
|
||||
#if 0
|
||||
#ifdef MAME_DEBUG
|
||||
fprintf(fp, "\t\t jmp ecx\n");
|
||||
fprintf(fp, "\t\t pushad\n");
|
||||
fprintf(fp, "\t\t call %sm68k_illegal_opcode\n", PREF);
|
||||
fprintf(fp, "\t\t popad\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Exception(4,0xFFFE);
|
||||
}
|
||||
|
||||
@ -7655,9 +7505,6 @@ void CodeSegmentBegin(void)
|
||||
fprintf(fp, "\t\t EXTERN %sopcode_entry\n", PREF);
|
||||
// fprintf(fp, "\t\t EXTERN %scur_mrhard\n", PREF);
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
fprintf(fp, "\t\t EXTERN %sm68k_illegal_opcode\n", PREF);
|
||||
#endif
|
||||
|
||||
#ifdef OS2
|
||||
fprintf(fp, "\t\t SECTION maincode USE32 FLAT CLASS=CODE\n\n");
|
||||
@ -7738,15 +7585,6 @@ void CodeSegmentBegin(void)
|
||||
fprintf(fp, "\t\t test dword [%s],-1\n",ICOUNT);
|
||||
fprintf(fp, "\t\t js short MainExit\n\n");
|
||||
|
||||
#ifdef FBA_DEBUG
|
||||
|
||||
fprintf(fp, "\n\t\t test byte [%smame_debug],byte 0xff\n", PREF);
|
||||
fprintf(fp, "\t\t jns near .NoDebug\n");
|
||||
fprintf(fp, "\t\t call near FBADebugActive\n\n");
|
||||
fprintf(fp, ".NoDebug\n");
|
||||
|
||||
#endif
|
||||
|
||||
if(CPU==2)
|
||||
{
|
||||
/* 32 Bit */
|
||||
@ -7787,13 +7625,6 @@ void CodeSegmentBegin(void)
|
||||
|
||||
/* If in Debug mode make normal SR register */
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
|
||||
ReadCCR('W', ECX);
|
||||
fprintf(fp, "\t\t mov [%s],eax\n\n",REG_S);
|
||||
|
||||
#endif
|
||||
|
||||
fprintf(fp, "\t\t popad\n");
|
||||
fprintf(fp, "\t\t ret\n");
|
||||
|
||||
@ -7954,31 +7785,6 @@ void CodeSegmentBegin(void)
|
||||
MemoryBanking(1);
|
||||
|
||||
fprintf(fp, "\t\t ret\n");
|
||||
|
||||
#ifdef FBA_DEBUG
|
||||
|
||||
fprintf(fp,"\n; Call FBA debugging callback\n\n");
|
||||
fprintf(fp, "FBADebugActive:");
|
||||
fprintf(fp, "\t\t mov [%s],ESI\n",REG_PC);
|
||||
fprintf(fp, "\t\t mov [%s],EDX\n",REG_CCR);
|
||||
fprintf(fp, "\t\t call [%sa68k_memory_intf+0]\n", PREF);
|
||||
if (SavedRegs[EDX] == '-')
|
||||
{
|
||||
fprintf(fp, "\t\t mov EDX,[%s]\n",REG_CCR);
|
||||
}
|
||||
if (SavedRegs[ESI] == '-')
|
||||
{
|
||||
fprintf(fp, "\t\t mov ESI,[%s]\n",REG_PC);
|
||||
}
|
||||
if (SavedRegs[EBP] == '-')
|
||||
{
|
||||
fprintf(fp, "\t\t mov ebp,dword [%sOP_ROM]\n", PREF);
|
||||
}
|
||||
fprintf(fp,"\n; Now continue as usual\n\n");
|
||||
fprintf(fp, "\t\t ret\n");
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void CodeSegmentEnd(void)
|
||||
@ -8062,13 +7868,6 @@ void CodeSegmentEnd(void)
|
||||
fprintf(fp, "\t\t DD 0100h,0101h,0900h,0901h,0140h,0141h,0940h,0941h\n");
|
||||
fprintf(fp, "\t\t DD 0180h,0181h,0980h,0981h,01C0h,01C1h,09C0h,09C1h\n");
|
||||
|
||||
#if 0
|
||||
fprintf(fp, "\n\nImmTable\n");
|
||||
fprintf(fp, "\t\t DD 8,1,2,3,4,5,6,7\n\n");
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Exception Timing Table */
|
||||
|
||||
fprintf(fp, "exception_cycles\n");
|
||||
|
@ -3066,11 +3066,7 @@ void branchinstructions(void)
|
||||
|
||||
void moveq(void)
|
||||
{
|
||||
#if 0
|
||||
int Count;
|
||||
#else
|
||||
int i, j;
|
||||
#endif
|
||||
|
||||
/* The Code */
|
||||
|
||||
@ -3089,18 +3085,10 @@ void moveq(void)
|
||||
EffectiveAddressWrite(0, 'L', OPCODE, TRUE, "----------------SSSSSSSS----G-F-", FALSE, TRUE);
|
||||
Completed();
|
||||
|
||||
#if 0
|
||||
/* Set OpcodeArray (Not strictly correct, since some are illegal!) */
|
||||
|
||||
for (Count = 0x7000; Count < 0x8000; Count++) {
|
||||
OpcodeArray[Count] = 0x7000;
|
||||
}
|
||||
#else
|
||||
|
||||
for(i = 0x0000; i <= 0x0E00; i += 0x0200)
|
||||
for(j = 0x0000; j <= 0x00FF; j += 0x0001)
|
||||
OpcodeArray[0x7000 + i + j] = 0x7000;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -6833,10 +6821,6 @@ void CodeSegmentBegin(void)
|
||||
fprintf(fp, "\t\t .extern %sopcode_entry,4\n", PREF);
|
||||
fprintf(fp, "\t\t .extern %scur_mrhard,4\n", PREF);
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
fprintf(fp, "\t\t .extern %sm68k_illegal_opcode,4\n", PREF);
|
||||
#endif
|
||||
|
||||
fprintf(fp, "\n\n\n\t\t .text\n\n");
|
||||
|
||||
|
||||
@ -6958,18 +6942,8 @@ void CodeSegmentBegin(void)
|
||||
fprintf(fp, "\t\t subu %s,%s,%s\n", regnameslong[PC], regnameslong[PC], regnameslong[BASEPC]);
|
||||
fprintf(fp, "\t\t sw %s,%s\t\t # Save PC\n", regnameslong[PC], REG_PC);
|
||||
|
||||
/* If in Debug mode make normal SR register */
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
|
||||
ReadCCR('W', V0);
|
||||
|
||||
#else
|
||||
|
||||
ReadCCR('B', V0);
|
||||
|
||||
#endif
|
||||
|
||||
fprintf(fp, "\t\t lw %s,%s\n", regnameslong[T0], REG_SRH);
|
||||
fprintf(fp, "\t\t sw %s,%s\n", regnameslong[V0], REG_CCR);
|
||||
fprintf(fp, "\t\t andi %s,%s,0x20\n", regnameslong[T0], regnameslong[T0]);
|
||||
|
@ -16,22 +16,6 @@ INT32 nSekCyclesTotal, nSekCyclesScanline, nSekCyclesSegment, nSekCyclesDone, nS
|
||||
|
||||
INT32 nSekCPUType[SEK_MAX], nSekCycles[SEK_MAX], nSekIRQPending[SEK_MAX];
|
||||
|
||||
#if defined (FBA_DEBUG)
|
||||
|
||||
void (*SekDbgBreakpointHandlerRead)(UINT32, INT32);
|
||||
void (*SekDbgBreakpointHandlerFetch)(UINT32, INT32);
|
||||
void (*SekDbgBreakpointHandlerWrite)(UINT32, INT32);
|
||||
|
||||
UINT32 (*SekDbgFetchByteDisassembler)(UINT32);
|
||||
UINT32 (*SekDbgFetchWordDisassembler)(UINT32);
|
||||
UINT32 (*SekDbgFetchLongDisassembler)(UINT32);
|
||||
|
||||
static struct { UINT32 address; INT32 id; } BreakpointDataRead[9] = { { 0, 0 }, };
|
||||
static struct { UINT32 address; INT32 id; } BreakpointDataWrite[9] = { { 0, 0 }, };
|
||||
static struct { UINT32 address; INT32 id; } BreakpointFetch[9] = { { 0, 0 }, };
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (EMU_A68K)
|
||||
static void UpdateA68KContext()
|
||||
{
|
||||
@ -71,68 +55,6 @@ static UINT32 GetA68KUSP()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (FBA_DEBUG)
|
||||
|
||||
inline static void CheckBreakpoint_R(UINT32 a, const UINT32 m)
|
||||
{
|
||||
a &= m;
|
||||
|
||||
for (INT32 i = 0; BreakpointDataRead[i].address; i++) {
|
||||
if ((BreakpointDataRead[i].address & m) == a) {
|
||||
|
||||
#ifdef EMU_A68K
|
||||
UpdateA68KContext();
|
||||
#endif
|
||||
|
||||
SekDbgBreakpointHandlerRead(a, BreakpointDataRead[i].id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline static void CheckBreakpoint_W(UINT32 a, const UINT32 m)
|
||||
{
|
||||
a &= m;
|
||||
|
||||
for (INT32 i = 0; BreakpointDataWrite[i].address; i++) {
|
||||
if ((BreakpointDataWrite[i].address & m) == a) {
|
||||
|
||||
#ifdef EMU_A68K
|
||||
UpdateA68KContext();
|
||||
#endif
|
||||
|
||||
SekDbgBreakpointHandlerWrite(a, BreakpointDataWrite[i].id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline static void CheckBreakpoint_PC()
|
||||
{
|
||||
for (INT32 i = 0; BreakpointFetch[i].address; i++) {
|
||||
if (BreakpointFetch[i].address == (UINT32)SekGetPC(-1)) {
|
||||
|
||||
#ifdef EMU_A68K
|
||||
UpdateA68KContext();
|
||||
#endif
|
||||
|
||||
SekDbgBreakpointHandlerFetch(SekGetPC(-1), BreakpointFetch[i].id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline static void SingleStep_PC()
|
||||
{
|
||||
#ifdef EMU_A68K
|
||||
UpdateA68KContext();
|
||||
#endif
|
||||
|
||||
SekDbgBreakpointHandlerFetch(SekGetPC(-1), 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Default memory access handlers
|
||||
|
||||
@ -370,115 +292,6 @@ inline static void WriteLongROM(UINT32 a, UINT32 d)
|
||||
pSekExt->WriteLong[(uintptr_t)pr](a, d);
|
||||
}
|
||||
|
||||
#if defined (FBA_DEBUG)
|
||||
|
||||
// Breakpoint checking memory access functions
|
||||
UINT8 __fastcall ReadByteBP(UINT32 a)
|
||||
{
|
||||
UINT8* pr;
|
||||
|
||||
a &= 0xFFFFFF;
|
||||
|
||||
pr = FIND_R(a);
|
||||
|
||||
CheckBreakpoint_R(a, ~0);
|
||||
|
||||
if ((uintptr_t)pr >= SEK_MAXHANDLER) {
|
||||
a ^= 1;
|
||||
return pr[a & SEK_PAGEM];
|
||||
}
|
||||
return pSekExt->ReadByte[(uintptr_t)pr](a);
|
||||
}
|
||||
|
||||
void __fastcall WriteByteBP(UINT32 a, UINT8 d)
|
||||
{
|
||||
UINT8* pr;
|
||||
|
||||
a &= 0xFFFFFF;
|
||||
|
||||
pr = FIND_W(a);
|
||||
|
||||
CheckBreakpoint_W(a, ~0);
|
||||
|
||||
if ((uintptr_t)pr >= SEK_MAXHANDLER) {
|
||||
a ^= 1;
|
||||
pr[a & SEK_PAGEM] = (UINT8)d;
|
||||
return;
|
||||
}
|
||||
pSekExt->WriteByte[(uintptr_t)pr](a, d);
|
||||
}
|
||||
|
||||
UINT16 __fastcall ReadWordBP(UINT32 a)
|
||||
{
|
||||
UINT8* pr;
|
||||
|
||||
a &= 0xFFFFFF;
|
||||
|
||||
pr = FIND_R(a);
|
||||
|
||||
CheckBreakpoint_R(a, ~1);
|
||||
|
||||
if ((uintptr_t)pr >= SEK_MAXHANDLER) {
|
||||
return BURN_UNALIGNED_READ16(pr + (a & SEK_PAGEM));
|
||||
}
|
||||
return pSekExt->ReadWord[(uintptr_t)pr](a);
|
||||
}
|
||||
|
||||
void __fastcall WriteWordBP(UINT32 a, UINT16 d)
|
||||
{
|
||||
UINT8* pr;
|
||||
|
||||
a &= 0xFFFFFF;
|
||||
|
||||
pr = FIND_W(a);
|
||||
|
||||
CheckBreakpoint_W(a, ~1);
|
||||
|
||||
if ((uintptr_t)pr >= SEK_MAXHANDLER) {
|
||||
BURN_UNALIGNED_WRITE16(pr + (a & SEK_PAGEM), d);
|
||||
return;
|
||||
}
|
||||
pSekExt->WriteWord[(uintptr_t)pr](a, d);
|
||||
}
|
||||
|
||||
UINT32 __fastcall ReadLongBP(UINT32 a)
|
||||
{
|
||||
UINT8* pr;
|
||||
|
||||
a &= 0xFFFFFF;
|
||||
|
||||
pr = FIND_R(a);
|
||||
|
||||
CheckBreakpoint_R(a, ~1);
|
||||
|
||||
if ((uintptr_t)pr >= SEK_MAXHANDLER) {
|
||||
UINT32 r = BURN_UNALIGNED_READ32(pr + (a & SEK_PAGEM));
|
||||
r = (r >> 16) | (r << 16);
|
||||
return r;
|
||||
}
|
||||
return pSekExt->ReadLong[(uintptr_t)pr](a);
|
||||
}
|
||||
|
||||
void __fastcall WriteLongBP(UINT32 a, UINT32 d)
|
||||
{
|
||||
UINT8* pr;
|
||||
|
||||
a &= 0xFFFFFF;
|
||||
|
||||
pr = FIND_W(a);
|
||||
|
||||
CheckBreakpoint_W(a, ~1);
|
||||
|
||||
if ((uintptr_t)pr >= SEK_MAXHANDLER) {
|
||||
d = (d >> 16) | (d << 16);
|
||||
BURN_UNALIGNED_WRITE32(pr + (a & SEK_PAGEM), d);
|
||||
return;
|
||||
}
|
||||
pSekExt->WriteLong[(uintptr_t)pr](a, d);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// A68K variables
|
||||
|
||||
@ -530,11 +343,6 @@ void __fastcall A68KWrite8 (UINT32 a,UINT8 d) { WriteByte(a,d);}
|
||||
void __fastcall A68KWrite16(UINT32 a,UINT16 d) { WriteWord(a,d);}
|
||||
void __fastcall A68KWrite32(UINT32 a,UINT32 d) { WriteLong(a,d);}
|
||||
|
||||
#if defined (FBA_DEBUG)
|
||||
void __fastcall A68KCheckBreakpoint() { CheckBreakpoint_PC(); }
|
||||
void __fastcall A68KSingleStep() { SingleStep_PC(); }
|
||||
#endif
|
||||
|
||||
#ifdef EMU_A68K
|
||||
void __fastcall A68KChangePC(UINT32 pc)
|
||||
{
|
||||
@ -558,27 +366,6 @@ UINT32 __fastcall M68KFetchByte(UINT32 a) { return (UINT32)FetchByte(a); }
|
||||
UINT32 __fastcall M68KFetchWord(UINT32 a) { return (UINT32)FetchWord(a); }
|
||||
UINT32 __fastcall M68KFetchLong(UINT32 a) { return FetchLong(a); }
|
||||
|
||||
#ifdef FBA_DEBUG
|
||||
UINT32 __fastcall M68KReadByteBP(UINT32 a) { return (UINT32)ReadByteBP(a); }
|
||||
UINT32 __fastcall M68KReadWordBP(UINT32 a) { return (UINT32)ReadWordBP(a); }
|
||||
UINT32 __fastcall M68KReadLongBP(UINT32 a) { return ReadLongBP(a); }
|
||||
|
||||
void __fastcall M68KWriteByteBP(UINT32 a, UINT32 d) { WriteByteBP(a, d); }
|
||||
void __fastcall M68KWriteWordBP(UINT32 a, UINT32 d) { WriteWordBP(a, d); }
|
||||
void __fastcall M68KWriteLongBP(UINT32 a, UINT32 d) { WriteLongBP(a, d); }
|
||||
|
||||
void M68KCheckBreakpoint() { CheckBreakpoint_PC(); }
|
||||
void M68KSingleStep() { SingleStep_PC(); }
|
||||
|
||||
UINT32 (__fastcall *M68KReadByteDebug)(UINT32);
|
||||
UINT32 (__fastcall *M68KReadWordDebug)(UINT32);
|
||||
UINT32 (__fastcall *M68KReadLongDebug)(UINT32);
|
||||
|
||||
void (__fastcall *M68KWriteByteDebug)(UINT32, UINT32);
|
||||
void (__fastcall *M68KWriteWordDebug)(UINT32, UINT32);
|
||||
void (__fastcall *M68KWriteLongDebug)(UINT32, UINT32);
|
||||
#endif
|
||||
|
||||
void __fastcall M68KWriteByte(UINT32 a, UINT32 d) { WriteByte(a, d); }
|
||||
void __fastcall M68KWriteWord(UINT32 a, UINT32 d) { WriteWord(a, d); }
|
||||
void __fastcall M68KWriteLong(UINT32 a, UINT32 d) { WriteLong(a, d); }
|
||||
@ -602,26 +389,6 @@ struct A68KInter a68k_inter_normal = {
|
||||
A68KRead32, // unused
|
||||
};
|
||||
|
||||
#if defined (FBA_DEBUG)
|
||||
|
||||
struct A68KInter a68k_inter_breakpoint = {
|
||||
NULL,
|
||||
ReadByteBP,
|
||||
ReadWordBP,
|
||||
ReadLongBP,
|
||||
WriteByteBP,
|
||||
WriteWordBP,
|
||||
WriteLongBP,
|
||||
A68KChangePC,
|
||||
A68KFetch8,
|
||||
A68KFetch16,
|
||||
A68KFetch32,
|
||||
A68KRead16, // unused
|
||||
A68KRead32, // unused
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1253,18 +1020,6 @@ INT32 SekRun(const INT32 nCycles)
|
||||
|
||||
void SekDbgDisableBreakpoints()
|
||||
{
|
||||
#if defined FBA_DEBUG && defined EMU_M68K
|
||||
m68k_set_instr_hook_callback(NULL);
|
||||
|
||||
M68KReadByteDebug = M68KReadByte;
|
||||
M68KReadWordDebug = M68KReadWord;
|
||||
M68KReadLongDebug = M68KReadLong;
|
||||
|
||||
M68KWriteByteDebug = M68KWriteByte;
|
||||
M68KWriteWordDebug = M68KWriteWord;
|
||||
M68KWriteLongDebug = M68KWriteLong;
|
||||
#endif
|
||||
|
||||
#ifdef EMU_A68K
|
||||
a68k_memory_intf = a68k_inter_normal;
|
||||
#endif
|
||||
@ -1272,138 +1027,6 @@ void SekDbgDisableBreakpoints()
|
||||
mame_debug = 0;
|
||||
}
|
||||
|
||||
#if defined (FBA_DEBUG)
|
||||
|
||||
void SekDbgEnableBreakpoints()
|
||||
{
|
||||
if (BreakpointDataRead[0].address || BreakpointDataWrite[0].address || BreakpointFetch[0].address) {
|
||||
#if defined FBA_DEBUG && defined EMU_M68K
|
||||
SekDbgDisableBreakpoints();
|
||||
|
||||
if (BreakpointFetch[0].address) {
|
||||
m68k_set_instr_hook_callback(M68KCheckBreakpoint);
|
||||
}
|
||||
|
||||
if (BreakpointDataRead[0].address) {
|
||||
M68KReadByteDebug = M68KReadByteBP;
|
||||
M68KReadWordDebug = M68KReadWordBP;
|
||||
M68KReadLongDebug = M68KReadLongBP;
|
||||
}
|
||||
|
||||
if (BreakpointDataWrite[0].address) {
|
||||
M68KWriteByteDebug = M68KWriteByteBP;
|
||||
M68KWriteWordDebug = M68KWriteWordBP;
|
||||
M68KWriteLongDebug = M68KWriteLongBP;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EMU_A68K
|
||||
a68k_memory_intf = a68k_inter_breakpoint;
|
||||
if (BreakpointFetch[0].address) {
|
||||
a68k_memory_intf.DebugCallback = A68KCheckBreakpoint;
|
||||
mame_debug = 255;
|
||||
} else {
|
||||
a68k_memory_intf.DebugCallback = NULL;
|
||||
mame_debug = 0;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
SekDbgDisableBreakpoints();
|
||||
}
|
||||
}
|
||||
|
||||
void SekDbgEnableSingleStep()
|
||||
{
|
||||
#if defined FBA_DEBUG && defined EMU_M68K
|
||||
m68k_set_instr_hook_callback(M68KSingleStep);
|
||||
#endif
|
||||
|
||||
#ifdef EMU_A68K
|
||||
a68k_memory_intf.DebugCallback = A68KSingleStep;
|
||||
mame_debug = 254;
|
||||
#endif
|
||||
}
|
||||
|
||||
INT32 SekDbgSetBreakpointDataRead(UINT32 nAddress, INT32 nIdentifier)
|
||||
{
|
||||
for (INT32 i = 0; i < 8; i++) {
|
||||
if (BreakpointDataRead[i].id == nIdentifier) {
|
||||
|
||||
if (nAddress) { // Change breakpoint
|
||||
BreakpointDataRead[i].address = nAddress;
|
||||
} else { // Delete breakpoint
|
||||
for ( ; i < 8; i++) {
|
||||
BreakpointDataRead[i] = BreakpointDataRead[i + 1];
|
||||
}
|
||||
}
|
||||
|
||||
SekDbgEnableBreakpoints();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// No breakpoints present, add it to the 1st slot
|
||||
BreakpointDataRead[0].address = nAddress;
|
||||
BreakpointDataRead[0].id = nIdentifier;
|
||||
|
||||
SekDbgEnableBreakpoints();
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT32 SekDbgSetBreakpointDataWrite(UINT32 nAddress, INT32 nIdentifier)
|
||||
{
|
||||
for (INT32 i = 0; i < 8; i++) {
|
||||
if (BreakpointDataWrite[i].id == nIdentifier) {
|
||||
|
||||
if (nAddress) { // Change breakpoint
|
||||
BreakpointDataWrite[i].address = nAddress;
|
||||
} else { // Delete breakpoint
|
||||
for ( ; i < 8; i++) {
|
||||
BreakpointDataWrite[i] = BreakpointDataWrite[i + 1];
|
||||
}
|
||||
}
|
||||
|
||||
SekDbgEnableBreakpoints();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// No breakpoints present, add it to the 1st slot
|
||||
BreakpointDataWrite[0].address = nAddress;
|
||||
BreakpointDataWrite[0].id = nIdentifier;
|
||||
|
||||
SekDbgEnableBreakpoints();
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT32 SekDbgSetBreakpointFetch(UINT32 nAddress, INT32 nIdentifier)
|
||||
{
|
||||
for (INT32 i = 0; i < 8; i++) {
|
||||
if (BreakpointFetch[i].id == nIdentifier) {
|
||||
|
||||
if (nAddress) { // Change breakpoint
|
||||
BreakpointFetch[i].address = nAddress;
|
||||
} else { // Delete breakpoint
|
||||
for ( ; i < 8; i++) {
|
||||
BreakpointFetch[i] = BreakpointFetch[i + 1];
|
||||
}
|
||||
}
|
||||
|
||||
SekDbgEnableBreakpoints();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// No breakpoints present, add it to the 1st slot
|
||||
BreakpointFetch[0].address = nAddress;
|
||||
BreakpointFetch[0].id = nIdentifier;
|
||||
|
||||
SekDbgEnableBreakpoints();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Memory map setup
|
||||
|
||||
|
@ -160,11 +160,7 @@ inline static INT32 SekSegmentCycles(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined FBA_DEBUG
|
||||
static INT32 SekTotalCycles(void)
|
||||
#else
|
||||
inline static INT32 SekTotalCycles(void)
|
||||
#endif
|
||||
{
|
||||
#ifdef EMU_M68K
|
||||
return nSekCyclesTotal + nSekCyclesToDo - m68k_ICount;
|
||||
|
@ -125,11 +125,7 @@
|
||||
/* If ON, CPU will call the instruction hook callback before every
|
||||
* instruction.
|
||||
*/
|
||||
#ifdef FBA_DEBUG
|
||||
#define M68K_INSTRUCTION_HOOK OPT_ON
|
||||
#else
|
||||
#define M68K_INSTRUCTION_HOOK OPT_OFF
|
||||
#endif
|
||||
#define M68K_INSTRUCTION_HOOK OPT_OFF
|
||||
#define M68K_INSTRUCTION_CALLBACK() your_instruction_hook_function()
|
||||
|
||||
|
||||
@ -200,15 +196,6 @@ extern unsigned int (*SekDbgFetchByteDisassembler)(unsigned int);
|
||||
extern unsigned int (*SekDbgFetchWordDisassembler)(unsigned int);
|
||||
extern unsigned int (*SekDbgFetchLongDisassembler)(unsigned int);
|
||||
|
||||
#if defined FBA_DEBUG
|
||||
extern unsigned int (__fastcall *M68KReadByteDebug)(unsigned int);
|
||||
extern unsigned int (__fastcall *M68KReadWordDebug)(unsigned int);
|
||||
extern unsigned int (__fastcall *M68KReadLongDebug)(unsigned int);
|
||||
|
||||
extern void (__fastcall *M68KWriteByteDebug)(unsigned int, unsigned int);
|
||||
extern void (__fastcall *M68KWriteWordDebug)(unsigned int, unsigned int);
|
||||
extern void (__fastcall *M68KWriteLongDebug)(unsigned int, unsigned int);
|
||||
#else
|
||||
unsigned int __fastcall M68KReadByte(unsigned int a);
|
||||
unsigned int __fastcall M68KReadWord(unsigned int a);
|
||||
unsigned int __fastcall M68KReadLong(unsigned int a);
|
||||
@ -216,7 +203,6 @@ unsigned int __fastcall M68KReadLong(unsigned int a);
|
||||
void __fastcall M68KWriteByte(unsigned int a, unsigned int d);
|
||||
void __fastcall M68KWriteWord(unsigned int a, unsigned int d);
|
||||
void __fastcall M68KWriteLong(unsigned int a, unsigned int d);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@ -238,17 +224,6 @@ void __fastcall M68KWriteLong(unsigned int a, unsigned int d);
|
||||
#define m68k_read_disassembler_16(address) SekDbgFetchWordDisassembler(address)
|
||||
#define m68k_read_disassembler_32(address) SekDbgFetchLongDisassembler(address)
|
||||
|
||||
#if defined FBA_DEBUG
|
||||
/* Read from anywhere */
|
||||
#define m68k_read_memory_8(address) M68KReadByteDebug(address)
|
||||
#define m68k_read_memory_16(address) M68KReadWordDebug(address)
|
||||
#define m68k_read_memory_32(address) M68KReadLongDebug(address)
|
||||
|
||||
/* Write to anywhere */
|
||||
#define m68k_write_memory_8(address, value) M68KWriteByteDebug(address, value)
|
||||
#define m68k_write_memory_16(address, value) M68KWriteWordDebug(address, value)
|
||||
#define m68k_write_memory_32(address, value) M68KWriteLongDebug(address, value)
|
||||
#else
|
||||
/* Read from anywhere */
|
||||
#define m68k_read_memory_8(address) M68KReadByte(address)
|
||||
#define m68k_read_memory_16(address) M68KReadWord(address)
|
||||
@ -258,8 +233,6 @@ void __fastcall M68KWriteLong(unsigned int a, unsigned int d);
|
||||
#define m68k_write_memory_8(address, value) M68KWriteByte(address, value)
|
||||
#define m68k_write_memory_16(address, value) M68KWriteWord(address, value)
|
||||
#define m68k_write_memory_32(address, value) M68KWriteLong(address, value)
|
||||
#endif /* FBA_DEBUG */
|
||||
|
||||
|
||||
/* ======================================================================== */
|
||||
/* ============================== END OF FILE ============================= */
|
||||
|
@ -111,10 +111,6 @@ static Z80ReadOpArgHandler Z80CPUReadOpArg;
|
||||
|
||||
unsigned char Z80Vector = 0;
|
||||
|
||||
#define VERBOSE 0
|
||||
|
||||
#define LOG(x) //do { if (VERBOSE) logerror x; } while (0)
|
||||
|
||||
/* execute main opcodes inside a big switch statement */
|
||||
#ifndef BIG_SWITCH
|
||||
#define BIG_SWITCH 1
|
||||
@ -804,7 +800,6 @@ Z80_INLINE UINT32 ARG16(void)
|
||||
* RETN
|
||||
***************************************************************/
|
||||
#define RETN { \
|
||||
LOG(("Z80 #%d RETN IFF1:%d IFF2:%d\n", cpu_getactivecpu(), IFF1, IFF2)); \
|
||||
POP( pc ); \
|
||||
change_pc(PCD); \
|
||||
IFF1 = IFF2; \
|
||||
@ -2126,10 +2121,7 @@ OP(xycb,fd) { L = SET(7, RM(EA) ); WM( EA,L ); } /* SET 7,L=(XY+o) */
|
||||
OP(xycb,fe) { WM( EA, SET(7,RM(EA)) ); } /* SET 7,(XY+o) */
|
||||
OP(xycb,ff) { A = SET(7, RM(EA) ); WM( EA,A ); } /* SET 7,A=(XY+o) */
|
||||
|
||||
OP(illegal,1) {
|
||||
// logerror("Z80 #%d ill. opcode $%02x $%02x\n",
|
||||
// cpu_getactivecpu(), cpu_readop((PCD-1)&0xffff), cpu_readop(PCD));
|
||||
}
|
||||
OP(illegal,1) { }
|
||||
|
||||
/**********************************************************
|
||||
* IX register related opcodes (DD prefix)
|
||||
@ -2713,11 +2705,7 @@ OP(fd,fd) { illegal_1(); op_fd(); } /* DB FD */
|
||||
OP(fd,fe) { illegal_1(); op_fe(); } /* DB FD */
|
||||
OP(fd,ff) { illegal_1(); op_ff(); } /* DB FD */
|
||||
|
||||
OP(illegal,2)
|
||||
{
|
||||
// logerror("Z80 #%d ill. opcode $ed $%02x\n",
|
||||
// cpu_getactivecpu(), cpu_readop((PCD-1)&0xffff));
|
||||
}
|
||||
OP(illegal,2) { }
|
||||
|
||||
/**********************************************************
|
||||
* special opcodes (ED prefix)
|
||||
@ -3317,23 +3305,12 @@ static void take_interrupt(void)
|
||||
/* Clear both interrupt flip flops */
|
||||
IFF1 = IFF2 = 0;
|
||||
|
||||
/* Daisy chain mode? If so, call the requesting device */
|
||||
// if (Z80.daisy)
|
||||
// irq_vector = z80daisy_call_ack_device(Z80.daisy);
|
||||
|
||||
/* else call back the cpu interface to retrieve the vector */
|
||||
// else
|
||||
// irq_vector = (*Z80.irq_callback)(0);
|
||||
|
||||
// LOG(("Z80 #%d single int. irq_vector $%02x\n", cpu_getactivecpu(), irq_vector));
|
||||
|
||||
/* Interrupt mode 2. Call [Z80.i:databyte] */
|
||||
if( IM == 2 )
|
||||
{
|
||||
irq_vector = (irq_vector & 0xff) | (I << 8);
|
||||
PUSH( pc );
|
||||
RM16( irq_vector, &Z80.pc );
|
||||
// LOG(("Z80 #%d IM2 [$%04x] = $%04x\n",cpu_getactivecpu() , irq_vector, PCD));
|
||||
/* CALL opcode timing */
|
||||
z80_ICount -= cc[Z80_TABLE_op][0xcd];
|
||||
}
|
||||
@ -3341,7 +3318,6 @@ static void take_interrupt(void)
|
||||
/* Interrupt mode 1. RST 38h */
|
||||
if( IM == 1 )
|
||||
{
|
||||
// LOG(("Z80 #%d IM1 $0038\n",cpu_getactivecpu() ));
|
||||
PUSH( pc );
|
||||
PCD = 0x0038;
|
||||
/* RST $38 + 'interrupt latency' cycles */
|
||||
@ -3352,7 +3328,6 @@ static void take_interrupt(void)
|
||||
/* Interrupt mode 0. We check for CALL and JP instructions, */
|
||||
/* if neither of these were found we assume a 1 byte opcode */
|
||||
/* was placed on the databus */
|
||||
// LOG(("Z80 #%d IM0 $%04x\n",cpu_getactivecpu() , irq_vector));
|
||||
switch (irq_vector & 0xff0000)
|
||||
{
|
||||
case 0xcd0000: /* call */
|
||||
@ -3521,7 +3496,6 @@ int Z80Execute(int cycles)
|
||||
/* to just check here */
|
||||
if (Z80.nmi_pending)
|
||||
{
|
||||
// LOG(("Z80 #%d take NMI\n", cpu_getactivecpu()));
|
||||
PRVPC = (UINT32)-1; /* there isn't a valid previous program counter */
|
||||
LEAVE_HALT; /* Check if processor was halted */
|
||||
|
||||
@ -3656,452 +3630,7 @@ int ActiveZ80GetDE()
|
||||
return Z80.de.w.l;
|
||||
}
|
||||
|
||||
int ActiveZ80GetHL()
|
||||
int ActiveZ80GetHL(void)
|
||||
{
|
||||
return Z80.hl.w.l;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/****************************************************************************
|
||||
* Processor initialization
|
||||
****************************************************************************/
|
||||
static void z80_init(int index, int clock, const void *config, int (*irqcallback)(int))
|
||||
{
|
||||
int i, p;
|
||||
|
||||
/* setup cycle tables */
|
||||
cc[Z80_TABLE_op] = cc_op;
|
||||
cc[Z80_TABLE_cb] = cc_cb;
|
||||
cc[Z80_TABLE_ed] = cc_ed;
|
||||
cc[Z80_TABLE_xy] = cc_xy;
|
||||
cc[Z80_TABLE_xycb] = cc_xycb;
|
||||
cc[Z80_TABLE_ex] = cc_ex;
|
||||
|
||||
#if BIG_FLAGS_ARRAY
|
||||
if( !SZHVC_add || !SZHVC_sub )
|
||||
{
|
||||
int oldval, newval, val;
|
||||
UINT8 *padd, *padc, *psub, *psbc;
|
||||
/* allocate big flag arrays once */
|
||||
SZHVC_add = (UINT8 *)malloc(2*256*256);
|
||||
SZHVC_sub = (UINT8 *)malloc(2*256*256);
|
||||
if( !SZHVC_add || !SZHVC_sub )
|
||||
{
|
||||
fatalerror("Z80: failed to allocate 2 * 128K flags arrays!!!");
|
||||
}
|
||||
padd = &SZHVC_add[ 0*256];
|
||||
padc = &SZHVC_add[256*256];
|
||||
psub = &SZHVC_sub[ 0*256];
|
||||
psbc = &SZHVC_sub[256*256];
|
||||
for (oldval = 0; oldval < 256; oldval++)
|
||||
{
|
||||
for (newval = 0; newval < 256; newval++)
|
||||
{
|
||||
/* add or adc w/o carry set */
|
||||
val = newval - oldval;
|
||||
*padd = (newval) ? ((newval & 0x80) ? SF : 0) : ZF;
|
||||
*padd |= (newval & (YF | XF)); /* undocumented flag bits 5+3 */
|
||||
if( (newval & 0x0f) < (oldval & 0x0f) ) *padd |= HF;
|
||||
if( newval < oldval ) *padd |= CF;
|
||||
if( (val^oldval^0x80) & (val^newval) & 0x80 ) *padd |= VF;
|
||||
padd++;
|
||||
|
||||
/* adc with carry set */
|
||||
val = newval - oldval - 1;
|
||||
*padc = (newval) ? ((newval & 0x80) ? SF : 0) : ZF;
|
||||
*padc |= (newval & (YF | XF)); /* undocumented flag bits 5+3 */
|
||||
if( (newval & 0x0f) <= (oldval & 0x0f) ) *padc |= HF;
|
||||
if( newval <= oldval ) *padc |= CF;
|
||||
if( (val^oldval^0x80) & (val^newval) & 0x80 ) *padc |= VF;
|
||||
padc++;
|
||||
|
||||
/* cp, sub or sbc w/o carry set */
|
||||
val = oldval - newval;
|
||||
*psub = NF | ((newval) ? ((newval & 0x80) ? SF : 0) : ZF);
|
||||
*psub |= (newval & (YF | XF)); /* undocumented flag bits 5+3 */
|
||||
if( (newval & 0x0f) > (oldval & 0x0f) ) *psub |= HF;
|
||||
if( newval > oldval ) *psub |= CF;
|
||||
if( (val^oldval) & (oldval^newval) & 0x80 ) *psub |= VF;
|
||||
psub++;
|
||||
|
||||
/* sbc with carry set */
|
||||
val = oldval - newval - 1;
|
||||
*psbc = NF | ((newval) ? ((newval & 0x80) ? SF : 0) : ZF);
|
||||
*psbc |= (newval & (YF | XF)); /* undocumented flag bits 5+3 */
|
||||
if( (newval & 0x0f) >= (oldval & 0x0f) ) *psbc |= HF;
|
||||
if( newval >= oldval ) *psbc |= CF;
|
||||
if( (val^oldval) & (oldval^newval) & 0x80 ) *psbc |= VF;
|
||||
psbc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
p = 0;
|
||||
if( i&0x01 ) ++p;
|
||||
if( i&0x02 ) ++p;
|
||||
if( i&0x04 ) ++p;
|
||||
if( i&0x08 ) ++p;
|
||||
if( i&0x10 ) ++p;
|
||||
if( i&0x20 ) ++p;
|
||||
if( i&0x40 ) ++p;
|
||||
if( i&0x80 ) ++p;
|
||||
SZ[i] = i ? i & SF : ZF;
|
||||
SZ[i] |= (i & (YF | XF)); /* undocumented flag bits 5+3 */
|
||||
SZ_BIT[i] = i ? i & SF : ZF | PF;
|
||||
SZ_BIT[i] |= (i & (YF | XF)); /* undocumented flag bits 5+3 */
|
||||
SZP[i] = SZ[i] | ((p & 1) ? 0 : PF);
|
||||
SZHV_inc[i] = SZ[i];
|
||||
if( i == 0x80 ) SZHV_inc[i] |= VF;
|
||||
if( (i & 0x0f) == 0x00 ) SZHV_inc[i] |= HF;
|
||||
SZHV_dec[i] = SZ[i] | NF;
|
||||
if( i == 0x7f ) SZHV_dec[i] |= VF;
|
||||
if( (i & 0x0f) == 0x0f ) SZHV_dec[i] |= HF;
|
||||
}
|
||||
|
||||
state_save_register_item("z80", index, Z80.prvpc.w.l);
|
||||
state_save_register_item("z80", index, Z80.pc.w.l);
|
||||
state_save_register_item("z80", index, Z80.sp.w.l);
|
||||
state_save_register_item("z80", index, Z80.af.w.l);
|
||||
state_save_register_item("z80", index, Z80.bc.w.l);
|
||||
state_save_register_item("z80", index, Z80.de.w.l);
|
||||
state_save_register_item("z80", index, Z80.hl.w.l);
|
||||
state_save_register_item("z80", index, Z80.ix.w.l);
|
||||
state_save_register_item("z80", index, Z80.iy.w.l);
|
||||
state_save_register_item("z80", index, Z80.af2.w.l);
|
||||
state_save_register_item("z80", index, Z80.bc2.w.l);
|
||||
state_save_register_item("z80", index, Z80.de2.w.l);
|
||||
state_save_register_item("z80", index, Z80.hl2.w.l);
|
||||
state_save_register_item("z80", index, Z80.r);
|
||||
state_save_register_item("z80", index, Z80.r2);
|
||||
state_save_register_item("z80", index, Z80.iff1);
|
||||
state_save_register_item("z80", index, Z80.iff2);
|
||||
state_save_register_item("z80", index, Z80.halt);
|
||||
state_save_register_item("z80", index, Z80.im);
|
||||
state_save_register_item("z80", index, Z80.i);
|
||||
state_save_register_item("z80", index, Z80.nmi_state);
|
||||
state_save_register_item("z80", index, Z80.nmi_pending);
|
||||
state_save_register_item("z80", index, Z80.irq_state);
|
||||
state_save_register_item("z80", index, Z80.after_ei);
|
||||
|
||||
/* Reset registers to their initial values */
|
||||
memset(&Z80, 0, sizeof(Z80));
|
||||
Z80.daisy = config;
|
||||
Z80.irq_callback = irqcallback;
|
||||
IX = IY = 0xffff; /* IX and IY are FFFF after a reset! */
|
||||
F = ZF; /* Zero flag is set */
|
||||
|
||||
Z80Vector = 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Do a reset
|
||||
****************************************************************************/
|
||||
static void z80_reset(void)
|
||||
{
|
||||
PC = 0x0000;
|
||||
I = 0;
|
||||
R = 0;
|
||||
R2 = 0;
|
||||
Z80.nmi_state = Z80_CLEAR_LINE;
|
||||
Z80.nmi_pending = FALSE;
|
||||
Z80.irq_state = Z80_CLEAR_LINE;
|
||||
Z80.after_ei = FALSE;
|
||||
|
||||
if (Z80.daisy)
|
||||
z80daisy_reset(Z80.daisy);
|
||||
|
||||
change_pc(PCD);
|
||||
}
|
||||
|
||||
static void z80_exit(void)
|
||||
{
|
||||
#if BIG_FLAGS_ARRAY
|
||||
if (SZHVC_add) free(SZHVC_add);
|
||||
SZHVC_add = NULL;
|
||||
if (SZHVC_sub) free(SZHVC_sub);
|
||||
SZHVC_sub = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Execute 'cycles' T-states. Return number of T-states really executed
|
||||
****************************************************************************/
|
||||
static int z80_execute(int cycles)
|
||||
{
|
||||
z80_ICount = cycles;
|
||||
|
||||
/* check for NMIs on the way in; they can only be set externally */
|
||||
/* via timers, and can't be dynamically enabled, so it is safe */
|
||||
/* to just check here */
|
||||
if (Z80.nmi_pending)
|
||||
{
|
||||
LOG(("Z80 #%d take NMI\n", cpu_getactivecpu()));
|
||||
PRVPC = -1; /* there isn't a valid previous program counter */
|
||||
LEAVE_HALT; /* Check if processor was halted */
|
||||
|
||||
IFF1 = 0;
|
||||
PUSH( pc );
|
||||
PCD = 0x0066;
|
||||
change_pc(PCD);
|
||||
z80_ICount -= 11;
|
||||
Z80.nmi_pending = FALSE;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
/* check for IRQs before each instruction */
|
||||
if (Z80.irq_state != Z80_CLEAR_LINE && IFF1 && !Z80.after_ei)
|
||||
take_interrupt();
|
||||
Z80.after_ei = FALSE;
|
||||
|
||||
PRVPC = PCD;
|
||||
CALL_DEBUGGER(PCD);
|
||||
R++;
|
||||
EXEC_INLINE(op,ROP());
|
||||
} while( z80_ICount > 0 );
|
||||
|
||||
return cycles - z80_ICount;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Burn 'cycles' T-states. Adjust R register for the lost time
|
||||
****************************************************************************/
|
||||
static void z80_burn(int cycles)
|
||||
{
|
||||
if( cycles > 0 )
|
||||
{
|
||||
/* NOP takes 4 cycles per instruction */
|
||||
int n = (cycles + 3) / 4;
|
||||
R += n;
|
||||
z80_ICount -= 4 * n;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Get all registers in given buffer
|
||||
****************************************************************************/
|
||||
static void z80_get_context (void *dst)
|
||||
{
|
||||
if( dst )
|
||||
*(Z80_Regs*)dst = Z80;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Set all registers to given values
|
||||
****************************************************************************/
|
||||
static void z80_set_context (void *src)
|
||||
{
|
||||
if( src )
|
||||
Z80 = *(Z80_Regs*)src;
|
||||
change_pc(PCD);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Set IRQ line state
|
||||
****************************************************************************/
|
||||
static void set_irq_line(int irqline, int state)
|
||||
{
|
||||
if (irqline == INPUT_LINE_NMI)
|
||||
{
|
||||
/* mark an NMI pending on the rising edge */
|
||||
if (Z80.nmi_state == Z80_CLEAR_LINE && state != Z80_CLEAR_LINE)
|
||||
Z80.nmi_pending = TRUE;
|
||||
Z80.nmi_state = state;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* update the IRQ state via the daisy chain */
|
||||
Z80.irq_state = state;
|
||||
if (Z80.daisy)
|
||||
Z80.irq_state = z80daisy_update_irq_state(Z80.daisy);
|
||||
|
||||
/* the main execute loop will take the interrupt */
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Generic set_info
|
||||
**************************************************************************/
|
||||
|
||||
static void z80_set_info(UINT32 state, cpuinfo *info)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
/* --- the following bits of info are set as 64-bit signed integers --- */
|
||||
case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI: set_irq_line(INPUT_LINE_NMI, info->i); break;
|
||||
case CPUINFO_INT_INPUT_STATE + 0: set_irq_line(0, info->i); break;
|
||||
|
||||
case CPUINFO_INT_PC: PC = info->i; change_pc(PCD); break;
|
||||
case CPUINFO_INT_REGISTER + Z80_PC: Z80.pc.w.l = info->i; break;
|
||||
case CPUINFO_INT_SP: SP = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_SP: Z80.sp.w.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_A: Z80.af.b.h = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_B: Z80.bc.b.h = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_C: Z80.bc.b.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_D: Z80.de.b.h = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_E: Z80.de.b.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_H: Z80.hl.b.h = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_L: Z80.hl.b.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_AF: Z80.af.w.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_BC: Z80.bc.w.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_DE: Z80.de.w.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_HL: Z80.hl.w.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_IX: Z80.ix.w.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_IY: Z80.iy.w.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_R: Z80.r = info->i; Z80.r2 = info->i & 0x80; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_I: Z80.i = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_AF2: Z80.af2.w.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_BC2: Z80.bc2.w.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_DE2: Z80.de2.w.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_HL2: Z80.hl2.w.l = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_IM: Z80.im = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_IFF1: Z80.iff1 = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_IFF2: Z80.iff2 = info->i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_HALT: Z80.halt = info->i; break;
|
||||
|
||||
/* --- the following bits of info are set as pointers to data or functions --- */
|
||||
case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_op: cc[Z80_TABLE_op] = info->p; break;
|
||||
case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_cb: cc[Z80_TABLE_cb] = info->p; break;
|
||||
case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_ed: cc[Z80_TABLE_ed] = info->p; break;
|
||||
case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_xy: cc[Z80_TABLE_xy] = info->p; break;
|
||||
case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_xycb: cc[Z80_TABLE_xycb] = info->p; break;
|
||||
case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_ex: cc[Z80_TABLE_ex] = info->p; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Generic get_info
|
||||
**************************************************************************/
|
||||
|
||||
void z80_get_info(UINT32 state, cpuinfo *info)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
/* --- the following bits of info are returned as 64-bit signed integers --- */
|
||||
case CPUINFO_INT_CONTEXT_SIZE: info->i = sizeof(Z80); break;
|
||||
case CPUINFO_INT_INPUT_LINES: info->i = 1; break;
|
||||
case CPUINFO_INT_DEFAULT_IRQ_VECTOR: info->i = 0xff; break;
|
||||
case CPUINFO_INT_ENDIANNESS: info->i = CPU_IS_LE; break;
|
||||
case CPUINFO_INT_CLOCK_MULTIPLIER: info->i = 1; break;
|
||||
case CPUINFO_INT_CLOCK_DIVIDER: info->i = 1; break;
|
||||
case CPUINFO_INT_MIN_INSTRUCTION_BYTES: info->i = 1; break;
|
||||
case CPUINFO_INT_MAX_INSTRUCTION_BYTES: info->i = 4; break;
|
||||
case CPUINFO_INT_MIN_CYCLES: info->i = 1; break;
|
||||
case CPUINFO_INT_MAX_CYCLES: info->i = 16; break;
|
||||
|
||||
case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 8; break;
|
||||
case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16; break;
|
||||
case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0; break;
|
||||
case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA: info->i = 0; break;
|
||||
case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA: info->i = 0; break;
|
||||
case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA: info->i = 0; break;
|
||||
case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO: info->i = 8; break;
|
||||
case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO: info->i = 16; break;
|
||||
case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO: info->i = 0; break;
|
||||
|
||||
case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI: info->i = Z80.nmi_state; break;
|
||||
case CPUINFO_INT_INPUT_STATE + 0: info->i = Z80.irq_state; break;
|
||||
|
||||
case CPUINFO_INT_PREVIOUSPC: info->i = Z80.prvpc.w.l; break;
|
||||
|
||||
case CPUINFO_INT_PC: info->i = PCD; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_PC: info->i = Z80.pc.w.l; break;
|
||||
case CPUINFO_INT_SP: info->i = SPD; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_SP: info->i = Z80.sp.w.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_A: info->i = Z80.af.b.h; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_B: info->i = Z80.bc.b.h; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_C: info->i = Z80.bc.b.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_D: info->i = Z80.de.b.h; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_E: info->i = Z80.de.b.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_H: info->i = Z80.hl.b.h; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_L: info->i = Z80.hl.b.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_AF: info->i = Z80.af.w.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_BC: info->i = Z80.bc.w.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_DE: info->i = Z80.de.w.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_HL: info->i = Z80.hl.w.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_IX: info->i = Z80.ix.w.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_IY: info->i = Z80.iy.w.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_R: info->i = (Z80.r & 0x7f) | (Z80.r2 & 0x80); break;
|
||||
case CPUINFO_INT_REGISTER + Z80_I: info->i = Z80.i; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_AF2: info->i = Z80.af2.w.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_BC2: info->i = Z80.bc2.w.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_DE2: info->i = Z80.de2.w.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_HL2: info->i = Z80.hl2.w.l; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_IM: info->i = Z80.im; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_IFF1: info->i = Z80.iff1; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_IFF2: info->i = Z80.iff2; break;
|
||||
case CPUINFO_INT_REGISTER + Z80_HALT: info->i = Z80.halt; break;
|
||||
|
||||
/* --- the following bits of info are returned as pointers to data or functions --- */
|
||||
case CPUINFO_PTR_SET_INFO: info->setinfo = z80_set_info; break;
|
||||
case CPUINFO_PTR_GET_CONTEXT: info->getcontext = z80_get_context; break;
|
||||
case CPUINFO_PTR_SET_CONTEXT: info->setcontext = z80_set_context; break;
|
||||
case CPUINFO_PTR_INIT: info->init = z80_init; break;
|
||||
case CPUINFO_PTR_RESET: info->reset = z80_reset; break;
|
||||
case CPUINFO_PTR_EXIT: info->exit = z80_exit; break;
|
||||
case CPUINFO_PTR_EXECUTE: info->execute = z80_execute; break;
|
||||
case CPUINFO_PTR_BURN: info->burn = NULL; break;
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
case CPUINFO_PTR_DISASSEMBLE: info->disassemble = z80_dasm; break;
|
||||
#endif
|
||||
case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &z80_ICount; break;
|
||||
case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_op: info->p = (void *)cc[Z80_TABLE_op]; break;
|
||||
case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_cb: info->p = (void *)cc[Z80_TABLE_cb]; break;
|
||||
case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_ed: info->p = (void *)cc[Z80_TABLE_ed]; break;
|
||||
case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_xy: info->p = (void *)cc[Z80_TABLE_xy]; break;
|
||||
case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_xycb: info->p = (void *)cc[Z80_TABLE_xycb]; break;
|
||||
case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_ex: info->p = (void *)cc[Z80_TABLE_ex]; break;
|
||||
|
||||
/* --- the following bits of info are returned as NULL-terminated strings --- */
|
||||
case CPUINFO_STR_NAME: strcpy(info->s, "Z80"); break;
|
||||
case CPUINFO_STR_CORE_FAMILY: strcpy(info->s, "Zilog Z80"); break;
|
||||
case CPUINFO_STR_CORE_VERSION: strcpy(info->s, "3.7"); break;
|
||||
case CPUINFO_STR_CORE_FILE: strcpy(info->s, __FILE__); break;
|
||||
case CPUINFO_STR_CORE_CREDITS: strcpy(info->s, "Copyright Juergen Buchmueller, all rights reserved."); break;
|
||||
|
||||
case CPUINFO_STR_FLAGS:
|
||||
sprintf(info->s, "%c%c%c%c%c%c%c%c",
|
||||
Z80.af.b.l & 0x80 ? 'S':'.',
|
||||
Z80.af.b.l & 0x40 ? 'Z':'.',
|
||||
Z80.af.b.l & 0x20 ? '5':'.',
|
||||
Z80.af.b.l & 0x10 ? 'H':'.',
|
||||
Z80.af.b.l & 0x08 ? '3':'.',
|
||||
Z80.af.b.l & 0x04 ? 'P':'.',
|
||||
Z80.af.b.l & 0x02 ? 'N':'.',
|
||||
Z80.af.b.l & 0x01 ? 'C':'.');
|
||||
break;
|
||||
|
||||
case CPUINFO_STR_REGISTER + Z80_PC: sprintf(info->s, "PC:%04X", Z80.pc.w.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_SP: sprintf(info->s, "SP:%04X", Z80.sp.w.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_A: sprintf(info->s, "~A:%02X", Z80.af.b.h); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_B: sprintf(info->s, "~B:%02X", Z80.bc.b.h); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_C: sprintf(info->s, "~C:%02X", Z80.bc.b.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_D: sprintf(info->s, "~D:%02X", Z80.de.b.h); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_E: sprintf(info->s, "~E:%02X", Z80.de.b.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_H: sprintf(info->s, "~H:%02X", Z80.hl.b.h); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_L: sprintf(info->s, "~L:%02X", Z80.hl.b.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_AF: sprintf(info->s, "AF:%04X", Z80.af.w.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_BC: sprintf(info->s, "BC:%04X", Z80.bc.w.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_DE: sprintf(info->s, "DE:%04X", Z80.de.w.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_HL: sprintf(info->s, "HL:%04X", Z80.hl.w.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_IX: sprintf(info->s, "IX:%04X", Z80.ix.w.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_IY: sprintf(info->s, "IY:%04X", Z80.iy.w.l);
|
||||
break;
|
||||
case CPUINFO_STR_REGISTER + Z80_R: sprintf(info->s, "R:%02X", (Z80.r & 0x7f) | (Z80.r2 & 0x80)); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_I: sprintf(info->s, "I:%02X", Z80.i); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_AF2: sprintf(info->s, "AF2:%04X", Z80.af2.w.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_BC2: sprintf(info->s, "BC2:%04X", Z80.bc2.w.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_DE2: sprintf(info->s, "DE2:%04X", Z80.de2.w.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_HL2: sprintf(info->s, "HL2:%04X", Z80.hl2.w.l); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_IM: sprintf(info->s, "IM:%X", Z80.im); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_IFF1: sprintf(info->s, "IFF1:%X", Z80.iff1); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_IFF2: sprintf(info->s, "IFF2:%X", Z80.iff2); break;
|
||||
case CPUINFO_STR_REGISTER + Z80_HALT: sprintf(info->s, "HALT:%X", Z80.halt); break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -11,7 +11,6 @@
|
||||
#define CLEAR_LINE 0
|
||||
#define ASSERT_LINE 1
|
||||
|
||||
|
||||
void z80daisy_reset(const struct z80_irq_daisy_chain *daisy)
|
||||
{
|
||||
/* loop over all devices and call their reset function */
|
||||
@ -52,8 +51,6 @@ int z80daisy_call_ack_device(const struct z80_irq_daisy_chain *daisy)
|
||||
if (state & Z80_DAISY_INT)
|
||||
return (*daisy->irq_ack)(daisy->param);
|
||||
}
|
||||
|
||||
// logerror("z80daisy_call_ack_device: failed to find an device to ack!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -72,6 +69,4 @@ void z80daisy_call_reti_device(const struct z80_irq_daisy_chain *daisy)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// logerror("z80daisy_call_reti_device: failed to find an device to reti!\n");
|
||||
}
|
||||
|
@ -83,14 +83,12 @@ UINT8 __fastcall ZetReadOp(UINT32 a)
|
||||
{
|
||||
// check mem map
|
||||
UINT8 * pr = ZetCPUContext[nOpenedCPU]->pZetMemMap[0x200 | (a >> 8)];
|
||||
if (pr != NULL) {
|
||||
if (pr != NULL)
|
||||
return pr[a & 0xff];
|
||||
}
|
||||
|
||||
// check read handler
|
||||
if (ZetCPUContext[nOpenedCPU]->ZetRead != NULL) {
|
||||
if (ZetCPUContext[nOpenedCPU]->ZetRead != NULL)
|
||||
return ZetCPUContext[nOpenedCPU]->ZetRead(a);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -99,14 +97,12 @@ UINT8 __fastcall ZetReadOpArg(UINT32 a)
|
||||
{
|
||||
// check mem map
|
||||
UINT8 * pr = ZetCPUContext[nOpenedCPU]->pZetMemMap[0x300 | (a >> 8)];
|
||||
if (pr != NULL) {
|
||||
if (pr != NULL)
|
||||
return pr[a & 0xff];
|
||||
}
|
||||
|
||||
// check read handler
|
||||
if (ZetCPUContext[nOpenedCPU]->ZetRead != NULL) {
|
||||
if (ZetCPUContext[nOpenedCPU]->ZetRead != NULL)
|
||||
return ZetCPUContext[nOpenedCPU]->ZetRead(a);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -188,9 +184,8 @@ INT32 ZetInit(INT32 nCPU)
|
||||
nZetCyclesDone[nCPU] = 0;
|
||||
nZ80ICount[nCPU] = 0;
|
||||
|
||||
for (INT32 j = 0; j < (0x0100 * 4); j++) {
|
||||
for (INT32 j = 0; j < (0x0100 * 4); j++)
|
||||
ZetCPUContext[nCPU]->pZetMemMap[j] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nZetCyclesTotal = 0;
|
||||
@ -211,54 +206,6 @@ INT32 ZetInit(INT32 nCPU)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
INT32 ZetInit(INT32 nCount)
|
||||
{
|
||||
nOpenedCPU = -1;
|
||||
|
||||
ZetCPUContext = (struct ZetExt *) malloc(nCount * sizeof(ZetExt));
|
||||
if (ZetCPUContext == NULL) return 1;
|
||||
memset(ZetCPUContext, 0, nCount * sizeof(ZetExt));
|
||||
|
||||
Z80Init();
|
||||
|
||||
for (INT32 i = 0; i < nCount; i++) {
|
||||
ZetCPUContext[i].ZetIn = ZetDummyInHandler;
|
||||
ZetCPUContext[i].ZetOut = ZetDummyOutHandler;
|
||||
ZetCPUContext[i].ZetRead = ZetDummyReadHandler;
|
||||
ZetCPUContext[i].ZetWrite = ZetDummyWriteHandler;
|
||||
ZetCPUContext[i].BusReq = 0;
|
||||
// TODO: Z80Init() will set IX IY F regs with default value, so get them ...
|
||||
Z80GetContext(&ZetCPUContext[i].reg);
|
||||
|
||||
nZetCyclesDone[i] = 0;
|
||||
nZ80ICount[i] = 0;
|
||||
|
||||
for (INT32 j = 0; j < (0x0100 * 4); j++) {
|
||||
ZetCPUContext[i].pZetMemMap[j] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
nZetCyclesTotal = 0;
|
||||
|
||||
Z80SetIOReadHandler(ZetReadIO);
|
||||
Z80SetIOWriteHandler(ZetWriteIO);
|
||||
Z80SetProgramReadHandler(ZetReadProg);
|
||||
Z80SetProgramWriteHandler(ZetWriteProg);
|
||||
Z80SetCPUOpReadHandler(ZetReadOp);
|
||||
Z80SetCPUOpArgReadHandler(ZetReadOpArg);
|
||||
|
||||
nCPUCount = nCount % MAX_Z80;
|
||||
|
||||
nHasZet = nCount;
|
||||
|
||||
for (INT32 i = 0; i < nCount; i++)
|
||||
CpuCheatRegister(0x0004, i);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
UINT8 ZetReadByte(UINT16 address)
|
||||
{
|
||||
if (nOpenedCPU < 0) return 0;
|
||||
@ -333,9 +280,7 @@ void ZetRunAdjust(INT32 /*nCycles*/)
|
||||
{
|
||||
}
|
||||
|
||||
void ZetRunEnd(void)
|
||||
{
|
||||
}
|
||||
void ZetRunEnd(void) { }
|
||||
|
||||
// This function will make an area callback ZetRead/ZetWrite
|
||||
INT32 ZetMemCallback(INT32 nStart, INT32 nEnd, INT32 nMode)
|
||||
@ -343,20 +288,22 @@ INT32 ZetMemCallback(INT32 nStart, INT32 nEnd, INT32 nMode)
|
||||
UINT8 cStart = (nStart >> 8);
|
||||
UINT8 **pMemMap = ZetCPUContext[nOpenedCPU]->pZetMemMap;
|
||||
|
||||
for (UINT16 i = cStart; i <= (nEnd >> 8); i++) {
|
||||
switch (nMode) {
|
||||
case 0:
|
||||
pMemMap[0 + i] = NULL;
|
||||
break;
|
||||
case 1:
|
||||
pMemMap[0x100 + i] = NULL;
|
||||
break;
|
||||
case 2:
|
||||
pMemMap[0x200 + i] = NULL;
|
||||
pMemMap[0x300 + i] = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (UINT16 i = cStart; i <= (nEnd >> 8); i++)
|
||||
{
|
||||
switch (nMode)
|
||||
{
|
||||
case 0:
|
||||
pMemMap[0 + i] = NULL;
|
||||
break;
|
||||
case 1:
|
||||
pMemMap[0x100 + i] = NULL;
|
||||
break;
|
||||
case 2:
|
||||
pMemMap[0x200 + i] = NULL;
|
||||
pMemMap[0x300 + i] = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -365,10 +312,10 @@ void ZetExit(void)
|
||||
{
|
||||
Z80Exit();
|
||||
|
||||
for (INT32 i = 0; i < MAX_Z80; i++) {
|
||||
if (ZetCPUContext[i]) {
|
||||
for (INT32 i = 0; i < MAX_Z80; i++)
|
||||
{
|
||||
if (ZetCPUContext[i])
|
||||
BurnFree (ZetCPUContext[i]);
|
||||
}
|
||||
}
|
||||
|
||||
nCPUCount = 0;
|
||||
@ -410,25 +357,22 @@ INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem)
|
||||
UINT8 cStart = (nStart >> 8);
|
||||
UINT8 **pMemMap = ZetCPUContext[nOpenedCPU]->pZetMemMap;
|
||||
|
||||
for (UINT16 i = cStart; i <= (nEnd >> 8); i++) {
|
||||
switch (nMode) {
|
||||
case 0: {
|
||||
pMemMap[0 + i] = Mem + ((i - cStart) << 8);
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
pMemMap[0x100 + i] = Mem + ((i - cStart) << 8);
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
pMemMap[0x200 + i] = Mem + ((i - cStart) << 8);
|
||||
pMemMap[0x300 + i] = Mem + ((i - cStart) << 8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (UINT16 i = cStart; i <= (nEnd >> 8); i++)
|
||||
{
|
||||
switch (nMode)
|
||||
{
|
||||
case 0:
|
||||
pMemMap[0 + i] = Mem + ((i - cStart) << 8);
|
||||
break;
|
||||
case 1:
|
||||
pMemMap[0x100 + i] = Mem + ((i - cStart) << 8);
|
||||
break;
|
||||
case 2:
|
||||
pMemMap[0x200 + i] = Mem + ((i - cStart) << 8);
|
||||
pMemMap[0x300 + i] = Mem + ((i - cStart) << 8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -441,7 +385,8 @@ INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem01, UINT8 *Mem
|
||||
if (nMode != 2)
|
||||
return 1;
|
||||
|
||||
for (UINT16 i = cStart; i <= (nEnd >> 8); i++) {
|
||||
for (UINT16 i = cStart; i <= (nEnd >> 8); i++)
|
||||
{
|
||||
pMemMap[0x200 + i] = Mem01 + ((i - cStart) << 8);
|
||||
pMemMap[0x300 + i] = Mem02 + ((i - cStart) << 8);
|
||||
}
|
||||
@ -506,20 +451,21 @@ INT32 ZetScan(INT32 nAction)
|
||||
|
||||
void ZetSetIRQLine(const INT32 line, const INT32 status)
|
||||
{
|
||||
switch ( status ) {
|
||||
case ZET_IRQSTATUS_NONE:
|
||||
Z80SetIrqLine(0, 0);
|
||||
break;
|
||||
case ZET_IRQSTATUS_ACK:
|
||||
Z80SetIrqLine(line, 1);
|
||||
break;
|
||||
case ZET_IRQSTATUS_AUTO:
|
||||
Z80SetIrqLine(line, 1);
|
||||
Z80Execute(0);
|
||||
Z80SetIrqLine(0, 0);
|
||||
Z80Execute(0);
|
||||
break;
|
||||
}
|
||||
switch ( status )
|
||||
{
|
||||
case ZET_IRQSTATUS_NONE:
|
||||
Z80SetIrqLine(0, 0);
|
||||
break;
|
||||
case ZET_IRQSTATUS_ACK:
|
||||
Z80SetIrqLine(line, 1);
|
||||
break;
|
||||
case ZET_IRQSTATUS_AUTO:
|
||||
Z80SetIrqLine(line, 1);
|
||||
Z80Execute(0);
|
||||
Z80SetIrqLine(0, 0);
|
||||
Z80Execute(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ZetSetVector(INT32 vector)
|
||||
@ -527,12 +473,9 @@ void ZetSetVector(INT32 vector)
|
||||
Z80Vector = vector;
|
||||
}
|
||||
|
||||
UINT8 ZetGetVector()
|
||||
{
|
||||
return Z80Vector;
|
||||
}
|
||||
UINT8 ZetGetVector(void) { return Z80Vector; }
|
||||
|
||||
INT32 ZetNmi()
|
||||
INT32 ZetNmi(void)
|
||||
{
|
||||
Z80SetIrqLine(Z80_INPUT_LINE_NMI, 1);
|
||||
Z80Execute(0);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -227,9 +227,6 @@ DRV BurnDrvstakwin;
|
||||
DRV BurnDrvstakwin2;
|
||||
DRV BurnDrvstrhoop;
|
||||
DRV BurnDrvs1945p;
|
||||
#if defined FBA_DEBUG
|
||||
DRV BurnDrvsbp; // no comment [NOT WORKING]
|
||||
#endif
|
||||
DRV BurnDrvsdodgeb;
|
||||
DRV BurnDrvSsideki;
|
||||
DRV BurnDrvSsideki2;
|
||||
@ -554,9 +551,6 @@ static struct BurnDriver* pDriver[] = {
|
||||
&BurnDrvstakwin2, // Stakes Winner 2
|
||||
&BurnDrvstrhoop, // Street Hoop / Street Slam / Dunk Dream (DEM-004) (DEH-004)
|
||||
&BurnDrvs1945p, // Strikers 1945 Plus
|
||||
#if defined FBA_DEBUG
|
||||
&BurnDrvsbp, // Super Bubble Pop [no comment, NOT WORKING]
|
||||
#endif
|
||||
&BurnDrvsdodgeb, // Super Dodge Ball / Kunio no Nekketsu Toukyuu Densetsu
|
||||
&BurnDrvSsideki, // Super Sidekicks / Tokuten Ou
|
||||
&BurnDrvSsideki2, // Super Sidekicks 2 - The World Championship / Tokuten Ou 2 - real fight football (NGM-061)(NGH-061)
|
||||
|
File diff suppressed because one or more lines are too long
@ -344,39 +344,30 @@ static int isowavInit()
|
||||
wav_exit();
|
||||
|
||||
isowavTOC = (isowavCDROM_TOC*)malloc(sizeof(isowavCDROM_TOC));
|
||||
if (isowavTOC == NULL) {
|
||||
if (isowavTOC == NULL)
|
||||
return 1;
|
||||
}
|
||||
memset(isowavTOC, 0, sizeof(isowavCDROM_TOC));
|
||||
|
||||
TCHAR* filename = ExtractFilename(CDEmuImage);
|
||||
|
||||
if (_tcslen(filename) < 4) {
|
||||
if (_tcslen(filename) < 4)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (_tcscmp(_T(".cue"), filename + _tcslen(filename) - 4) == 0) {
|
||||
if (isowavParseCueFile()) {
|
||||
dprintf(_T("*** Couldn't parse .cue file\n"));
|
||||
if (isowavParseCueFile())
|
||||
{
|
||||
isowavExit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (isowavTestISO()) {
|
||||
dprintf(_T("*** Couldn't find .iso / .bin file\n"));
|
||||
isowavExit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
dprintf(_T(" CD image TOC read\n"));
|
||||
|
||||
for (int i = isowavTOC->FirstTrack - 1; i < isowavTOC->LastTrack; i++) {
|
||||
dprintf(_T(" track %2i start %02i:%02i:%02i control 0x%02X %s\n"), isowavTOC->TrackData[i].TrackNumber, isowavTOC->TrackData[i].Address[1], isowavTOC->TrackData[i].Address[2], isowavTOC->TrackData[i].Address[3], isowavTOC->TrackData[i].Control, isowavTOC->TrackData[i].Filename);
|
||||
else
|
||||
{
|
||||
if (isowavTestISO())
|
||||
{
|
||||
isowavExit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
dprintf(_T(" total running time %02i:%02i:%02i\n"), isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[1], isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[2], isowavTOC->TrackData[(int)isowavTOC->LastTrack].Address[3]);
|
||||
|
||||
CDEmuStatus = idle;
|
||||
|
||||
@ -413,37 +404,27 @@ static int isowavPlayLBA(int LBA)
|
||||
}
|
||||
}
|
||||
|
||||
if (isowavTrack >= isowavTOC->LastTrack) {
|
||||
if (isowavTrack >= isowavTOC->LastTrack)
|
||||
return 1;
|
||||
}
|
||||
|
||||
bprintf(PRINT_IMPORTANT, _T(" playing track %2i - %s\n"), isowavTrack + 1, isowavTOC->TrackData[isowavTrack].Filename);
|
||||
|
||||
isowavFile = _tfopen(isowavTOC->TrackData[isowavTrack].Filename, _T("rb"));
|
||||
if (isowavFile == NULL) {
|
||||
if (isowavFile == NULL)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( _tcsstr(isowavTOC->TrackData[isowavTrack].Filename, _T(".wav")) || _tcsstr(isowavTOC->TrackData[isowavTrack].Filename, _T(".WAV"))) {
|
||||
// is a wav, no need to keep this file pointer
|
||||
if (isowavFile) {
|
||||
if (isowavFile)
|
||||
{
|
||||
fclose(isowavFile);
|
||||
isowavFile = NULL;
|
||||
}
|
||||
|
||||
if(wav_open(isowavTOC->TrackData[isowavTrack].Filename)) {
|
||||
wav_play();
|
||||
} else {
|
||||
// error creating the WAV stream
|
||||
else // error creating the WAV stream
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
//dprintf(_T("*** WAV: wBitsPerSample: %d \n"), wav->g_pStreamingSound->m_pWaveFile->m_pwfx->wBitsPerSample);
|
||||
//dprintf(_T("*** WAV: nAvgBytesPerSec: %d \n"), wav->g_pStreamingSound->m_pWaveFile->m_pwfx->nAvgBytesPerSec);
|
||||
//dprintf(_T("*** WAV: m_dwSize: %d \n"), wav->g_pStreamingSound->m_pWaveFile->m_dwSize);
|
||||
//dprintf(_T("*** WAV: nBlockAlign: %d \n"), wav->g_pStreamingSound->m_pWaveFile->m_pwfx->nBlockAlign);
|
||||
|
||||
isowavLBA = isowavMSFToLBA(isowavTOC->TrackData[isowavTrack].Address);
|
||||
CDEmuStatus = playing;
|
||||
|
||||
@ -476,30 +457,22 @@ static int isowavLoadSector(int LBA, char* pBuffer)
|
||||
|
||||
isowavTrack = track;
|
||||
|
||||
bprintf(PRINT_IMPORTANT, _T(" reading track %2i - %s\n"), isowavTrack + 1, isowavTOC->TrackData[isowavTrack].Filename);
|
||||
|
||||
isowavFile = _tfopen(isowavTOC->TrackData[isowavTrack].Filename, _T("rb"));
|
||||
if (isowavFile == NULL) {
|
||||
if (isowavFile == NULL)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (fseek(isowavFile, (LBA - isowavMSFToLBA(isowavTOC->TrackData[isowavTrack].Address)) * 2048, SEEK_SET)) {
|
||||
dprintf(_T("*** couldn't seek\n"));
|
||||
|
||||
if (fseek(isowavFile, (LBA - isowavMSFToLBA(isowavTOC->TrackData[isowavTrack].Address)) * 2048, SEEK_SET))
|
||||
return 0;
|
||||
}
|
||||
|
||||
isowavLBA = (ftell(isowavFile) + 2047) / 2048;
|
||||
|
||||
CDEmuStatus = reading;
|
||||
}
|
||||
|
||||
if (fread(pBuffer, 1, 2048, isowavFile) <= 0) {
|
||||
dprintf(_T("*** couldn't read from file\n"));
|
||||
|
||||
if (fread(pBuffer, 1, 2048, isowavFile) <= 0)
|
||||
{
|
||||
isowavStop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user