Moved CPU definition into common/

git-svn-id: svn://svn.cc65.org/cc65/trunk@2111 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-05-01 23:24:20 +00:00
parent 8fb90af8ff
commit 986e3779ce
17 changed files with 174 additions and 81 deletions

View File

@@ -6,10 +6,10 @@
/* */
/* */
/* */
/* (C) 1998-2000 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@musoftware.de */
/* (C) 1998-2003 Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
@@ -331,8 +331,7 @@ static const struct {
/* The current CPU and an array with instruction tables */
static enum CPUType CPU = CPU_6502;
/* An array with instruction tables */
static const InsTable* InsTabs[CPU_COUNT] = {
(const InsTable*) &InsTab6502,
(const InsTable*) &InsTab65SC02,
@@ -676,7 +675,7 @@ static int CmpName (const void* Key, const void* Instr)
void SetCPU (enum CPUType NewCPU)
void SetCPU (cpu_t NewCPU)
/* Set a new CPU */
{
/* Make sure the parameter is correct */
@@ -693,7 +692,7 @@ void SetCPU (enum CPUType NewCPU)
enum CPUType GetCPU (void)
cpu_t GetCPU (void)
/* Return the current CPU */
{
return CPU;

View File

@@ -1,15 +1,15 @@
/*****************************************************************************/
/* */
/* instr.h */
/* instr.h */
/* */
/* Instruction encoding for the ca65 macroassembler */
/* */
/* */
/* */
/* (C) 1998-2000 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@musoftware.de */
/* (C) 1998-2003 Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
@@ -38,21 +38,17 @@
/* common */
#include "cpu.h"
/*****************************************************************************/
/* Data */
/* Data */
/*****************************************************************************/
/* Supported CPUs */
enum CPUType {
CPU_6502,
CPU_65C02,
CPU_65816,
CPU_SUNPLUS, /* Not in the freeware version - sorry */
CPU_COUNT /* Count of different CPUs */
};
/* Constants for the addressing mode. If an opcode is available in zero page
* and absolut adressing mode, both bits are set. When checking for valid
* modes, the zeropage bit is checked first. Similar, the implicit bit is set
@@ -134,10 +130,10 @@ extern unsigned char ExtBytes [AMI_COUNT];
void SetCPU (enum CPUType NewCPU);
void SetCPU (cpu_t NewCPU);
/* Set a new CPU */
enum CPUType GetCPU (void);
cpu_t GetCPU (void);
/* Return the current CPU */
int FindInstruction (const char* Ident);

View File

@@ -609,6 +609,15 @@ int main (int argc, char* argv [])
exit (EXIT_FAILURE);
}
/* If no CPU given, use the default CPU for the target */
if (GetCPU () == CPU_UNKNOWN) {
if (Target != TGT_UNKNOWN) {
SetCPU (DefaultCPU[Target]);
} else {
SetCPU (CPU_6502);
}
}
/* Intialize the target translation tables */
TgtTranslateInit ();