From 6543495dda38a40d311e0cdda26035445d8826a4 Mon Sep 17 00:00:00 2001 From: Eric Smith Date: Tue, 21 Jun 2016 00:00:00 -0600 Subject: [PATCH] Old updates, unfortunately don't remember the details. --- dis.h | 18 +- initopts.c | 15 +- lex.l | 12 +- main.c | 80 +++------ print.c | 5 +- tbl.c | 510 ++++++++++++++++++++++++++--------------------------- 6 files changed, 311 insertions(+), 329 deletions(-) diff --git a/dis.h b/dis.h index a7b8354..607678d 100644 --- a/dis.h +++ b/dis.h @@ -1,8 +1,8 @@ /* * dis6502 by Robert Bond, Udi Finkelstein, and Eric Smith * - * $Id$ - * Copyright 2000-2003 Eric Smith + * $Id: dis.h 26 2004-01-17 23:28:23Z eric $ + * Copyright 2000-2016 Eric Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -37,6 +37,10 @@ extern int bopt; enum boot_mode { UNKNOWN, RAW_BINARY, ATARI_LOAD, C64_LOAD, ATARI_BOOT }; extern int base_address, vector_address; +#define MAX_ENTRY 100 +extern int entry_count; +extern int entry_address[MAX_ENTRY]; + extern int asmout; extern unsigned char f[]; extern unsigned char d[]; @@ -57,7 +61,7 @@ extern long offset[]; #define OFFSET 0x80 /* should be printed as an offset */ struct info { - char opn[4]; + char *opn; int nb; int flag; }; @@ -68,12 +72,11 @@ extern struct info optbl[]; /* Where control goes */ -#define NORM 1 #define JUMP 2 #define FORK 4 #define STOP 8 -#define CTLMASK (NORM|JUMP|FORK|STOP) +#define CTLMASK (JUMP|FORK|STOP) /* Instruction format */ @@ -90,9 +93,9 @@ extern struct info optbl[]; #define IND 0x8000 #define ZPY 0x10000 #define ZPG 0x20000 -#define ILL 0x40000 +#define INZ 0x40000 -#define ADRMASK (IMM|ABS|ACC|IMP|INX|INY|ZPX|ABX|ABY|REL|IND|ZPY|ZPG|ILL) +#define ADRMASK (IMM|ABS|ACC|IMP|INX|INY|ZPX|ABX|ABY|REL|IND|ZPY|ZPG|INZ) struct ref_chain { struct ref_chain *next; @@ -115,7 +118,6 @@ char *get_name(addr_t loc); #define TJTAB2 264 #define EQS 265 #define OFS 266 -#define TJTAB 267 extern FILE *yyin, *yyout; int lineno; diff --git a/initopts.c b/initopts.c index 805dd34..f33345c 100644 --- a/initopts.c +++ b/initopts.c @@ -16,8 +16,14 @@ int npredef = 0; char *file; char *progname = "dis"; int bopt = UNKNOWN; + int base_address = 0; + int vector_address = 0x10000; + +int entry_count = 0; +int entry_address[MAX_ENTRY]; + int asmout = 0; void usage (void) @@ -29,8 +35,9 @@ void usage (void) " -c Commodore 64\n" " options: -a assembly output\n" " -p predefs\n" + " -e
alternate entry point address\n" " -v
alternate vector address\n" - " -7 mask character data to 7-bit\n", + " -7 mask character data to 7-bit", progname); exit (1); } @@ -67,6 +74,12 @@ void initopts (int argc, char *argv[]) bopt = RAW_BINARY; argc--; break; + case 'e': + entry_address [entry_count++] = strtoul (*++argv, &p, 0); + if (*p) + crash ("address required"); + argc--; + break; case 'v': vector_address = strtoul (*++argv, &p, 0); if (*p) diff --git a/lex.l b/lex.l index 05cbf4d..1899887 100644 --- a/lex.l +++ b/lex.l @@ -1,8 +1,8 @@ /* * dis6502 by Robert Bond, Udi Finkelstein, and Eric Smith * - * $Id$ - * Copyright 2001-2003, 2008 Eric Smith + * $Id: lex.l 26 2004-01-17 23:28:23Z eric $ + * Copyright 2001-2014 Eric Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -28,6 +28,7 @@ #include #include "dis.h" int lineno = 0; +char *strcpy(); %} %option nounput @@ -61,13 +62,6 @@ alphanum [0-9a-zA-Z_] \.[Jj][Tt][Aa][Bb]2 { return TJTAB2; } -\.[Jj][Tt][Aa][Bb] { return TJTAB; } - -\-{digit}+ { - (void)sscanf(yytext, "%d", &token.ival); - return NUMBER; - } - {digit}+ { (void)sscanf(yytext, "%d", &token.ival); return NUMBER; diff --git a/main.c b/main.c index a049d01..cdc3c23 100644 --- a/main.c +++ b/main.c @@ -1,8 +1,8 @@ /* * dis6502 by Robert Bond, Udi Finkelstein, and Eric Smith * - * $Id$ - * Copyright 2000-2003, 2008 Eric Smith + * $Id: main.c 26 2004-01-17 23:28:23Z eric $ + * Copyright 2000-2016 Eric Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -24,6 +24,7 @@ #include #include #include +#include #include "dis.h" @@ -50,13 +51,6 @@ int jtab2_addr_high [JTAB2_MAX]; /* .jtab2 directive */ int jtab2_size [JTAB2_MAX]; int jtab2_count = 0; -#define JTAB_MAX 50 -int jtab_addr [JTAB_MAX]; /* .jtab directive */ -int jtab_addr [JTAB_MAX]; -int jtab_size [JTAB_MAX]; -int jtab_offset [JTAB_MAX]; -int jtab_count = 0; - VALUE token; unsigned char d[0x10000]; /* The data */ @@ -103,7 +97,7 @@ void trace_inst (addr_t addr) opcode = getbyte(addr); ip = &optbl[opcode]; - if (ip->flag & ILL) + if (! (ip->flag & ADRMASK)) // illegal if no address mode return; f[addr] |= ISOP; @@ -137,6 +131,7 @@ void trace_inst (addr_t addr) case IMP: case REL: case IND: + case INZ: break; case ABS: if (ip->flag & (JUMP | FORK)) @@ -161,9 +156,13 @@ void trace_inst (addr_t addr) switch (ip->flag & CTLMASK) { - case NORM: - break; case JUMP: + if (ip->flag & REL) + { + if (operand > 127) + operand = (~0xff | operand); + operand = operand + addr; + } f[operand] |= JREF; save_ref(istart, operand); add_trace(operand); @@ -186,7 +185,7 @@ void trace_inst (addr_t addr) case STOP: return; default: - crash("Optable error"); + break; } } } @@ -259,23 +258,6 @@ void do_jtab2 (void) } } -void do_jtab (void) -{ - int i, j; - int loc, code; - for (i = 0; i < jtab_count; i++) - { - loc = jtab_addr [i]; - for (j = 0; j < jtab_size [i]; j+=2) - { - char *trace_sym = (char *) malloc (6); - code = (d [loc + j] + (d [loc + j + 1] << 8)) - jtab_offset [i]; - sprintf (trace_sym, "T%04x", code); - start_trace (code, trace_sym); - } - } -} - int main (int argc, char *argv[]) @@ -314,7 +296,6 @@ int main (int argc, char *argv[]) do_ptrace (); do_rtstab (); do_jtab2 (); - do_jtab (); trace_all (); @@ -372,23 +353,6 @@ void get_predef (void) crash(".jtab2 needs a number operand"); jtab2_size [jtab2_count++] = token.ival; break; - case TJTAB: - if (yylex() != NUMBER) - crash(".jtab needs a number operand"); - if (token.ival > 0x10000 || token.ival < 0) - crash("Number out of range"); - jtab_addr [jtab_count] = token.ival; - if (yylex() != ',') - crash(".jtab needs a comma"); - if (yylex() != NUMBER) - crash(".jtab2 needs a number operand"); - jtab_size [jtab_count] = token.ival; - if (yylex() != ',') - crash(".jtab needs a comma"); - if (yylex() != NUMBER) - crash(".jtab2 needs a number operand"); - jtab_offset [jtab_count++] = token.ival; - break; case TSTART: if (yylex() != NUMBER) crash(".trace needs a number operand"); @@ -637,9 +601,23 @@ void binaryloadfile (void) fprintf (stderr, "base: %04x reset: %04x irq: %04x nmi: %04x\n", base_address, reset, irq, nmi); - start_trace ((d [reset+1] << 8) | d [reset], "RESET"); - start_trace ((d [irq +1] << 8) | d [irq ], "IRQ"); - start_trace ((d [nmi +1] << 8) | d [nmi ], "NMI"); + if (entry_count) + { + int i; + char label [8]; + for (i = 0; i < entry_count; i++) + { + snprintf (label, sizeof (label), "e_%04x", entry_address[i]); + printf("label: %s\n", label); + start_trace (entry_address[i], label); + } + } + else + { + start_trace ((d [reset+1] << 8) | d [reset], "RESET"); + start_trace ((d [irq +1] << 8) | d [irq ], "IRQ"); + start_trace ((d [nmi +1] << 8) | d [nmi ], "NMI"); + } } int diff --git a/print.c b/print.c index 1ba7601..a049a91 100644 --- a/print.c +++ b/print.c @@ -1,8 +1,8 @@ /* * dis6502 by Robert Bond, Udi Finkelstein, and Eric Smith * - * $Id: print.c,v 1.8 2003/09/16 12:00:00 eric Exp $ - * Copyright 2000-2003 Eric Smith + * $Id: print.c 26 2004-01-17 23:28:23Z eric $ + * Copyright 2000-2014 Eric Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -210,6 +210,7 @@ int print_inst(addr_t addr) printf("\t%s", lname(operand, 1)); break; case IND: + case INZ: printf("\t(%s)", lname(operand, 1)); break; case ABX: diff --git a/tbl.c b/tbl.c index 52e9b87..8a5f3b4 100644 --- a/tbl.c +++ b/tbl.c @@ -1,8 +1,8 @@ /* * dis6502 by Robert Bond, Udi Finkelstein, and Eric Smith * - * $Id: tbl.c,v 1.4 2003/09/15 21:49:25 eric Exp $ - * Copyright 2001-2003 Eric Smith + * $Id: tbl.c 26 2004-01-17 23:28:23Z eric $ + * Copyright 2001-2014 Eric Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -27,260 +27,254 @@ #include "dis.h" struct info optbl[256] = { - /* 00 */ { { 'B', 'R', 'K', 0, }, 1, IMP|STOP, }, - /* 01 */ { { 'O', 'R', 'A', 0, }, 2, INX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 05 */ { { 'O', 'R', 'A', 0, }, 2, ZPG|NORM, }, - /* 06 */ { { 'A', 'S', 'L', 0, }, 2, ZPG|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 08 */ { { 'P', 'H', 'P', 0, }, 1, IMP|NORM, }, - /* 09 */ { { 'O', 'R', 'A', 0, }, 2, IMM|NORM, }, - /* 0a */ { { 'A', 'S', 'L', 0, }, 1, ACC|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 0d */ { { 'O', 'R', 'A', 0, }, 3, ABS|NORM, }, - /* 0e */ { { 'A', 'S', 'L', 0, }, 3, ABS|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 10 */ { { 'B', 'P', 'L', 0, }, 2, REL|FORK, }, - /* 11 */ { { 'O', 'R', 'A', 0, }, 2, INY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 15 */ { { 'O', 'R', 'A', 0, }, 2, ZPX|NORM, }, - /* 16 */ { { 'A', 'S', 'L', 0, }, 2, ZPX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 18 */ { { 'C', 'L', 'C', 0, }, 1, IMP|NORM, }, - /* 19 */ { { 'O', 'R', 'A', 0, }, 3, ABY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 1d */ { { 'O', 'R', 'A', 0, }, 3, ABX|NORM, }, - /* 1e */ { { 'A', 'S', 'L', 0, }, 3, ABX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 20 */ { { 'J', 'S', 'R', 0, }, 3, ABS|FORK, }, - /* 21 */ { { 'A', 'N', 'D', 0, }, 2, INX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 24 */ { { 'B', 'I', 'T', 0, }, 2, ZPG|NORM, }, - /* 25 */ { { 'A', 'N', 'D', 0, }, 2, ZPG|NORM, }, - /* 26 */ { { 'R', 'O', 'L', 0, }, 2, ZPG|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 28 */ { { 'P', 'L', 'P', 0, }, 1, IMP|NORM, }, - /* 29 */ { { 'A', 'N', 'D', 0, }, 2, IMM|NORM, }, - /* 2a */ { { 'R', 'O', 'L', 0, }, 1, ACC|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 2c */ { { 'B', 'I', 'T', 0, }, 3, ABS|NORM, }, - /* 2d */ { { 'A', 'N', 'D', 0, }, 3, ABS|NORM, }, - /* 2e */ { { 'R', 'O', 'L', 0, }, 3, ABS|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 30 */ { { 'B', 'M', 'I', 0, }, 2, REL|FORK, }, - /* 31 */ { { 'A', 'N', 'D', 0, }, 2, INY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 35 */ { { 'A', 'N', 'D', 0, }, 2, ZPX|NORM, }, - /* 36 */ { { 'R', 'O', 'L', 0, }, 2, ZPX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 38 */ { { 'S', 'E', 'C', 0, }, 1, IMP|NORM, }, - /* 39 */ { { 'A', 'N', 'D', 0, }, 3, ABY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 3d */ { { 'A', 'N', 'D', 0, }, 3, ABX|NORM, }, - /* 3e */ { { 'R', 'O', 'L', 0, }, 3, ABX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 40 */ { { 'R', 'T', 'I', 0, }, 1, IMP|STOP, }, - /* 41 */ { { 'E', 'O', 'R', 0, }, 2, INX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 45 */ { { 'E', 'O', 'R', 0, }, 2, ZPG|NORM, }, - /* 46 */ { { 'L', 'S', 'R', 0, }, 2, ZPG|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 48 */ { { 'P', 'H', 'A', 0, }, 1, IMP|NORM, }, - /* 49 */ { { 'E', 'O', 'R', 0, }, 2, IMM|NORM, }, - /* 4a */ { { 'L', 'S', 'R', 0, }, 1, ACC|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 4c */ { { 'J', 'M', 'P', 0, }, 3, ABS|JUMP, }, - /* 4d */ { { 'E', 'O', 'R', 0, }, 3, ABS|NORM, }, - /* 4e */ { { 'L', 'S', 'R', 0, }, 3, ABS|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 50 */ { { 'B', 'V', 'C', 0, }, 2, REL|FORK, }, - /* 51 */ { { 'E', 'O', 'R', 0, }, 2, INY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 55 */ { { 'E', 'O', 'R', 0, }, 2, ZPX|NORM, }, - /* 56 */ { { 'L', 'S', 'R', 0, }, 2, ZPX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 58 */ { { 'C', 'L', 'I', 0, }, 1, IMP|NORM, }, - /* 59 */ { { 'E', 'O', 'R', 0, }, 3, ABY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 5d */ { { 'E', 'O', 'R', 0, }, 3, ABX|NORM, }, - /* 5e */ { { 'L', 'S', 'R', 0, }, 3, ABX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 60 */ { { 'R', 'T', 'S', 0, }, 1, IMP|STOP, }, - /* 61 */ { { 'A', 'D', 'C', 0, }, 2, INX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 65 */ { { 'A', 'D', 'C', 0, }, 2, ZPG|NORM, }, - /* 66 */ { { 'R', 'O', 'R', 0, }, 2, ZPG|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 68 */ { { 'P', 'L', 'A', 0, }, 1, IMP|NORM, }, - /* 69 */ { { 'A', 'D', 'C', 0, }, 2, IMM|NORM, }, - /* 6a */ { { 'R', 'O', 'R', 0, }, 1, ACC|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 6c */ { { 'J', 'M', 'P', 0, }, 3, IND|STOP, }, - /* 6d */ { { 'A', 'D', 'C', 0, }, 3, ABS|NORM, }, - /* 6e */ { { 'R', 'O', 'R', 0, }, 3, ABS|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 70 */ { { 'B', 'V', 'S', 0, }, 2, REL|FORK, }, - /* 71 */ { { 'A', 'D', 'C', 0, }, 2, INY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 75 */ { { 'A', 'D', 'C', 0, }, 2, ZPX|NORM, }, - /* 76 */ { { 'R', 'O', 'R', 0, }, 2, ZPX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 78 */ { { 'S', 'E', 'I', 0, }, 1, IMP|NORM, }, - /* 79 */ { { 'A', 'D', 'C', 0, }, 3, ABY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 7d */ { { 'A', 'D', 'C', 0, }, 3, ABX|NORM, }, - /* 7e */ { { 'R', 'O', 'R', 0, }, 3, ABX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 81 */ { { 'S', 'T', 'A', 0, }, 2, INX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 84 */ { { 'S', 'T', 'Y', 0, }, 2, ZPG|NORM, }, - /* 85 */ { { 'S', 'T', 'A', 0, }, 2, ZPG|NORM, }, - /* 86 */ { { 'S', 'T', 'X', 0, }, 2, ZPG|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 88 */ { { 'D', 'E', 'Y', 0, }, 1, IMP|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 8a */ { { 'T', 'X', 'A', 0, }, 1, IMP|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 8c */ { { 'S', 'T', 'Y', 0, }, 3, ABS|NORM, }, - /* 8d */ { { 'S', 'T', 'A', 0, }, 3, ABS|NORM, }, - /* 8e */ { { 'S', 'T', 'X', 0, }, 3, ABS|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 90 */ { { 'B', 'C', 'C', 0, }, 2, REL|FORK, }, - /* 91 */ { { 'S', 'T', 'A', 0, }, 2, INY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 94 */ { { 'S', 'T', 'Y', 0, }, 2, ZPX|NORM, }, - /* 95 */ { { 'S', 'T', 'A', 0, }, 2, ZPX|NORM, }, - /* 96 */ { { 'S', 'T', 'X', 0, }, 2, ZPY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 98 */ { { 'T', 'Y', 'A', 0, }, 1, IMP|NORM, }, - /* 99 */ { { 'S', 'T', 'A', 0, }, 3, ABY|NORM, }, - /* 9a */ { { 'T', 'X', 'S', 0, }, 1, IMP|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 9d */ { { 'S', 'T', 'A', 0, }, 3, ABX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* a0 */ { { 'L', 'D', 'Y', 0, }, 2, IMM|NORM, }, - /* a1 */ { { 'L', 'D', 'A', 0, }, 2, INX|NORM, }, - /* a2 */ { { 'L', 'D', 'X', 0, }, 2, IMM|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* a4 */ { { 'L', 'D', 'Y', 0, }, 2, ZPG|NORM, }, - /* a5 */ { { 'L', 'D', 'A', 0, }, 2, ZPG|NORM, }, - /* a6 */ { { 'L', 'D', 'X', 0, }, 2, ZPG|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* a8 */ { { 'T', 'A', 'Y', 0, }, 1, IMP|NORM, }, - /* a9 */ { { 'L', 'D', 'A', 0, }, 2, IMM|NORM, }, - /* aa */ { { 'T', 'A', 'X', 0, }, 1, IMP|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* ac */ { { 'L', 'D', 'Y', 0, }, 3, ABS|NORM, }, - /* ad */ { { 'L', 'D', 'A', 0, }, 3, ABS|NORM, }, - /* ae */ { { 'L', 'D', 'X', 0, }, 3, ABS|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* b0 */ { { 'B', 'C', 'S', 0, }, 2, REL|FORK, }, - /* b1 */ { { 'L', 'D', 'A', 0, }, 2, INY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* b4 */ { { 'L', 'D', 'Y', 0, }, 2, ZPX|NORM, }, - /* b5 */ { { 'L', 'D', 'A', 0, }, 2, ZPX|NORM, }, - /* b6 */ { { 'L', 'D', 'X', 0, }, 2, ZPY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* b8 */ { { 'C', 'L', 'V', 0, }, 1, IMP|NORM, }, - /* b9 */ { { 'L', 'D', 'A', 0, }, 3, ABY|NORM, }, - /* ba */ { { 'T', 'S', 'X', 0, }, 1, IMP|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* bc */ { { 'L', 'D', 'Y', 0, }, 3, ABX|NORM, }, - /* bd */ { { 'L', 'D', 'A', 0, }, 3, ABX|NORM, }, - /* be */ { { 'L', 'D', 'X', 0, }, 3, ABY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* c0 */ { { 'C', 'P', 'Y', 0, }, 2, IMM|NORM, }, - /* c1 */ { { 'C', 'M', 'P', 0, }, 2, INX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* c4 */ { { 'C', 'P', 'Y', 0, }, 2, ZPG|NORM, }, - /* c5 */ { { 'C', 'M', 'P', 0, }, 2, ZPG|NORM, }, - /* c6 */ { { 'D', 'E', 'C', 0, }, 2, ZPG|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* c8 */ { { 'I', 'N', 'Y', 0, }, 1, IMP|NORM, }, - /* c9 */ { { 'C', 'M', 'P', 0, }, 2, IMM|NORM, }, - /* ca */ { { 'D', 'E', 'X', 0, }, 1, IMP|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* cc */ { { 'C', 'P', 'Y', 0, }, 3, ABS|NORM, }, - /* cd */ { { 'C', 'M', 'P', 0, }, 3, ABS|NORM, }, - /* ce */ { { 'D', 'E', 'C', 0, }, 3, ABS|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* d0 */ { { 'B', 'N', 'E', 0, }, 2, REL|FORK, }, - /* d1 */ { { 'C', 'M', 'P', 0, }, 2, INY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* d5 */ { { 'C', 'M', 'P', 0, }, 2, ZPX|NORM, }, - /* d6 */ { { 'D', 'E', 'C', 0, }, 2, ZPX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* d8 */ { { 'C', 'L', 'D', 0, }, 1, IMP|NORM, }, - /* d9 */ { { 'C', 'M', 'P', 0, }, 3, ABY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* dd */ { { 'C', 'M', 'P', 0, }, 3, ABX|NORM, }, - /* de */ { { 'D', 'E', 'C', 0, }, 3, ABX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* e0 */ { { 'C', 'P', 'X', 0, }, 2, IMM|NORM, }, - /* e1 */ { { 'S', 'B', 'C', 0, }, 2, INX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* e4 */ { { 'C', 'P', 'X', 0, }, 2, ZPG|NORM, }, - /* e5 */ { { 'S', 'B', 'C', 0, }, 2, ZPG|NORM, }, - /* e6 */ { { 'I', 'N', 'C', 0, }, 2, ZPG|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* e8 */ { { 'I', 'N', 'X', 0, }, 1, IMP|NORM, }, - /* e9 */ { { 'S', 'B', 'C', 0, }, 2, IMM|NORM, }, - /* ea */ { { 'N', 'O', 'P', 0, }, 1, IMP|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* ec */ { { 'C', 'P', 'X', 0, }, 3, ABS|NORM, }, - /* ed */ { { 'S', 'B', 'C', 0, }, 3, ABS|NORM, }, - /* ee */ { { 'I', 'N', 'C', 0, }, 3, ABS|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* f0 */ { { 'B', 'E', 'Q', 0, }, 2, REL|FORK, }, - /* f1 */ { { 'S', 'B', 'C', 0, }, 2, INY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* f5 */ { { 'S', 'B', 'C', 0, }, 2, ZPX|NORM, }, - /* f6 */ { { 'I', 'N', 'C', 0, }, 2, ZPX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* f8 */ { { 'S', 'E', 'D', 0, }, 1, IMP|NORM, }, - /* f9 */ { { 'S', 'B', 'C', 0, }, 3, ABY|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, - /* fd */ { { 'S', 'B', 'C', 0, }, 3, ABX|NORM, }, - /* fe */ { { 'I', 'N', 'C', 0, }, 3, ABX|NORM, }, - /* 00 */ { { '?', '?', '?', 0, }, 1, ILL|NORM, }, + [0x00] = { "brk", 1, IMP|JUMP }, + [0x01] = { "ora", 2, INX }, + + [0x05] = { "ora", 2, ZPG }, + [0x06] = { "asl", 2, ZPG }, + + [0x08] = { "php", 1, IMP }, + [0x09] = { "ora", 2, IMM }, + [0x0a] = { "asl", 1, ACC }, + + [0x0d] = { "ora", 3, ABS }, + [0x0e] = { "asl", 3, ABS }, + + [0x10] = { "bpl", 2, REL|FORK }, + [0x11] = { "ora", 2, INY }, + + [0x15] = { "ora", 2, ZPX }, + [0x16] = { "asl", 2, ZPX }, + + [0x18] = { "clc", 1, IMP }, + [0x19] = { "ora", 3, ABY }, + + [0x1d] = { "ora", 3, ABX }, + [0x1e] = { "asl", 3, ABX }, + + [0x20] = { "jsr", 3, ABS|FORK }, + [0x21] = { "and", 2, INX }, + + [0x24] = { "bit", 2, ZPG }, + [0x25] = { "and", 2, ZPG }, + [0x26] = { "rol", 2, ZPG }, + + [0x28] = { "plp", 1, IMP }, + [0x29] = { "and", 2, IMM }, + [0x2a] = { "rol", 1, ACC }, + + [0x2c] = { "bit", 3, ABS }, + [0x2d] = { "and", 3, ABS }, + [0x2e] = { "rol", 3, ABS }, + + [0x30] = { "bmi", 2, REL|FORK }, + [0x31] = { "and", 2, INY }, + + [0x35] = { "and", 2, ZPX }, + [0x36] = { "rol", 2, ZPX }, + + [0x38] = { "sec", 1, IMP }, + [0x39] = { "and", 3, ABY }, + + [0x3d] = { "and", 3, ABX }, + [0x3e] = { "rol", 3, ABX }, + + [0x40] = { "rti", 1, IMP|STOP }, + [0x41] = { "eor", 2, INX }, + + [0x45] = { "eor", 2, ZPG }, + + [0x48] = { "pha", 1, IMP }, + [0x49] = { "eor", 2, IMM }, + + [0x4a] = { "lsr", 1, ACC }, + + [0x4c] = { "jmp", 3, ABS|JUMP }, + [0x4d] = { "eor", 3, ABS }, + [0x4e] = { "lsr", 3, ABS }, + + [0x50] = { "bvc", 2, REL|FORK }, + [0x51] = { "eor", 2, INY }, + + [0x55] = { "eor", 2, ZPX }, + [0x56] = { "lsr", 2, ZPX }, + + [0x58] = { "cli", 1, IMP }, + [0x59] = { "eor", 3, ABY }, + + [0x5d] = { "eor", 3, ABX }, + [0x5e] = { "lsr", 3, ABX }, + + [0x60] = { "rts", 1, IMP|STOP }, + [0x61] = { "adc", 2, INX }, + + [0x65] = { "adc", 2, ZPG }, + [0x66] = { "ror", 2, ZPG }, + + [0x68] = { "pla", 1, IMP }, + [0x69] = { "adc", 2, IMM }, + [0x6a] = { "ror", 1, ACC }, + + [0x6c] = { "jmp", 3, IND|STOP }, + [0x6d] = { "adc", 3, ABS }, + [0x6e] = { "ror", 3, ABS }, + + [0x70] = { "bvs", 2, REL|FORK }, + [0x71] = { "adc", 2, INY }, + + [0x75] = { "adc", 2, ZPX }, + [0x76] = { "ror", 2, ZPX }, + + [0x78] = { "sei", 1, IMP }, + [0x79] = { "adc", 3, ABY }, + + [0x7d] = { "adc", 3, ABX }, + [0x7e] = { "ror", 3, ABX }, + + [0x81] = { "sta", 2, INX }, + + [0x84] = { "sty", 2, ZPG }, + [0x85] = { "sta", 2, ZPG }, + [0x86] = { "stx", 2, ZPG }, + + [0x88] = { "dey", 1, IMP }, + + [0x8a] = { "txa", 1, IMP }, + + [0x8c] = { "sty", 3, ABS }, + [0x8d] = { "sta", 3, ABS }, + [0x8e] = { "stx", 3, ABS }, + + [0x90] = { "bcc", 2, REL|FORK }, + [0x91] = { "sta", 2, INY }, + + [0x94] = { "sty", 2, ZPX }, + [0x95] = { "sta", 2, ZPX }, + [0x96] = { "stx", 2, ZPY }, + + [0x98] = { "tya", 1, IMP }, + [0x99] = { "sta", 3, ABY }, + [0x9a] = { "txs", 1, IMP }, + + [0x9d] = { "sta", 3, ABX }, + + [0xa0] = { "ldy", 2, IMM }, + [0xa1] = { "lda", 2, INX }, + [0xa2] = { "ldx", 2, IMM }, + + [0xa4] = { "ldy", 2, ZPG }, + [0xa5] = { "lda", 2, ZPG }, + [0xa6] = { "ldx", 2, ZPG }, + + [0xa8] = { "tay", 1, IMP }, + [0xa9] = { "lda", 2, IMM }, + [0xaa] = { "tax", 1, IMP }, + + [0xac] = { "ldy", 3, ABS }, + [0xad] = { "lda", 3, ABS }, + [0xae] = { "ldx", 3, ABS }, + + [0xb0] = { "bcs", 2, REL|FORK }, + [0xb1] = { "lda", 2, INY }, + + [0xb4] = { "ldy", 2, ZPX }, + [0xb5] = { "lda", 2, ZPX }, + [0xb6] = { "ldx", 2, ZPY }, + + [0xb8] = { "clv", 1, IMP }, + [0xb9] = { "lda", 3, ABY }, + [0xba] = { "tsx", 1, IMP }, + + [0xbc] = { "ldy", 3, ABX }, + [0xbd] = { "lda", 3, ABX }, + [0xbe] = { "ldx", 3, ABY }, + + [0xc0] = { "cpy", 2, IMM }, + [0xc1] = { "cmp", 2, INX }, + + [0xc4] = { "cpy", 2, ZPG }, + [0xc5] = { "cmp", 2, ZPG }, + [0xc6] = { "dec", 2, ZPG }, + + [0xc8] = { "iny", 1, IMP }, + [0xc9] = { "cmp", 2, IMM }, + [0xca] = { "dex", 1, IMP }, + + [0xcc] = { "cpy", 3, ABS }, + [0xcd] = { "cmp", 3, ABS }, + [0xce] = { "dec", 3, ABS }, + + [0xd0] = { "bne", 2, REL|FORK }, + [0xd1] = { "cmp", 2, INY }, + + [0xd5] = { "cmp", 2, ZPX }, + [0xd6] = { "dec", 2, ZPX }, + + [0xd8] = { "cld", 1, IMP }, + [0xd9] = { "cmp", 3, ABY }, + + [0xdd] = { "cmp", 3, ABX }, + [0xde] = { "dec", 3, ABX }, + + [0xe0] = { "cpx", 2, IMM }, + [0xe1] = { "sbc", 2, INX }, + + [0xe4] = { "cpx", 2, ZPG }, + [0xe5] = { "sbc", 2, ZPG }, + [0xe6] = { "inc", 2, ZPG }, + + [0xe8] = { "inx", 1, IMP }, + [0xe9] = { "sbc", 2, IMM }, + [0xea] = { "nop", 1, IMP }, + + [0xec] = { "cpx", 3, ABS }, + [0xed] = { "sbc", 3, ABS }, + [0xee] = { "inc", 3, ABS }, + + [0xf0] = { "beq", 2, REL|FORK }, + [0xf1] = { "sbc", 2, INY }, + + [0xf5] = { "sbc", 2, ZPX }, + [0xf6] = { "inc", 2, ZPX }, + + [0xf8] = { "sed", 1, IMP }, + [0xf9] = { "sbc", 3, ABY }, + + [0xfd] = { "sbc", 3, ABX }, + [0xfe] = { "inc", 3, ABX }, + +#if 1 +// 65C02 + [0x04] = { "tsb", 2, ZPG }, + [0x0c] = { "tsb", 3, ABS }, + [0x12] = { "ora", 2, INZ }, + [0x14] = { "trb", 2, ZPG }, + [0x1a] = { "inc", 1, ACC }, + [0x1c] = { "trb", 3, ABS }, + [0x32] = { "and", 2, INZ }, + [0x34] = { "bit", 2, ZPX }, + [0x3a] = { "dec", 1, ACC }, + [0x3c] = { "bit", 3, ABX }, + [0x52] = { "eor", 2, INZ }, + [0x5a] = { "phy", 1, IMP }, + [0x64] = { "stz", 2, ZPG }, + [0x72] = { "adc", 2, INZ }, + [0x74] = { "stz", 2, ZPX }, + [0x7a] = { "ply", 1, IMP }, + [0x7c] = { "jmp", 3, ABX|STOP }, + [0x80] = { "bra", 2, REL|JUMP }, + [0x89] = { "bit", 2, IMM }, + [0x92] = { "sta", 2, INZ }, + [0x9c] = { "stz", 3, ABS }, + [0x9e] = { "stz", 3, ABX }, + [0xb2] = { "lda", 2, INZ }, + [0xd2] = { "cmp", 2, INZ }, + [0xda] = { "phx", 1, IMP }, + [0xf2] = { "sbc", 2, INZ }, + [0xfa] = { "plx", 1, IMP }, +#endif + +#if 0 +// Rockwell bit instructions +#endif };