One more intermediate state - not compilable.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5644 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2002-2003 Ullrich von Bassewitz */
|
/* (C) 2002-2012, Ullrich von Bassewitz */
|
||||||
/* R<EFBFBD>merstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -44,10 +44,10 @@
|
|||||||
|
|
||||||
/* sim65 */
|
/* sim65 */
|
||||||
#include "cfgdata.h"
|
#include "cfgdata.h"
|
||||||
|
#include "chip.h"
|
||||||
#include "chipdata.h"
|
#include "chipdata.h"
|
||||||
#include "cpucore.h"
|
#include "cpucore.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "chip.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -301,6 +301,7 @@ ChipInstance* MirrorChipInstance (const ChipInstance* Orig, unsigned Addr)
|
|||||||
|
|
||||||
/* Initialize the fields */
|
/* Initialize the fields */
|
||||||
CI->C = Orig->C;
|
CI->C = Orig->C;
|
||||||
|
CI->AS = 0;
|
||||||
CI->Addr = Addr;
|
CI->Addr = Addr;
|
||||||
CI->Size = Orig->Size;
|
CI->Size = Orig->Size;
|
||||||
CI->Data = Orig->Data;
|
CI->Data = Orig->Data;
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2002-2003 Ullrich von Bassewitz */
|
/* (C) 2003-2012, Ullrich von Bassewitz */
|
||||||
/* R<EFBFBD>merstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
|||||||
@@ -143,8 +143,8 @@ static void ParseCPU (void)
|
|||||||
AttrCheck (Attr, atType, "TYPE");
|
AttrCheck (Attr, atType, "TYPE");
|
||||||
AttrCheck (Attr, atAddrSpace, "ADDRSPACE");
|
AttrCheck (Attr, atAddrSpace, "ADDRSPACE");
|
||||||
|
|
||||||
/* Create the CPU */
|
/* Create the system using the specified CPU */
|
||||||
CPUInstance = NewCPU ("6502", Size);
|
System = NewSystem (NewCPU ("6502", Size));
|
||||||
|
|
||||||
/* Skip the semicolon */
|
/* Skip the semicolon */
|
||||||
CfgConsumeSemi ();
|
CfgConsumeSemi ();
|
||||||
@@ -158,7 +158,7 @@ static void ParseAddrSpace (void)
|
|||||||
unsigned I;
|
unsigned I;
|
||||||
|
|
||||||
/* CPU must be defined before the address space */
|
/* CPU must be defined before the address space */
|
||||||
if (CPUInstance == 0) {
|
if (System == 0) {
|
||||||
CfgError ("CPU must be defined before address space definitions");
|
CfgError ("CPU must be defined before address space definitions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cpucore.c */
|
/* cpu-6502.c */
|
||||||
/* */
|
/* */
|
||||||
/* CPU core for the 6502 simulator */
|
/* CPU core for the 6502 simulator */
|
||||||
/* */
|
/* */
|
||||||
@@ -44,17 +44,17 @@
|
|||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
|
|
||||||
/* sim65 */
|
/* sim65 */
|
||||||
|
#include "cpu-6502.h"
|
||||||
#include "cpuregs.h"
|
#include "cpuregs.h"
|
||||||
#include "cputype.h"
|
#include "cputype.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "cpucore.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Data */
|
/* Data */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cpucore.h */
|
/* cpu-6502.h */
|
||||||
/* */
|
/* */
|
||||||
/* CPU core for the 6502 simulator */
|
/* CPU core for the 6502 simulator */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2002-2003 Ullrich von Bassewitz */
|
/* (C) 2002-2012, Ullrich von Bassewitz */
|
||||||
/* R<EFBFBD>merstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -33,8 +33,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef CPUCORE_H
|
#ifndef CPU_6502_H
|
||||||
#define CPUCORE_H
|
#define CPU_6502_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ void CPURun (void);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* End of cpucore.h */
|
/* End of cpu-6502.h */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -44,17 +44,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/* Data */
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* The actual CPU instance */
|
|
||||||
CPUCore* CPU = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Code */
|
/* Code */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -76,7 +65,7 @@ CPUCore* NewCPUCore (const char* Name, unsigned AddrSpaceSize)
|
|||||||
|
|
||||||
/* Initialize the data */
|
/* Initialize the data */
|
||||||
C->Handle = 0; /* ### */
|
C->Handle = 0; /* ### */
|
||||||
C->AS = NewAddressSpace (AddrSpaceSize);
|
C->AddressSize = AddrSpaceSize;
|
||||||
|
|
||||||
/* Return the new CPU core */
|
/* Return the new CPU core */
|
||||||
return C;
|
return C;
|
||||||
|
|||||||
@@ -52,12 +52,14 @@
|
|||||||
/* CPU core structure */
|
/* CPU core structure */
|
||||||
typedef struct CPUCore CPUCore;
|
typedef struct CPUCore CPUCore;
|
||||||
struct CPUCore {
|
struct CPUCore {
|
||||||
void* Handle; /* Pointer to shared lib handle */
|
void* Handle; /* Pointer to shared lib handle */
|
||||||
AddressSpace* AS; /* Address space */
|
unsigned AddressSize; /* Size of the address space */
|
||||||
};
|
|
||||||
|
|
||||||
/* The actual CPU instance */
|
/* Callback functions */
|
||||||
extern CPUCore* CPU;
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
88
src/sim65/cpudata.h
Normal file
88
src/sim65/cpudata.h
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
/*****************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* cpudata.h */
|
||||||
|
/* */
|
||||||
|
/* CPU data passed from the CPU plugins */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* (C) 2012, Ullrich von Bassewitz */
|
||||||
|
/* Roemerstrasse 52 */
|
||||||
|
/* D-70794 Filderstadt */
|
||||||
|
/* EMail: uz@cc65.org */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
/* warranty. In no event will the authors be held liable for any damages */
|
||||||
|
/* arising from the use of this software. */
|
||||||
|
/* */
|
||||||
|
/* Permission is granted to anyone to use this software for any purpose, */
|
||||||
|
/* including commercial applications, and to alter it and redistribute it */
|
||||||
|
/* freely, subject to the following restrictions: */
|
||||||
|
/* */
|
||||||
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
||||||
|
/* claim that you wrote the original software. If you use this software */
|
||||||
|
/* in a product, an acknowledgment in the product documentation would be */
|
||||||
|
/* appreciated but is not required. */
|
||||||
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
||||||
|
/* be misrepresented as being the original software. */
|
||||||
|
/* 3. This notice may not be removed or altered from any source */
|
||||||
|
/* distribution. */
|
||||||
|
/* */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef CPUDATA_H
|
||||||
|
#define CPUDATA_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Data */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Forwards */
|
||||||
|
struct SimData;
|
||||||
|
|
||||||
|
/* CPUData structure */
|
||||||
|
typedef struct CPUData CPUData;
|
||||||
|
struct CPUData {
|
||||||
|
const char* CPUName; /* Name of the chip */
|
||||||
|
unsigned MajorVersion; /* Version information */
|
||||||
|
unsigned MinorVersion;
|
||||||
|
|
||||||
|
/* -- Exported functions -- */
|
||||||
|
|
||||||
|
void Init (const struct SimData* Data);
|
||||||
|
/* Initialize the CPU module */
|
||||||
|
|
||||||
|
void* (*CreateInstance) (void* CfgInfo);
|
||||||
|
/* Create an instance of the CPU. Return the instance data pointer */
|
||||||
|
|
||||||
|
void (*DestroyInstance) (void* Data);
|
||||||
|
/* Destroy an instance of the CPU */
|
||||||
|
|
||||||
|
void Reset (void* Data);
|
||||||
|
/* Generate a CPU RESET */
|
||||||
|
|
||||||
|
void IRQRequest (void* Data);
|
||||||
|
/* Generate an IRQ */
|
||||||
|
|
||||||
|
void NMIRequest (void* Data);
|
||||||
|
/* Generate an NMI */
|
||||||
|
|
||||||
|
void Run (void* Data);
|
||||||
|
/* Run one CPU instruction */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* End of cpudata.h */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ static void OptChipDir (const char* Opt attribute ((unused)), const char* Arg)
|
|||||||
char* Name;
|
char* Name;
|
||||||
struct stat S;
|
struct stat S;
|
||||||
|
|
||||||
/* ### Ignore anything buy *.so files */
|
/* ### Ignore anything but *.so files */
|
||||||
unsigned NameLen = strlen (E->d_name);
|
unsigned NameLen = strlen (E->d_name);
|
||||||
if (NameLen <= 3) {
|
if (NameLen <= 3) {
|
||||||
continue;
|
continue;
|
||||||
@@ -168,7 +168,7 @@ static void OptConfig (const char* Opt attribute ((unused)), const char* Arg)
|
|||||||
{
|
{
|
||||||
if (CfgAvail ()) {
|
if (CfgAvail ()) {
|
||||||
Error ("Cannot use -C twice");
|
Error ("Cannot use -C twice");
|
||||||
}
|
}
|
||||||
CfgSetName (Arg);
|
CfgSetName (Arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2003 Ullrich von Bassewitz */
|
/* (C) 2003-2012, Ullrich von Bassewitz */
|
||||||
/* R<EFBFBD>merstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -37,7 +37,6 @@
|
|||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
/* sim65 */
|
/* sim65 */
|
||||||
#include "addrspace.h"
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +47,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
System* NewSystem (struct CPUData* CPU)
|
System* NewSystem (CPUCore* CPU)
|
||||||
/* Create and initialize a new System struct. The function will read the size
|
/* Create and initialize a new System struct. The function will read the size
|
||||||
* of the address space from the CPU, and also create a new AddressSpace
|
* of the address space from the CPU, and also create a new AddressSpace
|
||||||
* object. No chips are assigned, however.
|
* object. No chips are assigned, however.
|
||||||
@@ -59,7 +58,7 @@ System* NewSystem (struct CPUData* CPU)
|
|||||||
|
|
||||||
/* Initialize the fields */
|
/* Initialize the fields */
|
||||||
Sys->CPU = CPU;
|
Sys->CPU = CPU;
|
||||||
Sys->AS = 0; /* ### */
|
Sys->AS = NewAddressSpace (CPU->AddressSize);
|
||||||
Sys->ChipInstances = AUTO_COLLECTION_INITIALIZER;
|
Sys->ChipInstances = AUTO_COLLECTION_INITIALIZER;
|
||||||
|
|
||||||
/* Return the new system */
|
/* Return the new system */
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2003 Ullrich von Bassewitz */
|
/* (C) 2003-2012, Ullrich von Bassewitz */
|
||||||
/* R<EFBFBD>merstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
@@ -41,6 +41,10 @@
|
|||||||
/* common.h */
|
/* common.h */
|
||||||
#include "coll.h"
|
#include "coll.h"
|
||||||
|
|
||||||
|
/* sim65 */
|
||||||
|
#include "addrspace.h"
|
||||||
|
#include "cpucore.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -50,29 +54,30 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Forwards */
|
/* Forwards */
|
||||||
struct CPUData;
|
struct CPUCore;
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
typedef struct System System;
|
typedef struct System System;
|
||||||
struct System {
|
struct System {
|
||||||
|
CPUCore* CPU; /* The CPU in the system */
|
||||||
struct CPUData* CPU; /* The CPU in the system */
|
AddressSpace* AS; /* The CPU address space */
|
||||||
struct AddressSpace* AS; /* The CPU address space */
|
Collection ChipInstances; /* Instances of all the chips */
|
||||||
Collection ChipInstances;/* Instances of all the chips */
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Global pointer to simulated system */
|
||||||
|
extern System* System;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Code */
|
/* Code */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
System* NewSystem (struct CPUData* CPU);
|
System* NewSystem (CPUCore* CPU);
|
||||||
/* Create and initialize a new System struct. The function will read the size
|
/* Create and initialize a new System struct. The function will read the size
|
||||||
* of the address space from the CPU, and also create a new AddressSpace
|
* of the address space from the CPU, and also create a new AddressSpace
|
||||||
* object. No chips are assigned, however.
|
* object. No chips are assigned, however.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user