From 6fdb318658cb5b0a83c1bc4af7fb27c6bdb87854 Mon Sep 17 00:00:00 2001
From: Irmen de Jong
Date: Fri, 30 Oct 2020 12:16:54 +0100
Subject: [PATCH] updated to r2249 from svn repo
---
64tass.1 | 47 +++++++-----
64tass.c | 133 +++++++++++++++++---------------
README | 207 +++++++++++++++++++++++++-------------------------
README.html | 191 +++++++++++++++++++++++-----------------------
arguments.c | 4 +-
error.c | 9 +--
error.h | 4 +-
file.c | 138 ++++++++++++++++++++++++---------
functionobj.c | 4 +-
instruction.c | 50 ++++++------
inttypes.h | 3 +-
listing.c | 26 +++----
macro.c | 14 ++--
optimizer.c | 6 +-
section.c | 8 +-
section.h | 11 +--
16 files changed, 470 insertions(+), 385 deletions(-)
diff --git a/64tass.1 b/64tass.1
index e289604..413a591 100644
--- a/64tass.1
+++ b/64tass.1
@@ -194,10 +194,6 @@ Also it's hard to notice that an unchanged call turned into label after the
definition got renamed. This warning helps to find such calls so that prefixes
can be added.
.TP 0.5i
-\fB\-Wno\-addr\-wrap\fR
-Don't warn about memory location address space wrap around.
-If a memory location ends up outside of the processors address space then just wrap it around.
-.TP 0.5i
\fB\-Wno\-deprecated\fR
Don't warn about deprecated features.
Unfortunately there were some features added previously which shouldn't
@@ -227,17 +223,9 @@ You may disable this if you use labels which look like mistyped versions of
implied addressing mode instructions and you don't want to put them in the
first column.
.TP 0.5i
-\fB\-Wno\-mem\-wrap\fR
-Don't warn for compile offset wrap around.
-Continue from the beginning of image file once it's end was reached.
-.TP 0.5i
\fB\-Wno\-page\fR
Don't do an error for page crossing.
.TP 0.5i
-\fB\-Wno\-pc\-wrap\fR
-Don't warn for program counter wrap around.
-Continue from the beginning of program bank once it's end was reached.
-.TP 0.5i
\fB-Wno\-pitfalls\fR
Don't note on common pitfalls.
Experts don't need notes about how to fix things ;)
@@ -245,9 +233,34 @@ Experts don't need notes about how to fix things ;)
\fB\-Wno\-portable\fR
Don't warn about source portability problems.
.TP 0.5i
+\fB\-Wno\-size\-larger\fR
+Don't warn if size is larger due to negative offset
+Negative offsets add space in front of memory area that's out of bound. Sometimes this may be fine.
+.TP 0.5i
\fB\-Wno\-star\-assign\fR
Don't warn about ignored compound multiply.
.TP 0.5i
+\fB\-Wno\-wrap\-addr\fR
+Don't warn about address space calculation wrap around.
+If a memory location ends up outside of the processors address space then just wrap it around.
+.TP 0.5i
+\fB\-Wno\-wrap\-bank0\fR
+Don't warn for bank 0 address calculation wrap around.
+.TP 0.5i
+\fB\-Wno\-wrap\-dpage\fR
+Don't warn for direct page address calculation wrap around.
+.TP 0.5i
+\fB\-Wno\-wrap\-mem\fR
+Don't warn for compile offset wrap around.
+Continue from the beginning of image file once it's end was reached.
+.TP 0.5i
+\fB\-Wno\-wrap\-pbank\fR
+Don't warn for program bank address calculation wrap around.
+.TP 0.5i
+\fB\-Wno\-wrap\-pc\fR
+Don't warn for program counter bank crossing.
+If it's data only and the programmer deals with it then this might be ok.
+.TP 0.5i
\fB\-Wold\-equal\fR
Warn about old equal operator.
The single '=' operator is only there for compatibility reasons and should
@@ -263,10 +276,6 @@ Warn about symbol shadowing.
Checks if local variables 'shadow' other variables of same name in upper
scopes in ambiguous ways.
.TP 0.5i
-\fB\-Wno\-size\-larger\fR
-Don't warn if size is larger due to negative offset
-Negative offsets add space in front of memory area that's out of bound. Sometimes this may be fine.
-.TP 0.5i
\fB\-Wstrict\-bool\fR
Warn about implicit boolean conversions.
Boolean values can be interpreted as numeric 0/1 and other types as booleans. This is convenient but may cause mistakes.
@@ -277,15 +286,15 @@ Warn about multiple switch case matches
\fB\-Wunused\fR
Warn about unused constant symbols, any type.
.TP 0.5i
-\fB\-Wunused-macro\fR
-Warn about unused macros.
-.TP 0.5i
\fB\-Wunused-const\fR
Warn about unused constants.
.TP 0.5i
\fB\-Wunused-label\fR
Warn about unused labels.
.TP 0.5i
+\fB\-Wunused-macro\fR
+Warn about unused macros.
+.TP 0.5i
\fB\-Wunused-variable\fR
Warn about unused variables.
.SS Target selection options
diff --git a/64tass.c b/64tass.c
index 75879b4..d0fd19c 100644
--- a/64tass.c
+++ b/64tass.c
@@ -1,6 +1,6 @@
/*
Turbo Assembler 6502/65C02/65816/DTV
- $Id: 64tass.c 2241 2020-07-30 06:12:02Z soci $
+ $Id: 64tass.c 2246 2020-10-17 09:51:34Z soci $
6502/65C02 Turbo Assembler Version 1.3
(c) 1996 Taboo Productions, Marek Matula
@@ -95,7 +95,7 @@ static struct waitfor_s {
struct linepos_s epoint;
union {
struct {
- address2_t laddr;
+ address_t laddr;
Obj *val;
address_t addr;
Label *label;
@@ -115,7 +115,7 @@ static struct waitfor_s {
} cmd_section;
struct {
bool unionmode;
- address2_t laddr;
+ address_t laddr;
address_t addr, addr2;
} cmd_union;
struct {
@@ -129,7 +129,7 @@ static struct waitfor_s {
size_t membp;
} cmd_weak;
struct {
- address2_t laddr;
+ address_t laddr;
address_t addr;
Label *label;
size_t membp;
@@ -407,10 +407,12 @@ static void memskip(address_t db, linepos_t epoint) {
if (current_address->wrapwarn) {err_msg_mem_wrap(epoint);current_address->wrapwarn = false;}
current_address->moved = false;
}
- if (current_address->l_address.address > 0xffff || db > 0x10000 - current_address->l_address.address) {
- current_address->l_address.address = ((current_address->l_address.address + db - 1) & 0xffff) + 1;
- err_msg_pc_wrap(epoint);
- } else current_address->l_address.address += db;
+ if (current_address->bankwarn) {err_msg_pc_bank(epoint);current_address->bankwarn = false;}
+ if (db > (~current_address->l_address & 0xffff)) {
+ current_address->bankwarn = ((-current_address->l_address & 0xffff) == db);
+ if (!current_address->bankwarn) err_msg_pc_bank(epoint);
+ current_address->l_address = (current_address->l_address + db) & all_mem;
+ } else current_address->l_address += db;
if (db > (~current_address->address & all_mem2)) {
if (db - 1 + current_address->address == all_mem2) {
current_address->wrapwarn = current_address->moved = true;
@@ -437,10 +439,12 @@ FAST_CALL uint8_t *pokealloc(address_t db, linepos_t epoint) {
if (current_address->wrapwarn) {err_msg_mem_wrap(epoint);current_address->wrapwarn = false;}
current_address->moved = false;
}
- if (current_address->l_address.address > 0xffff || db > 0x10000 - current_address->l_address.address) {
- current_address->l_address.address = ((current_address->l_address.address + db - 1) & 0xffff) + 1;
- err_msg_pc_wrap(epoint);
- } else current_address->l_address.address += db;
+ if (current_address->bankwarn) {err_msg_pc_bank(epoint);current_address->bankwarn = false;}
+ if (db > (~current_address->l_address & 0xffff)) {
+ current_address->bankwarn = ((-current_address->l_address & 0xffff) == db);
+ if (!current_address->bankwarn) err_msg_pc_bank(epoint);
+ current_address->l_address = (current_address->l_address + db) & all_mem;
+ } else current_address->l_address += db;
if (db > (~current_address->address & all_mem2)) {
if (db - 1 + current_address->address == all_mem2) {
current_address->wrapwarn = current_address->moved = true;
@@ -763,7 +767,7 @@ static void byterecursion(Obj *val, int prm, struct byterecursion_s *brec, int b
uv &= all_mem;
switch (am) {
case A_NONE:
- if ((current_address->l_address.bank ^ uv) > 0xffff) err_msg2(ERROR_CANT_CROSS_BA, val2, brec->epoint);
+ if ((current_address->l_address ^ uv) > 0xffff) err_msg2(ERROR_CANT_CROSS_BA, val2, brec->epoint);
break;
case A_KR:
break;
@@ -847,17 +851,19 @@ static void logical_close(linepos_t epoint) {
current_address->l_union = waitfor->u.cmd_logical.laddr;
diff = 0;
} else {
+ bool overflowed = false;
diff = (current_address->address - waitfor->u.cmd_logical.addr) & all_mem2;
if (diff != 0) {
- if (waitfor->u.cmd_logical.laddr.address > 0xffff || diff > 0x10000 - waitfor->u.cmd_logical.laddr.address) {
- current_address->l_address.address = ((waitfor->u.cmd_logical.laddr.address + diff - 1) & 0xffff) + 1;
- if (epoint != NULL) err_msg_pc_wrap(epoint);
- } else current_address->l_address.address = waitfor->u.cmd_logical.laddr.address + diff;
- } else current_address->l_address.address = waitfor->u.cmd_logical.laddr.address;
- current_address->l_address.bank = waitfor->u.cmd_logical.laddr.bank;
- if (current_address->l_address.bank > all_mem) {
+ current_address->bankwarn = ((-current_address->l_address & 0xffff) == diff);
+ if (diff > (~waitfor->u.cmd_logical.laddr & 0xffff)) {
+ current_address->l_address = waitfor->u.cmd_logical.laddr + diff;
+ overflowed = current_address->l_address < diff;
+ if (epoint != NULL && !current_address->bankwarn) err_msg_pc_bank(epoint);
+ } else current_address->l_address = waitfor->u.cmd_logical.laddr + diff;
+ } else current_address->l_address = waitfor->u.cmd_logical.laddr;
+ if (current_address->l_address > all_mem || overflowed) {
if (epoint != NULL) err_msg_big_address(epoint);
- current_address->l_address.bank &= all_mem;
+ current_address->l_address &= all_mem;
}
}
val_destroy(current_address->l_address_val);
@@ -879,9 +885,9 @@ static void virtual_close(linepos_t epoint) {
val_destroy(¤t_address->mem->v);
free(current_address);
current_address = waitfor->u.cmd_virtual.section_address;
- if (current_address->l_address.bank > all_mem) {
+ if (current_address->l_address > all_mem) {
if (epoint != NULL) err_msg_big_address(epoint);
- current_address->l_address.bank &= all_mem;
+ current_address->l_address &= all_mem;
}
}
@@ -892,9 +898,9 @@ static void section_close(linepos_t epoint) {
}
current_section = waitfor->u.cmd_section.section;
current_address = waitfor->u.cmd_section.section_address;
- if (current_address->l_address.bank > all_mem) {
+ if (current_address->l_address > all_mem) {
if (epoint != NULL) err_msg_big_address(epoint);
- current_address->l_address.bank &= all_mem;
+ current_address->l_address &= all_mem;
}
}
@@ -1023,6 +1029,7 @@ static bool section_start(linepos_t epoint) {
tmp->size = tmp->address.end - tmp->address.start;
tmp->address.end = tmp->address.start = tmp->restart;
tmp->address.wrapwarn = false;
+ tmp->address.bankwarn = false;
tmp->address.address = tmp->restart;
tmp->address.l_address = tmp->l_restart;
val_destroy(&tmp->address.mem->v);
@@ -1048,6 +1055,7 @@ static bool virtual_start(linepos_t epoint) {
new_waitfor(W_ENDV2, epoint); waitfor->u.cmd_virtual.section_address = current_address; waitfor->u.cmd_virtual.label = NULL;
section_address = (struct section_address_s *)mallocx(sizeof *section_address);
section_address->wrapwarn = section_address->moved = false;
+ section_address->bankwarn = false;
do {
struct values_s *vs;
@@ -1066,8 +1074,7 @@ static bool virtual_start(linepos_t epoint) {
}
tmp = vs->val;
section_address->address = uval;
- section_address->l_address.address = uval & 0xffff;
- section_address->l_address.bank = uval & all_mem & ~(address_t)0xffff;
+ section_address->l_address = uval & all_mem;
section_address->l_address_val = get_star_value(0, tmp);
} while (false);
@@ -1092,6 +1099,7 @@ static void starhandle(Obj *val, linepos_t epoint, linepos_t epoint2) {
address_t addr, laddr;
current_address->wrapwarn = false;
+ current_address->bankwarn = false;
if (!current_address->moved) {
if (current_address->end < current_address->address) current_address->end = current_address->address;
current_address->moved = true;
@@ -1110,8 +1118,7 @@ static void starhandle(Obj *val, linepos_t epoint, linepos_t epoint2) {
break;
}
if (all_mem2 == 0xffffffff && current_section->logicalrecursion == 0) {
- current_address->l_address.address = uval & 0xffff;
- current_address->l_address.bank = uval & all_mem & ~(address_t)0xffff;
+ current_address->l_address = uval & all_mem;
val_destroy(current_address->l_address_val);
current_address->l_address_val = get_star_value(0, val);
val_destroy(val);
@@ -1122,7 +1129,7 @@ static void starhandle(Obj *val, linepos_t epoint, linepos_t epoint2) {
}
return;
}
- laddr = current_address->l_address.address + (current_address->l_address.bank & all_mem); /* overflow included! */
+ laddr = current_address->l_address;
addr = (address_t)uval & all_mem;
if (arguments.tasmcomp) addr = (uint16_t)addr;
else if (addr >= laddr) {
@@ -1134,8 +1141,7 @@ static void starhandle(Obj *val, linepos_t epoint, linepos_t epoint2) {
current_address->address = addr;
memjmp(current_address->mem, current_address->address);
}
- current_address->l_address.address = uval & 0xffff;
- current_address->l_address.bank = uval & all_mem & ~(address_t)0xffff;
+ current_address->l_address = uval & all_mem;
val_destroy(current_address->l_address_val);
current_address->l_address_val = get_star_value(0, val);
val_destroy(val);
@@ -1225,6 +1231,7 @@ static MUST_CHECK Obj *tuple_scope(Label *newlabel, Obj **o) {
fixeddig = false;
}
}
+ if (current_address->bankwarn) {err_msg_pc_bank(&newlabel->epoint);current_address->bankwarn = false;}
if (code->addr != star || code->requires != current_section->requires || code->conflicts != current_section->conflicts || code->offs != 0) {
code->addr = star;
code->requires = current_section->requires;
@@ -1240,6 +1247,7 @@ static MUST_CHECK Obj *tuple_scope(Label *newlabel, Obj **o) {
code->names->epoint = newlabel->epoint;
} else {
code = new_code();
+ if (current_address->bankwarn) {err_msg_pc_bank(&newlabel->epoint);current_address->bankwarn = false;}
code->addr = star;
code->typ = val_reference(current_address->l_address_val);
code->size = 0;
@@ -1783,12 +1791,13 @@ MUST_CHECK Obj *compile(void)
newlabel = NULL;
labelname.len = 0;ignore();epoint = lpoint; mycontext = current_context;
if (current_address->unionmode) {
- if (current_address->l_address.address != current_address->l_union.address || current_address->l_address.bank != current_address->l_union.bank) {
+ if (current_address->l_address != current_address->l_union) {
current_address->l_address = current_address->l_union;
- if (current_address->l_address.bank > all_mem) {
+ if (current_address->l_address > all_mem) {
err_msg_big_address(&epoint);
- current_address->l_address.bank &= all_mem;
+ current_address->l_address &= all_mem;
}
+ current_address->bankwarn = false;
}
if (current_address->address != current_address->start) {
if (!current_address->moved) {
@@ -1800,7 +1809,7 @@ MUST_CHECK Obj *compile(void)
memjmp(current_address->mem, current_address->address);
}
}
- star = (current_address->l_address.address & 0xffff) | current_address->l_address.bank;
+ star = current_address->l_address;
wht = here();
if (wht >= 'A') {
labelname.data = pline + lpoint.pos;
@@ -2384,11 +2393,12 @@ MUST_CHECK Obj *compile(void)
current_section->provides = ~(uval_t)0;current_section->requires = current_section->conflicts = 0;
section_address.wrapwarn = section_address.moved = false;
+ section_address.bankwarn = false;
section_address.unionmode = (prm == CMD_UNION);
section_address.address = section_address.start = section_address.end = 0;
- section_address.l_start.address = section_address.l_start.bank = 0;
- section_address.l_union.address = section_address.l_union.bank = 0;
- section_address.l_address.address = section_address.l_address.bank = 0;
+ section_address.l_start = 0;
+ section_address.l_union = 0;
+ section_address.l_address = 0;
section_address.l_address_val = (Obj *)ref_int(int_value[0]);
section_address.mem = new_memblocks(0, 0);
section_address.mem->lastaddr = 0;
@@ -2462,9 +2472,9 @@ MUST_CHECK Obj *compile(void)
current_section->provides = provides; current_section->requires = requires; current_section->conflicts = conflicts;
current_address = oldsection_address;
- if (current_address->l_address.bank > all_mem) {
+ if (current_address->l_address > all_mem) {
err_msg_big_address(&cmdpoint);
- current_address->l_address.bank &= all_mem;
+ current_address->l_address &= all_mem;
}
if (doubledef) val_destroy(&structure->v);
@@ -2484,11 +2494,11 @@ MUST_CHECK Obj *compile(void)
}
case CMD_SECTION:
if (section_start(&cmdpoint)) goto breakerr;
- star = (current_address->l_address.address & 0xffff) | current_address->l_address.bank;
+ star = current_address->l_address;
break;
case CMD_VIRTUAL:
if (virtual_start(&cmdpoint)) goto breakerr;
- star = (current_address->l_address.address & 0xffff) | current_address->l_address.bank;
+ star = current_address->l_address;
break;
case CMD_BREPT:
case CMD_BFOR:
@@ -2544,7 +2554,7 @@ MUST_CHECK Obj *compile(void)
case CMD_DUNION:
{
address_t oldstart, oldend;
- address2_t oldl_start, oldl_union;
+ address_t oldl_start, oldl_union;
bool oldunionmode;
bool labelexists, ret, doubledef = false;
Type *obj;
@@ -2609,6 +2619,7 @@ MUST_CHECK Obj *compile(void)
if (!ret && !doubledef) {
Code *code = (Code *)label->value;
+ if (current_address->bankwarn) {err_msg_pc_bank(&epoint);current_address->bankwarn = false;}
if (labelexists && code->v.obj == CODE_OBJ) {
Obj *tmp = current_address->l_address_val;
if (!tmp->obj->same(tmp, code->typ)) {
@@ -2791,6 +2802,7 @@ MUST_CHECK Obj *compile(void)
fixeddig = false;
}
}
+ if (current_address->bankwarn) {err_msg_pc_bank(&epoint);current_address->bankwarn = false;}
if (code->addr != star || code->requires != current_section->requires || code->conflicts != current_section->conflicts || code->offs != 0) {
code->addr = star;
code->requires = current_section->requires;
@@ -2815,6 +2827,7 @@ MUST_CHECK Obj *compile(void)
newlabel->owner = true;
newlabel->value = (Obj *)code;
newlabel->epoint = epoint;
+ if (current_address->bankwarn) {err_msg_pc_bank(&epoint);current_address->bankwarn = false;}
code->addr = star;
code->typ = val_reference(current_address->l_address_val);
code->size = 0;
@@ -3266,9 +3279,8 @@ MUST_CHECK Obj *compile(void)
if (close_waitfor(W_ENDP)) {
} else if (waitfor->what==W_ENDP2) {
if (diagnostics.page) {
- if (((current_address->l_address.address ^ waitfor->u.cmd_page.laddr.address) & 0xff00) != 0 ||
- current_address->l_address.bank != waitfor->u.cmd_page.laddr.bank) {
- err_msg_page((waitfor->u.cmd_page.laddr.address & 0xffff) | waitfor->u.cmd_page.laddr.bank, (current_address->l_address.address & 0xffff) | current_address->l_address.bank, &epoint);
+ if ((current_address->l_address ^ waitfor->u.cmd_page.laddr) > 0xff) {
+ err_msg_page(waitfor->u.cmd_page.laddr, current_address->l_address, &epoint);
}
}
if (waitfor->u.cmd_page.label != NULL) {set_size(waitfor->u.cmd_page.label, current_address->address - waitfor->u.cmd_page.addr, current_address->mem, waitfor->u.cmd_page.addr, waitfor->u.cmd_page.membp);val_destroy(&waitfor->u.cmd_page.label->v);}
@@ -3545,13 +3557,13 @@ MUST_CHECK Obj *compile(void)
err_msg_output_and_destroy(err_addressing(am, &vs->epoint, -1));
break;
}
+ uval &= all_mem;
if (current_address->unionmode) {
- current_address->l_union.address = uval & 0xffff;
- current_address->l_union.bank = uval & all_mem & ~(address_t)0xffff;
+ current_address->l_union = uval;
} else {
- current_address->l_address.address = uval & 0xffff;
- current_address->l_address.bank = uval & all_mem & ~(address_t)0xffff;
+ current_address->l_address = uval;
}
+ current_address->bankwarn = false;
val_destroy(current_address->l_address_val);
tmp = vs->val;
current_address->l_address_val = get_star_value(0, tmp);
@@ -3765,7 +3777,7 @@ MUST_CHECK Obj *compile(void)
if (touval2(vs->val, &uval, 8 * sizeof uval, &vs->epoint)) {}
else if (uval == 0) err_msg2(ERROR_NO_ZERO_VALUE, NULL, &vs->epoint);
else if (uval > 1) {
- address_t itt = (all_mem2 == 0xffffffff && current_section->logicalrecursion == 0) ? current_address->address : ((current_address->l_address.address + current_address->l_address.bank - current_address->l_start.address - current_address->l_start.bank) & all_mem);
+ address_t itt = (all_mem2 == 0xffffffff && current_section->logicalrecursion == 0) ? current_address->address : ((current_address->l_address - current_address->l_start) & all_mem);
if (uval > max) {
if (itt != 0) db = max - itt + 1;
} else {
@@ -4082,9 +4094,9 @@ MUST_CHECK Obj *compile(void)
for (cpui = cpus; *cpui != NULL; cpui++) {
if (cpuname.len == strlen((*cpui)->name) && memcmp((*cpui)->name, cpuname.data, cpuname.len) == 0) {
const struct cpu_s *cpumode = (*cpui != &default_cpu) ? *cpui : arguments.cpumode;
- if (current_address->l_address.bank > cpumode->max_address) {
+ if (current_address->l_address > cpumode->max_address) {
err_msg_big_address(&epoint);
- current_address->l_address.bank &= cpumode->max_address;
+ current_address->l_address &= cpumode->max_address;
}
set_cpumode(cpumode);
break;
@@ -4437,7 +4449,7 @@ MUST_CHECK Obj *compile(void)
case CMD_DSTRUCT: if ((waitfor->skip & 1) != 0)
{ /* .dstruct */
address_t oldstart, oldend;
- address2_t oldl_start, oldl_union;
+ address_t oldl_start, oldl_union;
bool oldunionmode;
struct values_s *vs;
Type *obj;
@@ -4492,6 +4504,7 @@ MUST_CHECK Obj *compile(void)
if (tmp3->usepass == 0 || tmp3->defpass < pass - 1) {
size_t ln = tmp3->address.mem->mem.p, ln2 = tmp3->address.mem->p;
tmp3->address.wrapwarn = tmp3->address.moved = false;
+ tmp3->address.bankwarn = false;
tmp3->address.end = tmp3->address.start = tmp3->restart = tmp3->address.address = current_address->address;
tmp3->l_restart = tmp3->address.l_address = current_address->l_address;
tmp3->usepass = pass;
@@ -4526,10 +4539,8 @@ MUST_CHECK Obj *compile(void)
if (tmp3->address.end < tmp3->address.start) tmp3->address.end = all_mem2 + 1;
memjmp(tmp3->address.mem, current_address->address);
}
- if (tmp3->l_restart.address != current_address->l_address.address ||
- tmp3->l_restart.bank != current_address->l_address.bank) {
- tmp3->address.l_address.address = (tmp3->address.l_address.address + current_address->l_address.address - tmp3->l_restart.address) & 0xffff;
- tmp3->address.l_address.bank = (tmp3->address.l_address.bank + current_address->l_address.bank - tmp3->l_restart.bank) & all_mem;
+ if (tmp3->l_restart != current_address->l_address) {
+ tmp3->address.l_address = (tmp3->address.l_address + current_address->l_address - tmp3->l_restart) & all_mem;
tmp3->l_restart = current_address->l_address;
if (fixeddig && pass > max_pass) err_msg_cant_calculate(NULL, &epoint);
fixeddig = false;
@@ -4541,11 +4552,11 @@ MUST_CHECK Obj *compile(void)
tmp3->address.moved = true;
}
tmp3->address.wrapwarn = false;
+ tmp3->address.bankwarn = false;
t = tmp3->address.end - tmp3->address.start;
tmp3->address.end = tmp3->address.start = tmp3->restart = tmp3->address.address = current_address->address;
tmp3->address.l_address = current_address->l_address;
- if (tmp3->l_restart.address != current_address->l_address.address ||
- tmp3->l_restart.bank != current_address->l_address.bank) {
+ if (tmp3->l_restart != current_address->l_address) {
tmp3->l_restart = current_address->l_address;
if (fixeddig && pass > max_pass) err_msg_cant_calculate(NULL, &epoint);
fixeddig = false;
diff --git a/README b/README
index e1116b7..e223d02 100644
--- a/README
+++ b/README
@@ -1396,8 +1396,7 @@ The compile offset is where the data and code ends up in memory (or in image
file).
The program counter is what labels get set to and what the special star label
-refers to. It wraps when the border of a 64 KiB program bank is crossed. The
-actual program bank is not incremented, just like on a real processor.
+refers to.
Normally both are the same (code is compiled to the location it runs from) but
it does not need to be.
@@ -3260,6 +3259,13 @@ default, the others are disabled.
This check is there to catch typos, unsupported implied instructions, or
unknown aliases and not for enforcing label placement.
+-Wno-page
+ Don't do an error for page crossing
+
+ Normally the .page directive gives an error on page crossing, this
+ directive can disable it. Using `-Wno-error=page' can turn it into a
+ warning only.
+
-Wno-pitfalls
Don't note about common pitfalls.
@@ -3279,6 +3285,29 @@ default, the others are disabled.
There's a signed variant for the immediate addressing so `lda #+xx'
will make it work
+-Wno-portable
+ Don't warn about source portability problems.
+
+ These cross platform development annoyances are checked for:
+
+ + Case insensitive use of file names or use of short names.
+ + Use of backslashes for path separation instead of forward slashes.
+ + Use of reserved characters in file names.
+ + Absolute paths
+-Wno-size-larger
+ Don't warn if size is larger due to negative offset
+
+ size() and len() can be used to measure a memory area. Normally there's no
+ offset used but a positive offset may be used to reduce available space up
+ until nothing remains.
+
+ On the other hand if a negative offset is used then more space will be
+ available (ahead of the area) which may or may not be desired.
+
+ var .byte ?, ?, ?
+ var2 = var - 2 ; start 2 bytes earlier
+ ldx #size(var2) ; size is 6 bytes due to 2 bytes ahead
+
-Wno-star-assign
Don't warn about ignored compound multiply.
@@ -3294,6 +3323,71 @@ default, the others are disabled.
to a separate line, or in case of space allocation it could be improved to
use `.byte ?' or `.fill x'.
+-Wno-wrap-addr
+ Don't warn about memory location address space wrap around.
+
+ Applying offsets to memory locations may result in addresses which end up
+ outside of the processors address space.
+
+ For example "tmp" is at $1000 and then it's addressed as lda tmp-$2000 then
+ the result will be lda $f000 or lda $fff000 depending on the CPU. If this
+ is fine then this warning can be disabled otherwise it can be made into an
+ error by using -Werror=wrap-addr.
+
+-Wno-wrap-bank0
+ Don't warn for bank 0 wrap around.
+
+ Adding an offset to a bank 0 address may end up outside of bank 0. If this
+ happens a warning is issued and the address wraps around.
+
+ The warning may be ignored using this command line parameter. Alternatively
+ it could be turned into an error by using -Werror=wrap-bank0.
+
+-Wno-wrap-dpage
+ Don't warn for direct page wrap around.
+
+ Adding an offset to a direct page address may end up outside of the direct
+ page. For a 65816 or 65EL02 an alternative addressing mode is used but on
+ other processors if this happens a warning is issued and the address wraps
+ around.
+
+ The warning may be ignored using this command line parameter. Alternatively
+ it could be turned into an error by using -Werror=wrap-dpage.
+
+-Wno-wrap-mem
+ Don't warn for compile offset wrap around.
+
+ While assembling the compile offset may reach the end of memory image. If
+ this happens a warning is issued and the compile offset is set to the start
+ of image.
+
+ The warning may be ignored using this command line parameter. Alternatively
+ it could be turned into an error by using -Werror=wrap-mem.
+
+ The image size depends on the output format. See the Output options section
+ above.
+
+-Wno-wrap-pc
+ Don't warn for program counter bank crossing.
+
+ While assembling the program counter may reach the end of the current
+ program bank. If this happens a warning is issued as a real CPU will not
+ cross the bank on execution. On the other hand some addressing modes handle
+ bank crosses so this might not be actually a problem for data.
+
+ The warning may be ignored using this command line parameter. Alternatively
+ it could be turned into an error by using -Werror=wrap-pc.
+
+-Wno-wrap-pbank
+ Don't warn for program bank address calculation wrap around.
+
+ Adding an offset to a program bank address may end up outside of the
+ current program bank. If this happens a warning is issued and the address
+ wraps around.
+
+ The warning may be ignored using this command line parameter. Alternatively
+ it could be turned into an error by using -Werror=wrap-pbank.
+
-Wold-equal
Warn about old equal operator.
@@ -3318,22 +3412,6 @@ default, the others are disabled.
missed. Most CPUs are supported with the notable exception of 65816 and
65EL02, but this could improve in later versions.
--Wno-page
- Don't do an error for page crossing
-
- Normally the .page directive gives an error on page crossing, this
- directive can disable it. Using `-Wno-error=page' can turn it into a
- warning only.
-
--Wno-portable
- Don't warn about source portability problems.
-
- These cross platform development annoyances are checked for:
-
- + Case insensitive use of file names or use of short names.
- + Use of backslashes for path separation instead of forward slashes.
- + Use of reserved characters in file names.
- + Absolute paths
-Wshadow
Warn about symbol shadowing.
@@ -3350,20 +3428,6 @@ default, the others are disabled.
.end
asl bl.x ; not ambiguous
--Wno-size-larger
- Don't warn if size is larger due to negative offset
-
- size() and len() can be used to measure a memory area. Normally there's no
- offset used but a positive offset may be used to reduce available space up
- until nothing remains.
-
- On the other hand if a negative offset is used then more space will be
- available (ahead of the area) which may or may not be desired.
-
- var .byte ?, ?, ?
- var2 = var - 2 ; start 2 bytes earlier
- ldx #size(var2) ; size is 6 bytes due to 2 bytes ahead
-
-Wstrict-bool
Warn about implicit boolean conversions.
@@ -3395,82 +3459,18 @@ default, the others are disabled.
The following options can be used to be more specific:
- -Wunused-macro
- Warn about unused macros.
-Wunused-const
Warn about unused constants.
-Wunused-label
Warn about unused labels.
+ -Wunused-macro
+ Warn about unused macros.
-Wunused-variable
Warn about unused variables.
Symbols which appear in a default 64tass symbol list file and their root
symbols are treated as used for exporting purposes.
--Wno-wrap-addr
- Don't warn about memory location address space wrap around.
-
- Applying offsets to memory locations may result in addresses which end up
- outside of the processors address space.
-
- For example "tmp" is at $1000 and then it's addressed as lda tmp-$2000 then
- the result will be lda $f000 or lda $fff000 depending on the CPU. If this
- is fine then this warning can be disabled otherwise it can be made into an
- error by using -Werror=wrap-addr.
-
--Wno-wrap-bank0
- Don't warn for bank 0 wrap around.
-
- Adding an offset to a bank 0 address may end up outside of bank 0. If this
- happens a warning is issued and the address wraps around.
-
- The warning may be ignored using this command line parameter. Alternatively
- it could be turned into an error by using -Werror=wrap-bank0.
-
--Wno-wrap-dpage
- Don't warn for direct page wrap around.
-
- Adding an offset to a direct page address may end up outside of the direct
- page. For a 65816 or 65EL02 an alternative addressing mode is used but on
- other processors if this happens a warning is issued and the address wraps
- around.
-
- The warning may be ignored using this command line parameter. Alternatively
- it could be turned into an error by using -Werror=wrap-dpage.
-
--Wno-wrap-mem
- Don't warn for compile offset wrap around.
-
- While assembling the compile offset may reach the end of memory image. If
- this happens a warning is issued and the compile offset is set to the start
- of image.
-
- The warning may be ignored using this command line parameter. Alternatively
- it could be turned into an error by using -Werror=wrap-mem.
-
- The image size depends on the output format. See the Output options section
- above.
-
--Wno-wrap-pc
- Don't warn for program counter wrap around.
-
- While assembling the program counter may reach the end of the current
- program bank. If this happens a warning is issued and the address wraps
- around.
-
- The warning may be ignored using this command line parameter. Alternatively
- it could be turned into an error by using -Werror=wrap-pc.
-
--Wno-wrap-pbank
- Don't warn for program bank address calculation wrap around.
-
- Adding an offset to a program bank address may end up outside of the
- current program bank. If this happens a warning is issued and the address
- wraps around.
-
- The warning may be ignored using this command line parameter. Alternatively
- it could be turned into an error by using -Werror=wrap-pbank.
-
Target selection on command line
These options will select the default architecture. It can be overridden by
@@ -3853,6 +3853,9 @@ directive ignored
an assembler directive was ignored for compatibility reasons
expected ? values but got ? to unpack
the number of variables must match the number of values when unpacking
+file name uses reserved character '?'
+ do not use \ : * ? " < > | in file names as some operating systems don't
+ like these
immediate addressing mode suggested
numeric constant was used as an address which was likely meant as an
immediate value
@@ -3894,9 +3897,8 @@ possibly redundant if last 'jsr' is changed to 'jmp'
possibly redundant indexing with a constant value
the index register used seems to be constant and there's a way to eliminate
indexing by a constant offset
-processor program counter overflow
- pc address was set back to the start of actual 64 KiB program bank as end
- of bank was reached
+processor program counter crossed bank
+ pc address had crossed into another 64 KiB program bank
program bank address overflow
the calculated memory location address ended up outside of the current
program bank and is now wrapped.
@@ -3906,9 +3908,6 @@ symbol case mismatch '?'
the file's real name is not '?'
check if all characters match including their case as this is not the real
name of the file
-this name uses reserved characters '?'
- do not use \ : * ? " < > | in file names as some operating systems don't
- like these
unused symbol '?'
this symbol has is not referred anywhere and therefore may be unused
use '/' as path separation '?'
diff --git a/README.html b/README.html
index 1cd2058..b907eb6 100644
--- a/README.html
+++ b/README.html
@@ -1787,9 +1787,7 @@
The program counter is what labels get set to and what the special star
-label refers to. It wraps when the border of a 64 KiB program bank is
-crossed. The actual program bank is not incremented, just like on a real
-processor.
+label refers to.
Normally both are the same (code is compiled to the location it runs from)
but it does not need to be.
@@ -3686,6 +3684,12 @@