Move Corecompare to Tools directory

This commit is contained in:
jb
2009-02-05 08:55:36 +00:00
parent 586150bf93
commit 1345b04608
9 changed files with 0 additions and 9928 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,149 +0,0 @@
// !$*UTF8*$!
{
08FB7793FE84155DC02AAC07 /* Project object */ = {
activeArchitecture = ppc;
activeBuildConfigurationName = Release;
activeExecutable = EF8E674E0DA226B4000B54B0 /* corecompare */;
activeTarget = 8DD76FA90486AB0100D96B5E /* corecompare */;
addToTargets = (
8DD76FA90486AB0100D96B5E /* corecompare */,
);
breakpoints = (
);
codeSenseManager = EF8E67550DA226BA000B54B0 /* Code sense */;
executables = (
EF8E674E0DA226B4000B54B0 /* corecompare */,
);
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
243,
20,
48,
43,
43,
20,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
PBXFileDataSource_Target_ColumnID,
);
};
PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
203,
60,
20,
48,
43,
43,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXTargetDataSource_PrimaryAttribute,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 228834066;
PBXWorkspaceStateSaveDate = 228834066;
};
sourceControlManager = EF8E67540DA226BA000B54B0 /* Source Control */;
userBuildSettings = {
};
};
8DD76FA90486AB0100D96B5E /* corecompare */ = {
activeExec = 0;
executables = (
EF8E674E0DA226B4000B54B0 /* corecompare */,
);
};
EF8E674E0DA226B4000B54B0 /* corecompare */ = {
isa = PBXExecutable;
activeArgIndices = (
);
argumentStrings = (
);
autoAttachOnCrash = 1;
breakpointsEnabled = 0;
configStateDict = {
};
customDataFormattersEnabled = 1;
debuggerPlugin = GDBDebugging;
disassemblyDisplayState = 0;
dylibVariantSuffix = "";
enableDebugStr = 1;
environmentEntries = (
);
executableSystemSymbolLevel = 0;
executableUserSymbolLevel = 0;
libgmallocEnabled = 0;
name = corecompare;
sourceDirectories = (
);
};
EF8E67540DA226BA000B54B0 /* Source Control */ = {
isa = PBXSourceControlManager;
fallbackIsa = XCSourceControlManager;
isSCMEnabled = 0;
scmConfiguration = {
};
};
EF8E67550DA226BA000B54B0 /* Code sense */ = {
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
EF8E676B0DA22D89000B54B0 /* corecompare.c */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {691, 3136}}";
sepNavSelRange = "{1892, 0}";
sepNavVisRange = "{4014, 1289}";
sepNavWindowFrame = "{{530, 104}, {750, 728}}";
};
};
EF8E676E0DA22D92000B54B0 /* corecpu.c */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {691, 24976}}";
sepNavSelRange = "{812, 0}";
sepNavVisRange = "{0, 1590}";
sepNavWindowFrame = "{{519, 66}, {750, 728}}";
};
};
EF8E676F0DA22D92000B54B0 /* corecpu.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {439, 2422}}";
sepNavSelRange = "{757, 75}";
sepNavVisRange = "{544, 315}";
};
};
EF8E677C0DA231E1000B54B0 /* cpu6502.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {691, 1330}}";
sepNavSelRange = "{1729, 52}";
sepNavVisRange = "{1268, 881}";
sepNavWindowFrame = "{{421, 93}, {750, 728}}";
};
};
EF8E677D0DA231E1000B54B0 /* cpu6502.c */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {691, 42966}}";
sepNavSelRange = "{13594, 52}";
sepNavVisRange = "{12984, 1303}";
sepNavWindowFrame = "{{86, 104}, {750, 728}}";
};
};
}

View File

