From: cuz Date: Fri, 8 Aug 2003 11:12:04 +0000 (+0000) Subject: Base code for handling different CPUs, more improvements X-Git-Tag: V2.12.0~1470 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=897f3e953079ed54c01ad72ddb312e1d5d43f388;p=cc65 Base code for handling different CPUs, more improvements git-svn-id: svn://svn.cc65.org/cc65/trunk@2253 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/da65/cpu.c b/src/da65/cpu.c deleted file mode 100644 index b772b3fbb..000000000 --- a/src/da65/cpu.c +++ /dev/null @@ -1,66 +0,0 @@ -/*****************************************************************************/ -/* */ -/* cpu.c */ -/* */ -/* CPU type definitions */ -/* */ -/* */ -/* */ -/* (C) 2000 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ -/* */ -/* */ -/* 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. */ -/* */ -/*****************************************************************************/ - - - -#include "cpu.h" - - - -/*****************************************************************************/ -/* Data */ -/*****************************************************************************/ - - - -/* Current CPU */ -CPUType CPU = CPU_6502; - - - -/*****************************************************************************/ -/* Code */ -/*****************************************************************************/ - - - -void SetCPU (CPUType NewCPU) -/* Set a new CPU */ -{ - CPU = NewCPU; -} - - - - - diff --git a/src/da65/cpu.h b/src/da65/cpu.h deleted file mode 100644 index b945c6ba6..000000000 --- a/src/da65/cpu.h +++ /dev/null @@ -1,76 +0,0 @@ -/*****************************************************************************/ -/* */ -/* cpu.h */ -/* */ -/* CPU type definitions */ -/* */ -/* */ -/* */ -/* (C) 2000 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ -/* */ -/* */ -/* 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 CPU_H -#define CPU_H - - - -/*****************************************************************************/ -/* Data */ -/*****************************************************************************/ - - - -/* Supported CPUs */ -typedef enum CPUType { - CPU_6502 = 0x01, - CPU_65C02 = 0x02, - CPU_65816 = 0x04, - CPU_ALL = 0x07 -} CPUType; - -/* Current CPU */ -extern CPUType CPU; - - - -/*****************************************************************************/ -/* Code */ -/*****************************************************************************/ - - - -void SetCPU (CPUType NewCPU); -/* Set a new CPU */ - - - -/* End of cpu.h */ - -#endif - - - diff --git a/src/da65/global.c b/src/da65/global.c index f1052c58a..04c4c68e1 100644 --- a/src/da65/global.c +++ b/src/da65/global.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 2000-2003 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -52,6 +52,7 @@ const char OutExt[] = ".dis"; /* Output file extension */ const char CfgExt[] = ".cfg"; /* Config file extension */ /* Flags and other command line stuff */ +unsigned char DebugInfo = 0; /* Add debug info to the object file */ unsigned char FormFeeds = 0; /* Add form feeds to the output? */ unsigned char PassCount = 2; /* How many passed do we do? */ unsigned long StartAddr = 0xC000; /* Start/load address of the program */ diff --git a/src/da65/global.h b/src/da65/global.h index 4c2b10663..73af8d4a6 100644 --- a/src/da65/global.h +++ b/src/da65/global.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 2000-2003 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -53,6 +53,7 @@ extern const char OutExt[]; /* Output file extension */ extern const char CfgExt[]; /* Config file extension */ /* Flags and other command line stuff */ +extern unsigned char DebugInfo; /* Add debug info to the object file */ extern unsigned char FormFeeds; /* Add form feeds to the output? */ extern unsigned char PassCount; /* How many passed do we do? */ extern unsigned long StartAddr; /* Start/load address of the program */ diff --git a/src/da65/main.c b/src/da65/main.c index fcb1ccfce..9fe9cedca 100644 --- a/src/da65/main.c +++ b/src/da65/main.c @@ -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ömerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -42,6 +42,7 @@ /* common */ #include "abend.h" #include "cmdline.h" +#include "cpu.h" #include "fname.h" #include "print.h" #include "version.h" @@ -50,7 +51,6 @@ #include "attrtab.h" #include "code.h" #include "config.h" -#include "cpu.h" #include "data.h" #include "error.h" #include "global.h" @@ -82,6 +82,7 @@ static void Usage (void) "\n" "Long options:\n" " --cpu type\t\tSet cpu type\n" + " --debug-info\t\tAdd debug info to object file\n" " --formfeeds\t\tAdd formfeeds to the output\n" " --help\t\tHelp (this text)\n" " --pagelength n\tSet the page length for the listing\n" @@ -120,25 +121,21 @@ static unsigned long CvtNumber (const char* Arg, const char* Number) -static void OptCPU (const char* Opt, const char* Arg) +static void OptCPU (const char* Opt attribute ((unused)), const char* Arg) /* Handle the --cpu option */ { - if (Arg == 0) { - NeedArg (Opt); - } - if (strcmp (Arg, "6502") == 0) { - SetCPU (CPU_6502); - } else if (strcmp (Arg, "65C02") == 0) { - SetCPU (CPU_65C02); - } else if (strcmp (Arg, "65816") == 0) { - SetCPU (CPU_65816); -#ifdef SUNPLUS - } else if (strcmp (Arg, "sunplus") == 0) { - SetCPU (CPU_SUNPLUS); -#endif - } else { - AbEnd ("Invalid CPU: `%s'", Arg); - } + /* Find the CPU from the given name */ + CPU = FindCPU (Arg); + SetOpcTable (CPU); +} + + + +static void OptDebugInfo (const char* Opt attribute ((unused)), + const char* Arg attribute ((unused))) +/* Add debug info to the object file */ +{ + DebugInfo = 1; } @@ -257,7 +254,7 @@ static void OneOpcode (unsigned RemainingBytes) case atDWordTab: DWordTable (); - break; + break; case atAddrTab: AddrTable (); @@ -307,6 +304,7 @@ static void Disassemble (void) /* Pass 2 */ Pass = 2; ResetCode (); + OutputSettings (); DefOutOfRangeLabels (); OnePass (); } @@ -319,6 +317,7 @@ int main (int argc, char* argv []) /* Program long options */ static const LongOpt OptTab[] = { { "--cpu", 1, OptCPU }, + { "--debug-info", 0, OptDebugInfo }, { "--formfeeds", 0, OptFormFeeds }, { "--help", 0, OptHelp }, { "--pagelength", 1, OptPageLength }, @@ -347,6 +346,10 @@ int main (int argc, char* argv []) LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); break; + case 'g': + OptDebugInfo (Arg, 0); + break; + case 'h': OptHelp (Arg, 0); break; @@ -405,6 +408,11 @@ int main (int argc, char* argv []) OutFile = MakeFilename (InFile, OutExt); } + /* If no CPU given, use the default CPU */ + if (CPU == CPU_UNKNOWN) { + CPU = CPU_6502; + } + /* Load the input file */ LoadCode (InFile, StartAddr); diff --git a/src/da65/make/gcc.mak b/src/da65/make/gcc.mak index 348c5e391..9f98eee83 100644 --- a/src/da65/make/gcc.mak +++ b/src/da65/make/gcc.mak @@ -13,12 +13,15 @@ LDFLAGS= OBJS = attrtab.o \ code.o \ config.o \ - cpu.o \ data.o \ error.o \ global.o \ handler.o \ main.o \ + opc6502.o \ + opc65816.o \ + opc65c02.o \ + opc65sc02.o \ opctable.o \ output.o \ scanner.o diff --git a/src/da65/opc6502.c b/src/da65/opc6502.c new file mode 100644 index 000000000..129b596f8 --- /dev/null +++ b/src/da65/opc6502.c @@ -0,0 +1,309 @@ +/*****************************************************************************/ +/* */ +/* opc6502.h */ +/* */ +/* 6502 opcode description table */ +/* */ +/* */ +/* */ +/* (C) 2003 Ullrich von Bassewitz */ +/* Römerstrasse 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. */ +/* */ +/*****************************************************************************/ + + + +/* da65 */ +#include "handler.h" +#include "opc6502.h" + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +/* Descriptions for all opcodes */ +const OpcDesc OpcTable_6502[256] = { + { "brk", 1, 0, CPU_6502, OH_Implicit }, /* $00 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $01 */ + { "cop", 2, 0, CPU_65816, OH_Implicit }, /* $02 */ + { "ora", 2, 0, CPU_65816, OH_StackRelative }, /* $03 */ + { "tsb", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $04 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $05 */ + { "asl", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $06 */ + { "ora", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $07 */ + { "php", 1, 0, CPU_6502, OH_Implicit }, /* $08 */ + { "ora", 2, 0, CPU_6502, OH_Immidiate }, /* $09 */ + { "asl", 1, 0, CPU_6502, OH_Accumulator }, /* $0a */ + { "phd", 1, 0, CPU_65816, OH_Implicit }, /* $0b */ + { "tsb", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $0c */ + { "ora", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $0d */ + { "asl", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $0e */ + { "ora", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $0f */ + { "bpl", 2, lfLabel, CPU_6502, OH_Relative }, /* $10 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $11 */ + { "ora", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $12 */ + { "ora", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $13 */ + { "trb", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $14 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $15 */ + { "asl", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $16 */ + { "ora", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $17 */ + { "clc", 1, 0, CPU_6502, OH_Implicit }, /* $18 */ + { "ora", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $19 */ + { "inc", 1, 0, CPU_65816, OH_Accumulator }, /* $1a */ + { "tcs", 1, 0, CPU_65816, OH_Implicit }, /* $1b */ + { "trb", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $1c */ + { "ora", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $1d */ + { "asl", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $1e */ + { "ora", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $1f */ + { "jsr", 3, lfLabel, CPU_6502, OH_Absolute }, /* $20 */ + { "and", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $21 */ + { "jsl", 3, lfLabel, CPU_65816, OH_AbsoluteLong }, /* $22 */ + { "and", 2, 0, CPU_65816, OH_StackRelative }, /* $23 */ + { "bit", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $24 */ + { "and", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $25 */ + { "rol", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $26 */ + { "and", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $27 */ + { "plp", 1, 0, CPU_6502, OH_Implicit }, /* $28 */ + { "and", 2, 0, CPU_6502, OH_Immidiate }, /* $29 */ + { "rol", 1, 0, CPU_6502, OH_Accumulator }, /* $2a */ + { "pld", 1, 0, CPU_65816, OH_Implicit }, /* $2b */ + { "bit", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $2c */ + { "and", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $2d */ + { "rol", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $2e */ + { "and", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $2f */ + { "bmi", 2, lfLabel, CPU_6502, OH_Relative }, /* $30 */ + { "and", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $31 */ + { "and", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $32 */ + { "and", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $33 */ + { "bit", 2, lfUseLabel, CPU_65816, OH_DirectX }, /* $34 */ + { "and", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $35 */ + { "rol", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $36 */ + { "and", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $37 */ + { "sec", 1, 0, CPU_6502, OH_Implicit }, /* $38 */ + { "and", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $39 */ + { "dec", 1, 0, CPU_65816, OH_Accumulator }, /* $3a */ + { "tsc", 1, 0, CPU_65816, OH_Implicit }, /* $3b */ + { "bit", 3, lfUseLabel, CPU_65816, OH_AbsoluteX }, /* $3c */ + { "and", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $3d */ + { "rol", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $3e */ + { "and", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $3f */ + { "rti", 1, 0, CPU_6502, OH_Rts }, /* $40 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $41 */ + { "wdm", 2, 0, CPU_65816, OH_Implicit }, /* $42 */ + { "eor", 2, 0, CPU_65816, OH_StackRelative }, /* $43 */ + { "mvp", 3, 0, CPU_65816, OH_BlockMove }, /* $44 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $45 */ + { "lsr", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $46 */ + { "eor", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $47 */ + { "pha", 1, 0, CPU_6502, OH_Implicit }, /* $48 */ + { "eor", 2, 0, CPU_6502, OH_Immidiate }, /* $49 */ + { "lsr", 1, 0, CPU_6502, OH_Accumulator }, /* $4a */ + { "phk", 1, 0, CPU_65816, OH_Implicit }, /* $4b */ + { "jmp", 3, lfLabel, CPU_6502, OH_JmpAbsolute }, /* $4c */ + { "eor", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $4d */ + { "lsr", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $4e */ + { "eor", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $4f */ + { "bvc", 2, lfLabel, CPU_6502, OH_Relative }, /* $50 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $51 */ + { "eor", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $52 */ + { "eor", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $53 */ + { "mvn", 3, 0, CPU_65816, OH_BlockMove }, /* $54 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $55 */ + { "lsr", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $56 */ + { "eor", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $57 */ + { "cli", 1, 0, CPU_6502, OH_Implicit }, /* $58 */ + { "eor", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $59 */ + { "phy", 1, 0, CPU_65816, OH_Implicit }, /* $5a */ + { "tcd", 1, 0, CPU_65816, OH_Implicit }, /* $5b */ + { "jml", 4, lfLabel, CPU_65816, OH_AbsoluteLong }, /* $5c */ + { "eor", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $5d */ + { "lsr", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $5e */ + { "eor", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $5f */ + { "rts", 1, 0, CPU_6502, OH_Rts }, /* $60 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $61 */ + { "per", 3, lfLabel, CPU_65816, OH_RelativeLong }, /* $62 */ + { "adc", 2, 0, CPU_65816, OH_StackRelative }, /* $63 */ + { "stz", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $64 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $65 */ + { "ror", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $66 */ + { "adc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $67 */ + { "pla", 1, 0, CPU_6502, OH_Implicit }, /* $68 */ + { "adc", 2, 0, CPU_6502, OH_Immidiate }, /* $69 */ + { "ror", 1, 0, CPU_6502, OH_Accumulator }, /* $6a */ + { "rtl", 1, 0, CPU_65816, OH_Implicit }, /* $6b */ + { "jmp", 3, lfLabel, CPU_6502, OH_JmpAbsoluteIndirect }, /* $6c */ + { "adc", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $6d */ + { "ror", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $6e */ + { "adc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $6f */ + { "bvs", 2, lfLabel, CPU_6502, OH_Relative }, /* $70 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $71 */ + { "adc", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $72 */ + { "adc", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $73 */ + { "stz", 2, lfUseLabel, CPU_65816, OH_DirectX }, /* $74 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $75 */ + { "ror", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $76 */ + { "adc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $77 */ + { "sei", 1, 0, CPU_6502, OH_Implicit }, /* $78 */ + { "adc", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $79 */ + { "ply", 1, 0, CPU_65816, OH_Implicit }, /* $7a */ + { "tdc", 1, 0, CPU_65816, OH_Implicit }, /* $7b */ + { "jmp", 3, lfLabel, CPU_65816, OH_AbsoluteXIndirect }, /* $7c */ + { "adc", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $7d */ + { "ror", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $7e */ + { "adc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $7f */ + { "bra", 2, lfLabel, CPU_65816, OH_Relative }, /* $80 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $81 */ + { "brl", 3, lfLabel, CPU_65816, OH_RelativeLong }, /* $82 */ + { "sta", 2, 0, CPU_65816, OH_StackRelative }, /* $83 */ + { "sty", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $84 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $85 */ + { "stx", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $86 */ + { "sta", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $87 */ + { "dey", 1, 0, CPU_6502, OH_Implicit }, /* $88 */ + { "bit", 2, 0, CPU_65816, OH_Immidiate }, /* $89 */ + { "txa", 1, 0, CPU_6502, OH_Implicit }, /* $8a */ + { "phb", 1, 0, CPU_65816, OH_Implicit }, /* $8b */ + { "sty", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $8c */ + { "sta", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $8d */ + { "stx", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $8e */ + { "sta", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $8f */ + { "bcc", 2, lfLabel, CPU_6502, OH_Relative }, /* $90 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $91 */ + { "sta", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $92 */ + { "sta", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $93 */ + { "sty", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $94 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $95 */ + { "stx", 2, lfUseLabel, CPU_6502, OH_DirectY }, /* $96 */ + { "sta", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $97 */ + { "tya", 1, 0, CPU_6502, OH_Implicit }, /* $98 */ + { "sta", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $99 */ + { "txs", 1, 0, CPU_6502, OH_Implicit }, /* $9a */ + { "txy", 1, 0, CPU_65816, OH_Implicit }, /* $9b */ + { "stz", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $9c */ + { "sta", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $9d */ + { "stz", 3, lfUseLabel, CPU_65816, OH_AbsoluteX }, /* $9e */ + { "sta", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $9f */ + { "ldy", 2, 0, CPU_6502, OH_Immidiate }, /* $a0 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $a1 */ + { "ldx", 2, 0, CPU_6502, OH_Immidiate }, /* $a2 */ + { "lda", 2, 0, CPU_65816, OH_StackRelative }, /* $a3 */ + { "ldy", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $a4 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $a5 */ + { "ldx", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $a6 */ + { "lda", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $a7 */ + { "tay", 1, 0, CPU_6502, OH_Implicit }, /* $a8 */ + { "lda", 2, 0, CPU_6502, OH_Immidiate }, /* $a9 */ + { "tax", 1, 0, CPU_6502, OH_Implicit }, /* $aa */ + { "plb", 1, 0, CPU_65816, OH_Implicit }, /* $ab */ + { "ldy", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ac */ + { "lda", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ad */ + { "ldx", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ae */ + { "lda", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $af */ + { "bcs", 2, lfLabel, CPU_6502, OH_Relative }, /* $b0 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $b1 */ + { "lda", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $b2 */ + { "lda", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $b3 */ + { "ldy", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $b4 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $b5 */ + { "ldx", 2, lfUseLabel, CPU_6502, OH_DirectY }, /* $b6 */ + { "lda", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $b7 */ + { "clv", 1, 0, CPU_6502, OH_Implicit }, /* $b8 */ + { "lda", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $b9 */ + { "tsx", 1, 0, CPU_6502, OH_Implicit }, /* $ba */ + { "tyx", 1, 0, CPU_65816, OH_Implicit }, /* $bb */ + { "ldy", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $bc */ + { "lda", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $bd */ + { "ldx", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $be */ + { "lda", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $bf */ + { "cpy", 2, 0, CPU_6502, OH_Immidiate }, /* $c0 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $c1 */ + { "rep", 2, 0, CPU_65816, OH_Immidiate }, /* $c2 */ + { "cmp", 2, 0, CPU_65816, OH_StackRelative }, /* $c3 */ + { "cpy", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $c4 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $c5 */ + { "dec", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $c6 */ + { "cmp", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $c7 */ + { "iny", 1, 0, CPU_6502, OH_Implicit }, /* $c8 */ + { "cmp", 2, 0, CPU_6502, OH_Immidiate }, /* $c9 */ + { "dex", 1, 0, CPU_6502, OH_Implicit }, /* $ca */ + { "wai", 1, 0, CPU_65816, OH_Implicit }, /* $cb */ + { "cpy", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $cc */ + { "cmp", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $cd */ + { "dec", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ce */ + { "cmp", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $cf */ + { "bne", 2, lfLabel, CPU_6502, OH_Relative }, /* $d0 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $d1 */ + { "cmp", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $d2 */ + { "cmp", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $d3 */ + { "pei", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $d4 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $d5 */ + { "dec", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $d6 */ + { "cmp", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $d7 */ + { "cld", 1, 0, CPU_6502, OH_Implicit }, /* $d8 */ + { "cmp", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $d9 */ + { "phx", 1, 0, CPU_65816, OH_Implicit }, /* $da */ + { "stp", 1, 0, CPU_65816, OH_Implicit }, /* $db */ + { "jml", 3, lfLabel, CPU_65816, OH_AbsoluteIndirect }, /* $dc */ + { "cmp", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $dd */ + { "dec", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $de */ + { "cmp", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $df */ + { "cpx", 2, 0, CPU_6502, OH_Immidiate }, /* $e0 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $e1 */ + { "sep", 2, 0, CPU_65816, OH_Immidiate }, /* $e2 */ + { "sbc", 2, 0, CPU_65816, OH_StackRelative }, /* $e3 */ + { "cpx", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $e4 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $e5 */ + { "inc", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $e6 */ + { "sbc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $e7 */ + { "inx", 1, 0, CPU_6502, OH_Implicit }, /* $e8 */ + { "sbc", 2, 0, CPU_6502, OH_Immidiate }, /* $e9 */ + { "nop", 1, 0, CPU_6502, OH_Implicit }, /* $ea */ + { "xba", 1, 0, CPU_65816, OH_Implicit }, /* $eb */ + { "cpx", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ec */ + { "sbc", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ed */ + { "inc", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ee */ + { "sbc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $ef */ + { "beq", 2, lfLabel, CPU_6502, OH_Relative }, /* $f0 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $f1 */ + { "sbc", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $f2 */ + { "sbc", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $f3 */ + { "pea", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $f4 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $f5 */ + { "inc", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $f6 */ + { "sbc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $f7 */ + { "sed", 1, 0, CPU_6502, OH_Implicit }, /* $f8 */ + { "sbc", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $f9 */ + { "plx", 1, 0, CPU_65816, OH_Implicit }, /* $fa */ + { "xce", 1, 0, CPU_65816, OH_Implicit }, /* $fb */ + { "jsr", 3, lfLabel, CPU_65816, OH_AbsoluteXIndirect }, /* $fc */ + { "sbc", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $fd */ + { "inc", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $fe */ + { "sbc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $ff */ +}; + + + diff --git a/src/da65/opc6502.h b/src/da65/opc6502.h new file mode 100644 index 000000000..c74273bf6 --- /dev/null +++ b/src/da65/opc6502.h @@ -0,0 +1,60 @@ +/*****************************************************************************/ +/* */ +/* opc6502.h */ +/* */ +/* 6502 opcode description table */ +/* */ +/* */ +/* */ +/* (C) 2003 Ullrich von Bassewitz */ +/* Römerstrasse 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 OPC6502_H +#define OPC6502_H + + + +#include "opcdesc.h" + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +/* Descriptions for all opcodes */ +extern const OpcDesc OpcTable_6502[256]; + + + +/* End of opc6502.h */ +#endif + + + diff --git a/src/da65/opc65816.c b/src/da65/opc65816.c new file mode 100644 index 000000000..309da81d6 --- /dev/null +++ b/src/da65/opc65816.c @@ -0,0 +1,309 @@ +/*****************************************************************************/ +/* */ +/* opc65816.h */ +/* */ +/* 65816 opcode description table */ +/* */ +/* */ +/* */ +/* (C) 2003 Ullrich von Bassewitz */ +/* Römerstrasse 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. */ +/* */ +/*****************************************************************************/ + + + +/* da65 */ +#include "handler.h" +#include "opc65816.h" + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +/* Descriptions for all opcodes */ +const OpcDesc OpcTable_65816[256] = { + { "brk", 1, 0, CPU_6502, OH_Implicit }, /* $00 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $01 */ + { "cop", 2, 0, CPU_65816, OH_Implicit }, /* $02 */ + { "ora", 2, 0, CPU_65816, OH_StackRelative }, /* $03 */ + { "tsb", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $04 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $05 */ + { "asl", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $06 */ + { "ora", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $07 */ + { "php", 1, 0, CPU_6502, OH_Implicit }, /* $08 */ + { "ora", 2, 0, CPU_6502, OH_Immidiate }, /* $09 */ + { "asl", 1, 0, CPU_6502, OH_Accumulator }, /* $0a */ + { "phd", 1, 0, CPU_65816, OH_Implicit }, /* $0b */ + { "tsb", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $0c */ + { "ora", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $0d */ + { "asl", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $0e */ + { "ora", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $0f */ + { "bpl", 2, lfLabel, CPU_6502, OH_Relative }, /* $10 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $11 */ + { "ora", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $12 */ + { "ora", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $13 */ + { "trb", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $14 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $15 */ + { "asl", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $16 */ + { "ora", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $17 */ + { "clc", 1, 0, CPU_6502, OH_Implicit }, /* $18 */ + { "ora", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $19 */ + { "inc", 1, 0, CPU_65816, OH_Accumulator }, /* $1a */ + { "tcs", 1, 0, CPU_65816, OH_Implicit }, /* $1b */ + { "trb", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $1c */ + { "ora", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $1d */ + { "asl", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $1e */ + { "ora", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $1f */ + { "jsr", 3, lfLabel, CPU_6502, OH_Absolute }, /* $20 */ + { "and", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $21 */ + { "jsl", 3, lfLabel, CPU_65816, OH_AbsoluteLong }, /* $22 */ + { "and", 2, 0, CPU_65816, OH_StackRelative }, /* $23 */ + { "bit", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $24 */ + { "and", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $25 */ + { "rol", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $26 */ + { "and", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $27 */ + { "plp", 1, 0, CPU_6502, OH_Implicit }, /* $28 */ + { "and", 2, 0, CPU_6502, OH_Immidiate }, /* $29 */ + { "rol", 1, 0, CPU_6502, OH_Accumulator }, /* $2a */ + { "pld", 1, 0, CPU_65816, OH_Implicit }, /* $2b */ + { "bit", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $2c */ + { "and", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $2d */ + { "rol", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $2e */ + { "and", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $2f */ + { "bmi", 2, lfLabel, CPU_6502, OH_Relative }, /* $30 */ + { "and", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $31 */ + { "and", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $32 */ + { "and", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $33 */ + { "bit", 2, lfUseLabel, CPU_65816, OH_DirectX }, /* $34 */ + { "and", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $35 */ + { "rol", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $36 */ + { "and", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $37 */ + { "sec", 1, 0, CPU_6502, OH_Implicit }, /* $38 */ + { "and", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $39 */ + { "dec", 1, 0, CPU_65816, OH_Accumulator }, /* $3a */ + { "tsc", 1, 0, CPU_65816, OH_Implicit }, /* $3b */ + { "bit", 3, lfUseLabel, CPU_65816, OH_AbsoluteX }, /* $3c */ + { "and", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $3d */ + { "rol", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $3e */ + { "and", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $3f */ + { "rti", 1, 0, CPU_6502, OH_Rts }, /* $40 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $41 */ + { "wdm", 2, 0, CPU_65816, OH_Implicit }, /* $42 */ + { "eor", 2, 0, CPU_65816, OH_StackRelative }, /* $43 */ + { "mvp", 3, 0, CPU_65816, OH_BlockMove }, /* $44 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $45 */ + { "lsr", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $46 */ + { "eor", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $47 */ + { "pha", 1, 0, CPU_6502, OH_Implicit }, /* $48 */ + { "eor", 2, 0, CPU_6502, OH_Immidiate }, /* $49 */ + { "lsr", 1, 0, CPU_6502, OH_Accumulator }, /* $4a */ + { "phk", 1, 0, CPU_65816, OH_Implicit }, /* $4b */ + { "jmp", 3, lfLabel, CPU_6502, OH_JmpAbsolute }, /* $4c */ + { "eor", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $4d */ + { "lsr", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $4e */ + { "eor", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $4f */ + { "bvc", 2, lfLabel, CPU_6502, OH_Relative }, /* $50 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $51 */ + { "eor", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $52 */ + { "eor", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $53 */ + { "mvn", 3, 0, CPU_65816, OH_BlockMove }, /* $54 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $55 */ + { "lsr", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $56 */ + { "eor", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $57 */ + { "cli", 1, 0, CPU_6502, OH_Implicit }, /* $58 */ + { "eor", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $59 */ + { "phy", 1, 0, CPU_65816, OH_Implicit }, /* $5a */ + { "tcd", 1, 0, CPU_65816, OH_Implicit }, /* $5b */ + { "jml", 4, lfLabel, CPU_65816, OH_AbsoluteLong }, /* $5c */ + { "eor", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $5d */ + { "lsr", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $5e */ + { "eor", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $5f */ + { "rts", 1, 0, CPU_6502, OH_Rts }, /* $60 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $61 */ + { "per", 3, lfLabel, CPU_65816, OH_RelativeLong }, /* $62 */ + { "adc", 2, 0, CPU_65816, OH_StackRelative }, /* $63 */ + { "stz", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $64 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $65 */ + { "ror", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $66 */ + { "adc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $67 */ + { "pla", 1, 0, CPU_6502, OH_Implicit }, /* $68 */ + { "adc", 2, 0, CPU_6502, OH_Immidiate }, /* $69 */ + { "ror", 1, 0, CPU_6502, OH_Accumulator }, /* $6a */ + { "rtl", 1, 0, CPU_65816, OH_Implicit }, /* $6b */ + { "jmp", 3, lfLabel, CPU_6502, OH_JmpAbsoluteIndirect }, /* $6c */ + { "adc", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $6d */ + { "ror", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $6e */ + { "adc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $6f */ + { "bvs", 2, lfLabel, CPU_6502, OH_Relative }, /* $70 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $71 */ + { "adc", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $72 */ + { "adc", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $73 */ + { "stz", 2, lfUseLabel, CPU_65816, OH_DirectX }, /* $74 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $75 */ + { "ror", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $76 */ + { "adc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $77 */ + { "sei", 1, 0, CPU_6502, OH_Implicit }, /* $78 */ + { "adc", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $79 */ + { "ply", 1, 0, CPU_65816, OH_Implicit }, /* $7a */ + { "tdc", 1, 0, CPU_65816, OH_Implicit }, /* $7b */ + { "jmp", 3, lfLabel, CPU_65816, OH_AbsoluteXIndirect }, /* $7c */ + { "adc", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $7d */ + { "ror", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $7e */ + { "adc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $7f */ + { "bra", 2, lfLabel, CPU_65816, OH_Relative }, /* $80 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $81 */ + { "brl", 3, lfLabel, CPU_65816, OH_RelativeLong }, /* $82 */ + { "sta", 2, 0, CPU_65816, OH_StackRelative }, /* $83 */ + { "sty", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $84 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $85 */ + { "stx", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $86 */ + { "sta", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $87 */ + { "dey", 1, 0, CPU_6502, OH_Implicit }, /* $88 */ + { "bit", 2, 0, CPU_65816, OH_Immidiate }, /* $89 */ + { "txa", 1, 0, CPU_6502, OH_Implicit }, /* $8a */ + { "phb", 1, 0, CPU_65816, OH_Implicit }, /* $8b */ + { "sty", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $8c */ + { "sta", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $8d */ + { "stx", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $8e */ + { "sta", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $8f */ + { "bcc", 2, lfLabel, CPU_6502, OH_Relative }, /* $90 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $91 */ + { "sta", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $92 */ + { "sta", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $93 */ + { "sty", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $94 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $95 */ + { "stx", 2, lfUseLabel, CPU_6502, OH_DirectY }, /* $96 */ + { "sta", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $97 */ + { "tya", 1, 0, CPU_6502, OH_Implicit }, /* $98 */ + { "sta", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $99 */ + { "txs", 1, 0, CPU_6502, OH_Implicit }, /* $9a */ + { "txy", 1, 0, CPU_65816, OH_Implicit }, /* $9b */ + { "stz", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $9c */ + { "sta", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $9d */ + { "stz", 3, lfUseLabel, CPU_65816, OH_AbsoluteX }, /* $9e */ + { "sta", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $9f */ + { "ldy", 2, 0, CPU_6502, OH_Immidiate }, /* $a0 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $a1 */ + { "ldx", 2, 0, CPU_6502, OH_Immidiate }, /* $a2 */ + { "lda", 2, 0, CPU_65816, OH_StackRelative }, /* $a3 */ + { "ldy", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $a4 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $a5 */ + { "ldx", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $a6 */ + { "lda", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $a7 */ + { "tay", 1, 0, CPU_6502, OH_Implicit }, /* $a8 */ + { "lda", 2, 0, CPU_6502, OH_Immidiate }, /* $a9 */ + { "tax", 1, 0, CPU_6502, OH_Implicit }, /* $aa */ + { "plb", 1, 0, CPU_65816, OH_Implicit }, /* $ab */ + { "ldy", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ac */ + { "lda", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ad */ + { "ldx", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ae */ + { "lda", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $af */ + { "bcs", 2, lfLabel, CPU_6502, OH_Relative }, /* $b0 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $b1 */ + { "lda", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $b2 */ + { "lda", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $b3 */ + { "ldy", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $b4 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $b5 */ + { "ldx", 2, lfUseLabel, CPU_6502, OH_DirectY }, /* $b6 */ + { "lda", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $b7 */ + { "clv", 1, 0, CPU_6502, OH_Implicit }, /* $b8 */ + { "lda", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $b9 */ + { "tsx", 1, 0, CPU_6502, OH_Implicit }, /* $ba */ + { "tyx", 1, 0, CPU_65816, OH_Implicit }, /* $bb */ + { "ldy", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $bc */ + { "lda", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $bd */ + { "ldx", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $be */ + { "lda", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $bf */ + { "cpy", 2, 0, CPU_6502, OH_Immidiate }, /* $c0 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $c1 */ + { "rep", 2, 0, CPU_65816, OH_Immidiate }, /* $c2 */ + { "cmp", 2, 0, CPU_65816, OH_StackRelative }, /* $c3 */ + { "cpy", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $c4 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $c5 */ + { "dec", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $c6 */ + { "cmp", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $c7 */ + { "iny", 1, 0, CPU_6502, OH_Implicit }, /* $c8 */ + { "cmp", 2, 0, CPU_6502, OH_Immidiate }, /* $c9 */ + { "dex", 1, 0, CPU_6502, OH_Implicit }, /* $ca */ + { "wai", 1, 0, CPU_65816, OH_Implicit }, /* $cb */ + { "cpy", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $cc */ + { "cmp", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $cd */ + { "dec", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ce */ + { "cmp", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $cf */ + { "bne", 2, lfLabel, CPU_6502, OH_Relative }, /* $d0 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $d1 */ + { "cmp", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $d2 */ + { "cmp", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $d3 */ + { "pei", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $d4 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $d5 */ + { "dec", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $d6 */ + { "cmp", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $d7 */ + { "cld", 1, 0, CPU_6502, OH_Implicit }, /* $d8 */ + { "cmp", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $d9 */ + { "phx", 1, 0, CPU_65816, OH_Implicit }, /* $da */ + { "stp", 1, 0, CPU_65816, OH_Implicit }, /* $db */ + { "jml", 3, lfLabel, CPU_65816, OH_AbsoluteIndirect }, /* $dc */ + { "cmp", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $dd */ + { "dec", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $de */ + { "cmp", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $df */ + { "cpx", 2, 0, CPU_6502, OH_Immidiate }, /* $e0 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $e1 */ + { "sep", 2, 0, CPU_65816, OH_Immidiate }, /* $e2 */ + { "sbc", 2, 0, CPU_65816, OH_StackRelative }, /* $e3 */ + { "cpx", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $e4 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $e5 */ + { "inc", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $e6 */ + { "sbc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $e7 */ + { "inx", 1, 0, CPU_6502, OH_Implicit }, /* $e8 */ + { "sbc", 2, 0, CPU_6502, OH_Immidiate }, /* $e9 */ + { "nop", 1, 0, CPU_6502, OH_Implicit }, /* $ea */ + { "xba", 1, 0, CPU_65816, OH_Implicit }, /* $eb */ + { "cpx", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ec */ + { "sbc", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ed */ + { "inc", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ee */ + { "sbc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $ef */ + { "beq", 2, lfLabel, CPU_6502, OH_Relative }, /* $f0 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $f1 */ + { "sbc", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $f2 */ + { "sbc", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $f3 */ + { "pea", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $f4 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $f5 */ + { "inc", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $f6 */ + { "sbc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $f7 */ + { "sed", 1, 0, CPU_6502, OH_Implicit }, /* $f8 */ + { "sbc", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $f9 */ + { "plx", 1, 0, CPU_65816, OH_Implicit }, /* $fa */ + { "xce", 1, 0, CPU_65816, OH_Implicit }, /* $fb */ + { "jsr", 3, lfLabel, CPU_65816, OH_AbsoluteXIndirect }, /* $fc */ + { "sbc", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $fd */ + { "inc", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $fe */ + { "sbc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $ff */ +}; + + + diff --git a/src/da65/opc65816.h b/src/da65/opc65816.h new file mode 100644 index 000000000..4bf5a9c22 --- /dev/null +++ b/src/da65/opc65816.h @@ -0,0 +1,60 @@ +/*****************************************************************************/ +/* */ +/* opc65816.h */ +/* */ +/* 65816 opcode description table */ +/* */ +/* */ +/* */ +/* (C) 2003 Ullrich von Bassewitz */ +/* Römerstrasse 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 OPC65816_H +#define OPC65816_H + + + +#include "opcdesc.h" + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +/* Descriptions for all opcodes */ +extern const OpcDesc OpcTable_65816[256]; + + + +/* End of opc65816.h */ +#endif + + + diff --git a/src/da65/opc65c02.c b/src/da65/opc65c02.c new file mode 100644 index 000000000..85eb7abd4 --- /dev/null +++ b/src/da65/opc65c02.c @@ -0,0 +1,309 @@ +/*****************************************************************************/ +/* */ +/* opc65c02.h */ +/* */ +/* 65C02 opcode description table */ +/* */ +/* */ +/* */ +/* (C) 2003 Ullrich von Bassewitz */ +/* Römerstrasse 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. */ +/* */ +/*****************************************************************************/ + + + +/* da65 */ +#include "handler.h" +#include "opc65c02.h" + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +/* Descriptions for all opcodes */ +const OpcDesc OpcTable_65C02[256] = { + { "brk", 1, 0, CPU_6502, OH_Implicit }, /* $00 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $01 */ + { "cop", 2, 0, CPU_65816, OH_Implicit }, /* $02 */ + { "ora", 2, 0, CPU_65816, OH_StackRelative }, /* $03 */ + { "tsb", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $04 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $05 */ + { "asl", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $06 */ + { "ora", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $07 */ + { "php", 1, 0, CPU_6502, OH_Implicit }, /* $08 */ + { "ora", 2, 0, CPU_6502, OH_Immidiate }, /* $09 */ + { "asl", 1, 0, CPU_6502, OH_Accumulator }, /* $0a */ + { "phd", 1, 0, CPU_65816, OH_Implicit }, /* $0b */ + { "tsb", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $0c */ + { "ora", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $0d */ + { "asl", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $0e */ + { "ora", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $0f */ + { "bpl", 2, lfLabel, CPU_6502, OH_Relative }, /* $10 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $11 */ + { "ora", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $12 */ + { "ora", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $13 */ + { "trb", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $14 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $15 */ + { "asl", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $16 */ + { "ora", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $17 */ + { "clc", 1, 0, CPU_6502, OH_Implicit }, /* $18 */ + { "ora", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $19 */ + { "inc", 1, 0, CPU_65816, OH_Accumulator }, /* $1a */ + { "tcs", 1, 0, CPU_65816, OH_Implicit }, /* $1b */ + { "trb", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $1c */ + { "ora", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $1d */ + { "asl", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $1e */ + { "ora", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $1f */ + { "jsr", 3, lfLabel, CPU_6502, OH_Absolute }, /* $20 */ + { "and", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $21 */ + { "jsl", 3, lfLabel, CPU_65816, OH_AbsoluteLong }, /* $22 */ + { "and", 2, 0, CPU_65816, OH_StackRelative }, /* $23 */ + { "bit", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $24 */ + { "and", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $25 */ + { "rol", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $26 */ + { "and", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $27 */ + { "plp", 1, 0, CPU_6502, OH_Implicit }, /* $28 */ + { "and", 2, 0, CPU_6502, OH_Immidiate }, /* $29 */ + { "rol", 1, 0, CPU_6502, OH_Accumulator }, /* $2a */ + { "pld", 1, 0, CPU_65816, OH_Implicit }, /* $2b */ + { "bit", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $2c */ + { "and", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $2d */ + { "rol", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $2e */ + { "and", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $2f */ + { "bmi", 2, lfLabel, CPU_6502, OH_Relative }, /* $30 */ + { "and", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $31 */ + { "and", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $32 */ + { "and", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $33 */ + { "bit", 2, lfUseLabel, CPU_65816, OH_DirectX }, /* $34 */ + { "and", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $35 */ + { "rol", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $36 */ + { "and", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $37 */ + { "sec", 1, 0, CPU_6502, OH_Implicit }, /* $38 */ + { "and", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $39 */ + { "dec", 1, 0, CPU_65816, OH_Accumulator }, /* $3a */ + { "tsc", 1, 0, CPU_65816, OH_Implicit }, /* $3b */ + { "bit", 3, lfUseLabel, CPU_65816, OH_AbsoluteX }, /* $3c */ + { "and", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $3d */ + { "rol", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $3e */ + { "and", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $3f */ + { "rti", 1, 0, CPU_6502, OH_Rts }, /* $40 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $41 */ + { "wdm", 2, 0, CPU_65816, OH_Implicit }, /* $42 */ + { "eor", 2, 0, CPU_65816, OH_StackRelative }, /* $43 */ + { "mvp", 3, 0, CPU_65816, OH_BlockMove }, /* $44 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $45 */ + { "lsr", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $46 */ + { "eor", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $47 */ + { "pha", 1, 0, CPU_6502, OH_Implicit }, /* $48 */ + { "eor", 2, 0, CPU_6502, OH_Immidiate }, /* $49 */ + { "lsr", 1, 0, CPU_6502, OH_Accumulator }, /* $4a */ + { "phk", 1, 0, CPU_65816, OH_Implicit }, /* $4b */ + { "jmp", 3, lfLabel, CPU_6502, OH_JmpAbsolute }, /* $4c */ + { "eor", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $4d */ + { "lsr", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $4e */ + { "eor", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $4f */ + { "bvc", 2, lfLabel, CPU_6502, OH_Relative }, /* $50 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $51 */ + { "eor", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $52 */ + { "eor", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $53 */ + { "mvn", 3, 0, CPU_65816, OH_BlockMove }, /* $54 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $55 */ + { "lsr", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $56 */ + { "eor", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $57 */ + { "cli", 1, 0, CPU_6502, OH_Implicit }, /* $58 */ + { "eor", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $59 */ + { "phy", 1, 0, CPU_65816, OH_Implicit }, /* $5a */ + { "tcd", 1, 0, CPU_65816, OH_Implicit }, /* $5b */ + { "jml", 4, lfLabel, CPU_65816, OH_AbsoluteLong }, /* $5c */ + { "eor", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $5d */ + { "lsr", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $5e */ + { "eor", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $5f */ + { "rts", 1, 0, CPU_6502, OH_Rts }, /* $60 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $61 */ + { "per", 3, lfLabel, CPU_65816, OH_RelativeLong }, /* $62 */ + { "adc", 2, 0, CPU_65816, OH_StackRelative }, /* $63 */ + { "stz", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $64 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $65 */ + { "ror", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $66 */ + { "adc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $67 */ + { "pla", 1, 0, CPU_6502, OH_Implicit }, /* $68 */ + { "adc", 2, 0, CPU_6502, OH_Immidiate }, /* $69 */ + { "ror", 1, 0, CPU_6502, OH_Accumulator }, /* $6a */ + { "rtl", 1, 0, CPU_65816, OH_Implicit }, /* $6b */ + { "jmp", 3, lfLabel, CPU_6502, OH_JmpAbsoluteIndirect }, /* $6c */ + { "adc", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $6d */ + { "ror", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $6e */ + { "adc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $6f */ + { "bvs", 2, lfLabel, CPU_6502, OH_Relative }, /* $70 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $71 */ + { "adc", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $72 */ + { "adc", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $73 */ + { "stz", 2, lfUseLabel, CPU_65816, OH_DirectX }, /* $74 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $75 */ + { "ror", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $76 */ + { "adc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $77 */ + { "sei", 1, 0, CPU_6502, OH_Implicit }, /* $78 */ + { "adc", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $79 */ + { "ply", 1, 0, CPU_65816, OH_Implicit }, /* $7a */ + { "tdc", 1, 0, CPU_65816, OH_Implicit }, /* $7b */ + { "jmp", 3, lfLabel, CPU_65816, OH_AbsoluteXIndirect }, /* $7c */ + { "adc", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $7d */ + { "ror", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $7e */ + { "adc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $7f */ + { "bra", 2, lfLabel, CPU_65816, OH_Relative }, /* $80 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $81 */ + { "brl", 3, lfLabel, CPU_65816, OH_RelativeLong }, /* $82 */ + { "sta", 2, 0, CPU_65816, OH_StackRelative }, /* $83 */ + { "sty", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $84 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $85 */ + { "stx", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $86 */ + { "sta", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $87 */ + { "dey", 1, 0, CPU_6502, OH_Implicit }, /* $88 */ + { "bit", 2, 0, CPU_65816, OH_Immidiate }, /* $89 */ + { "txa", 1, 0, CPU_6502, OH_Implicit }, /* $8a */ + { "phb", 1, 0, CPU_65816, OH_Implicit }, /* $8b */ + { "sty", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $8c */ + { "sta", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $8d */ + { "stx", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $8e */ + { "sta", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $8f */ + { "bcc", 2, lfLabel, CPU_6502, OH_Relative }, /* $90 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $91 */ + { "sta", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $92 */ + { "sta", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $93 */ + { "sty", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $94 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $95 */ + { "stx", 2, lfUseLabel, CPU_6502, OH_DirectY }, /* $96 */ + { "sta", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $97 */ + { "tya", 1, 0, CPU_6502, OH_Implicit }, /* $98 */ + { "sta", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $99 */ + { "txs", 1, 0, CPU_6502, OH_Implicit }, /* $9a */ + { "txy", 1, 0, CPU_65816, OH_Implicit }, /* $9b */ + { "stz", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $9c */ + { "sta", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $9d */ + { "stz", 3, lfUseLabel, CPU_65816, OH_AbsoluteX }, /* $9e */ + { "sta", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $9f */ + { "ldy", 2, 0, CPU_6502, OH_Immidiate }, /* $a0 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $a1 */ + { "ldx", 2, 0, CPU_6502, OH_Immidiate }, /* $a2 */ + { "lda", 2, 0, CPU_65816, OH_StackRelative }, /* $a3 */ + { "ldy", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $a4 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $a5 */ + { "ldx", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $a6 */ + { "lda", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $a7 */ + { "tay", 1, 0, CPU_6502, OH_Implicit }, /* $a8 */ + { "lda", 2, 0, CPU_6502, OH_Immidiate }, /* $a9 */ + { "tax", 1, 0, CPU_6502, OH_Implicit }, /* $aa */ + { "plb", 1, 0, CPU_65816, OH_Implicit }, /* $ab */ + { "ldy", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ac */ + { "lda", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ad */ + { "ldx", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ae */ + { "lda", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $af */ + { "bcs", 2, lfLabel, CPU_6502, OH_Relative }, /* $b0 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $b1 */ + { "lda", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $b2 */ + { "lda", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $b3 */ + { "ldy", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $b4 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $b5 */ + { "ldx", 2, lfUseLabel, CPU_6502, OH_DirectY }, /* $b6 */ + { "lda", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $b7 */ + { "clv", 1, 0, CPU_6502, OH_Implicit }, /* $b8 */ + { "lda", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $b9 */ + { "tsx", 1, 0, CPU_6502, OH_Implicit }, /* $ba */ + { "tyx", 1, 0, CPU_65816, OH_Implicit }, /* $bb */ + { "ldy", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $bc */ + { "lda", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $bd */ + { "ldx", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $be */ + { "lda", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $bf */ + { "cpy", 2, 0, CPU_6502, OH_Immidiate }, /* $c0 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $c1 */ + { "rep", 2, 0, CPU_65816, OH_Immidiate }, /* $c2 */ + { "cmp", 2, 0, CPU_65816, OH_StackRelative }, /* $c3 */ + { "cpy", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $c4 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $c5 */ + { "dec", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $c6 */ + { "cmp", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $c7 */ + { "iny", 1, 0, CPU_6502, OH_Implicit }, /* $c8 */ + { "cmp", 2, 0, CPU_6502, OH_Immidiate }, /* $c9 */ + { "dex", 1, 0, CPU_6502, OH_Implicit }, /* $ca */ + { "wai", 1, 0, CPU_65816, OH_Implicit }, /* $cb */ + { "cpy", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $cc */ + { "cmp", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $cd */ + { "dec", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ce */ + { "cmp", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $cf */ + { "bne", 2, lfLabel, CPU_6502, OH_Relative }, /* $d0 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $d1 */ + { "cmp", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $d2 */ + { "cmp", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $d3 */ + { "pei", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $d4 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $d5 */ + { "dec", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $d6 */ + { "cmp", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $d7 */ + { "cld", 1, 0, CPU_6502, OH_Implicit }, /* $d8 */ + { "cmp", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $d9 */ + { "phx", 1, 0, CPU_65816, OH_Implicit }, /* $da */ + { "stp", 1, 0, CPU_65816, OH_Implicit }, /* $db */ + { "jml", 3, lfLabel, CPU_65816, OH_AbsoluteIndirect }, /* $dc */ + { "cmp", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $dd */ + { "dec", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $de */ + { "cmp", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $df */ + { "cpx", 2, 0, CPU_6502, OH_Immidiate }, /* $e0 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $e1 */ + { "sep", 2, 0, CPU_65816, OH_Immidiate }, /* $e2 */ + { "sbc", 2, 0, CPU_65816, OH_StackRelative }, /* $e3 */ + { "cpx", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $e4 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $e5 */ + { "inc", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $e6 */ + { "sbc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $e7 */ + { "inx", 1, 0, CPU_6502, OH_Implicit }, /* $e8 */ + { "sbc", 2, 0, CPU_6502, OH_Immidiate }, /* $e9 */ + { "nop", 1, 0, CPU_6502, OH_Implicit }, /* $ea */ + { "xba", 1, 0, CPU_65816, OH_Implicit }, /* $eb */ + { "cpx", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ec */ + { "sbc", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ed */ + { "inc", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ee */ + { "sbc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $ef */ + { "beq", 2, lfLabel, CPU_6502, OH_Relative }, /* $f0 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $f1 */ + { "sbc", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $f2 */ + { "sbc", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $f3 */ + { "pea", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $f4 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $f5 */ + { "inc", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $f6 */ + { "sbc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $f7 */ + { "sed", 1, 0, CPU_6502, OH_Implicit }, /* $f8 */ + { "sbc", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $f9 */ + { "plx", 1, 0, CPU_65816, OH_Implicit }, /* $fa */ + { "xce", 1, 0, CPU_65816, OH_Implicit }, /* $fb */ + { "jsr", 3, lfLabel, CPU_65816, OH_AbsoluteXIndirect }, /* $fc */ + { "sbc", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $fd */ + { "inc", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $fe */ + { "sbc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $ff */ +}; + + + diff --git a/src/da65/opc65c02.h b/src/da65/opc65c02.h new file mode 100644 index 000000000..e60148e08 --- /dev/null +++ b/src/da65/opc65c02.h @@ -0,0 +1,60 @@ +/*****************************************************************************/ +/* */ +/* opc65c02.h */ +/* */ +/* 65C02 opcode description table */ +/* */ +/* */ +/* */ +/* (C) 2003 Ullrich von Bassewitz */ +/* Römerstrasse 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 OPC65C02_H +#define OPC65C02_H + + + +#include "opcdesc.h" + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +/* Descriptions for all opcodes */ +extern const OpcDesc OpcTable_65C02[256]; + + + +/* End of opc65c02.h */ +#endif + + + diff --git a/src/da65/opc65sc02.c b/src/da65/opc65sc02.c new file mode 100644 index 000000000..cf0522ad2 --- /dev/null +++ b/src/da65/opc65sc02.c @@ -0,0 +1,309 @@ +/*****************************************************************************/ +/* */ +/* opc65sc02.h */ +/* */ +/* 65SC02 opcode description table */ +/* */ +/* */ +/* */ +/* (C) 2003 Ullrich von Bassewitz */ +/* Römerstrasse 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. */ +/* */ +/*****************************************************************************/ + + + +/* da65 */ +#include "handler.h" +#include "opc65sc02.h" + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +/* Descriptions for all opcodes */ +const OpcDesc OpcTable_65SC02[256] = { + { "brk", 1, 0, CPU_6502, OH_Implicit }, /* $00 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $01 */ + { "cop", 2, 0, CPU_65816, OH_Implicit }, /* $02 */ + { "ora", 2, 0, CPU_65816, OH_StackRelative }, /* $03 */ + { "tsb", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $04 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $05 */ + { "asl", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $06 */ + { "ora", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $07 */ + { "php", 1, 0, CPU_6502, OH_Implicit }, /* $08 */ + { "ora", 2, 0, CPU_6502, OH_Immidiate }, /* $09 */ + { "asl", 1, 0, CPU_6502, OH_Accumulator }, /* $0a */ + { "phd", 1, 0, CPU_65816, OH_Implicit }, /* $0b */ + { "tsb", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $0c */ + { "ora", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $0d */ + { "asl", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $0e */ + { "ora", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $0f */ + { "bpl", 2, lfLabel, CPU_6502, OH_Relative }, /* $10 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $11 */ + { "ora", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $12 */ + { "ora", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $13 */ + { "trb", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $14 */ + { "ora", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $15 */ + { "asl", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $16 */ + { "ora", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $17 */ + { "clc", 1, 0, CPU_6502, OH_Implicit }, /* $18 */ + { "ora", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $19 */ + { "inc", 1, 0, CPU_65816, OH_Accumulator }, /* $1a */ + { "tcs", 1, 0, CPU_65816, OH_Implicit }, /* $1b */ + { "trb", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $1c */ + { "ora", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $1d */ + { "asl", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $1e */ + { "ora", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $1f */ + { "jsr", 3, lfLabel, CPU_6502, OH_Absolute }, /* $20 */ + { "and", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $21 */ + { "jsl", 3, lfLabel, CPU_65816, OH_AbsoluteLong }, /* $22 */ + { "and", 2, 0, CPU_65816, OH_StackRelative }, /* $23 */ + { "bit", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $24 */ + { "and", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $25 */ + { "rol", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $26 */ + { "and", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $27 */ + { "plp", 1, 0, CPU_6502, OH_Implicit }, /* $28 */ + { "and", 2, 0, CPU_6502, OH_Immidiate }, /* $29 */ + { "rol", 1, 0, CPU_6502, OH_Accumulator }, /* $2a */ + { "pld", 1, 0, CPU_65816, OH_Implicit }, /* $2b */ + { "bit", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $2c */ + { "and", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $2d */ + { "rol", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $2e */ + { "and", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $2f */ + { "bmi", 2, lfLabel, CPU_6502, OH_Relative }, /* $30 */ + { "and", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $31 */ + { "and", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $32 */ + { "and", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $33 */ + { "bit", 2, lfUseLabel, CPU_65816, OH_DirectX }, /* $34 */ + { "and", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $35 */ + { "rol", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $36 */ + { "and", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $37 */ + { "sec", 1, 0, CPU_6502, OH_Implicit }, /* $38 */ + { "and", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $39 */ + { "dec", 1, 0, CPU_65816, OH_Accumulator }, /* $3a */ + { "tsc", 1, 0, CPU_65816, OH_Implicit }, /* $3b */ + { "bit", 3, lfUseLabel, CPU_65816, OH_AbsoluteX }, /* $3c */ + { "and", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $3d */ + { "rol", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $3e */ + { "and", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $3f */ + { "rti", 1, 0, CPU_6502, OH_Rts }, /* $40 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $41 */ + { "wdm", 2, 0, CPU_65816, OH_Implicit }, /* $42 */ + { "eor", 2, 0, CPU_65816, OH_StackRelative }, /* $43 */ + { "mvp", 3, 0, CPU_65816, OH_BlockMove }, /* $44 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $45 */ + { "lsr", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $46 */ + { "eor", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $47 */ + { "pha", 1, 0, CPU_6502, OH_Implicit }, /* $48 */ + { "eor", 2, 0, CPU_6502, OH_Immidiate }, /* $49 */ + { "lsr", 1, 0, CPU_6502, OH_Accumulator }, /* $4a */ + { "phk", 1, 0, CPU_65816, OH_Implicit }, /* $4b */ + { "jmp", 3, lfLabel, CPU_6502, OH_JmpAbsolute }, /* $4c */ + { "eor", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $4d */ + { "lsr", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $4e */ + { "eor", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $4f */ + { "bvc", 2, lfLabel, CPU_6502, OH_Relative }, /* $50 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $51 */ + { "eor", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $52 */ + { "eor", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $53 */ + { "mvn", 3, 0, CPU_65816, OH_BlockMove }, /* $54 */ + { "eor", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $55 */ + { "lsr", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $56 */ + { "eor", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $57 */ + { "cli", 1, 0, CPU_6502, OH_Implicit }, /* $58 */ + { "eor", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $59 */ + { "phy", 1, 0, CPU_65816, OH_Implicit }, /* $5a */ + { "tcd", 1, 0, CPU_65816, OH_Implicit }, /* $5b */ + { "jml", 4, lfLabel, CPU_65816, OH_AbsoluteLong }, /* $5c */ + { "eor", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $5d */ + { "lsr", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $5e */ + { "eor", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $5f */ + { "rts", 1, 0, CPU_6502, OH_Rts }, /* $60 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $61 */ + { "per", 3, lfLabel, CPU_65816, OH_RelativeLong }, /* $62 */ + { "adc", 2, 0, CPU_65816, OH_StackRelative }, /* $63 */ + { "stz", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $64 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $65 */ + { "ror", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $66 */ + { "adc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $67 */ + { "pla", 1, 0, CPU_6502, OH_Implicit }, /* $68 */ + { "adc", 2, 0, CPU_6502, OH_Immidiate }, /* $69 */ + { "ror", 1, 0, CPU_6502, OH_Accumulator }, /* $6a */ + { "rtl", 1, 0, CPU_65816, OH_Implicit }, /* $6b */ + { "jmp", 3, lfLabel, CPU_6502, OH_JmpAbsoluteIndirect }, /* $6c */ + { "adc", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $6d */ + { "ror", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $6e */ + { "adc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $6f */ + { "bvs", 2, lfLabel, CPU_6502, OH_Relative }, /* $70 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $71 */ + { "adc", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $72 */ + { "adc", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $73 */ + { "stz", 2, lfUseLabel, CPU_65816, OH_DirectX }, /* $74 */ + { "adc", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $75 */ + { "ror", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $76 */ + { "adc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $77 */ + { "sei", 1, 0, CPU_6502, OH_Implicit }, /* $78 */ + { "adc", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $79 */ + { "ply", 1, 0, CPU_65816, OH_Implicit }, /* $7a */ + { "tdc", 1, 0, CPU_65816, OH_Implicit }, /* $7b */ + { "jmp", 3, lfLabel, CPU_65816, OH_AbsoluteXIndirect }, /* $7c */ + { "adc", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $7d */ + { "ror", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $7e */ + { "adc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $7f */ + { "bra", 2, lfLabel, CPU_65816, OH_Relative }, /* $80 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $81 */ + { "brl", 3, lfLabel, CPU_65816, OH_RelativeLong }, /* $82 */ + { "sta", 2, 0, CPU_65816, OH_StackRelative }, /* $83 */ + { "sty", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $84 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $85 */ + { "stx", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $86 */ + { "sta", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $87 */ + { "dey", 1, 0, CPU_6502, OH_Implicit }, /* $88 */ + { "bit", 2, 0, CPU_65816, OH_Immidiate }, /* $89 */ + { "txa", 1, 0, CPU_6502, OH_Implicit }, /* $8a */ + { "phb", 1, 0, CPU_65816, OH_Implicit }, /* $8b */ + { "sty", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $8c */ + { "sta", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $8d */ + { "stx", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $8e */ + { "sta", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $8f */ + { "bcc", 2, lfLabel, CPU_6502, OH_Relative }, /* $90 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $91 */ + { "sta", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $92 */ + { "sta", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $93 */ + { "sty", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $94 */ + { "sta", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $95 */ + { "stx", 2, lfUseLabel, CPU_6502, OH_DirectY }, /* $96 */ + { "sta", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $97 */ + { "tya", 1, 0, CPU_6502, OH_Implicit }, /* $98 */ + { "sta", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $99 */ + { "txs", 1, 0, CPU_6502, OH_Implicit }, /* $9a */ + { "txy", 1, 0, CPU_65816, OH_Implicit }, /* $9b */ + { "stz", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $9c */ + { "sta", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $9d */ + { "stz", 3, lfUseLabel, CPU_65816, OH_AbsoluteX }, /* $9e */ + { "sta", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $9f */ + { "ldy", 2, 0, CPU_6502, OH_Immidiate }, /* $a0 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $a1 */ + { "ldx", 2, 0, CPU_6502, OH_Immidiate }, /* $a2 */ + { "lda", 2, 0, CPU_65816, OH_StackRelative }, /* $a3 */ + { "ldy", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $a4 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $a5 */ + { "ldx", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $a6 */ + { "lda", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $a7 */ + { "tay", 1, 0, CPU_6502, OH_Implicit }, /* $a8 */ + { "lda", 2, 0, CPU_6502, OH_Immidiate }, /* $a9 */ + { "tax", 1, 0, CPU_6502, OH_Implicit }, /* $aa */ + { "plb", 1, 0, CPU_65816, OH_Implicit }, /* $ab */ + { "ldy", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ac */ + { "lda", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ad */ + { "ldx", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ae */ + { "lda", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $af */ + { "bcs", 2, lfLabel, CPU_6502, OH_Relative }, /* $b0 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $b1 */ + { "lda", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $b2 */ + { "lda", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $b3 */ + { "ldy", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $b4 */ + { "lda", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $b5 */ + { "ldx", 2, lfUseLabel, CPU_6502, OH_DirectY }, /* $b6 */ + { "lda", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $b7 */ + { "clv", 1, 0, CPU_6502, OH_Implicit }, /* $b8 */ + { "lda", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $b9 */ + { "tsx", 1, 0, CPU_6502, OH_Implicit }, /* $ba */ + { "tyx", 1, 0, CPU_65816, OH_Implicit }, /* $bb */ + { "ldy", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $bc */ + { "lda", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $bd */ + { "ldx", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $be */ + { "lda", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $bf */ + { "cpy", 2, 0, CPU_6502, OH_Immidiate }, /* $c0 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $c1 */ + { "rep", 2, 0, CPU_65816, OH_Immidiate }, /* $c2 */ + { "cmp", 2, 0, CPU_65816, OH_StackRelative }, /* $c3 */ + { "cpy", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $c4 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $c5 */ + { "dec", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $c6 */ + { "cmp", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $c7 */ + { "iny", 1, 0, CPU_6502, OH_Implicit }, /* $c8 */ + { "cmp", 2, 0, CPU_6502, OH_Immidiate }, /* $c9 */ + { "dex", 1, 0, CPU_6502, OH_Implicit }, /* $ca */ + { "wai", 1, 0, CPU_65816, OH_Implicit }, /* $cb */ + { "cpy", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $cc */ + { "cmp", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $cd */ + { "dec", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ce */ + { "cmp", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $cf */ + { "bne", 2, lfLabel, CPU_6502, OH_Relative }, /* $d0 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $d1 */ + { "cmp", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $d2 */ + { "cmp", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $d3 */ + { "pei", 2, lfUseLabel, CPU_65816, OH_Direct }, /* $d4 */ + { "cmp", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $d5 */ + { "dec", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $d6 */ + { "cmp", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $d7 */ + { "cld", 1, 0, CPU_6502, OH_Implicit }, /* $d8 */ + { "cmp", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $d9 */ + { "phx", 1, 0, CPU_65816, OH_Implicit }, /* $da */ + { "stp", 1, 0, CPU_65816, OH_Implicit }, /* $db */ + { "jml", 3, lfLabel, CPU_65816, OH_AbsoluteIndirect }, /* $dc */ + { "cmp", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $dd */ + { "dec", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $de */ + { "cmp", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $df */ + { "cpx", 2, 0, CPU_6502, OH_Immidiate }, /* $e0 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_DirectXIndirect }, /* $e1 */ + { "sep", 2, 0, CPU_65816, OH_Immidiate }, /* $e2 */ + { "sbc", 2, 0, CPU_65816, OH_StackRelative }, /* $e3 */ + { "cpx", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $e4 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $e5 */ + { "inc", 2, lfUseLabel, CPU_6502, OH_Direct }, /* $e6 */ + { "sbc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLong }, /* $e7 */ + { "inx", 1, 0, CPU_6502, OH_Implicit }, /* $e8 */ + { "sbc", 2, 0, CPU_6502, OH_Immidiate }, /* $e9 */ + { "nop", 1, 0, CPU_6502, OH_Implicit }, /* $ea */ + { "xba", 1, 0, CPU_65816, OH_Implicit }, /* $eb */ + { "cpx", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ec */ + { "sbc", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ed */ + { "inc", 3, lfUseLabel, CPU_6502, OH_Absolute }, /* $ee */ + { "sbc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLong }, /* $ef */ + { "beq", 2, lfLabel, CPU_6502, OH_Relative }, /* $f0 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_DirectIndirectY }, /* $f1 */ + { "sbc", 2, lfUseLabel, CPU_65816, OH_DirectIndirect }, /* $f2 */ + { "sbc", 2, 0, CPU_65816, OH_StackRelativeIndirectY}, /* $f3 */ + { "pea", 3, lfUseLabel, CPU_65816, OH_Absolute }, /* $f4 */ + { "sbc", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $f5 */ + { "inc", 2, lfUseLabel, CPU_6502, OH_DirectX }, /* $f6 */ + { "sbc", 2, lfUseLabel, CPU_65816, OH_DirectIndirectLongY }, /* $f7 */ + { "sed", 1, 0, CPU_6502, OH_Implicit }, /* $f8 */ + { "sbc", 3, lfUseLabel, CPU_6502, OH_AbsoluteY }, /* $f9 */ + { "plx", 1, 0, CPU_65816, OH_Implicit }, /* $fa */ + { "xce", 1, 0, CPU_65816, OH_Implicit }, /* $fb */ + { "jsr", 3, lfLabel, CPU_65816, OH_AbsoluteXIndirect }, /* $fc */ + { "sbc", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $fd */ + { "inc", 3, lfUseLabel, CPU_6502, OH_AbsoluteX }, /* $fe */ + { "sbc", 4, lfUseLabel, CPU_65816, OH_AbsoluteLongX }, /* $ff */ +}; + + + diff --git a/src/da65/opc65sc02.h b/src/da65/opc65sc02.h new file mode 100644 index 000000000..cd08760ee --- /dev/null +++ b/src/da65/opc65sc02.h @@ -0,0 +1,60 @@ +/*****************************************************************************/ +/* */ +/* opc65sc02.h */ +/* */ +/* 65SC02 opcode description table */ +/* */ +/* */ +/* */ +/* (C) 2003 Ullrich von Bassewitz */ +/* Römerstrasse 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 OPC65SC02_H +#define OPC65SC02_H + + + +#include "opcdesc.h" + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +/* Descriptions for all opcodes */ +extern const OpcDesc OpcTable_65SC02[256]; + + + +/* End of opc65sc02.h */ +#endif + + + diff --git a/src/da65/opcdesc.h b/src/da65/opcdesc.h new file mode 100644 index 000000000..a570624a2 --- /dev/null +++ b/src/da65/opcdesc.h @@ -0,0 +1,76 @@ +/*****************************************************************************/ +/* */ +/* opcdesc.h */ +/* */ +/* Disassembler description for one opcode */ +/* */ +/* */ +/* */ +/* (C) 2000-2003 Ullrich von Bassewitz */ +/* Römerstrasse 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 OPCDESC_H +#define OPCDESC_H + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +/* Constants for LabelFlag */ +enum { + lfNoLabel = 0x00, /* Don't use a label */ + lfGenLabel = 0x01, /* Generate a label */ + lfUseLabel = 0x02, /* Use a label if there is one */ + lfLabel = lfUseLabel|lfGenLabel /* Generate and use a label */ +}; + +/* Forward/typedef for struct OpcDesc */ +typedef struct OpcDesc OpcDesc; + +/* Type of pointer to a function that handles opcode output */ +typedef void (*OpcHandler) (const OpcDesc*); + +/* Description for one opcode */ +struct OpcDesc { + char Mnemo [5]; /* Mnemonic */ + unsigned char Size; /* Size of this command */ + unsigned char LabelFlag; /* Generate/use label? */ + unsigned char CPU; /* Available for which CPU? */ + OpcHandler Handler; /* Handler routine */ +}; + + + +/* End of opcdesc.h */ +#endif + + + diff --git a/src/da65/opctable.c b/src/da65/opctable.c index bcb06abf7..89c6ccb96 100644 --- a/src/da65/opctable.c +++ b/src/da65/opctable.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 2000-2003 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -33,1813 +33,43 @@ -/* da65 */ -#include "cpu.h" -#include "handler.h" +/* da65 */ +#include "error.h" +#include "opc6502.h" +#include "opc65816.h" +#include "opc65c02.h" +#include "opc65sc02.h" #include "opctable.h" /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -const OpcDesc OpcTable[256] = { - { /* $00 */ - "brk", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $01 */ - "ora", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectXIndirect - }, - { /* $02 */ - "cop", - 2, - 0, - CPU_65816, - OH_Implicit - }, - { /* $03 */ - "ora", - 2, - 0, - CPU_65816, - OH_StackRelative - }, - { /* $04 */ - "tsb", - 2, - lfUseLabel, - CPU_65816, - OH_Direct - }, - { /* $05 */ - "ora", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $06 */ - "asl", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $07 */ - "ora", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLong - }, - { /* $08 */ - "php", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $09 */ - "ora", - 2, - 0, - CPU_ALL, - OH_Immidiate - }, - { /* $0a */ - "asl", - 1, - 0, - CPU_ALL, - OH_Accumulator - }, - { /* $0b */ - "phd", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $0c */ - "tsb", - 3, - lfUseLabel, - CPU_65816, - OH_Absolute - }, - { /* $0d */ - "ora", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $0e */ - "asl", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $0f */ - "ora", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLong - }, - { /* $10 */ - "bpl", - 2, - lfLabel, - CPU_ALL, - OH_Relative - }, - { /* $11 */ - "ora", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectIndirectY - }, - { /* $12 */ - "ora", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirect - }, - { /* $13 */ - "ora", - 2, - 0, - CPU_65816, - OH_StackRelativeIndirectY - }, - { /* $14 */ - "trb", - 2, - lfUseLabel, - CPU_65816, - OH_Direct - }, - { /* $15 */ - "ora", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $16 */ - "asl", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $17 */ - "ora", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLongY - }, - { /* $18 */ - "clc", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $19 */ - "ora", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteY - }, - { /* $1a */ - "inc", - 1, - 0, - CPU_65816, - OH_Accumulator - }, - { /* $1b */ - "tcs", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $1c */ - "trb", - 3, - lfUseLabel, - CPU_65816, - OH_Absolute - }, - { /* $1d */ - "ora", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $1e */ - "asl", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $1f */ - "ora", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLongX - }, - { /* $20 */ - "jsr", - 3, - lfLabel, - CPU_ALL, - OH_Absolute - }, - { /* $21 */ - "and", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectXIndirect - }, - { /* $22 */ - "jsl", - 3, - lfLabel, - CPU_65816, - OH_AbsoluteLong - }, - { /* $23 */ - "and", - 2, - 0, - CPU_65816, - OH_StackRelative - }, - { /* $24 */ - "bit", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $25 */ - "and", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $26 */ - "rol", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $27 */ - "and", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLong - }, - { /* $28 */ - "plp", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $29 */ - "and", - 2, - 0, - CPU_ALL, - OH_Immidiate - }, - { /* $2a */ - "rol", - 1, - 0, - CPU_ALL, - OH_Accumulator - }, - { /* $2b */ - "pld", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $2c */ - "bit", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $2d */ - "and", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $2e */ - "rol", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $2f */ - "and", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLong - }, - { /* $30 */ - "bmi", - 2, - lfLabel, - CPU_ALL, - OH_Relative - }, - { /* $31 */ - "and", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectIndirectY - }, - { /* $32 */ - "and", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirect - }, - { /* $33 */ - "and", - 2, - 0, - CPU_65816, - OH_StackRelativeIndirectY - }, - { /* $34 */ - "bit", - 2, - lfUseLabel, - CPU_65816, - OH_DirectX - }, - { /* $35 */ - "and", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $36 */ - "rol", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $37 */ - "and", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLongY - }, - { /* $38 */ - "sec", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $39 */ - "and", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteY - }, - { /* $3a */ - "dec", - 1, - 0, - CPU_65816, - OH_Accumulator - }, - { /* $3b */ - "tsc", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $3c */ - "bit", - 3, - lfUseLabel, - CPU_65816, - OH_AbsoluteX - }, - { /* $3d */ - "and", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $3e */ - "rol", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $3f */ - "and", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLongX - }, - { /* $40 */ - "rti", - 1, - 0, - CPU_ALL, - OH_Rts - }, - { /* $41 */ - "eor", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectXIndirect - }, - { /* $42 */ - "wdm", - 2, - 0, - CPU_65816, - OH_Implicit - }, - { /* $43 */ - "eor", - 2, - 0, - CPU_65816, - OH_StackRelative - }, - { /* $44 */ - "mvp", - 3, - 0, - CPU_65816, - OH_BlockMove - }, - { /* $45 */ - "eor", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $46 */ - "lsr", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $47 */ - "eor", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLong - }, - { /* $48 */ - "pha", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $49 */ - "eor", - 2, - 0, - CPU_ALL, - OH_Immidiate - }, - { /* $4a */ - "lsr", - 1, - 0, - CPU_ALL, - OH_Accumulator - }, - { /* $4b */ - "phk", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $4c */ - "jmp", - 3, - lfLabel, - CPU_ALL, - OH_JmpAbsolute - }, - { /* $4d */ - "eor", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $4e */ - "lsr", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $4f */ - "eor", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLong - }, - { /* $50 */ - "bvc", - 2, - lfLabel, - CPU_ALL, - OH_Relative - }, - { /* $51 */ - "eor", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectIndirectY - }, - { /* $52 */ - "eor", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirect - }, - { /* $53 */ - "eor", - 2, - 0, - CPU_65816, - OH_StackRelativeIndirectY - }, - { /* $54 */ - "mvn", - 3, - 0, - CPU_65816, - OH_BlockMove - }, - { /* $55 */ - "eor", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $56 */ - "lsr", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $57 */ - "eor", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLongY - }, - { /* $58 */ - "cli", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $59 */ - "eor", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteY - }, - { /* $5a */ - "phy", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $5b */ - "tcd", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $5c */ - "jml", - 4, - lfLabel, - CPU_65816, - OH_AbsoluteLong - }, - { /* $5d */ - "eor", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $5e */ - "lsr", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $5f */ - "eor", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLongX - }, - { /* $60 */ - "rts", - 1, - 0, - CPU_ALL, - OH_Rts - }, - { /* $61 */ - "adc", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectXIndirect - }, - { /* $62 */ - "per", - 3, - lfLabel, - CPU_65816, - OH_RelativeLong - }, - { /* $63 */ - "adc", - 2, - 0, - CPU_65816, - OH_StackRelative - }, - { /* $64 */ - "stz", - 2, - lfUseLabel, - CPU_65816, - OH_Direct - }, - { /* $65 */ - "adc", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $66 */ - "ror", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $67 */ - "adc", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLong - }, - { /* $68 */ - "pla", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $69 */ - "adc", - 2, - 0, - CPU_ALL, - OH_Immidiate - }, - { /* $6a */ - "ror", - 1, - 0, - CPU_ALL, - OH_Accumulator - }, - { /* $6b */ - "rtl", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $6c */ - "jmp", - 3, - lfLabel, - CPU_ALL, - OH_JmpAbsoluteIndirect - }, - { /* $6d */ - "adc", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $6e */ - "ror", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $6f */ - "adc", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLong - }, - { /* $70 */ - "bvs", - 2, - lfLabel, - CPU_ALL, - OH_Relative - }, - { /* $71 */ - "adc", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectIndirectY - }, - { /* $72 */ - "adc", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirect - }, - { /* $73 */ - "adc", - 2, - 0, - CPU_65816, - OH_StackRelativeIndirectY - }, - { /* $74 */ - "stz", - 2, - lfUseLabel, - CPU_65816, - OH_DirectX - }, - { /* $75 */ - "adc", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $76 */ - "ror", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $77 */ - "adc", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLongY - }, - { /* $78 */ - "sei", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $79 */ - "adc", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteY - }, - { /* $7a */ - "ply", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $7b */ - "tdc", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $7c */ - "jmp", - 3, - lfLabel, - CPU_65816, - OH_AbsoluteXIndirect - }, - { /* $7d */ - "adc", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $7e */ - "ror", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $7f */ - "adc", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLongX - }, - { /* $80 */ - "bra", - 2, - lfLabel, - CPU_65816, - OH_Relative - }, - { /* $81 */ - "sta", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectXIndirect - }, - { /* $82 */ - "brl", - 3, - lfLabel, - CPU_65816, - OH_RelativeLong - }, - { /* $83 */ - "sta", - 2, - 0, - CPU_65816, - OH_StackRelative - }, - { /* $84 */ - "sty", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $85 */ - "sta", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $86 */ - "stx", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $87 */ - "sta", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLong - }, - { /* $88 */ - "dey", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $89 */ - "bit", - 2, - 0, - CPU_65816, - OH_Immidiate - }, - { /* $8a */ - "txa", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $8b */ - "phb", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $8c */ - "sty", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $8d */ - "sta", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $8e */ - "stx", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $8f */ - "sta", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLong - }, - { /* $90 */ - "bcc", - 2, - lfLabel, - CPU_ALL, - OH_Relative - }, - { /* $91 */ - "sta", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectIndirectY - }, - { /* $92 */ - "sta", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirect - }, - { /* $93 */ - "sta", - 2, - 0, - CPU_65816, - OH_StackRelativeIndirectY - }, - { /* $94 */ - "sty", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $95 */ - "sta", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $96 */ - "stx", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectY - }, - { /* $97 */ - "sta", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLongY - }, - { /* $98 */ - "tya", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $99 */ - "sta", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteY - }, - { /* $9a */ - "txs", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $9b */ - "txy", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $9c */ - "stz", - 3, - lfUseLabel, - CPU_65816, - OH_Absolute - }, - { /* $9d */ - "sta", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $9e */ - "stz", - 3, - lfUseLabel, - CPU_65816, - OH_AbsoluteX - }, - { /* $9f */ - "sta", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLongX - }, - { /* $a0 */ - "ldy", - 2, - 0, - CPU_ALL, - OH_Immidiate - }, - { /* $a1 */ - "lda", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectXIndirect - }, - { /* $a2 */ - "ldx", - 2, - 0, - CPU_ALL, - OH_Immidiate - }, - { /* $a3 */ - "lda", - 2, - 0, - CPU_65816, - OH_StackRelative - }, - { /* $a4 */ - "ldy", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $a5 */ - "lda", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $a6 */ - "ldx", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $a7 */ - "lda", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLong - }, - { /* $a8 */ - "tay", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $a9 */ - "lda", - 2, - 0, - CPU_ALL, - OH_Immidiate - }, - { /* $aa */ - "tax", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $ab */ - "plb", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $ac */ - "ldy", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $ad */ - "lda", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $ae */ - "ldx", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $af */ - "lda", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLong - }, - { /* $b0 */ - "bcs", - 2, - lfLabel, - CPU_ALL, - OH_Relative - }, - { /* $b1 */ - "lda", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectIndirectY - }, - { /* $b2 */ - "lda", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirect - }, - { /* $b3 */ - "lda", - 2, - 0, - CPU_65816, - OH_StackRelativeIndirectY - }, - { /* $b4 */ - "ldy", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $b5 */ - "lda", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $b6 */ - "ldx", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectY - }, - { /* $b7 */ - "lda", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLongY - }, - { /* $b8 */ - "clv", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $b9 */ - "lda", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteY - }, - { /* $ba */ - "tsx", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $bb */ - "tyx", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $bc */ - "ldy", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $bd */ - "lda", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $be */ - "ldx", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteY - }, - { /* $bf */ - "lda", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLongX - }, - { /* $c0 */ - "cpy", - 2, - 0, - CPU_ALL, - OH_Immidiate - }, - { /* $c1 */ - "cmp", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectXIndirect - }, - { /* $c2 */ - "rep", - 2, - 0, - CPU_65816, - OH_Immidiate - }, - { /* $c3 */ - "cmp", - 2, - 0, - CPU_65816, - OH_StackRelative - }, - { /* $c4 */ - "cpy", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $c5 */ - "cmp", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $c6 */ - "dec", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $c7 */ - "cmp", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLong - }, - { /* $c8 */ - "iny", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $c9 */ - "cmp", - 2, - 0, - CPU_ALL, - OH_Immidiate - }, - { /* $ca */ - "dex", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $cb */ - "wai", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $cc */ - "cpy", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $cd */ - "cmp", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $ce */ - "dec", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $cf */ - "cmp", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLong - }, - { /* $d0 */ - "bne", - 2, - lfLabel, - CPU_ALL, - OH_Relative - }, - { /* $d1 */ - "cmp", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectXIndirect - }, - { /* $d2 */ - "cmp", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirect - }, - { /* $d3 */ - "cmp", - 2, - 0, - CPU_65816, - OH_StackRelativeIndirectY - }, - { /* $d4 */ - "pei", - 2, - lfUseLabel, - CPU_65816, - OH_Direct - }, - { /* $d5 */ - "cmp", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $d6 */ - "dec", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $d7 */ - "cmp", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLongY - }, - { /* $d8 */ - "cld", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $d9 */ - "cmp", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteY - }, - { /* $da */ - "phx", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $db */ - "stp", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $dc */ - "jml", - 3, - lfLabel, - CPU_65816, - OH_AbsoluteIndirect - }, - { /* $dd */ - "cmp", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $de */ - "dec", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $df */ - "cmp", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLongX - }, - { /* $e0 */ - "cpx", - 2, - 0, - CPU_ALL, - OH_Immidiate - }, - { /* $e1 */ - "sbc", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectXIndirect - }, - { /* $e2 */ - "sep", - 2, - 0, - CPU_65816, - OH_Immidiate - }, - { /* $e3 */ - "sbc", - 2, - 0, - CPU_65816, - OH_StackRelative - }, - { /* $e4 */ - "cpx", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $e5 */ - "sbc", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $e6 */ - "inc", - 2, - lfUseLabel, - CPU_ALL, - OH_Direct - }, - { /* $e7 */ - "sbc", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLong - }, - { /* $e8 */ - "inx", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $e9 */ - "sbc", - 2, - 0, - CPU_ALL, - OH_Immidiate - }, - { /* $ea */ - "nop", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $eb */ - "xba", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $ec */ - "cpx", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $ed */ - "sbc", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $ee */ - "inc", - 3, - lfUseLabel, - CPU_ALL, - OH_Absolute - }, - { /* $ef */ - "sbc", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLong - }, - { /* $f0 */ - "beq", - 2, - lfLabel, - CPU_ALL, - OH_Relative - }, - { /* $f1 */ - "sbc", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectIndirectY - }, - { /* $f2 */ - "sbc", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirect - }, - { /* $f3 */ - "sbc", - 2, - 0, - CPU_65816, - OH_StackRelativeIndirectY - }, - { /* $f4 */ - "pea", - 3, - lfUseLabel, - CPU_65816, - OH_Absolute - }, - { /* $f5 */ - "sbc", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $f6 */ - "inc", - 2, - lfUseLabel, - CPU_ALL, - OH_DirectX - }, - { /* $f7 */ - "sbc", - 2, - lfUseLabel, - CPU_65816, - OH_DirectIndirectLongY - }, - { /* $f8 */ - "sed", - 1, - 0, - CPU_ALL, - OH_Implicit - }, - { /* $f9 */ - "sbc", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteY - }, - { /* $fa */ - "plx", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $fb */ - "xce", - 1, - 0, - CPU_65816, - OH_Implicit - }, - { /* $fc */ - "jsr", - 3, - lfLabel, - CPU_65816, - OH_AbsoluteXIndirect - }, - { /* $fd */ - "sbc", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $fe */ - "inc", - 3, - lfUseLabel, - CPU_ALL, - OH_AbsoluteX - }, - { /* $ff */ - "sbc", - 4, - lfUseLabel, - CPU_65816, - OH_AbsoluteLongX - }, -}; +/* Descriptions for all opcodes */ +const OpcDesc* OpcTable = OpcTable_6502; + + + +/*****************************************************************************/ +/* Code */ +/*****************************************************************************/ + + + +void SetOpcTable (cpu_t CPU) +/* Set the correct opcode table for the given CPU */ +{ + switch (CPU) { + case CPU_6502: OpcTable = OpcTable_6502; break; + case CPU_65SC02: OpcTable = OpcTable_65SC02; break; + case CPU_65C02: OpcTable = OpcTable_65C02; break; + default: Error ("Unsupported CPU"); + } +} diff --git a/src/da65/opctable.h b/src/da65/opctable.h index f89daa5cb..a576865be 100644 --- a/src/da65/opctable.h +++ b/src/da65/opctable.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 2000-2003 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -38,37 +38,33 @@ +/* common */ +#include "cpu.h" + +/* da65 */ +#include "opcdesc.h" + + + /*****************************************************************************/ /* Data */ /*****************************************************************************/ -/* Constants for LabelFlag */ -enum { - lfNoLabel = 0x00, /* Don't use a label */ - lfGenLabel = 0x01, /* Generate a label */ - lfUseLabel = 0x02, /* Use a label if there is one */ - lfLabel = lfUseLabel|lfGenLabel /* Generate and use a label */ -}; +/* Descriptions for all opcodes */ +extern const OpcDesc* OpcTable; + -/* Forward/typedef for struct OpcDesc */ -typedef struct OpcDesc OpcDesc; -/* Type of pointer to a function that handles opcode output */ -typedef void (*OpcHandler) (const OpcDesc*); +/*****************************************************************************/ +/* Code */ +/*****************************************************************************/ -/* Description for one opcode */ -struct OpcDesc { - char Mnemo [4]; /* Mnemonic */ - unsigned char Size; /* Size of this command */ - unsigned char LabelFlag; /* Generate/use label? */ - unsigned char CPU; /* Available for which CPU? */ - OpcHandler Handler; /* Handler routine */ -}; -/* Descriptions for all opcodes */ -extern const OpcDesc OpcTable[256]; + +void SetOpcTable (cpu_t CPU); +/* Set the correct opcode table for the given CPU */ diff --git a/src/da65/output.c b/src/da65/output.c index 24977cf40..ac4108f9e 100644 --- a/src/da65/output.c +++ b/src/da65/output.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 2000-2003 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -40,6 +40,7 @@ #include /* common */ +#include "cpu.h" #include "print.h" #include "version.h" @@ -74,7 +75,7 @@ static void PageHeader (void) /* Print a page header */ { fprintf (F, - "; da65 V%u.%u.%u - (C) Copyright 2000 Ullrich von Bassewitz\n" + "; da65 V%u.%u.%u - (C) Copyright 2000-2003 Ullrich von Bassewitz\n" "; Input file: %s\n" "; Page: %u\n\n", VER_MAJOR, VER_MINOR, VER_PATCH, @@ -268,3 +269,17 @@ void LineComment (unsigned PC, unsigned Count) +void OutputSettings (void) +/* Output CPU and other settings */ +{ + LineFeed (); + Indent (MIndent); + Output (".setcpu"); + Indent (AIndent); + Output ("\"%s\"", CPUNames[CPU]); + LineFeed (); + LineFeed (); +} + + + diff --git a/src/da65/output.h b/src/da65/output.h index 31b0e52e9..0d1269b7d 100644 --- a/src/da65/output.h +++ b/src/da65/output.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 2000-2003 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -85,6 +85,9 @@ void SeparatorLine (void); void LineComment (unsigned PC, unsigned Count); /* Add a line comment with the PC and data bytes */ +void OutputSettings (void); +/* Output CPU and other settings */ + /* End of output.h */