mirror of
https://github.com/uffejakobsen/acme.git
synced 2025-03-25 08:29:31 +00:00
added another choice for "--dialect"
git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@348 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
parent
d70988c09d
commit
3deb9700dc
@ -10,7 +10,8 @@
|
||||
In release 0.87, support for some of the undocumented opcodes of the
|
||||
NMOS 6502 processor was added.
|
||||
In release 0.89, some more were added.
|
||||
In release 0.94.8, another one was added (lxa).
|
||||
In release 0.94.8, another one ("LXA") was added.
|
||||
In release 0.95.2, the "ANC" opcode was changed from 0x2b to 0x0b.
|
||||
In release 0.95.3, C64DTV2 support was added, which includes these
|
||||
opcodes as well.
|
||||
In release 0.95.4, the remaining seven were added.
|
||||
@ -39,7 +40,8 @@ opcodes (mnemonics in parentheses are used by other sources):
|
||||
| addressing mode |
|
||||
mnemonic | implied #8 8 8,x 16 16,x | performs:
|
||||
----------------+---------------------------------+-----------------------
|
||||
anc (ana, anb) | 0b* | A = A & arg, then C=N
|
||||
anc (ana) | 0b* | A = A & arg, then C=N
|
||||
anc (anb) | 2b* | A = A & arg, then C=N
|
||||
alr/asr | 4b | A = A & arg, then lsr
|
||||
arr | 6b | A = A & arg, then ror
|
||||
sbx (axs, sax) | cb | X = (A & X) - arg
|
||||
@ -60,7 +62,6 @@ Example:
|
||||
ACME version 0.95.2, anc#8 generates opcode 0x0b. Both opcodes work
|
||||
the same way on a real NMOS 6502 CPU, but they do not work on the
|
||||
C64DTV2.
|
||||
Using the "--dialect" CLI switch does not change the generated opcode!
|
||||
|
||||
**) Note that DOP ("double nop") and TOP ("triple nop") can be used
|
||||
with implied addressing, but the generated opcodes are those for
|
||||
|
@ -533,9 +533,9 @@ struct dialect_info dialects[] = {
|
||||
{V0_94_6__RIGHT_ASSOC_POWER, "0.94.6", "\"power of\" is now right-associative"},
|
||||
// {V, "0.94.7", "empty code segments are no longer included in output file"},
|
||||
{V0_94_8__DISABLED_OBSOLETE, "0.94.8", "\"*=\" works inside \"!pseudopc\", disabled \"!cbm/!realpc/!subzone\""},
|
||||
{V0_94_12__NEWFORSYNTAX, "0.94.12", "new \"!for\" syntax"},
|
||||
// {V, "0.95.2", "changed ANC#8 from 0x2b to 0x0b"},
|
||||
{V0_97__BACKSLASHESCAPING, "0.97", "backslash escaping and strings"},
|
||||
{V0_94_12__NEW_FOR_SYNTAX, "0.94.12", "new \"!for\" syntax"},
|
||||
{V0_95_2__NEW_ANC_OPCODE, "0.95.2", "changed ANC#8 from 0x2b to 0x0b"},
|
||||
{V0_97__BACKSLASH_ESCAPING, "0.97", "backslash escaping and strings"},
|
||||
// {V__CURRENT_VERSION, "default", "default"},
|
||||
{V__FUTURE_VERSION, "future", "enable all experimental features"},
|
||||
{0, NULL, NULL} // NULLs terminate
|
||||
@ -677,7 +677,7 @@ static char short_option(const char *argument)
|
||||
config.warn_on_indented_labels = FALSE;
|
||||
goto done;
|
||||
} else if (strcmp(argument + 1, OPTIONWNO_OLD_FOR) == 0) {
|
||||
config.dialect = V0_94_12__NEWFORSYNTAX - 1;
|
||||
config.dialect = V0_94_12__NEW_FOR_SYNTAX - 1;
|
||||
goto done;
|
||||
} else if (strcmp(argument + 1, OPTIONWNO_BIN_LEN) == 0) {
|
||||
config.warn_bin_mask = 0;
|
||||
|
@ -429,7 +429,7 @@ static void parse_quoted(char closing_quote)
|
||||
// without backslash escaping, both ' and " are used for single
|
||||
// characters.
|
||||
// with backslash escaping, ' is for characters and " is for strings:
|
||||
if ((closing_quote == '"') && (config.dialect >= V0_97__BACKSLASHESCAPING)) {
|
||||
if ((closing_quote == '"') && (config.dialect >= V0_97__BACKSLASH_ESCAPING)) {
|
||||
// string //////////////////////////////////
|
||||
string_prepare_string(&arg_stack[arg_sp], GlobalDynaBuf->size); // create string object and put on arg stack
|
||||
memcpy(arg_stack[arg_sp].u.string->payload, GLOBALDYNABUF_CURRENT, GlobalDynaBuf->size); // copy payload
|
||||
|
@ -50,9 +50,9 @@ enum dialect {
|
||||
V0_94_6__RIGHT_ASSOC_POWER, // v0.94.6 made "power of" operator right-associative
|
||||
// v0.94.7 fixed a bug: empty code segments no longer included in output file
|
||||
V0_94_8__DISABLED_OBSOLETE, // v0.94.8 made *= work inside !pseudopc, disabled !cbm/!realpc/!subzone
|
||||
V0_94_12__NEWFORSYNTAX, // v0.94.12 introduced the new "!for" syntax
|
||||
// v0.95.2 changed ANC#8 from 0x2b to 0x0b
|
||||
V0_97__BACKSLASHESCAPING, // v0.97 introduced backslash escaping (and therefore strings)
|
||||
V0_94_12__NEW_FOR_SYNTAX, // v0.94.12 introduced the new "!for" syntax
|
||||
V0_95_2__NEW_ANC_OPCODE, // v0.95.2 changed ANC#8 from opcode 0x2b to 0x0b
|
||||
V0_97__BACKSLASH_ESCAPING, // v0.97 introduced backslash escaping (and therefore strings)
|
||||
V__CURRENT_VERSION, // "RELEASE"
|
||||
// possible changes in future versions:
|
||||
// paths should be relative to file, not start dir
|
||||
|
@ -396,7 +396,7 @@ int input_quoted_to_dynabuf(char closing_quote)
|
||||
if (GotByte == closing_quote)
|
||||
return 0; // ok
|
||||
|
||||
if ((GotByte == '\\') && (config.dialect >= V0_97__BACKSLASHESCAPING))
|
||||
if ((GotByte == '\\') && (config.dialect >= V0_97__BACKSLASH_ESCAPING))
|
||||
escaped = TRUE;
|
||||
}
|
||||
DYNABUF_APPEND(GlobalDynaBuf, GotByte);
|
||||
@ -412,7 +412,7 @@ int input_unescape_dynabuf(int read_index)
|
||||
char byte;
|
||||
boolean escaped;
|
||||
|
||||
if (config.dialect < V0_97__BACKSLASHESCAPING)
|
||||
if (config.dialect < V0_97__BACKSLASH_ESCAPING)
|
||||
return 0; // ok
|
||||
|
||||
write_index = read_index;
|
||||
|
33
src/mnemo.c
33
src/mnemo.c
@ -114,13 +114,13 @@ SCB accu_lindz8[] = { 0, 0, 0, 0, 0x12, 0, 0,
|
||||
// mnemotable), the assembler finds out the column to use here. The row
|
||||
// depends on the used addressing mode. A zero entry in these tables means
|
||||
// that the combination of mnemonic and addressing mode is illegal.
|
||||
// | 6502 | 6502/65c02/65ce02/m65 | 65c02 | 65ce02 | 65816 | NMOS 6502 undocumented opcodes | C64DTV2 |
|
||||
enum { IDX_ASL,IDX_ROL,IDX_LSR,IDX_ROR,IDX_LDY,IDX_LDX,IDX_CPY,IDX_CPX,IDX_BIT,IDXcBIT,IDXmBITQ,IDX_STX,IDXeSTX,IDX_STY,IDXeSTY,IDX_DEC,IDXcDEC,IDX_INC,IDXcINC,IDXcTSB,IDXcTRB,IDXcSTZ,IDXeASR,IDXeASW,IDXeCPZ,IDXeLDZ,IDXePHW,IDXeROW,IDXeRTN,IDX16COP,IDX16REP,IDX16SEP,IDX16PEA,IDXuANC,IDXuALR,IDXuARR,IDXuSBX,IDXuNOP,IDXuDOP,IDXuTOP,IDXuLXA,IDXuANE,IDXuLAS,IDXuTAS,IDXuSHX,IDXuSHY,IDX_SAC,IDX_SIR};
|
||||
SCB misc_impl[] = { 0x0a, 0x2a, 0x4a, 0x6a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3a, 0, 0x1a, 0, 0, 0, 0x43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xea, 0x80, 0x0c, 0, 0, 0, 0, 0, 0, 0, 0}; // implied/accu
|
||||
SCB misc_imm[] = { 0, 0, 0, 0, 0xa0, 0xa2, 0xc0, 0xe0, 0, 0x89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xc2, 0xa3, 0xf4, 0, 0x62, /*2?*/0, 0xc2, 0xe2, 0, 0x0b, 0x4b, 0x6b, 0xcb, 0x80, 0x80, 0, 0xab, 0x8b, 0, 0, 0, 0, 0x32, 0x42}; // #$ff #$ffff
|
||||
SCS misc_abs[] = { 0x0e06, 0x2e26, 0x4e46, 0x6e66, 0xaca4, 0xaea6, 0xccc4, 0xece4, 0x2c24, 0x2c24, 0x2c24, 0x8e86, 0x8e86, 0x8c84, 0x8c84, 0xcec6, 0xcec6, 0xeee6, 0xeee6, 0x0c04, 0x1c14, 0x9c64, 0x44, 0xcb00, 0xdcd4, 0xab00, 0xfc00, 0xeb00, 0, 0x02, 0, 0, 0xf400, 0, 0, 0, 0, 0x0c04, 0x04, 0x0c00, 0, 0, 0, 0, 0, 0, 0, 0}; // $ff $ffff
|
||||
SCS misc_xabs[] = { 0x1e16, 0x3e36, 0x5e56, 0x7e76, 0xbcb4, 0, 0, 0, 0, 0x3c34, 0, 0, 0, 0x94, 0x8b94, 0xded6, 0xded6, 0xfef6, 0xfef6, 0, 0, 0x9e74, 0x54, 0, 0, 0xbb00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1c14, 0x14, 0x1c00, 0, 0, 0, 0, 0, 0x9c00, 0, 0}; // $ff,x $ffff,x
|
||||
SCS misc_yabs[] = { 0, 0, 0, 0, 0, 0xbeb6, 0, 0, 0, 0, 0, 0x96, 0x9b96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xbb00, 0x9b00, 0x9e00, 0, 0, 0}; // $ff,y $ffff,y
|
||||
// | 6502 | 6502/65c02/65ce02/m65 | 65c02 | 65ce02 | 65816 | NMOS 6502 undocumented opcodes | C64DTV2 |
|
||||
enum { IDX_ASL,IDX_ROL,IDX_LSR,IDX_ROR,IDX_LDY,IDX_LDX,IDX_CPY,IDX_CPX,IDX_BIT,IDXcBIT,IDXmBITQ,IDX_STX,IDXeSTX,IDX_STY,IDXeSTY,IDX_DEC,IDXcDEC,IDX_INC,IDXcINC,IDXcTSB,IDXcTRB,IDXcSTZ,IDXeASR,IDXeASW,IDXeCPZ,IDXeLDZ,IDXePHW,IDXeROW,IDXeRTN,IDX16COP,IDX16REP,IDX16SEP,IDX16PEA,IDXuANCa,IDXuANCb,IDXuALR,IDXuARR,IDXuSBX,IDXuNOP,IDXuDOP,IDXuTOP,IDXuLXA,IDXuANE,IDXuLAS,IDXuTAS,IDXuSHX,IDXuSHY,IDX_SAC,IDX_SIR};
|
||||
SCB misc_impl[] = { 0x0a, 0x2a, 0x4a, 0x6a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3a, 0, 0x1a, 0, 0, 0, 0x43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xea, 0x80, 0x0c, 0, 0, 0, 0, 0, 0, 0, 0}; // implied/accu
|
||||
SCB misc_imm[] = { 0, 0, 0, 0, 0xa0, 0xa2, 0xc0, 0xe0, 0, 0x89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xc2, 0xa3, 0xf4, 0, 0x62, /*2?*/0, 0xc2, 0xe2, 0, 0x0b, 0x2b, 0x4b, 0x6b, 0xcb, 0x80, 0x80, 0, 0xab, 0x8b, 0, 0, 0, 0, 0x32, 0x42}; // #$ff #$ffff
|
||||
SCS misc_abs[] = { 0x0e06, 0x2e26, 0x4e46, 0x6e66, 0xaca4, 0xaea6, 0xccc4, 0xece4, 0x2c24, 0x2c24, 0x2c24, 0x8e86, 0x8e86, 0x8c84, 0x8c84, 0xcec6, 0xcec6, 0xeee6, 0xeee6, 0x0c04, 0x1c14, 0x9c64, 0x44, 0xcb00, 0xdcd4, 0xab00, 0xfc00, 0xeb00, 0, 0x02, 0, 0, 0xf400, 0, 0, 0, 0, 0, 0x0c04, 0x04, 0x0c00, 0, 0, 0, 0, 0, 0, 0, 0}; // $ff $ffff
|
||||
SCS misc_xabs[] = { 0x1e16, 0x3e36, 0x5e56, 0x7e76, 0xbcb4, 0, 0, 0, 0, 0x3c34, 0, 0, 0, 0x94, 0x8b94, 0xded6, 0xded6, 0xfef6, 0xfef6, 0, 0, 0x9e74, 0x54, 0, 0, 0xbb00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1c14, 0x14, 0x1c00, 0, 0, 0, 0, 0, 0x9c00, 0, 0}; // $ff,x $ffff,x
|
||||
SCS misc_yabs[] = { 0, 0, 0, 0, 0, 0xbeb6, 0, 0, 0, 0, 0, 0x96, 0x9b96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xbb00, 0x9b00, 0x9e00, 0, 0, 0}; // $ff,y $ffff,y
|
||||
|
||||
// Code tables for group GROUP_ALLJUMPS:
|
||||
// These tables are needed for finding out the correct code when the mnemonic
|
||||
@ -261,9 +261,15 @@ static struct ronode mnemo_6502undoc1_tree[] = {
|
||||
|
||||
// undocumented opcodes of the NMOS 6502 that are _not_ supported by c64dtv2:
|
||||
// (currently ANC only, maybe more will get moved)
|
||||
static struct ronode mnemo_6502undoc2_tree[] = {
|
||||
static struct ronode mnemo_6502undoc2a_tree[] = {
|
||||
PREDEF_START,
|
||||
PREDEF_END("anc", MERGE(GROUP_MISC, IDXuANC)), // A = A & arg, then C=N (aka ANA, ANB)
|
||||
PREDEF_END("anc", MERGE(GROUP_MISC, IDXuANCa)), // A = A & arg, then C=N (aka ANA)
|
||||
// ^^^^ this marks the last element
|
||||
};
|
||||
// same tree with different ANC opcode, for "--dialect" < 0.95.2:
|
||||
static struct ronode mnemo_6502undoc2b_tree[] = {
|
||||
PREDEF_START,
|
||||
PREDEF_END("anc", MERGE(GROUP_MISC, IDXuANCb)), // A = A & arg, then C=N (aka ANB)
|
||||
// ^^^^ this marks the last element
|
||||
};
|
||||
|
||||
@ -1232,8 +1238,13 @@ boolean keyword_is_nmos6502_mnemo(int length)
|
||||
return TRUE;
|
||||
|
||||
// then check some more undocumented ("illegal") opcodes...
|
||||
if (check_mnemo_tree(mnemo_6502undoc2_tree, mnemo_dyna_buf))
|
||||
return TRUE;
|
||||
if (config.dialect >= V0_95_2__NEW_ANC_OPCODE) {
|
||||
if (check_mnemo_tree(mnemo_6502undoc2a_tree, mnemo_dyna_buf))
|
||||
return TRUE;
|
||||
} else {
|
||||
if (check_mnemo_tree(mnemo_6502undoc2b_tree, mnemo_dyna_buf))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ...then check original opcodes
|
||||
return check_mnemo_tree(mnemo_6502_tree, mnemo_dyna_buf);
|
||||
|
@ -471,7 +471,7 @@ static enum eos encode_string(const struct encoder *inner_encoder, unsigned char
|
||||
do {
|
||||
// we need to keep the old string handler code, because if user selects
|
||||
// older dialect, the new code will complain about string lengths > 1!
|
||||
if ((GotByte == '"') && (config.dialect < V0_97__BACKSLASHESCAPING)) {
|
||||
if ((GotByte == '"') && (config.dialect < V0_97__BACKSLASH_ESCAPING)) {
|
||||
// the old way of handling string literals:
|
||||
int offset;
|
||||
|
||||
@ -1114,7 +1114,7 @@ static enum eos po_for(void) // now GotByte = illegal char
|
||||
if (input_accept_comma()) {
|
||||
// new counter syntax
|
||||
loop.algorithm = FORALGO_NEWCOUNT;
|
||||
if (config.dialect < V0_94_12__NEWFORSYNTAX)
|
||||
if (config.dialect < V0_94_12__NEW_FOR_SYNTAX)
|
||||
Throw_first_pass_warning("Found new \"!for\" syntax.");
|
||||
loop.u.counter.first = intresult.val.intval; // use first argument
|
||||
ALU_defined_int(&intresult); // read second argument
|
||||
@ -1136,7 +1136,7 @@ static enum eos po_for(void) // now GotByte = illegal char
|
||||
} else {
|
||||
// old counter syntax
|
||||
loop.algorithm = FORALGO_OLDCOUNT;
|
||||
if (config.dialect >= V0_94_12__NEWFORSYNTAX)
|
||||
if (config.dialect >= V0_94_12__NEW_FOR_SYNTAX)
|
||||
Throw_first_pass_warning("Found old \"!for\" syntax.");
|
||||
if (intresult.val.intval < 0)
|
||||
Throw_serious_error("Loop count is negative.");
|
||||
@ -1380,7 +1380,7 @@ static enum eos throw_src_string(enum debuglevel level, const char prefix[])
|
||||
dynabuf_clear(user_message);
|
||||
dynabuf_add_string(user_message, prefix);
|
||||
do {
|
||||
if ((GotByte == '"') && (config.dialect < V0_97__BACKSLASHESCAPING)) {
|
||||
if ((GotByte == '"') && (config.dialect < V0_97__BACKSLASH_ESCAPING)) {
|
||||
dynabuf_clear(GlobalDynaBuf);
|
||||
if (input_quoted_to_dynabuf('"'))
|
||||
return SKIP_REMAINDER; // unterminated or escaping error
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#define RELEASE "0.97" // update before release FIXME
|
||||
#define CODENAME "Zem" // update before release
|
||||
#define CHANGE_DATE "20 Feb" // update before release FIXME
|
||||
#define CHANGE_DATE "21 Feb" // update before release FIXME
|
||||
#define CHANGE_YEAR "2024" // update before release
|
||||
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
|
||||
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME
|
||||
|
Loading…
x
Reference in New Issue
Block a user