diff --git a/src/debug.c b/src/debug.c index 49c3021..5df885e 100644 --- a/src/debug.c +++ b/src/debug.c @@ -20,13 +20,7 @@ #include "glog.h" // DISASSEMBLER STUFF -enum { - ABS = 1, ABSX, ABSY, ABSLONG, ABSIND, ABSXIND, IMPLY, ACCUM, IMMED, JUST8, - DLOC, DLOCX, DLOCY, LONG, LONGX, DLOCIND, DLOCINDY, DLOCXIND, DLOCBRAK, - DLOCBRAKY, DISP8, DISP8S, DISP8SINDY, DISP16, MVPMVN, REPVAL, SEPVAL -}; -extern const char * const disas_opcodes[256]; -extern const word32 disas_types[256]; +#include "disasm.h" // STEPPING/ENGINE STUFF extern Engine_reg engine; @@ -1217,8 +1211,8 @@ int do_dis_json(char *buf, word32 kpc, int accsize, int xsize, int op_provided, kpc++; - dtype = disas_types[opcode]; - out = disas_opcodes[opcode]; + dtype = disasm_types[opcode]; + out = disasm_opcodes[opcode]; type = dtype & 0xff; args = dtype >> 8; @@ -1292,6 +1286,12 @@ int do_dis_json(char *buf, word32 kpc, int accsize, int xsize, int op_provided, } sprintf(buf_disasm,"%s $%06x",out,val); break; + case ABSLONGX: + if(args != 3) { + printf("arg # mismatch for opcode %x\n", opcode); + } + sprintf(buf_disasm,"%s $%06x,X",out,val); + break; case ABSIND: if(args != 2) { printf("arg # mismatch for opcode %x\n", opcode); @@ -1349,18 +1349,6 @@ int do_dis_json(char *buf, word32 kpc, int accsize, int xsize, int op_provided, } sprintf(buf_disasm,"%s $%02x,Y",out,val); break; - case LONG: - if(args != 3) { - printf("arg # mismatch for opcode %x\n", opcode); - } - sprintf(buf_disasm,"%s $%06x",out,val); - break; - case LONGX: - if(args != 3) { - printf("arg # mismatch for opcode %x\n", opcode); - } - sprintf(buf_disasm,"%s $%06x,X",out,val); - break; case DLOCIND: if(args != 1) { printf("arg # mismatch for opcode %x\n", opcode); diff --git a/src/dis.c b/src/dis.c index 9dd95df..6bc6e87 100644 --- a/src/dis.c +++ b/src/dis.c @@ -9,7 +9,7 @@ #include "defc.h" #include -#include "disas.h" +#include "disasm.h" #define LINE_SIZE 160 @@ -836,8 +836,8 @@ int do_dis(FILE *outfile, word32 kpc, int accsize, int xsize, kpc++; - dtype = disas_types[opcode]; - out = disas_opcodes[opcode]; + dtype = disasm_types[opcode]; + out = disasm_opcodes[opcode]; type = dtype & 0xff; args = dtype >> 8; @@ -915,6 +915,13 @@ int do_dis(FILE *outfile, word32 kpc, int accsize, int xsize, sprintf(buffer,"%s\t$%06x",out,val); show_line(outfile, oldkpc,instr,args+1,buffer); break; + case ABSLONGX: + if(args != 3) { + printf("arg # mismatch for opcode %x\n", opcode); + } + sprintf(buffer,"%s\t$%06x,X",out,val); + show_line(outfile, oldkpc,instr,args+1,buffer); + break; case ABSIND: if(args != 2) { printf("arg # mismatch for opcode %x\n", opcode); @@ -981,20 +988,6 @@ int do_dis(FILE *outfile, word32 kpc, int accsize, int xsize, sprintf(buffer,"%s\t$%02x,Y",out,val); show_line(outfile, oldkpc,instr,args+1,buffer); break; - case LONG: - if(args != 3) { - printf("arg # mismatch for opcode %x\n", opcode); - } - sprintf(buffer,"%s\t$%06x",out,val); - show_line(outfile, oldkpc,instr,args+1,buffer); - break; - case LONGX: - if(args != 3) { - printf("arg # mismatch for opcode %x\n", opcode); - } - sprintf(buffer,"%s\t$%06x,X",out,val); - show_line(outfile, oldkpc,instr,args+1,buffer); - break; case DLOCIND: if(args != 1) { printf("arg # mismatch for opcode %x\n", opcode); diff --git a/src/disas.h b/src/disasm.c similarity index 85% rename from src/disas.h rename to src/disasm.c index 112d816..91c0082 100644 --- a/src/disas.h +++ b/src/disasm.c @@ -1,42 +1,7 @@ -/* - GSPLUS - Advanced Apple IIGS Emulator Environment - Based on the KEGS emulator written by Kent Dickey - See COPYRIGHT.txt for Copyright information - See LICENSE.txt for license (GPL v2) -*/ -enum { - ABS = 1, - ABSX, - ABSY, - ABSLONG, - ABSIND, - ABSXIND, - IMPLY, - ACCUM, - IMMED, - JUST8, - DLOC, - DLOCX, - DLOCY, - LONG, - LONGX, - DLOCIND, - DLOCINDY, - DLOCXIND, - DLOCBRAK, - DLOCBRAKY, - DISP8, - DISP8S, - DISP8SINDY, - DISP16, - MVPMVN, - REPVAL, - SEPVAL -}; +#include "disasm.h" - -const char * const disas_opcodes[256] = { +const char * const disasm_opcodes[256] = { "BRK", "ORA", "COP", "ORA", "TSB", "ORA", "ASL", "ORA", /* 00-07 */ "PHP", "ORA", "ASL", "PHD", "TSB", "ORA", "ASL", "ORA", /* 08-0f */ "BPL", "ORA", "ORA", "ORA", "TRB", "ORA", "ASL", "ORA", /* 10-17 */ @@ -72,7 +37,7 @@ const char * const disas_opcodes[256] = { }; -const word32 disas_types[256] = { +const unsigned disasm_types[256] = { JUST8+0x100, DLOCXIND+0x100, /* 00-01 */ JUST8+0x100, DISP8S+0x100, /* 02-03 */ DLOC+0x100, DLOC+0x100, /* 04-05 */ @@ -80,7 +45,7 @@ const word32 disas_types[256] = { IMPLY+0x000, IMMED+0x400, /* 08-9 */ ACCUM+0x000, IMPLY+0x000, /* 0a-b */ ABS+0x200, ABS+0x200, /* c-d */ - ABS+0x200, LONG+0x300, /* e-f */ + ABS+0x200, ABSLONG+0x300, /* e-f */ DISP8+0x100, DLOCINDY+0x100, /* 10-11 */ DLOCIND+0x100, DISP8SINDY+0x100, /* 12-13 */ DLOC+0x100, DLOCX+0x100, /* 14-15 */ @@ -88,7 +53,7 @@ const word32 disas_types[256] = { IMPLY+0x000, ABSY+0x200, /* 18-19 */ ACCUM+0x000, IMPLY+0x000, /* 1a-1b */ ABS+0x200, ABSX+0x200, /* 1c-1d */ - ABSX+0x200, LONGX+0x300, /* 1e-1f */ + ABSX+0x200, ABSLONGX+0x300, /* 1e-1f */ ABS+0x200, DLOCXIND+0x100, /* 20-21 */ ABSLONG+0x300, DISP8S+0x100, /* 22-23 */ DLOC+0x100, DLOC+0x100, /* 24-25 */ @@ -96,7 +61,7 @@ const word32 disas_types[256] = { IMPLY+0x000, IMMED+0x400, /* 28-29 */ ACCUM+0x000, IMPLY+0x000, /* 2a-2b */ ABS+0x200, ABS+0x200, /* 2c-2d */ - ABS+0x200, LONG+0x300, /* 2e-2f */ + ABS+0x200, ABSLONG+0x300, /* 2e-2f */ DISP8+0x100, DLOCINDY+0x100, /* 30-31 */ DLOCIND+0x100, DISP8SINDY+0x100, /* 32-33 */ DLOCX+0x100, DLOCX+0x100, /* 34-35 */ @@ -104,7 +69,7 @@ const word32 disas_types[256] = { IMPLY+0x000, ABSY+0x200, /* 38-39 */ ACCUM+0x000, IMPLY+0x000, /* 3a-3b */ ABSX+0x200, ABSX+0x200, /* 3c-3d */ - ABSX+0x200, LONGX+0x300, /* 3e-3f */ + ABSX+0x200, ABSLONGX+0x300, /* 3e-3f */ IMPLY+0x000, DLOCXIND+0x100, /* 40-41 */ JUST8+0x100, DISP8S+0x100, /* 42-43 */ MVPMVN+0x200, DLOC+0x100, /* 44-45 */ @@ -112,15 +77,15 @@ const word32 disas_types[256] = { IMPLY+0x000, IMMED+0x400, /* 48-49 */ ACCUM+0x000, IMPLY+0x000, /* 4a-4b */ ABS+0x200, ABS+0x200, /* 4c-4d */ - ABS+0x200, LONG+0x300, /* 4e-4f */ + ABS+0x200, ABSLONG+0x300, /* 4e-4f */ DISP8+0x100, DLOCINDY+0x100, /* 50-51 */ DLOCIND+0x100, DISP8SINDY+0x100, /* 52-53 */ MVPMVN+0x200, DLOCX+0x100, /* 54-55 */ DLOCX+0x100, DLOCBRAKY+0x100, /* 56-57 */ IMPLY+0x000, ABSY+0x200, /* 58-59 */ IMPLY+0x000, IMPLY+0x000, /* 5a-5b */ - LONG+0x300, ABSX+0x200, /* 5c-5d */ - ABSX+0x200, LONGX+0x300, /* 5e-5f */ + ABSLONG+0x300, ABSX+0x200, /* 5c-5d */ + ABSX+0x200, ABSLONGX+0x300, /* 5e-5f */ IMPLY+0x000, DLOCXIND+0x100, /* 60-61 */ DISP16+0x200, DISP8S+0x100, /* 62-63 */ DLOC+0x100, DLOC+0x100, /* 64-65 */ @@ -128,7 +93,7 @@ const word32 disas_types[256] = { IMPLY+0x000, IMMED+0x400, /* 68-69 */ ACCUM+0x000, IMPLY+0x000, /* 6a-6b */ ABSIND+0x200, ABS+0x200, /* 6c-6d */ - ABS+0x200, LONG+0x300, /* 6e-6f */ + ABS+0x200, ABSLONG+0x300, /* 6e-6f */ DISP8+0x100, DLOCINDY+0x100, /* 70-71 */ DLOCIND+0x100, DISP8SINDY+0x100, /* 72-73 */ DLOCX+0x100, DLOCX+0x100, /* 74-75 */ @@ -136,7 +101,7 @@ const word32 disas_types[256] = { IMPLY+0x000, ABSY+0x200, /* 78-79 */ IMPLY+0x000, IMPLY+0x000, /* 7a-7b */ ABSXIND+0x200, ABSX+0x200, /* 7c-7d */ - ABSX+0x200, LONGX+0x300, /* 7e-7f */ + ABSX+0x200, ABSLONGX+0x300, /* 7e-7f */ DISP8+0x100, DLOCXIND+0x100, /* 80-81 */ DISP16+0x200, DISP8S+0x100, /* 82-83 */ DLOC+0x100, DLOC+0x100, /* 84-85 */ @@ -144,7 +109,7 @@ const word32 disas_types[256] = { IMPLY+0x000, IMMED+0x400, /* 88-89 */ IMPLY+0x000, IMPLY+0x000, /* 8a-8b */ ABS+0x200, ABS+0x200, /* 8c-8d */ - ABS+0x200, LONG+0x300, /* 8e-8f */ + ABS+0x200, ABSLONG+0x300, /* 8e-8f */ DISP8+0x100, DLOCINDY+0x100, /* 90-91 */ DLOCIND+0x100, DISP8SINDY+0x100, /* 92-93 */ DLOCX+0x100, DLOCX+0x100, /* 94-95 */ @@ -152,7 +117,7 @@ const word32 disas_types[256] = { IMPLY+0x000, ABSY+0x200, /* 98-99 */ IMPLY+0x000, IMPLY+0x000, /* 9a-9b */ ABS+0x200, ABSX+0x200, /* 9c-9d */ - ABSX+0x200, LONGX+0x300, /* 9e-9f */ + ABSX+0x200, ABSLONGX+0x300, /* 9e-9f */ IMMED+0x500, DLOCXIND+0x100, /* a0-a1 */ IMMED+0x500, DISP8S+0x100, /* a2-a3 */ DLOC+0x100, DLOC+0x100, /* a4-a5 */ @@ -160,7 +125,7 @@ const word32 disas_types[256] = { IMPLY+0x000, IMMED+0x400, /* a8-a9 */ IMPLY+0x000, IMPLY+0x000, /* aa-ab */ ABS+0x200, ABS+0x200, /* ac-ad */ - ABS+0x200, LONG+0x300, /* ae-af */ + ABS+0x200, ABSLONG+0x300, /* ae-af */ DISP8+0x100, DLOCINDY+0x100, /* b0-b1 */ DLOCIND+0x100, DISP8SINDY+0x100, /* b2-b3 */ DLOCX+0x100, DLOCX+0x100, /* b4-b5 */ @@ -168,7 +133,7 @@ const word32 disas_types[256] = { IMPLY+0x000, ABSY+0x200, /* b8-b9 */ IMPLY+0x000, IMPLY+0x000, /* ba-bb */ ABSX+0x200, ABSX+0x200, /* bc-bd */ - ABSY+0x200, LONGX+0x300, /* be-bf */ + ABSY+0x200, ABSLONGX+0x300, /* be-bf */ IMMED+0x500, DLOCXIND+0x100, /* c0-c1 */ REPVAL+0x100, DISP8S+0x100, /* c2-c3 */ DLOC+0x100, DLOC+0x100, /* c4-c5 */ @@ -176,7 +141,7 @@ const word32 disas_types[256] = { IMPLY+0x000, IMMED+0x400, /* c8-c9 */ IMPLY+0x000, IMPLY+0x000, /* ca-cb */ ABS+0x200, ABS+0x200, /* cc-cd */ - ABS+0x200, LONG+0x300, /* ce-cf */ + ABS+0x200, ABSLONG+0x300, /* ce-cf */ DISP8+0x100, DLOCINDY+0x100, /* d0-d1 */ DLOCIND+0x100, DISP8SINDY+0x100, /* d2-d3 */ DLOC+0x100, DLOCX+0x100, /* d4-d5 */ @@ -184,7 +149,7 @@ const word32 disas_types[256] = { IMPLY+0x000, ABSY+0x200, /* d8-d9 */ IMPLY+0x000, IMPLY+0x000, /* da-db */ ABSIND+0x200, ABSX+0x200, /* dc-dd */ - ABSX+0x200, LONGX+0x300, /* de-df */ + ABSX+0x200, ABSLONGX+0x300, /* de-df */ IMMED+0x500, DLOCXIND+0x100, /* e0-e1 */ SEPVAL+0x100, DISP8S+0x100, /* e2-e3 */ DLOC+0x100, DLOC+0x100, /* e4-e5 */ @@ -192,7 +157,7 @@ const word32 disas_types[256] = { IMPLY+0x000, IMMED+0x400, /* e8-e9 */ IMPLY+0x000, IMPLY+0x000, /* ea-eb */ ABS+0x200, ABS+0x200, /* ec-ed */ - ABS+0x200, LONG+0x300, /* ee-ef */ + ABS+0x200, ABSLONG+0x300, /* ee-ef */ DISP8+0x100, DLOCINDY+0x100, /* f0-f1 */ DLOCIND+0x100, DISP8SINDY+0x100, /* f2-f3 */ IMMED+0x200, DLOCX+0x100, /* f4-f5 */ @@ -200,5 +165,5 @@ const word32 disas_types[256] = { IMPLY+0x000, ABSY+0x200, /* f8-f9 */ IMPLY+0x000, IMPLY+0x000, /* fa-fb */ ABSXIND+0x200, ABSX+0x200, /* fc-fd */ - ABSX+0x200, LONGX+0x300, /* fe-ff */ + ABSX+0x200, ABSLONGX+0x300, /* fe-ff */ }; diff --git a/src/disasm.h b/src/disasm.h new file mode 100644 index 0000000..3c437fd --- /dev/null +++ b/src/disasm.h @@ -0,0 +1,41 @@ +/* + GSPLUS - Advanced Apple IIGS Emulator Environment + Based on the KEGS emulator written by Kent Dickey + See COPYRIGHT.txt for Copyright information + See LICENSE.txt for license (GPL v2) +*/ + +enum { + ABS = 1, + ABSX, + ABSY, + ABSIND, + ABSXIND, + IMPLY, + ACCUM, + IMMED, + JUST8, + DLOC, + DLOCX, + DLOCY, + ABSLONG, + ABSLONGX, + DLOCIND, + DLOCINDY, + DLOCXIND, + DLOCBRAK, + DLOCBRAKY, + DISP8, + DISP8S, + DISP8SINDY, + DISP16, + MVPMVN, + REPVAL, + SEPVAL +}; + + +extern const char * const disasm_opcodes[256]; + + +extern const unsigned disasm_types[256]; \ No newline at end of file