From b2afe0d5f432822dfb5012ebd0b7af82d2976c30 Mon Sep 17 00:00:00 2001 From: marcobaye Date: Thu, 12 Feb 2015 00:57:01 +0000 Subject: [PATCH] updated "toacme" sources to current version (release 0.12 from 2015-02-04), now including a converter for "VisAss". git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@60 4df02467-bbd4-4a76-a152-e7ce94205b78 --- contrib/toacme/docs/CHANGES | 6 + contrib/toacme/docs/README | 30 +++-- contrib/toacme/src/Makefile | 8 +- contrib/toacme/src/Makefile.dos | 8 +- contrib/toacme/src/Makefile.riscos | 8 +- contrib/toacme/src/ab.c | 169 +++++++++++++++++++++++++---- contrib/toacme/src/ab.h | 19 +++- contrib/toacme/src/ab3.c | 109 +++---------------- contrib/toacme/src/f8ab.c | 26 ++--- contrib/toacme/src/main.c | 2 +- contrib/toacme/src/platform.h | 9 +- contrib/toacme/src/version.c | 31 +++--- contrib/toacme/src/vis.c | 49 +++++++++ 13 files changed, 296 insertions(+), 178 deletions(-) create mode 100644 contrib/toacme/src/vis.c diff --git a/contrib/toacme/docs/CHANGES b/contrib/toacme/docs/CHANGES index 1c69afa..4c5be5d 100644 --- a/contrib/toacme/docs/CHANGES +++ b/contrib/toacme/docs/CHANGES @@ -1,4 +1,10 @@ +2015-02-04 + Release 0.12 + Added "VisAss" converter mode. + Removed "umlaut fixing" and just went ahead with UTF-8. + Fixed home page (used the ACME sourceforge page). + 2012-10-08 Release 0.11 Beautified source, and added space after ',' in addressing modes. diff --git a/contrib/toacme/docs/README b/contrib/toacme/docs/README index 5f36504..1d9dca3 100644 --- a/contrib/toacme/docs/README +++ b/contrib/toacme/docs/README @@ -36,13 +36,10 @@ using ACME. In such cases, ToACME can be used to convert the source code files to ACME format. -Use ---- +Syntax and use +-------------- -ToACME can be invoked in two ways: - -toacme -toacme +./toacme FORMAT_ID INPUT_FILE OUTPUT_FILE Calling ToACME without any arguments will show a short message containing copyright information and a list of all known input @@ -66,17 +63,30 @@ Known input formats Currently, ToACME supports these input file formats: -format_id source file format quality +Format ID: source file format quality -------------------------------------------------- +object object code files poor +hypra C64: Hypra-Assembler ok +giga C64: Giga-Assembler ok +vis C64: VisAss untested ab3 C64: AssBlaster 3.0 to 3.2 good f8ab C64: Flash8-AssBlaster ok -giga C64: Giga-Assembler needs testing -hypra C64: Hypra-Assembler ok -object object code files poor + Contacting the author --------------------- +The newest version can be found at the ACME homepage: +http://sourceforge.net/projects/acme-crossass/ + If you want to report a bug or make a suggestion, then simply send an email to marco@baye.de + + +Credits +------- + +Thanks to Stefan Hübner for fixing the AssBlaster macro conversion code. +Thanks to Andreas Paul for helping with the Giga-Assembler mode. +Thanks to Arndt Dettke for helping with the Hypra-Assembler mode. diff --git a/contrib/toacme/src/Makefile b/contrib/toacme/src/Makefile index 3e81b32..ec773a3 100644 --- a/contrib/toacme/src/Makefile +++ b/contrib/toacme/src/Makefile @@ -1,4 +1,4 @@ -CFLAGS = -O3 -Wall +CFLAGS = -O3 -Wall -Wstrict-prototypes #LIBS = -lm CC = gcc RM = rm @@ -11,6 +11,8 @@ USERBIN = $(HOME)/bin all: $(PROGS) +vis.o: config.h acme.h io.h mnemo.h scr2iso.h vis.c + ab3.o: config.h ab.h acme.h io.h mnemo.h scr2iso.h ab3.c ab.o: config.h ab.h acme.h io.h scr2iso.h ab.c @@ -39,8 +41,8 @@ scr2iso.o: config.h scr2iso.h scr2iso.c version.o: config.h version.c -toacme: ab.o ab3.o acme.o f8ab.o giga.o gighyp.o hypra.o io.o main.o mnemo.o obj.o pet2iso.o platform.o scr2iso.o version.o - $(CC) $(LIBS) $(CFLAGS) -o toacme ab.o ab3.o acme.o f8ab.o giga.o gighyp.o hypra.o io.o main.o mnemo.o obj.o pet2iso.o platform.o scr2iso.o version.o +toacme: vis.o ab.o ab3.o acme.o f8ab.o giga.o gighyp.o hypra.o io.o main.o mnemo.o obj.o pet2iso.o platform.o scr2iso.o version.o + $(CC) $(LIBS) $(CFLAGS) -o toacme vis.o ab.o ab3.o acme.o f8ab.o giga.o gighyp.o hypra.o io.o main.o mnemo.o obj.o pet2iso.o platform.o scr2iso.o version.o strip toacme clean: diff --git a/contrib/toacme/src/Makefile.dos b/contrib/toacme/src/Makefile.dos index b474d63..b90279c 100644 --- a/contrib/toacme/src/Makefile.dos +++ b/contrib/toacme/src/Makefile.dos @@ -1,4 +1,4 @@ -CFLAGS = -Wall -s +CFLAGS = -Wall -s -Wstrict-prototypes #LIBS = -lm CC = gcc RM = rm @@ -11,6 +11,8 @@ PROGS = toacme all: $(PROGS) +vis.o: config.h acme.h io.h mnemo.h scr2iso.h vis.c + ab3.o: config.h ab.h acme.h io.h mnemo.h scr2iso.h ab3.c ab.o: config.h ab.h acme.h io.h scr2iso.h ab.c @@ -39,8 +41,8 @@ scr2iso.o: config.h scr2iso.h scr2iso.c version.o: config.h version.c -toacme: ab.o ab3.o acme.o f8ab.o giga.o gighyp.o hypra.o io.o main.o mnemo.o obj.o pet2iso.o platform.o scr2iso.o version.o - $(CC) $(LIBS) $(CFLAGS) -o toacme.out ab.o ab3.o acme.o f8ab.o giga.o gighyp.o hypra.o io.o main.o mnemo.o obj.o pet2iso.o platform.o scr2iso.o version.o +toacme: vis.o ab.o ab3.o acme.o f8ab.o giga.o gighyp.o hypra.o io.o main.o mnemo.o obj.o pet2iso.o platform.o scr2iso.o version.o + $(CC) $(LIBS) $(CFLAGS) -o toacme.out vis.o ab.o ab3.o acme.o f8ab.o giga.o gighyp.o hypra.o io.o main.o mnemo.o obj.o pet2iso.o platform.o scr2iso.o version.o copy /b \djgpp\bin\pmodstub.exe + toacme.out toacme_p.exe djp toacme.exe djp toacme_p.exe diff --git a/contrib/toacme/src/Makefile.riscos b/contrib/toacme/src/Makefile.riscos index 12e1c6f..2d81bb5 100644 --- a/contrib/toacme/src/Makefile.riscos +++ b/contrib/toacme/src/Makefile.riscos @@ -1,4 +1,4 @@ -CFLAGS = -O3 -Wall -mthrowback -mlibscl -mno-poke-function-name +CFLAGS = -O3 -Wall -Wstrict-prototypes -mthrowback -mlibscl -mno-poke-function-name #LIBS = -lm CC = gcc RM = rm @@ -11,6 +11,8 @@ PROGS = toacme all: $(PROGS) +vis.o: config.h acme.h io.h mnemo.h scr2iso.h vis.c + ab3.o: config.h ab.h acme.h io.h mnemo.h scr2iso.h ab3.c ab.o: config.h ab.h acme.h io.h scr2iso.h ab.c @@ -39,8 +41,8 @@ scr2iso.o: config.h scr2iso.h scr2iso.c version.o: config.h version.c -toacme: ab.o ab3.o acme.o f8ab.o giga.o gighyp.o hypra.o io.o main.o mnemo.o obj.o pet2iso.o platform.o scr2iso.o version.o - $(CC) $(LIBS) $(CFLAGS) -o !Unsqueezed ab.o ab3.o acme.o f8ab.o giga.o gighyp.o hypra.o io.o main.o mnemo.o obj.o pet2iso.o platform.o scr2iso.o version.o +toacme: vis.o ab.o ab3.o acme.o f8ab.o giga.o gighyp.o hypra.o io.o main.o mnemo.o obj.o pet2iso.o platform.o scr2iso.o version.o + $(CC) $(LIBS) $(CFLAGS) -o !Unsqueezed vis.o ab.o ab3.o acme.o f8ab.o giga.o gighyp.o hypra.o io.o main.o mnemo.o obj.o pet2iso.o platform.o scr2iso.o version.o Squeeze -f -v !Unsqueezed toacme #clean: diff --git a/contrib/toacme/src/ab.c b/contrib/toacme/src/ab.c index 09b9566..33ba74b 100644 --- a/contrib/toacme/src/ab.c +++ b/contrib/toacme/src/ab.c @@ -1,16 +1,112 @@ // ToACME - converts other source codes to ACME format. -// Copyright (C) 1999-2006 Marco Baye +// Copyright (C) 1999-2015 Marco Baye // Have a look at "main.c" for further info // -// stuff needed for both "AssBlaster 3.x" and "Flash8-AssBlaster" +// stuff needed for "VisAss", "AssBlaster 3.x" and/or "Flash8-AssBlaster" #include #include "ab.h" #include "acme.h" +#include "mnemo.h" #include "io.h" #include "scr2iso.h" +// comparison: +// VisAss AssBlaster 3.x F8-AssBlaster +// 00- Mnemonics? +// 48- PseudoOps +// 80..86 Mnemonics 80..db Mnemonics +// 87..95 Illegals +// 96..c7 Mnemonics +// c8..d4 PseudoOps dc..ec PseudoOps +// d5..fe unused ed..fe unused +// ff line mark ff line mark ff line mark + +// Mnemonic table in VisAss/AssBlaster 3.x order +const char *visass_ab3_mnemonic_table[] = { + NULL, // unused + MnemonicCPX, MnemonicCPY, + MnemonicLDX, MnemonicLDY, + MnemonicSTX, MnemonicSTY, +//============================= start of illegals ============================= + MnemonicSAX, // broken in VisAss/AB3, see docs (called AAX) + MnemonicASR, // broken in VisAss/AB3, see docs + MnemonicARR, // broken in VisAss/AB3, see docs + MnemonicSBX, // (called AXS) + MnemonicDCP, + MnemonicDOP, // ACME uses a different opcode + MnemonicISC, + MnemonicJAM, // ACME uses a different opcode (called KIL) + "!error \"See the ToACME docs about the illegal opcode LAR.\";", + // broken in VisAss/AB3? see docs + MnemonicLAX, // broken in VisAss/AB3, see docs + MnemonicRLA, MnemonicRRA, + MnemonicSLO, MnemonicSRE, + MnemonicTOP, // ACME uses a different opcode +//============================== end of illegals ============================== + MnemonicADC, MnemonicAND, MnemonicASL, + MnemonicBIT, + MnemonicBCS, MnemonicBEQ, MnemonicBCC, MnemonicBMI, + MnemonicBNE, MnemonicBPL, MnemonicBVS, MnemonicBVC, + MnemonicBRK, + MnemonicCLC, MnemonicCLD, MnemonicCLI, MnemonicCLV, + MnemonicCMP, + MnemonicDEC, MnemonicDEX, MnemonicDEY, + MnemonicEOR, + MnemonicINC, MnemonicINX, MnemonicINY, + MnemonicJMP, MnemonicJSR, + MnemonicLDA, + MnemonicLSR, + MnemonicNOP, + MnemonicORA, + MnemonicPHA, MnemonicPHP, MnemonicPLA, MnemonicPLP, + MnemonicROL, MnemonicROR, + MnemonicRTI, MnemonicRTS, + MnemonicSBC, + MnemonicSEC, MnemonicSED, MnemonicSEI, + MnemonicSTA, + MnemonicTAX, MnemonicTAY, MnemonicTSX, + MnemonicTXA, MnemonicTXS, MnemonicTYA, +}; + + +// PseudoOpcode table in VisAss/AssBlaster 3.x order +const char *visass_ab3_pseudo_opcode_table[] = { + NULL, // la NULL because ACME does not need a pseudo opcode for label defs + ACME_set_pc, // ba + ACME_po_byte, // by + ACME_po_fill, // br + ACME_po_pet, // tx + ACME_po_macro, // md see AB_PSEUDOOFFSET_MACRODEF + ACME_endmacro, // me + ACME_macro_call, // ma see AB_PSEUDOOFFSET_MACROCALL + ACME_po_eof, // st + ACME_po_scr, // ts + ACME_po_to, // to see AB_PSEUDOOFFSET_OUTFILE + ACME_po_word, // wo + "; ToACME: Cannot convert \\kc.\n", // kc + nothing // "nothing" +}; +// constants +const char nothing[] = "doesnotmatter"; // rename to visass_nopseudoopcode + + +void visass_ab3_illegals(void) +{ + IO_put_string( +"; ToACME: Adding pseudo opcode to enable undocumented (\"illegal\") opcodes:\n" +"\t!cpu 6510\n" +"; ToACME: Support for illegal opcodes is somewhat broken in VisAss/AssBlaster.\n" +"; ToACME: Make sure you read the ToACME docs to know what you'll have to\n" +"; ToACME: look out for.\n" +"; ToACME: Should work: DCP, DOP, ISC, JAM (called KIL in VisAss/AssBlaster),\n" +"; ToACME: RLA, RRA, SBX (was called AXS in AssBlaster), SLO, SRE, TOP.\n" +"; ToACME: Trouble: ARR, ASR, LAX, SAX (called AAX in VisAss/AssBlaster).\n" + ); +} + + // constants // generate error/warning messages @@ -33,7 +129,6 @@ const char warning_unknown_number_format[] = "Warning: AssBlaster file uses unkn // 0x3c-0x40 unused ? // 0x41-0x5f upper case screen codes (used for comments) // 0x60-0x7f unused ? -#define AB_FIRST_MNEMONIC 0x80 // 0x80-0xec differ between AssBlaster 3.x and Flash8-AssBlaster // 0xed-0xfe unused ? // 0xff end-of-line @@ -83,7 +178,7 @@ const char *addressing_modes[][2] = { // variables -struct ab *conf; +struct vab *conf; // functions @@ -167,13 +262,15 @@ static void pipe_global_name(void) // level 1 static void pipe_name(void) { - // Dieser kleine Hack macht alle lokalen ABL-Labels - // Auch unter ACME lokal. nur mit '^' global markierte - // Labels werden auch global bernommen ... - if (GotByte == SCREENCODE_UPARROW) - IO_get_byte(); // global: ^witharrow => witharrow - else - IO_put_byte('.'); // local: allothers => .allothers + if (conf->flags & VABFLAG_ADD_DOT) { + // Dieser kleine Hack macht alle lokalen ABL-Labels + // Auch unter ACME lokal. nur mit '^' global markierte + // Labels werden auch global übernommen ... + if (GotByte == SCREENCODE_UPARROW) + IO_get_byte(); // global: ^witharrow => witharrow + else + IO_put_byte('.'); // local: allothers => .allothers + } pipe_global_name(); // this does exactly what is needed } @@ -253,7 +350,11 @@ static int parse_mnemo(int mnemonic_offset) dot_replacement = '.', err_bits = 0; - addressing_mode = IO_get_byte(); // get addressing mode + if (conf->address_mode_count > 2) { + addressing_mode = IO_get_byte(); // get addressing mode + } else { + addressing_mode = 1; // dummy mode for VisAss + } IO_get_byte(); // and fetch next (not handled here) mnemonic = conf->mnemonics[mnemonic_offset]; if (mnemonic == NULL) { @@ -296,10 +397,14 @@ static int parse_pseudo_opcode(int pseudo_offset) int err_bits = 0; IO_get_byte(); // and fetch next (not handled here) - IO_put_string("\t\t"); pseudo_opcode = conf->pseudo_opcodes[pseudo_offset]; - if (pseudo_opcode) + if (pseudo_opcode != nothing) + IO_put_string("\t\t"); + else + pseudo_opcode = NULL; + if (pseudo_opcode) { IO_put_string(pseudo_opcode); + } // check for special cases switch (pseudo_offset) { case AB_PSEUDOOFFSET_MACROCALL: // (in ACME: '+') @@ -329,18 +434,42 @@ static int parse_pseudo_opcode(int pseudo_offset) // main routine for AssBlaster conversion (works for both AB3 and F8AB). // call with first byte of first line pre-read (in GotByte)! -void AB_main(struct ab *client_config) +void AB_main(struct vab *client_config) { int err_bits; const char *comment_indent; + int length_byte; + int handled; conf = client_config; ACME_switch_to_pet(); // convert lines until EndOfFile while (!IO_reached_eof) { err_bits = 0; // no errors yet (in this line) + handled = 0; + if (conf->flags & VABFLAG_HASLENGTHBYTE) { + length_byte = GotByte; + IO_get_byte(); + } comment_indent = "\t"; - if (GotByte < AB_FIRST_MNEMONIC) { + if (GotByte >= conf->first_mnemonic + && (GotByte < conf->first_mnemonic + conf->mnemonic_count)) { + handled = 1; + err_bits |= parse_mnemo(GotByte - conf->first_mnemonic); + } + if (GotByte >= conf->first_pseudo_opcode + && (GotByte < conf->first_pseudo_opcode + conf->pseudo_opcode_count)) { + handled = 1; + err_bits |= parse_pseudo_opcode(GotByte - conf->first_pseudo_opcode); + } + if (GotByte >= conf->first_unused_byte_value + && (GotByte != AB_ENDOFLINE)) { + handled = 1; + fprintf(global_output_stream, "; ToACME: AssBlaster file used unknown code ($%x). ", GotByte); + IO_get_byte(); // fetch next + err_bits |= parse_unspecified('.'); // output remainder + } + if (handled == 0) { switch (GotByte) { case 0: // empty line IO_get_byte(); // skip this byte @@ -357,14 +486,6 @@ void AB_main(struct ab *client_config) default: // implied label definition pipe_name(); } - } else if (GotByte < conf->first_pseudo_opcode) { - err_bits |= parse_mnemo(GotByte - AB_FIRST_MNEMONIC); - } else if (GotByte < conf->first_unused_byte_value) { - err_bits |= parse_pseudo_opcode(GotByte - conf->first_pseudo_opcode); - } else if (GotByte != AB_ENDOFLINE) { - fprintf(global_output_stream, "; ToACME: AssBlaster file used unknown code ($%x). ", GotByte); - IO_get_byte(); // fetch next - err_bits |= parse_unspecified('.'); // output remainder } // everything might be followed by a comment, so check diff --git a/contrib/toacme/src/ab.h b/contrib/toacme/src/ab.h index 383855b..0a2bbf6 100644 --- a/contrib/toacme/src/ab.h +++ b/contrib/toacme/src/ab.h @@ -2,7 +2,7 @@ // Copyright (C) 1999-2006 Marco Baye // Have a look at "main.c" for further info // -// stuff needed for both "AssBlaster 3.x" and "Flash8-AssBlaster" +// stuff needed for "VisAss", "AssBlaster 3.x" and "Flash8-AssBlaster" #ifndef ab_H #define ab_H @@ -10,18 +10,26 @@ #include "config.h" -// Definition of "Type of AssBlaster" structure -struct ab { +// Definition of "Type of VisAss/AssBlaster" structure +struct vab { + int flags; int (*number_parser) (void); const char **pseudo_opcodes; const char **mnemonics; int address_mode_count; + int first_mnemonic; + int mnemonic_count; int first_pseudo_opcode; + int pseudo_opcode_count; int first_unused_byte_value; + int unused_values_count; }; +#define VABFLAG_HASLENGTHBYTE (1u << 0) +#define VABFLAG_ADD_DOT (1u << 1) // Constants +extern const char nothing[]; #define AB_ENDOFLINE 0xff // meaning of internal error word. errors are collected until *after* a line // has been finished so the warning messages don't interfere with the generated @@ -29,12 +37,15 @@ struct ab { #define AB_ERRBIT_UNKNOWN_ADDRMODE (1u << 0) #define AB_ERRBIT_UNKNOWN_NUMBER_COMPRESSION (1u << 1) // SIZEMASK invalid #define AB_ERRBIT_UNKNOWN_NUMBER_FORMAT (1u << 2) // FORMATMASK invalid +extern const char *visass_ab3_mnemonic_table[]; +extern const char *visass_ab3_pseudo_opcode_table[]; // Prototypes +extern void visass_ab3_illegals(void); extern void AB_output_binary(unsigned long int value); extern void AB_output_hexadecimal(unsigned long int value); -extern void AB_main(struct ab *client_config); +extern void AB_main(struct vab *client_config); #endif diff --git a/contrib/toacme/src/ab3.c b/contrib/toacme/src/ab3.c index 773f707..886bb82 100644 --- a/contrib/toacme/src/ab3.c +++ b/contrib/toacme/src/ab3.c @@ -1,5 +1,5 @@ // ToACME - converts other source codes to ACME format. -// Copyright (C) 1999-2006 Marco Baye +// Copyright (C) 1999-2015 Marco Baye // Have a look at "main.c" for further info // // AssBlaster 3.x stuff @@ -9,7 +9,6 @@ #include "config.h" #include "ab.h" #include "acme.h" -#include "mnemo.h" #include "io.h" #include "scr2iso.h" @@ -18,84 +17,6 @@ #define AB3_ADDRESSING_MODES 12 -// Mnemonic table in AssBlaster 3.x order -static const char *mnemonic_table[] = { - NULL, // $80 unused - MnemonicCPX, // $81 - MnemonicCPY, // $82 - MnemonicLDX, // $83 - MnemonicLDY, // $84 - MnemonicSTX, // $85 - MnemonicSTY, // $86 -//============================= start of illegals ============================= - MnemonicSAX, // $87 (AAX in AB3) broken in AB3, see docs - MnemonicASR, // $88 broken in AB3, see docs - MnemonicARR, // $89 broken in AB3, see docs - MnemonicSBX, // $8a (AXS in AB3) - MnemonicDCP, // $8b - MnemonicDOP, // $8c different opcodes, same action - MnemonicISC, // $8d - MnemonicJAM, // $8e (KIL in AB3) different opcodes, same action - "!error \"See the ToACME docs about the illegal opcode LAR.\";", - // $8f broken in AB3? see docs - MnemonicLAX, // $90 broken in AB3, see docs - MnemonicRLA, // $91 - MnemonicRRA, // $92 - MnemonicSLO, // $93 - MnemonicSRE, // $94 - MnemonicTOP, // $95 different opcodes, same action -//============================== end of illegals ============================== - MnemonicADC, // $96 - MnemonicAND, // $97 - MnemonicASL, // $98 - MnemonicBIT, // $99 - MnemonicBCS, MnemonicBEQ, MnemonicBCC, MnemonicBMI, // $9a-$9d - MnemonicBNE, MnemonicBPL, MnemonicBVS, MnemonicBVC, // $9e-$a1 - MnemonicBRK, // $a2 - MnemonicCLC, MnemonicCLD, MnemonicCLI, MnemonicCLV, // $a3-$a6 - MnemonicCMP, // $a7 - MnemonicDEC, MnemonicDEX, MnemonicDEY, // $a8-$aa - MnemonicEOR, // $ab - MnemonicINC, MnemonicINX, MnemonicINY, // $ac-$ae - MnemonicJMP, MnemonicJSR, // $af-$b0 - MnemonicLDA, // $b1 - MnemonicLSR, // $b2 - MnemonicNOP,// 0x1a,0x3a,0x5a,0x7a,0xda,0xfa (legal 0xea) $b3 - MnemonicORA, // $b4 - MnemonicPHA, MnemonicPHP, MnemonicPLA, MnemonicPLP, // $b5-$b8 - MnemonicROL, MnemonicROR, // $b9-$ba - MnemonicRTI, MnemonicRTS, // ($bf-$c0 in F8AB) $bb-$bc - MnemonicSBC, // $bd - MnemonicSEC, MnemonicSED, MnemonicSEI, // $bc-$c0 - MnemonicSTA, // $c1 - MnemonicTAX, MnemonicTAY, MnemonicTSX, // $c2-$c4 - MnemonicTXA, MnemonicTXS, MnemonicTYA, // $c5-$c7 -}; - - -// PseudoOpcode table in AssBlaster 3.x order -static const char *pseudo_opcode_table[] = { -#define AB3_FIRST_PSEUDO_OPCODE 0xc8 - NULL, // (la) $c8 - // NULL because ACME does not need a pseudo opcode for label defs - ACME_set_pc, // (ba) $c9 - ACME_po_byte, // (by) $ca - ACME_po_fill, // (br) $cb - ACME_po_pet, // (tx) $cc - ACME_po_macro, // (md) $cd (see AB_PSEUDOOFFSET_MACRODEF) - ACME_endmacro, // (me) $ce - ACME_macro_call, // (ma) $cf (see AB_PSEUDOOFFSET_MACROCALL) - ACME_po_eof, // (st) $d0 - ACME_po_scr, // (ts) $d1 - ACME_po_to, // (to) $d2 (see AB_PSEUDOOFFSET_OUTFILE) - ACME_po_word, // (wo) $d3 - "; ToACME: Cannot convert \\kc.\n", - // (kc) $d4 -#define AB3_FIRST_UNUSED_CODE 0xd5 - // 0xd5-0xfe are unused in AB3 -}; - - // parse AssBlaster's packed number format. returns error bits. //#define AB_NUMVAL_FLAGBIT 0x80 // 10000000 indicates packed number #define AB3_NUMVAL_ADD_1 0x40 // 01000000 @@ -159,15 +80,20 @@ hex_fallback: IO_put_byte('$'); } -// config struct for shared ab code -struct ab ab3_conf = { +// config struct for shared VisAss/AB code +struct vab ab3_conf = { + VABFLAG_ADD_DOT, parse_number, - pseudo_opcode_table, - mnemonic_table, + visass_ab3_pseudo_opcode_table, + visass_ab3_mnemonic_table, AB3_ADDRESSING_MODES, // meaning of input bytes (0x80-0xec differ between AB3 and F8AB) - AB3_FIRST_PSEUDO_OPCODE, - AB3_FIRST_UNUSED_CODE, + 0x80, // first mnemonic + 40, // count + 0xc8, // first pseudo opcode + 13, // count + 0xd5, // first unused value + 42 // count }; @@ -175,16 +101,7 @@ struct ab ab3_conf = { void ab3_main(void) { IO_set_input_padding(AB_ENDOFLINE); - IO_put_string( -"; ToACME: Adding pseudo opcode to enable undocumented (\"illegal\") opcodes:\n" -"\t!cpu 6510\n" -"; ToACME: AssBlaster's support for illegal opcodes is somewhat broken.\n" -"; ToACME: Make sure you read the ToACME docs to know what you'll have to\n" -"; ToACME: look out for.\n" -"; ToACME: Should work: DCP, DOP, ISC, JAM (was called KIL in AssBlaster),\n" -"; ToACME: RLA, RRA, SBX (was called AXS in AssBlaster), SLO, SRE, TOP.\n" -"; ToACME: Trouble: ARR, ASR, LAX, SAX (was called AAX in AssBlaster).\n" - ); + visass_ab3_illegals(); IO_process_load_address(); // first byte after load address should be AB_ENDOFLINE in AB3 sources if (IO_get_byte() == AB_ENDOFLINE) { diff --git a/contrib/toacme/src/f8ab.c b/contrib/toacme/src/f8ab.c index 1d5aa6a..bae03ef 100644 --- a/contrib/toacme/src/f8ab.c +++ b/contrib/toacme/src/f8ab.c @@ -1,5 +1,5 @@ // ToACME - converts other source codes to ACME format. -// Copyright (C) 1999-2006 Marco Baye +// Copyright (C) 1999-2015 Marco Baye // Have a look at "main.c" for further info // // Flash8-AssBlaster stuff @@ -119,9 +119,7 @@ static const char *mnemonic_table[] = { // PseudoOpcode table in Flash8-AssBlaster order static const char *pseudo_opcode_table[] = { -#define F8AB_FIRST_PSEUDO_OPCODE 0xdc - NULL, // (la) $dc - // NULL because ACME does not need a pseudo opcode for label defs + NULL, // (la) $dc // NULL because ACME does not need a pseudo opcode for label defs ACME_set_pc, // (ba) $dd ACME_po_byte, // (by) $de ACME_po_fill, // (br) $df @@ -131,17 +129,14 @@ static const char *pseudo_opcode_table[] = { ACME_macro_call, // (ma) $e3 (see AB_PSEUDOOFFSET_MACROCALL) ACME_po_eof, // (st) $e4 // ACME_po_scr is not available in F8AB. Huh?! - "; ToACME: Cannot convert \\wa.\n", - // (wa) $e5 + "; ToACME: Cannot convert \\wa.\n", // (wa) $e5 ACME_po_to, // (on) $e6 (see AB_PSEUDOOFFSET_OUTFILE) - ACME_po_word, // (wo) $e7 - "; ToACME: Cannot convert \\kc.\n", - // (kc) $e8 + ACME_po_word, // (wo) $e7 + "; ToACME: Cannot convert \\kc.\n", // (kc) $e8 ACME_po_rl, // (rl) $e9 ACME_po_rs, // (rs) $ea ACME_po_al, // (al) $eb ACME_po_as, // (as) $ec -#define F8AB_FIRST_UNUSED_CODE 0xed // 0xed-0xfe are unused in F8AB // (FIXME - true? I only checked 0xed) }; @@ -215,14 +210,19 @@ hex_fallback: IO_put_byte('$'); // config struct for shared ab code -struct ab f8ab_conf = { +struct vab f8ab_conf = { + VABFLAG_ADD_DOT, parse_number, pseudo_opcode_table, mnemonic_table, F8AB_ADDRESSING_MODES, // meaning of input bytes (0x80-0xec differ between AB3 and F8AB) - F8AB_FIRST_PSEUDO_OPCODE, - F8AB_FIRST_UNUSED_CODE, + 0x80, // first mnemonic + 92, // count + 0xdc, // first pseudo opcode + 17, // count + 0xed, // first unused value + 18 // count }; diff --git a/contrib/toacme/src/main.c b/contrib/toacme/src/main.c index 18e32ec..8522c21 100644 --- a/contrib/toacme/src/main.c +++ b/contrib/toacme/src/main.c @@ -1,5 +1,5 @@ // ToACME - converts other source codes to ACME format. -// Copyright (C) 1999-2012 Marco Baye +// Copyright (C) 1999-2015 Marco Baye // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/contrib/toacme/src/platform.h b/contrib/toacme/src/platform.h index 321492c..54c23cc 100644 --- a/contrib/toacme/src/platform.h +++ b/contrib/toacme/src/platform.h @@ -1,5 +1,5 @@ // ToACME - converts other source codes to ACME format. -// Copyright (C) 1999-2006 Marco Baye +// Copyright (C) 1999-2015 Marco Baye // Have a look at "main.c" for further info // // Platform specific stuff @@ -20,12 +20,5 @@ extern void platform_set_file_type_text(const char *filename); #define PLATFORM_SETFILETYPE_TEXT(a) #endif -// fix umlaut for DOS version -#ifdef __DJGPP__ -#define STEFAN "Stefan Hbner" -#else -#define STEFAN "Stefan Hbner" -#endif - #endif diff --git a/contrib/toacme/src/version.c b/contrib/toacme/src/version.c index bec1345..48ee5bb 100644 --- a/contrib/toacme/src/version.c +++ b/contrib/toacme/src/version.c @@ -1,14 +1,15 @@ // ToACME - converts other source codes to ACME format. -// Copyright (C) 1999-2006 Marco Baye +// Copyright (C) 1999-2015 Marco Baye // Have a look at "main.c" for further info // // Version -#define RELEASE_NUMBER "0.11" // change before release (FIXME) -#define CHANGE_DATE "8 Oct" // change before release -#define CHANGE_YEAR "2012" // change before release -#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/" -#define FILE_TAG ";ACME 0.94.2" // check before release +#define RELEASE_NUMBER "0.12" // change before release (FIXME) +#define CHANGE_DATE "4 Feb" // change before release +#define CHANGE_YEAR "2015" // change before release +#define HOME_PAGE "http://sourceforge.net/projects/acme-crossass/" +// "http://home.pages.de/~mac_bacon/smorbrod/acme/" +#define FILE_TAG ";ACME 0.95.4" // check before release #include #include @@ -29,7 +30,7 @@ void version_show_info(const char program_name[]) { "ToACME - converts other assemblers' source codes to ACME format.\n" "Release " RELEASE_NUMBER " (" CHANGE_DATE " " CHANGE_YEAR "), Copyright (C) 1999-" CHANGE_YEAR " Marco Baye.\n" PLATFORM_VERSION "\n" -"Thanks to " STEFAN " for fixing the AssBlaster macro conversion code.\n" +"Thanks to Stefan Hübner for fixing the AssBlaster macro conversion code.\n" "Thanks to Andreas Paul for helping with the Giga-Assembler mode.\n" "Thanks to Arndt Dettke for helping with the Hypra-Assembler mode.\n" "\n" @@ -40,20 +41,22 @@ HOME_PAGE "\n" "This is free software, and you are welcome to redistribute it under\n" "certain conditions; as outlined in the GNU General Public License.\n" "\n" -"Syntax: %s \n" +"Syntax: %s FORMAT_ID INPUT_FILE OUTPUT_FILE\n" "\n" -"format_id source file format quality\n" +"Format ID: source file format quality\n" "--------------------------------------------------\n" +"object object code files poor\n" +"hypra C64: Hypra-Assembler ok\n" +"giga C64: Giga-Assembler ok\n" +"vis C64: VisAss untested\n" "ab3 C64: AssBlaster 3.0 to 3.2 good\n" "f8ab C64: Flash8-AssBlaster ok\n" -"giga C64: Giga-Assembler ok\n" -"hypra C64: Hypra-Assembler ok\n" -"object object code files poor\n" "\n" , program_name); } +extern void visass_main(void); extern void ab3_main(void); extern void f8ab_main(void); extern void giga_main(void); @@ -64,7 +67,9 @@ extern void obj_main(void); // check id string. returns whether illegal. int version_parse_id(const char id[]) { - if (strcmp(id, "ab3") == 0) + if (strcmp(id, "vis") == 0) + client_main = visass_main; + else if (strcmp(id, "ab3") == 0) client_main = ab3_main; else if (strcmp(id, "f8ab") == 0) client_main = f8ab_main; diff --git a/contrib/toacme/src/vis.c b/contrib/toacme/src/vis.c new file mode 100644 index 0000000..e6712cd --- /dev/null +++ b/contrib/toacme/src/vis.c @@ -0,0 +1,49 @@ +// ToACME - converts other source codes to ACME format. +// Copyright (C) 1999-2015 Marco Baye +// Have a look at "main.c" for further info +// +// VisAss stuff + +#include "ab.h" +#include "acme.h" +#include "io.h" + + +static int number_parser(void) +{ + return 0; +} + + +// config struct for shared VisAss/AB code +struct vab visass_conf = { + VABFLAG_HASLENGTHBYTE, + number_parser, + visass_ab3_pseudo_opcode_table, + visass_ab3_mnemonic_table, + 2, // we fake absolute addressing because VisAss does not encode the addr mode + // meaning of input bytes (0x80-0xec differ between VisAss, AB3 and F8AB) + 0, // first mnemonic + 0x48, // count + 0x48, // first pseudo opcode + 14, // count + 0x100, // first unused value (dummy) + 1 // count (dummy) +}; + + +// main +void visass_main(void) +{ + IO_set_input_padding(AB_ENDOFLINE); + visass_ab3_illegals(); + IO_process_load_address(); + // first byte after load address should be AB_ENDOFLINE in VisAss sources + if (IO_get_byte() == AB_ENDOFLINE) { + IO_get_byte(); // skip it and pre-read first valid byte + fputs("Input has VisAss header.\n", stderr); + } else { + fputs("Input does not have any known VisAss header.\n", stderr); + } + AB_main(&visass_conf); +}