@@ -1,243 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 44;
objects = {
/* Begin PBXBuildFile section */
8DD76FB00486AB0100D96B5E /* corecompare.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6A0FF2C0290799A04C91782 /* corecompare.1 */; };
EF8E676C0DA22D89000B54B0 /* corecompare.c in Sources */ = {isa = PBXBuildFile; fileRef = EF8E676B0DA22D89000B54B0 /* corecompare.c */; };
EF8E67700DA22D92000B54B0 /* corecpu.c in Sources */ = {isa = PBXBuildFile; fileRef = EF8E676E0DA22D92000B54B0 /* corecpu.c */; };
EF8E677E0DA231E1000B54B0 /* cpu6502.c in Sources */ = {isa = PBXBuildFile; fileRef = EF8E677D0DA231E1000B54B0 /* cpu6502.c */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
8DD76FAF0486AB0100D96B5E /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 8;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
8DD76FB00486AB0100D96B5E /* corecompare.1 in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
8DD76FB20486AB0100D96B5E /* corecompare */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = corecompare; sourceTree = BUILT_PRODUCTS_DIR; };
C6A0FF2C0290799A04C91782 /* corecompare.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = corecompare.1; sourceTree = "<group>"; };
EF8E676B0DA22D89000B54B0 /* corecompare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = corecompare.c; path = ../src/corecompare.c; sourceTree = SOURCE_ROOT; };
EF8E676E0DA22D92000B54B0 /* corecpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = corecpu.c; sourceTree = "<group>"; };
EF8E676F0DA22D92000B54B0 /* corecpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = corecpu.h; sourceTree = "<group>"; };
EF8E677C0DA231E1000B54B0 /* cpu6502.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cpu6502.h; path = ../../../src/cpu/cpu6502.h; sourceTree = SOURCE_ROOT; };
EF8E677D0DA231E1000B54B0 /* cpu6502.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cpu6502.c; path = ../../../src/cpu/cpu6502.c; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8DD76FAD0486AB0100D96B5E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
08FB7794FE84155DC02AAC07 /* corecompare */ = {
isa = PBXGroup;
children = (
08FB7795FE84155DC02AAC07 /* Source */,
C6A0FF2B0290797F04C91782 /* Documentation */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
name = corecompare;
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
EF8E67580DA2270E000B54B0 /* src */,
);
name = Source;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8DD76FB20486AB0100D96B5E /* corecompare */,
);
name = Products;
sourceTree = "<group>";
};
C6A0FF2B0290797F04C91782 /* Documentation */ = {
isa = PBXGroup;
children = (
C6A0FF2C0290799A04C91782 /* corecompare.1 */,
);
name = Documentation;
sourceTree = "<group>";
};
EF8E67580DA2270E000B54B0 /* src */ = {
isa = PBXGroup;
children = (
EF8E67770DA231AF000B54B0 /* CPU_JBN */,
EF8E676D0DA22D92000B54B0 /* CPU_MTO */,
EF8E676B0DA22D89000B54B0 /* corecompare.c */,
);
name = src;
sourceTree = "<group>";
};
EF8E676D0DA22D92000B54B0 /* CPU_MTO */ = {
isa = PBXGroup;
children = (
EF8E676E0DA22D92000B54B0 /* corecpu.c */,
EF8E676F0DA22D92000B54B0 /* corecpu.h */,
);
name = CPU_MTO;
path = ../src/CPU_MTO;
sourceTree = SOURCE_ROOT;
};
EF8E67770DA231AF000B54B0 /* CPU_JBN */ = {
isa = PBXGroup;
children = (
EF8E677C0DA231E1000B54B0 /* cpu6502.h */,
EF8E677D0DA231E1000B54B0 /* cpu6502.c */,
);
name = CPU_JBN;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8DD76FA90486AB0100D96B5E /* corecompare */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB928508733DD80010E9CD /* Build configuration list for PBXNativeTarget "corecompare" */;
buildPhases = (
8DD76FAB0486AB0100D96B5E /* Sources */,
8DD76FAD0486AB0100D96B5E /* Frameworks */,
8DD76FAF0486AB0100D96B5E /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = corecompare;
productInstallPath = "$(HOME)/bin";
productName = corecompare;
productReference = 8DD76FB20486AB0100D96B5E /* corecompare */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "corecompare" */;
compatibilityVersion = "Xcode 3.0";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* corecompare */;
projectDirPath = "";
projectRoot = "";
targets = (
8DD76FA90486AB0100D96B5E /* corecompare */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
8DD76FAB0486AB0100D96B5E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
EF8E676C0DA22D89000B54B0 /* corecompare.c in Sources */,
EF8E67700DA22D92000B54B0 /* corecpu.c in Sources */,
EF8E677E0DA231E1000B54B0 /* cpu6502.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
1DEB928608733DD80010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = corecompare;
ZERO_LINK = YES;
};
name = Debug;
};
1DEB928708733DD80010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
HEADER_SEARCH_PATHS = (
../../../src/emulator/,
../../../src/,
../../../src/cpu/,
../src/include/,
);
INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = corecompare;
};
name = Release;
};
1DEB928A08733DD80010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
};
name = Debug;
};
1DEB928B08733DD80010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1DEB928508733DD80010E9CD /* Build configuration list for PBXNativeTarget "corecompare" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB928608733DD80010E9CD /* Debug */,
1DEB928708733DD80010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "corecompare" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB928A08733DD80010E9CD /* Debug */,
1DEB928B08733DD80010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,163 +0,0 @@
/**
* CoreCPU - The Quick6502 Project
* corecpu.h
*
* Created by Manoel Trapier on 24/02/08
* Copyright 2008 986 Corp. All rights reserved.
*
* $LastChangedDate: 2008-03-21 01:55:10 +0100 (Ven, 21 mar 2008) $
* $Author: godzil $
* $HeadURL: svn+ssh://godzil@trac.godzil.net/svn/projects/Quick6502/trunk/corecpu.h $
* $Revision: 41 $
*
*/
#ifndef _QUICK6502_CORECPU_H_
#define _QUICK6502_CORECPU_H_
/* M6502 configuration
*
* Supported DEFINEs :
* NO_DECIMAL Quick6502 will not support BDC arithemtic (used for NES)
* CMOS_6502 Quick6502 will act as a CMOS 6502 (Not actually used)
*
*/
#ifdef CMOS_6502
#warning Quick6502 CMOS support is actually desactivated, desactivate it
#undef CMOS_6502
#endif
#ifndef NO_DECIMAL
#warning Quick6502 have actually no BCD support, fallback to no NO_DECIMAL
#define NO_DECIMAL
#endif
#include "types.h"
typedef byte (*quick6502_MemoryReadFunction)(unsigned short addr);
typedef void (*quick6502_MemoryWriteFunction)(unsigned short addr, byte value);
typedef struct quick6502_cpu_
{
/* 6502 registers */
byte reg_A, reg_X, reg_Y;
byte reg_P, reg_S;
unsigned short reg_PC;
/* Read/Write memory functions */
quick6502_MemoryReadFunction memory_read;
quick6502_MemoryWriteFunction memory_write;
quick6502_MemoryReadFunction memory_page0_read;
quick6502_MemoryWriteFunction memory_page0_write;
quick6502_MemoryReadFunction memory_stack_read;
quick6502_MemoryWriteFunction memory_stack_write;
quick6502_MemoryReadFunction memory_opcode_read;
/* Timing related */
long cycle_done;
byte exit_loop;
/* Other config options */
byte running; /* This field is used to prevent cpu free if this cpu is running */
} quick6502_cpu;
typedef struct quick6502_cpuconfig_
{
/* Read/Write memory functions */
quick6502_MemoryReadFunction memory_read;
quick6502_MemoryWriteFunction memory_write;
quick6502_MemoryReadFunction memory_page0_read;
quick6502_MemoryWriteFunction memory_page0_write;
quick6502_MemoryReadFunction memory_stack_read;
quick6502_MemoryWriteFunction memory_stack_write;
quick6502_MemoryReadFunction memory_opcode_read;
} quick6502_cpuconfig;
/*** Signal that we can send to the CPU ***/
typedef enum
{
Q6502_NO_SIGNAL = 0,
Q6502_IRQ_SIGNAL,
Q6502_NMI_SIGNAL,
Q6502_STOPLOOP_SIGNAL
} quick6502_signal;
/*** Some 6502 related definitions ***/
/*** P register flags ***/
#define Q6502_N_FLAG 0x80 /* Negavite flag */
#define Q6502_V_FLAG 0x40 /* oVerflow flag */
#define Q6502_R_FLAG 0x20 /* Not a real flag, but need to be to 1 on PHP */
#define Q6502_B_FLAG 0x10 /* Break flag */
#define Q6502_D_FLAG 0x08 /* BCD flag */
#define Q6502_I_FLAG 0x04 /* IRQ/BRK flag */
#define Q6502_Z_FLAG 0x02 /* Zero flag */
#define Q6502_C_FLAG 0x01 /* Carry flag */
/*** Interuption Vectors ***/
#define Q6502_NMI_LOW 0xFFFA
#define Q6502_NMI_HIGH 0xFFFB
#define Q6502_RESET_LOW 0xFFFC
#define Q6502_RESET_HIGH 0xFFFD
#define Q6502_IRQ_LOW 0xFFFE
#define Q6502_IRQ_HIGH 0xFFFF
/**
* Initialise the CPU
*
* Inputs:
*
* - CPU Init structure:
* +- Memory Read function pointer
* +- Memory Write function pointer
* +- Fast memory read function pointer (for opcodes read)
* +- Fast page 0 function / Read/Write
* +- Fast page 1 function / Read/Write
*
* Output:
*
* (void *): An opaque pointer to the internal structure of the CPU
*
*/
quick6502_cpu *quick6502_init(quick6502_cpuconfig *config);
/* Reset the CPU (must be done after init) */
void quick6502_reset(quick6502_cpu *cpu);
/**
* Run cpu for at least X cycles
*
* Output:
*
* int: (Number of cycle really done) - (Number of cycle asked)
*/
int quick6502_run(quick6502_cpu *cpu, int cycles);
/** Loop CPU until explicit quit */
void quick6502_loop(quick6502_cpu *cpu);
/** Run CPU for one instruction */
void quick6502_exec(quick6502_cpu *cpu);
/** Send IRQ/NMI/EXITLOOP signal to CPU */
void quick6502_int(quick6502_cpu *cpu, quick6502_signal signal);
/** Dump CPU State to the given file */
void quick6502_dump(quick6502_cpu *cpu, FILE * fp);
/** Get current instruction name at specified address and put it into buffer */
void quick6502_getinstruction(quick6502_cpu *cpu, unsigned short addr, char *buffer);
/**
* Free the CPU
*
* This function will free the CPU only if it's not currently used, it will
* return !0 if everything goes well and 0 if the free is impossible
*/
int quick6502_free(quick6502_cpu *cpu);
#endif /* _QUICK6502_CORECPU_H_ */

View File

@@ -1,220 +0,0 @@
/*
* corecompare.c
* Quick6502
*
* Created by Manoël Trapier on 18/03/08.
* Copyright 2008 986 Corp. All rights reserved.
*
* Simple tool to compare both core results
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include "corecpu.h"
#define BLANK_TIME 5000
#include "types.h"
byte mMainMemory[64*1024];
byte qMainMemory[64*1024];
unsigned short ProgramOrg = 0xFFE5;
byte Program[] = { 0xA9, 0xA5, 0x40, 0x18, 0x78, 0xD8, 0xB8, 0x00, 0xEA, 0xAA, 0xCA, 0xCA, 0xEA, 0x6A, 0x4C, 0xF2, 0xFF, 0xEA, 0x4C, 0xF2, 0xFF, 0xE7, 0xFF, 0xE8, 0xFF, 0xE5, 0xFF };
unsigned short Smb1Org = 0x8000;
#include "smb1.h"
#include "nestest.h"
unsigned short qMemoryReadAddr, mMemoryReadAddr;
unsigned short qMemoryWriteAddr, mMemoryWriteAddr;
unsigned char qMemoryWriteValue, mMemoryWriteValue;
unsigned char qMemoryReadValue, mMemoryReadValue;
/* Quick6502 related functions and main thread */
byte ReadMemory(unsigned short addr)
{
return (qMemoryReadValue = qMainMemory[(qMemoryReadAddr = addr)]);
}
byte ReadMemoryOpCode(unsigned short addr)
{
return qMainMemory[addr] ;
}
void WriteMemory(unsigned short addr, byte value)
{
qMemoryWriteValue = value;
qMemoryWriteAddr = addr;
qMainMemory[addr] = value;
}
/* JBN's 6502 CPU related functions */
#include <stdint.h>
#include "cpu6502.h"
#include "cyclesTable.h"
void Wr6502(register uint16_t Addr,register uint8_t Value)
{
mMemoryWriteValue = Value;
mMemoryWriteAddr = Addr;
mMainMemory[Addr] = Value;
}
uint8_t Rd6502 (register uint16_t Addr)
{
return (mMemoryReadValue = mMainMemory[(mMemoryReadAddr = Addr)]);
}
uint8_t Op6502 (register uint16_t Addr)
{
return mMainMemory[Addr];
}
void debugger_stop ()
{
}
int Exec6502 (nes_cpu6502_t *cpu)
{
uint8_t opcode;
int result;
/* Manage the Current Opcode. */
opcode = cpu->memRead (cpu->pc);
result = cpu6502_execOpCode (cpu, opcode);
if (result != 0) {
return -1;
}
/* Compute the CPU Time taken by the executed opcode. */
cpu->nbCycles -= OpcodesCycles[opcode];
return result;
}
int main (int argc, const char * argv[]) {
char qBuffer[100],
mBuffer[100],
qBuffer2[100],
mBuffer2[100];
int result, result2;
int count = 0;
int x;
/* Copy the 6502 program to both CPU's Memory */
//memcpy(MainMemory+ ProgramOrg, Program, 0x10000 - ProgramOrg );
//memcpy(qMainMemory+ Smb1Org, smb1, 0x10000 - Smb1Org );
//memcpy(mMainMemory+ Smb1Org, smb1, 0x10000 - Smb1Org );
memcpy(qMainMemory+ 0xC000, nestest, 0x10000 - 0xC000 );
memcpy(mMainMemory+ 0xC000, nestest, 0x10000 - 0xC000 );
mMainMemory[0x2002] = 0xC0;
qMainMemory[0x2002] = 0xC0;
/* mMainMemory[0x4016] = 0x41;
qMainMemory[0x4016] = 0x41;*/
/* Initialise both core */
nes_cpu6502_t mCpu;
quick6502_cpu *qCpu;
quick6502_cpuconfig CpuConfig;
/* Init the CPU */
CpuConfig.memory_read = ReadMemory;
CpuConfig.memory_write = WriteMemory;
CpuConfig.memory_opcode_read = ReadMemory;
CpuConfig.memory_page0_read =
CpuConfig.memory_stack_read = NULL;
CpuConfig.memory_page0_write =
CpuConfig.memory_stack_write = NULL;
qCpu = quick6502_init(&CpuConfig);
if (!qCpu)
{
printf("CPU initialisation error...");
exit(-1);
}
mCpu.memRead = Rd6502;
mCpu.memWrite = Wr6502;
quick6502_reset(qCpu);
cpuReset (&mCpu);
/* Run each one insruction by one instruction */
while(1)
{
if (count > 19000)
{
printf("Fire NMI!\n");
quick6502_int(qCpu, Q6502_NMI_SIGNAL);
NMI_Interrupt (&mCpu);
count = 0;
}
mMemoryWriteValue = 0;
mMemoryWriteAddr = 0;
mMemoryReadValue = 0;
mMemoryReadAddr = 0;
qMemoryWriteValue = 0;
qMemoryWriteAddr = 0;
qMemoryReadValue = 0;
qMemoryReadAddr = 0;
quick6502_exec(qCpu);
Exec6502(&mCpu);
sprintf(qBuffer, "A:%02X X:%02X Y:%02X S:%02X P:%02X PC:%04X",
qCpu->reg_A, qCpu->reg_X, qCpu->reg_Y, qCpu->reg_S, qCpu->reg_P, qCpu->reg_PC);
sprintf(mBuffer, "A:%02X X:%02X Y:%02X S:%02X P:%02X PC:%04X",
mCpu.a, mCpu.x, mCpu.y, mCpu.R_Stack, mCpu.R_Status, mCpu.pc);
result = strcmp(qBuffer, mBuffer);
sprintf(qBuffer2, "[R:%04X:%02X - W:%04X:%02X]",
qMemoryReadAddr,
qMemoryReadValue,
qMemoryWriteAddr,
qMemoryWriteValue);
sprintf(mBuffer2, "[R:%04X:%02X - W:%04X:%02X]",
mMemoryReadAddr,
mMemoryReadValue,
mMemoryWriteAddr,
mMemoryWriteValue);
result2 = strcmp(qBuffer2, mBuffer2);
if ((result != 0) || (result2 != 0))
{
#if 0
for ( x = 0x00; x < 0x100; x++)
{
printf("%02X|%02X ", ReadMemory(x), Rd6502(x));
if ((x&0x0F) == 0x0F)
printf("\n");
}
#endif
printf("REGS | %s | %s | %s\n", qBuffer, (result==0)?"===":"/!\\", mBuffer);
printf("MEMA | %s | %s | %s\n", qBuffer2, (result2==0)?"===":"/!\\", mBuffer2);
}
count ++;
}
return 0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +0,0 @@
/*
* Base type definitions - The TI-NESulator Project
* types.h - Taken from the Quick6502 project
*
* Created by Manoel Trapier on 18/09/06.
* Copyright 2003-2008 986 Corp. All rights reserved.
*
* $LastChangedDate: 2008-03-12 12:12:07 +0100 (Mer, 12 mar 2008) $
* $Author: godzil $
* $HeadURL: svn+ssh://godzil@trac.godzil.net/svn/projects/Quick6502/types.h $
* $Revision: 26 $
*
*/
#ifndef TYPES_H
#define TYPES_H
#ifndef BYTE_TYPE_DEFINED
#define BYTE_TYPE_DEFINED
typedef unsigned char byte;
#endif
typedef unsigned char bool;
#define true (0)
#define false (!true)
#endif