prepare: obj
@echo -e "\033[01;33m***\033[00;32m Preparing to compile Virtual Jaguar...\033[00m"
-# @echo "#define VJ_RELEASE_VERSION \"v2.0.2\"" > src/version.h
-# @echo "#define VJ_RELEASE_SUBVERSION \"Final\"" >> src/version.h
- @echo "#define VJ_RELEASE_VERSION \"SVN `svn info | grep -i revision`\"" > src/version.h
- @echo "#define VJ_RELEASE_SUBVERSION \"2.0.2 Prerelease\"" >> src/version.h
+ @echo "#define VJ_RELEASE_VERSION \"v2.0.2\"" > src/version.h
+ @echo "#define VJ_RELEASE_SUBVERSION \"Final\"" >> src/version.h
+# @echo "#define VJ_RELEASE_VERSION \"SVN `svn info | grep -i revision`\"" > src/version.h
+# @echo "#define VJ_RELEASE_SUBVERSION \"2.0.2 Prerelease\"" >> src/version.h
virtualjaguar: sources libs makefile-qt
@echo -e "\033[01;33m***\033[00;32m Making Virtual Jaguar GUI...\033[00m"
Stuff to add/fix for the next release of Virtual Jaguar
-------------------------------------------------------
+- Fix VC behavior to match what a real Jaguar does. Still not sure just what
+ the heck is going on there. [Shamus]
- Fix DSP code so that it doesn't hang in a spinlock waiting for the sound
buffer to empty. Probably a CS lock contention issue. [Shamus]
- Create an EEPROMs directory (or whatever is in EEPROMPath[]) if it doesn't
real hardware. [Shamus]
* Fixed video frame timing for both NTSC *and* PAL. [Shamus]
* Improved OP logging, added emulation of OP bug. [Shamus]
-* Fixed VC behavior to match what a real Jaguar does. [Shamus]
+* Fixed addressing bug with UAE 68000 core. [Shamus]
Virtual Jaguar v2.0.1 GCC/Qt
VJ_RELEASE_VERSION " (" VJ_RELEASE_SUBVERSION ")"
"</td></tr>"
"<tr><td align='right'><b>Coders: </b></td><td>James L. Hammons (shamus)<br>Niels Wagenaar (nwagenaar)<br>Carwin Jones (Caz)<br>Adam Green</td></tr>"
- "<tr><td align='right'><b>Testers: </b></td><td>Cyrano Jones, Robert R, TheUMan, Dissection,<br>overridex, geormetal</td></tr>"
+ "<tr><td align='right'><b>Testers: </b></td><td>Cyrano Jones, LinkoVitch, neo-rg, Robert R,<br>TheUMan, Dissection, overridex, geormetal</td></tr>"
"<tr><td align='right'><b>Build Team: </b></td><td>ggn (win32)<br>LinkoVitch, goldenegg (MacOS)</td></tr>"
"<tr><td align='right'><b>Homepage: </b></td><td>http://icculus.org/virtualjaguar/</td></tr>"
"</table>"
{
printf("Virtual Jaguar 2.0.0 help\n");
printf("\n");
- printf("Command line interface is non-functional ATM, but may return if there is\n"
- "enough demand for it. :-)\n");
+ printf("Command line interface is mostly non-functional ATM, but may return if\n"
+ "there is enough demand for it. :-)\n");
return 0;
}
if (strcmp(argv[1], "--yarrr") == 0)
// This is so we can pass this stuff using signal/slot mechanism...
//ick int id = qRegisterMetaType<uint32>();
- LogInit("virtualjaguar.log"); // Init logfile
+ bool success = (bool)LogInit("virtualjaguar.log"); // Init logfile
int retVal = -1; // Default is failure
+ if (!success)
+ printf("Failed to open virtualjaguar.log for writing!\n");
+
// Set up SDL library
if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO) < 0)
{
// This sets it to the "too large size" as the minimum!
QScrollBar * vsb = new QScrollBar(Qt::Vertical, this);
int sbWidth = vsb->size().width();
- printf("VSB size width: %u\n", sbWidth);
+// printf("VSB size width: %u\n", sbWidth);
int sbWidth2 = vsb->sizeHint().width();
- printf("VSB sizeHint width: %u\n", sbWidth2);
+// printf("VSB sizeHint width: %u\n", sbWidth2);
int sbWidth3 = vsb->minimumSize().width();
- printf("VSB minimum width: %u\n", sbWidth3);
+// printf("VSB minimum width: %u\n", sbWidth3);
int sbWidth4 = vsb->frameSize().width();
- printf("VSB frame width: %u\n", sbWidth4);
+// printf("VSB frame width: %u\n", sbWidth4);
delete vsb;
// fileList->setFixedWidth((488/4) + 4);
int sbWidth5 = fileList->frameWidth();
- printf("List frame width: %u, (diff=%d)\n", sbWidth5, sbWidth5 - ((488/4) + 4));
+// printf("List frame width: %u, (diff=%d)\n", sbWidth5, sbWidth5 - ((488/4) + 4));
int sbWidth6 = fileList->sizeHint().width();
- printf("List sizeHint width: %u\n", sbWidth6);
+// printf("List sizeHint width: %u\n", sbWidth6);
int sbWidth7 = fileList->minimumSize().width();
- printf("List minimum width: %u\n", sbWidth7);
+// printf("List minimum width: %u\n", sbWidth7);
int sbWidth8 = fileList->minimumSizeHint().width();
- printf("List minimum hint width: %u\n", sbWidth8);
-// fileList->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
-// fileList->verticalScrollBar()->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+// printf("List minimum hint width: %u\n", sbWidth8);
+//// fileList->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+//// fileList->verticalScrollBar()->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
// (488/4) + 4 is the width of the object in the filelistmodel. Dunno why the QListView
// isn't picking that up. :-(
// 488/4 + 4 = 126
if (pauseForFileSelector)
{
pauseForFileSelector = false;
- ToggleRunState();
+
+ // Some nutter might have unpaused while in the file selector, so check for that
+ if (!running)
+ ToggleRunState();
}
}
}
#endif
+void ShowM68KContext(void)
+{
+ printf("\t68K PC=%06X\n", m68k_get_reg(NULL, M68K_REG_PC));
+
+ for(int i=M68K_REG_D0; i<=M68K_REG_D7; i++)
+ {
+ printf("D%i = %08X ", i-M68K_REG_D0, m68k_get_reg(NULL, (m68k_register_t)i));
+
+ if (i == M68K_REG_D3 || i == M68K_REG_D7)
+ printf("\n");
+ }
+
+ for(int i=M68K_REG_A0; i<=M68K_REG_A7; i++)
+ {
+ printf("A%i = %08X ", i-M68K_REG_A0, m68k_get_reg(NULL, (m68k_register_t)i));
+
+ if (i == M68K_REG_A3 || i == M68K_REG_A7)
+ printf("\n");
+ }
+
+ uint32_t currpc = m68k_get_reg(NULL, M68K_REG_PC);
+ uint32_t disPC = currpc - 30;
+ char buffer[128];
+
+ do
+ {
+ uint32_t oldpc = disPC;
+ disPC += m68k_disassemble(buffer, disPC, 0);
+ printf("%s%08X: %s\n", (oldpc == currpc ? ">" : " "), oldpc, buffer);
+ }
+ while (disPC < (currpc + 10));
+}
+
//
// Musashi 68000 read/write/IRQ functions
//
unsigned int m68k_read_memory_8(unsigned int address)
{
+ // Musashi does this automagically for you, UAE core does not :-P
+ address &= 0x00FFFFFF;
#ifdef CPU_DEBUG_MEMORY
if ((address >= 0x000000) && (address <= 0x3FFFFF))
{
unsigned int m68k_read_memory_16(unsigned int address)
{
+ // Musashi does this automagically for you, UAE core does not :-P
+ address &= 0x00FFFFFF;
#ifdef CPU_DEBUG_MEMORY
/* if ((address >= 0x000000) && (address <= 0x3FFFFE))
{
unsigned int m68k_read_memory_32(unsigned int address)
{
+ // Musashi does this automagically for you, UAE core does not :-P
+ address &= 0x00FFFFFF;
//; So, it seems that it stores the returned DWORD at $51136 and $FB074.
/* if (address == 0x51136 || address == 0xFB074 || address == 0x1AF05E)
WriteLog("[RM32 PC=%08X] Addr: %08X, val: %08X\n", m68k_get_reg(NULL, M68K_REG_PC), address, (m68k_read_memory_16(address) << 16) | m68k_read_memory_16(address + 2));//*/
void m68k_write_memory_8(unsigned int address, unsigned int value)
{
+ // Musashi does this automagically for you, UAE core does not :-P
+ address &= 0x00FFFFFF;
#ifdef CPU_DEBUG_MEMORY
if ((address >= 0x000000) && (address <= 0x3FFFFF))
{
//$53D0
/*if (address >= 0x53D0 && address <= 0x53FF)
printf("M68K: Writing byte $%02X at $%08X, PC=$%08X\n", value, address, m68k_get_reg(NULL, M68K_REG_PC));//*/
+//Testing AvP on UAE core...
+//000075A0: FFFFF80E B6320220 (BITMAP)
+/*if (address == 0x75A0 && value == 0xFF)
+ printf("M68K: (8) Tripwire hit...\n");//*/
#ifndef USE_NEW_MMU
if ((address >= 0x000000) && (address <= 0x3FFFFF))
void m68k_write_memory_16(unsigned int address, unsigned int value)
{
+ // Musashi does this automagically for you, UAE core does not :-P
+ address &= 0x00FFFFFF;
#ifdef CPU_DEBUG_MEMORY
if ((address >= 0x000000) && (address <= 0x3FFFFE))
{
//$53D0
/*if (address >= 0x53D0 && address <= 0x53FF)
printf("M68K: Writing word $%04X at $%08X, PC=$%08X\n", value, address, m68k_get_reg(NULL, M68K_REG_PC));//*/
+//Testing AvP on UAE core...
+//000075A0: FFFFF80E B6320220 (BITMAP)
+/*if (address == 0x75A0 && value == 0xFFFF)
+{
+ printf("\nM68K: (16) Tripwire hit...\n");
+ ShowM68KContext();
+}//*/
#ifndef USE_NEW_MMU
if ((address >= 0x000000) && (address <= 0x3FFFFE))
void m68k_write_memory_32(unsigned int address, unsigned int value)
{
+ // Musashi does this automagically for you, UAE core does not :-P
+ address &= 0x00FFFFFF;
/*if (address == 0x4E00)
WriteLog("M68K: Writing %02X at %08X, PC=%08X\n", value, address, m68k_get_reg(NULL, M68K_REG_PC));//*/
//WriteLog("--> [WM32]\n");
doGPUDis = true;//*/
/* if (address == 0x51136 || address == 0xFB074)
WriteLog("[WM32 PC=%08X] Addr: %08X, val: %02X\n", m68k_get_reg(NULL, M68K_REG_PC), address, value);//*/
+//Testing AvP on UAE core...
+//000075A0: FFFFF80E B6320220 (BITMAP)
+/*if (address == 0x75A0 && (value & 0xFFFF0000) == 0xFFFF0000)
+{
+ printf("\nM68K: (32) Tripwire hit...\n");
+ ShowM68KContext();
+}//*/
#ifndef USE_NEW_MMU
m68k_write_memory_16(address, value >> 16);
void M68K_show_context(void)
{
- WriteLog("\t68K PC=%06X\n", m68k_get_reg(NULL, M68K_REG_PC));
+ WriteLog("68K PC=%06X\n", m68k_get_reg(NULL, M68K_REG_PC));
+
for(int i=M68K_REG_D0; i<=M68K_REG_D7; i++)
- WriteLog("\tD%i = %08X\n", i-M68K_REG_D0, m68k_get_reg(NULL, (m68k_register_t)i));
- WriteLog("\n");
+ {
+ WriteLog("D%i = %08X ", i-M68K_REG_D0, m68k_get_reg(NULL, (m68k_register_t)i));
+
+ if (i == M68K_REG_D3 || i == M68K_REG_D7)
+ WriteLog("\n");
+ }
+
for(int i=M68K_REG_A0; i<=M68K_REG_A7; i++)
- WriteLog("\tA%i = %08X\n", i-M68K_REG_A0, m68k_get_reg(NULL, (m68k_register_t)i));
+ {
+ WriteLog("A%i = %08X ", i-M68K_REG_A0, m68k_get_reg(NULL, (m68k_register_t)i));
+
+ if (i == M68K_REG_A3 || i == M68K_REG_A7)
+ WriteLog("\n");
+ }
WriteLog("68K disasm\n");
// jaguar_dasm(s68000readPC()-0x1000,0x20000);
//Seems to want $01010101... Dunno why. Investigate!
memset(jaguarMainROM, 0x01, 0x600000); // & set it to all 01s...
// memset(jaguar_mainRom, 0xFF, 0x600000); // & set it to all Fs...
- lowerField = false; // Reset the lower field flag
+ lowerField = false; // Reset the lower field flag
m68k_set_cpu_type(M68K_CPU_TYPE_68000);
+ m68k_pulse_reset(); // Need to do this so UAE disasm doesn't segfault on exit
GPUInit();
DSPInit();
TOMInit();
/* WriteLog("\n\nM68000 disassembly at $4000...\n");
JaguarDasm(0x4000, 10000);
WriteLog("\n");//*/
+// WriteLog("\n\nM68000 disassembly at $802000...\n");
+// JaguarDasm(0x800830, 0x1000);
}
//
ARFLAGS := -rs
# Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2
-CFLAGS := -MMD -O2 -ffast-math -fomit-frame-pointer
+CFLAGS := -MMD -O2 -ffast-math -fomit-frame-pointer -g
INCS := -I. -I./obj `sdl-config --cflags`
/* Sommarhack 2010) (see m68000.h) */
-const char GenCpu_fileid[] = "Hatari gencpu.c : " __DATE__ " " __TIME__;
+//const char GenCpu_fileid[] = "Hatari gencpu.c : " __DATE__ " " __TIME__;
#include <ctype.h>
#include <string.h>
//void m68k_disasm(FILE * f, uint32_t addr, uint32_t * nextpc, int cnt)
unsigned int m68k_disasm(char * output, uint32_t addr, uint32_t * nextpc, int cnt)
{
+ // Sanity checking...
+// if (addr > 0xFFFFFF)
+// addr = 0;
+
char f[256], str[256];
static const char * const ccnames[] =
{ "T ","F ","HI","LS","CC","CS","NE","EQ",
void Dasm(uint32_t offset, uint32_t qt)
{
#ifdef CPU_DEBUG
+// back up a few instructions...
+//offset -= 100;
static char buffer[2048];//, mem[64];
int pc = offset, oldpc;
uint32_t i;
#endif
}
+#ifdef CPU_DEBUG
+void DumpRegisters(void)
+{
+ uint32_t i;
+
+ for(i=0; i<16; i++)
+ {
+ printf("%s%i: %08X ", (i < 8 ? "D" : "A"), i & 0x7, regs.regs[i]);
+
+ if ((i & 0x03) == 3)
+ printf("\n");
+ }
+}
+#endif
+
void m68k_set_cpu_type(unsigned int type)
{
if (inRoutine)
instSeen++;
+#endif
+// AvP testing... (problem was: 32 bit addresses on 24 bit address cpu--FIXED)
+#if 0
+ static int go = 0;
+
+ if (regs.pc == 0x94BA)
+ {
+ go = 1;
+ printf("\n");
+ }
+
+ if (regs.pc == 0x94C6)
+ go = 0;
+
+// if (regs.regs[10] == 0xFFFFFFFF && go)
+ if (go)
+ {
+// printf("A2=-1, PC=%08X\n", regs.pc);
+// go = 0;
+// Dasm(regs.pc, 130);
+ Dasm(regs.pc, 1);
+ DumpRegisters();
+ }
+//94BA: 2468 0000 MOVEA.L (A0,$0000) == $0002328A, A2
+//94BE: 200A MOVE.L A2, D0
+//94C0: 6A02 BPL.B $94C4
+//94C2: 2452 MOVEA.L (A2), A2 ; <--- HERE
+//94C4: 4283 CLR.L D3
#endif
uint32_t opcode = get_iword(0);
//if ((opcode & 0xFFF8) == 0x31C0)