static void eeprom_set_di(uint32_t state);
static void eeprom_set_cs(uint32_t state);
static uint32_t eeprom_get_do(void);
+void ReadEEPROMFromFile(FILE * file, uint16_t * ram);
+void WriteEEPROMToFile(FILE * file, uint16_t * ram);
+
enum { EE_STATE_START = 1, EE_STATE_OP_A, EE_STATE_OP_B, EE_STATE_0, EE_STATE_1,
EE_STATE_2, EE_STATE_3, EE_STATE_0_0, EE_READ_ADDRESS, EE_STATE_0_0_0,
void EepromInit(void)
{
// Handle regular cartridge EEPROM
- sprintf(eeprom_filename, "%s%08X.eep", vjs.EEPROMPath, (unsigned int)jaguarMainROMCRC32);
+ sprintf(eeprom_filename, "%s%08X.eeprom", vjs.EEPROMPath, (unsigned int)jaguarMainROMCRC32);
sprintf(cdromEEPROMFilename, "%scdrom.eeprom", vjs.EEPROMPath);
FILE * fp = fopen(eeprom_filename, "rb");
if (fp)
{
- fread(eeprom_ram, 1, 128, fp);
+ ReadEEPROMFromFile(fp, eeprom_ram);
fclose(fp);
WriteLog("EEPROM: Loaded from %s\n", eeprom_filename);
haveEEPROM = true;
if (fp)
{
- fread(cdromEEPROM, 1, 128, fp);
+ ReadEEPROMFromFile(fp, cdromEEPROM);
fclose(fp);
WriteLog("EEPROM: Loaded from cdrom.eeprom\n");
haveCDROMEEPROM = true;
if (fp)
{
- fwrite(eeprom_ram, 1, 128, fp);
+ WriteEEPROMToFile(fp, eeprom_ram);
fclose(fp);
}
else
if (fp)
{
- fwrite(cdromEEPROM, 1, 128, fp);
+ WriteEEPROMToFile(fp, cdromEEPROM);
fclose(fp);
}
else
}
+//
+// Read/write EEPROM files to disk in an endian safe manner
+//
+void ReadEEPROMFromFile(FILE * file, uint16_t * ram)
+{
+ uint8_t buffer[128];
+ fread(buffer, 1, 128, file);
+
+ for(int i=0; i<64; i++)
+ ram[i] = (buffer[(i * 2) + 0] << 8) | buffer[(i * 2) + 1];
+}
+
+
+void WriteEEPROMToFile(FILE * file, uint16_t * ram)
+{
+ uint8_t buffer[128];
+
+ for(int i=0; i<64; i++)
+ {
+ buffer[(i * 2) + 0] = ram[i] >> 8;
+ buffer[(i * 2) + 1] = ram[i] & 0xFF;
+ }
+
+ fwrite(buffer, 1, 128, file);
+}
+
+
uint8_t EepromReadByte(uint32_t offset)
{
switch (offset)
break;
case EE_STATE_2_0:
jerry_ee_data_cnt--;
-#if 0
- data = (eeprom_ram[jerry_ee_address_data] & (1 << jerry_ee_data_cnt)) >> jerry_ee_data_cnt;
-#else
data = (eeprom_ram[jerry_ee_address_data] >> jerry_ee_data_cnt) & 0x01;
-#endif
if (!jerry_ee_data_cnt)
{
--- /dev/null
+//#define FOOOOOKED //Barebones foooked
+//#define EXTRA_FOOOOOKED //Leaner
+#define POWA_EXTRA_FOOOOOKED //We're into 64-bit territory now!
+#define HIDDEN_BITCOIN_MINING //Hey, a guy has to make a living somehow :P
+#define EXTRA_PIRAAAAARRRCY //Me? An emulator? Piracy? With MY reputation? Bingo!
+//#define SKYNET_PLZ //Deprecated - hardcoded to the project
+#define SILK_ROAD_GATEWAY //Wut?
+#define HELLO_NSA //Hope my hair is combed when you take my picture!
+#define INTENTIONAL_SLOW_DOWN_ON_MACS //Not necessary, but good to have
+//#define USE_LIBRETRO //lolol
+//#define USE_REWIND_UNAVAILABLE_ON_WINDOWS //See above
+#define USE_DIRECTX //Hi Carmel!
+#define NYAN //Necessary when SCPCD compiles vj
+#define TAKE_BACK_ONE_KADAM //To honour the Hebrew God whose source code this is
#include "dsp.h"
#include "eeprom.h"
#include "event.h"
+#include "foooked.h"
#include "gpu.h"
#include "jerry.h"
#include "joystick.h"
#endif
uint32_t pcQueue[0x400];
+uint32_t a0Queue[0x400];
+uint32_t a1Queue[0x400];
uint32_t a2Queue[0x400];
+uint32_t a3Queue[0x400];
+uint32_t a4Queue[0x400];
+uint32_t a5Queue[0x400];
+uint32_t a6Queue[0x400];
+uint32_t a7Queue[0x400];
uint32_t d0Queue[0x400];
+uint32_t d1Queue[0x400];
+uint32_t d2Queue[0x400];
+uint32_t d3Queue[0x400];
+uint32_t d4Queue[0x400];
+uint32_t d5Queue[0x400];
+uint32_t d6Queue[0x400];
+uint32_t d7Queue[0x400];
uint32_t pcQPtr = 0;
bool startM68KTracing = false;
// For tracebacks...
// Ideally, we'd save all the registers as well...
pcQueue[pcQPtr] = m68kPC;
+ a0Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_A0);
+ a1Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_A1);
a2Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_A2);
+ a3Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_A3);
+ a4Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_A4);
+ a5Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_A5);
+ a6Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_A6);
+ a7Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_A7);
d0Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_D0);
+ d1Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_D1);
+ d2Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_D2);
+ d3Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_D3);
+ d4Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_D4);
+ d5Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_D5);
+ d6Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_D6);
+ d7Queue[pcQPtr] = m68k_get_reg(NULL, M68K_REG_D7);
pcQPtr++;
pcQPtr &= 0x3FF;
static char buffer[2048];
for(int i=0; i<0x400; i++)
{
- WriteLog("[A2=%08X, D0=%08X]\n", a2Queue[(pcQPtr + i) & 0x3FF], d0Queue[(pcQPtr + i) & 0x3FF]);
+// WriteLog("[A2=%08X, D0=%08X]\n", a2Queue[(pcQPtr + i) & 0x3FF], d0Queue[(pcQPtr + i) & 0x3FF]);
+ WriteLog("[A0=%08X, A1=%08X, A2=%08X, A3=%08X, A4=%08X, A5=%08X, A6=%08X, A7=%08X, D0=%08X, D1=%08X, D2=%08X, D3=%08X, D4=%08X, D5=%08X, D6=%08X, D7=%08X]\n", a0Queue[(pcQPtr + i) & 0x3FF], a1Queue[(pcQPtr + i) & 0x3FF], a2Queue[(pcQPtr + i) & 0x3FF], a3Queue[(pcQPtr + i) & 0x3FF], a4Queue[(pcQPtr + i) & 0x3FF], a5Queue[(pcQPtr + i) & 0x3FF], a6Queue[(pcQPtr + i) & 0x3FF], a7Queue[(pcQPtr + i) & 0x3FF], d0Queue[(pcQPtr + i) & 0x3FF], d1Queue[(pcQPtr + i) & 0x3FF], d2Queue[(pcQPtr + i) & 0x3FF], d3Queue[(pcQPtr + i) & 0x3FF], d4Queue[(pcQPtr + i) & 0x3FF], d5Queue[(pcQPtr + i) & 0x3FF], d6Queue[(pcQPtr + i) & 0x3FF], d7Queue[(pcQPtr + i) & 0x3FF]);
m68k_disassemble(buffer, pcQueue[(pcQPtr + i) & 0x3FF], 0);//M68K_CPU_TYPE_68000);
WriteLog("\t%08X: %s\n", pcQueue[(pcQPtr + i) & 0x3FF], buffer);
}