mirror of
https://github.com/cc65/cc65.git
synced 2024-12-28 06:30:16 +00:00
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:
parent
10d58204b5
commit
74ee7a44a9
@ -6,10 +6,10 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2002-2003 Ullrich von Bassewitz */
|
||||
/* Römerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* (C) 2002-2012, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@ -44,10 +44,10 @@
|
||||
|
||||
/* sim65 */
|
||||
#include "cfgdata.h"
|
||||
#include "chip.h"
|
||||
#include "chipdata.h"
|
||||
#include "cpucore.h"
|
||||
#include "error.h"
|
||||
#include "chip.h"
|
||||
|
||||
|
||||
|
||||
@ -301,6 +301,7 @@ ChipInstance* MirrorChipInstance (const ChipInstance* Orig, unsigned Addr)
|
||||
|
||||
/* Initialize the fields */
|
||||
CI->C = Orig->C;
|
||||
CI->AS = 0;
|
||||
CI->Addr = Addr;
|
||||
CI->Size = Orig->Size;
|
||||
CI->Data = Orig->Data;
|
||||
|
@ -6,10 +6,10 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2002-2003 Ullrich von Bassewitz */
|
||||
/* Römerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* (C) 2003-2012, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* 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, atAddrSpace, "ADDRSPACE");
|
||||
|
||||
/* Create the CPU */
|
||||
CPUInstance = NewCPU ("6502", Size);
|
||||
/* Create the system using the specified CPU */
|
||||
System = NewSystem (NewCPU ("6502", Size));
|
||||
|
||||
/* Skip the semicolon */
|
||||
CfgConsumeSemi ();
|
||||
@ -158,7 +158,7 @@ static void ParseAddrSpace (void)
|
||||
unsigned I;
|
||||
|
||||
/* CPU must be defined before the address space */
|
||||
if (CPUInstance == 0) {
|
||||
if (System == 0) {
|
||||
CfgError ("CPU must be defined before address space definitions");
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* cpucore.c */
|
||||
/* cpu-6502.c */
|
||||
/* */
|
||||
/* CPU core for the 6502 simulator */
|
||||
/* */
|
||||
@ -44,17 +44,17 @@
|
||||
#include "strbuf.h"
|
||||
|
||||
/* sim65 */
|
||||
#include "cpu-6502.h"
|
||||
#include "cpuregs.h"
|
||||
#include "cputype.h"
|
||||
#include "error.h"
|
||||
#include "global.h"
|
||||
#include "memory.h"
|
||||
#include "cpucore.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* cpucore.h */
|
||||
/* cpu-6502.h */
|
||||
/* */
|
||||
/* CPU core for the 6502 simulator */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2002-2003 Ullrich von Bassewitz */
|
||||
/* Römerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* (C) 2002-2012, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@ -33,8 +33,8 @@
|
||||
|
||||
|
||||
|
||||
#ifndef CPUCORE_H
|
||||
#define CPUCORE_H
|
||||
#ifndef CPU_6502_H
|
||||
#define CPU_6502_H
|
||||
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ void CPURun (void);
|
||||
|
||||
|
||||
|
||||
/* End of cpucore.h */
|
||||
/* End of cpu-6502.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -44,17 +44,6 @@
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* The actual CPU instance */
|
||||
CPUCore* CPU = 0;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
@ -76,7 +65,7 @@ CPUCore* NewCPUCore (const char* Name, unsigned AddrSpaceSize)
|
||||
|
||||
/* Initialize the data */
|
||||
C->Handle = 0; /* ### */
|
||||
C->AS = NewAddressSpace (AddrSpaceSize);
|
||||
C->AddressSize = AddrSpaceSize;
|
||||
|
||||
/* Return the new CPU core */
|
||||
return C;
|
||||
|
@ -52,12 +52,14 @@
|
||||
/* CPU core structure */
|
||||
typedef struct CPUCore CPUCore;
|
||||
struct CPUCore {
|
||||
void* Handle; /* Pointer to shared lib handle */
|
||||
AddressSpace* AS; /* Address space */
|
||||
};
|
||||
void* Handle; /* Pointer to shared lib handle */
|
||||
unsigned AddressSize; /* Size of the address space */
|
||||
|
||||
/* The actual CPU instance */
|
||||
extern CPUCore* CPU;
|
||||
/* Callback functions */
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
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;
|
||||
struct stat S;
|
||||
|
||||
/* ### Ignore anything buy *.so files */
|
||||
/* ### Ignore anything but *.so files */
|
||||
unsigned NameLen = strlen (E->d_name);
|
||||
if (NameLen <= 3) {
|
||||
continue;
|
||||
@ -168,7 +168,7 @@ static void OptConfig (const char* Opt attribute ((unused)), const char* Arg)
|
||||
{
|
||||
if (CfgAvail ()) {
|
||||
Error ("Cannot use -C twice");
|
||||
}
|
||||
}
|
||||
CfgSetName (Arg);
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,10 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2003 Ullrich von Bassewitz */
|
||||
/* Römerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* (C) 2003-2012, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@ -37,7 +37,6 @@
|
||||
#include "xmalloc.h"
|
||||
|
||||
/* sim65 */
|
||||
#include "addrspace.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
|
||||
* of the address space from the CPU, and also create a new AddressSpace
|
||||
* object. No chips are assigned, however.
|
||||
@ -59,7 +58,7 @@ System* NewSystem (struct CPUData* CPU)
|
||||
|
||||
/* Initialize the fields */
|
||||
Sys->CPU = CPU;
|
||||
Sys->AS = 0; /* ### */
|
||||
Sys->AS = NewAddressSpace (CPU->AddressSize);
|
||||
Sys->ChipInstances = AUTO_COLLECTION_INITIALIZER;
|
||||
|
||||
/* Return the new system */
|
||||
|
@ -6,10 +6,10 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2003 Ullrich von Bassewitz */
|
||||
/* Römerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* (C) 2003-2012, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@ -41,6 +41,10 @@
|
||||
/* common.h */
|
||||
#include "coll.h"
|
||||
|
||||
/* sim65 */
|
||||
#include "addrspace.h"
|
||||
#include "cpucore.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -50,29 +54,30 @@
|
||||
|
||||
|
||||
/* Forwards */
|
||||
struct CPUData;
|
||||
struct CPUCore;
|
||||
|
||||
/* */
|
||||
typedef struct System System;
|
||||
struct System {
|
||||
|
||||
struct CPUData* CPU; /* The CPU in the system */
|
||||
struct AddressSpace* AS; /* The CPU address space */
|
||||
Collection ChipInstances;/* Instances of all the chips */
|
||||
|
||||
CPUCore* CPU; /* The CPU in the system */
|
||||
AddressSpace* AS; /* The CPU address space */
|
||||
Collection ChipInstances; /* Instances of all the chips */
|
||||
};
|
||||
|
||||
/* Global pointer to simulated system */
|
||||
extern System* System;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
System* NewSystem (struct CPUData* CPU);
|
||||
/* 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
|
||||
System* NewSystem (CPUCore* CPU);
|
||||
/* 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
|
||||
* object. No chips are assigned, however.
|
||||
*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user