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 @@

Controlling the compile offset and program counterThe 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.

+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 @@

Diagnostic options +
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.

There are some common mistakes, but experts and those who read this don't @@ -3702,6 +3706,31 @@

Diagnostic options +
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.

Normally symbol ∗= ... means compound multiply of the variable in front. @@ -3712,6 +3741,64 @@

Diagnostic options +
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.

The single = operator is only there for compatibility reasons and should be written as == normally.

@@ -3733,23 +3820,6 @@

Diagnostic options -
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.

Checks if local variables shadow other variables of same name in upper scopes in @@ -3766,20 +3836,6 @@

Diagnostic options -
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.

Boolean values can be interpreted as numeric 0/1 and other types as @@ -3809,15 +3865,15 @@

Diagnostic options -
-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. @@ -3825,63 +3881,6 @@

Diagnostic options -
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

@@ -4259,6 +4258,7 @@

Warnings

direct page address overflow
the calculated memory location address ended up outside of direct page and is now wrapped.
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
implicit floating point rounding
a floating point number with fractional part was used for an integer parameter
independent result, possibly changeable to 'lda'
the result does not seem to depend on the input so it could be just loaded instead @@ -4274,11 +4274,10 @@

Warnings

possibly redundant as ...
according to the optimizer this might not be needed
possibly redundant if last 'jsr' is changed to 'jmp'
tail call elimination possibility was detected
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.
symbol case mismatch '?'
the symbol is matching case insensitively but it's not all letters are exactly the same
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 '?'
backslash is not a path separator on all systems while forward slash will work independent of the host operating system
use relative path for '?'
file's path is absolute and depends on the file system layout and the source will not compile without the exact same environment diff --git a/arguments.c b/arguments.c index 10d47a1..e2519f9 100644 --- a/arguments.c +++ b/arguments.c @@ -1,5 +1,5 @@ /* - $Id: arguments.c 2237 2020-07-11 22:47:14Z soci $ + $Id: arguments.c 2245 2020-10-17 08:09:10Z soci $ 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 @@ -682,7 +682,7 @@ int testarg(int *argc2, char **argv2[], struct file_s *fin) { " -Wno-wrap-dpage No direct page overflow warning\n" " -Wno-wrap-mem No offset overflow warning\n" " -Wno-wrap-pbank No program bank overflow warning\n" - " -Wno-wrap-pc No PC overflow warning\n" + " -Wno-wrap-pc No PC bank cross warning\n" " -Wno-pitfalls No common pitfall notes\n" " -Wno-portable No portability warnings\n" " -Wno-size-larger No size larger than original warnings\n" diff --git a/error.c b/error.c index cf8909e..b737556 100644 --- a/error.c +++ b/error.c @@ -1,5 +1,5 @@ /* - $Id: error.c 2238 2020-07-18 15:15:24Z soci $ + $Id: error.c 2245 2020-10-17 08:09:10Z soci $ 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 @@ -619,8 +619,7 @@ static void err_msg_str_name(const char *msg, const str_t *name, linepos_t epoin } void err_msg_big_address(linepos_t epoint) { - address_t addr = (current_address->l_address.address & 0xffff) | current_address->l_address.bank; - Obj *val = get_star_value(addr, current_address->l_address_val); + Obj *val = get_star_value(current_address->l_address, current_address->l_address_val); bool more = new_error_msg(SV_ERROR, current_file_list, epoint); adderror("address not in processor address space "); err_msg_variable(val); @@ -1206,10 +1205,10 @@ void err_msg_jmp_bug(linepos_t epoint) { adderror("possible jmp ($xxff) bug [-Wjmp-bug]"); } -void err_msg_pc_wrap(linepos_t epoint) { +void err_msg_pc_bank(linepos_t epoint) { if (!diagnostics.wrap.pc) return; new_error_msg2(diagnostic_errors.wrap.pc, epoint); - adderror("processor program counter overflow [-Wwrap-pc]"); + adderror("processor program counter crossed bank [-Wwrap-pc]"); } void err_msg_mem_wrap(linepos_t epoint) { diff --git a/error.h b/error.h index 5a06a3f..71dabe6 100644 --- a/error.h +++ b/error.h @@ -1,5 +1,5 @@ /* - $Id: error.h 2238 2020-07-18 15:15:24Z soci $ + $Id: error.h 2245 2020-10-17 08:09:10Z soci $ 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 @@ -80,7 +80,7 @@ extern void err_msg_bool_oper(struct oper_s *); extern void err_msg_implied_reg(linepos_t, uint32_t); extern void err_msg_size_larger(linepos_t); extern void err_msg_jmp_bug(linepos_t); -extern void err_msg_pc_wrap(linepos_t); +extern void err_msg_pc_bank(linepos_t); extern void err_msg_mem_wrap(linepos_t); extern void err_msg_addr_wrap(linepos_t); extern void err_msg_dpage_wrap(linepos_t); diff --git a/file.c b/file.c index 340461b..962da5f 100644 --- a/file.c +++ b/file.c @@ -1,5 +1,5 @@ /* - $Id: file.c 2231 2020-06-28 21:39:53Z soci $ + $Id: file.c 2249 2020-10-25 21:13:54Z soci $ 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 @@ -190,53 +190,119 @@ static MUST_CHECK wchar_t *convert_name(const char *name, size_t max) { #endif static bool portability(const str_t *name, linepos_t epoint) { -#ifdef _WIN32 - DWORD ret; - wchar_t *wname = convert_name((const char *)name->data, name->len); - size_t len; - wchar_t *wname2; - bool different; - if (wname == NULL) return false; - len = wcslen(wname) + 1; - wname2 = (wchar_t *)malloc(len * sizeof *wname2); - if (wname2 == NULL) { - free(wname); + struct linepos_s epoint2; + const uint8_t *pos; +#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __MSDOS__ || defined __DOS__ + if (name->len == 0) return true; + pos = (const uint8_t *)memchr(name->data, '\\', name->len); + if (pos != NULL) { + epoint2.line = epoint->line; + epoint2.pos = interstring_position(epoint, name->data, pos - name->data); + err_msg2(ERROR_____BACKSLASH, name, &epoint2); return false; } - ret = GetLongPathNameW(wname, wname2, len); - different = ret != 0 && memcmp(wname, wname2, ret * sizeof *wname2) != 0; - free(wname2); - free(wname); - if (different) { - err_msg2(ERROR___INSENSITIVE, name, epoint); + if (name->data[0] == '/' || is_driveletter((const char *)name->data)) { + err_msg2(ERROR_ABSOLUTE_PATH, name, epoint); return false; } -#endif -#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __MSDOS__ || defined __DOS__ - if (memchr(name->data, '\\', name->len) != NULL) { - err_msg2(ERROR_____BACKSLASH, name, epoint); +#else + const char *c; + if (name->len == 0) return true; + for (c = "\\:*?\"<>|"; *c != '\0'; c++) { + pos = (const uint8_t *)memchr(name->data, *c, name->len); + if (pos == NULL) continue; + epoint2.line = epoint->line; + epoint2.pos = interstring_position(epoint, name->data, pos - name->data); + err_msg2(ERROR__RESERVED_CHR, name, &epoint2); return false; } - if ((name->len > 0 && name->data[0] == '/') || (name->len > 1 && is_driveletter((const char *)name->data))) { + if (name->data[0] == '/') { err_msg2(ERROR_ABSOLUTE_PATH, name, epoint); return false; } -#else - const char *c; - if (name->len > 0) { - for (c = "\\:*?\"<>|"; *c != '\0'; c++) { - if (memchr(name->data, *c, name->len) == NULL) continue; - err_msg2(ERROR__RESERVED_CHR, name, epoint); - return false; +#endif + return true; +} + +#ifdef _WIN32 +static wchar_t *get_real_name(const wchar_t *name) { + typedef DWORD _stdcall (*Getfinalpathnamebyhandleptr)(HANDLE, LPWSTR, DWORD, DWORD); + static Getfinalpathnamebyhandleptr get_final_path_by_handle; + static HINSTANCE kernel_handle; + DWORD ret; + size_t len = wcslen(name) + 1; + wchar_t *real_name = (wchar_t *)malloc(len * sizeof *real_name); + if (real_name == NULL) return NULL; + if (get_final_path_by_handle == NULL && kernel_handle == NULL) { + kernel_handle = LoadLibrary("kernel32.dll"); + if (kernel_handle != NULL) get_final_path_by_handle = (Getfinalpathnamebyhandleptr)GetProcAddress(kernel_handle, "GetFinalPathNameByHandleW"); + } + if (get_final_path_by_handle != NULL) { + HANDLE handle = CreateFileW(name, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (handle != INVALID_HANDLE_VALUE) { + ret = get_final_path_by_handle(handle, real_name, len, 12); + if (ret > len) { + wchar_t *tmp = (wchar_t *)realloc(real_name, ret * sizeof *real_name); + if (tmp != NULL) { + real_name = tmp; + len = ret; + ret = get_final_path_by_handle(handle, real_name, len, 12); + } + } + CloseHandle(handle); + if (ret < len && ret != 0) { + return real_name; + } + } + } + ret = GetLongPathNameW(name, real_name, len); + if (ret > len) { + wchar_t *tmp = (wchar_t *)realloc(real_name, ret * sizeof *real_name); + if (tmp != NULL) { + real_name = tmp; + len = ret; + ret = GetLongPathNameW(name, real_name, len); } - if (name->data[0] == '/') { - err_msg2(ERROR_ABSOLUTE_PATH, name, epoint); + } + if (ret < len && ret != 0) { + return real_name; + } + free(real_name); + return NULL; +} + +static bool portability2(const str_t *name, const char *realname, linepos_t epoint) { + wchar_t *wname = convert_name(realname, SIZE_MAX); + if (wname != NULL) { + bool different = false; + wchar_t *wname2 = get_real_name(wname); + if (wname2 != NULL) { + wchar_t *bname = convert_name((const char *)name->data, name->len); + if (bname != NULL) { + size_t len = wcslen(wname); + size_t len2 = wcslen(bname); + size_t ret = wcslen(wname2); + free(bname); + if (len2 > len) len2 = len; + if (len2 > ret) len2 = ret; + for (; len2 > 0; len2--) { + if (wname[len - len2] != wname2[ret - len2] && wname2[ret - len2] != '\\') { + different = true; + break; + } + } + } + free(wname2); + } + free(wname); + if (different) { + err_msg2(ERROR___INSENSITIVE, name, epoint); return false; } } -#endif - return true; + return portability(name, epoint); } +#endif FILE *file_open(const char *name, const char *mode) { FILE *f; @@ -767,7 +833,11 @@ struct file_s *openfile(const char *name, const char *base, int ftype, const str return NULL; } if (!tmp->portable && val != NULL && diagnostics.portable) { +#ifdef _WIN32 + tmp->portable = portability2(val, tmp->realname, epoint); +#else tmp->portable = portability(val, epoint); +#endif } tmp->open++; return tmp; diff --git a/functionobj.c b/functionobj.c index e55e914..79f7caa 100644 --- a/functionobj.c +++ b/functionobj.c @@ -1,5 +1,5 @@ /* - $Id: functionobj.c 2244 2020-08-19 18:31:35Z soci $ + $Id: functionobj.c 2245 2020-10-17 08:09:10Z soci $ 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 @@ -500,7 +500,7 @@ static Obj *function_rta_addr(oper_t op, bool rta) { uv &= all_mem; switch (am) { case A_NONE: - if ((current_address->l_address.bank ^ uv) > 0xffff) err_msg2(ERROR_CANT_CROSS_BA, val, op->epoint2); + if ((current_address->l_address ^ uv) > 0xffff) err_msg2(ERROR_CANT_CROSS_BA, val, op->epoint2); break; case A_KR: break; diff --git a/instruction.c b/instruction.c index de421c7..c4eb594 100644 --- a/instruction.c +++ b/instruction.c @@ -1,5 +1,5 @@ /* - $Id: instruction.c 2209 2020-05-19 05:03:31Z soci $ + $Id: instruction.c 2245 2020-10-17 08:09:10Z soci $ 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 @@ -512,19 +512,19 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi if (false) { justrel2: invalid = touaddress(val, &uval, 16, epoint2); - if (invalid) uval = current_address->l_address.address + 1 + ln; + if (invalid) uval = current_address->l_address + 1 + ln; uval &= 0xffff; - uval |= (uval_t)current_address->l_address.bank; + uval |= (uval_t)current_address->l_address & ~0xffff; crossbank = false; } else { justrel: invalid = touaddress(val, &uval, all_mem_bits, epoint2); if (invalid) { - uval = current_address->l_address.address + 1 + ln; + uval = current_address->l_address + 1 + ln; crossbank = false; } else { uval &= all_mem; - crossbank = ((uval_t)current_address->l_address.bank ^ uval) > 0xffff; + crossbank = ((uval_t)current_address->l_address ^ uval) > 0xffff; } } xadr = (uint16_t)adr; @@ -534,9 +534,9 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi oval = val->obj == ADDRESS_OBJ ? ((Address *)val)->val : val; if (oval->obj == CODE_OBJ && pass != ((Code *)oval)->apass && cnmemonic[ADR_REL_L] == ____) { /* not for 65CE02! */ if (s == NULL) s = new_star(vline + 1, &starexists); - adr = starexists ? (uint16_t)(uval - s->addr) : (uint16_t)(uval - current_address->l_address.address - 1 - ln); + adr = starexists ? (uint16_t)(uval - s->addr) : (uint16_t)(uval - current_address->l_address - 1 - ln); } else { - adr = (uint16_t)(uval - current_address->l_address.address - 1 - ln); + adr = (uint16_t)(uval - current_address->l_address - 1 - ln); } if (false) { bool longpossible; @@ -550,7 +550,7 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi if (invalid) uval = 0; if (!longpossible && (uval & 0x80) != 0) uval |= ~(uval_t)0xff; uval &= 0xffff; - uval |= (uval_t)current_address->l_address.bank; + uval |= (uval_t)current_address->l_address & ~0xffff; crossbank = false; xadr = (uint16_t)adr; starexists = false; s = NULL; @@ -566,8 +566,8 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi bool exists; struct longjump_s *lj = new_longjump(uval, &exists); if (exists && lj->defpass == pass) { - if ((current_address->l_address.bank ^ lj->dest) <= 0xffff) { - uint32_t adrk = (uint16_t)(lj->dest - current_address->l_address.address - 2); + if ((current_address->l_address ^ lj->dest) <= 0xffff) { + uint32_t adrk = (uint16_t)(lj->dest - current_address->l_address - 2); if (adrk >= 0xFF80 || adrk <= 0x007F) { adr = adrk; goto branchok; @@ -576,8 +576,8 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi } cpu_opt_long_branch(cnmemonic[ADR_REL]); if (s == NULL) s = new_star(vline + 1, &starexists); - dump_instr(cnmemonic[ADR_REL] ^ 0x20, starexists ? ((uint16_t)(s->addr - current_address->l_address.address - 2)) : 3, 1, epoint); - lj->dest = (current_address->l_address.address & 0xffff) | current_address->l_address.bank; + dump_instr(cnmemonic[ADR_REL] ^ 0x20, starexists ? ((uint16_t)(s->addr - current_address->l_address - 2)) : 3, 1, epoint); + lj->dest = current_address->l_address; lj->defpass = pass; if (diagnostics.long_branch) err_msg2(ERROR___LONG_BRANCH, NULL, epoint2); cpu_opt_long_branch(0xea); @@ -593,8 +593,8 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi goto branchok; } if (exists && lj->defpass == pass) { - if ((current_address->l_address.bank ^ lj->dest) <= 0xffff) { - uint32_t adrk = (uint16_t)(lj->dest - current_address->l_address.address - 3); + if ((current_address->l_address ^ lj->dest) <= 0xffff) { + uint32_t adrk = (uint16_t)(lj->dest - current_address->l_address - 3); if (adrk >= 0xFF80 || adrk <= 0x007F) { adr = adrk; goto branchok; @@ -603,7 +603,7 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi } cpu_opt_long_branch(cnmemonic[ADR_BIT_ZP_REL] ^ longbranch); dump_instr(cnmemonic[ADR_BIT_ZP_REL] ^ 0x80 ^ longbranch, xadr | 0x300, 2, epoint); - lj->dest = (current_address->l_address.address & 0xffff) | current_address->l_address.bank; + lj->dest = current_address->l_address; lj->defpass = pass; if (diagnostics.long_branch) err_msg2(ERROR___LONG_BRANCH, NULL, epoint2); cpu_opt_long_branch(0xea); @@ -631,7 +631,7 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi cpu_opt_long_branch(0); branchend: if (s != NULL) { - address_t st = (current_address->l_address.address & 0xffff) | current_address->l_address.bank; + address_t st = current_address->l_address; if (starexists && s->addr != st) { if (fixeddig && pass > max_pass) err_msg_cant_calculate(NULL, epoint); fixeddig = false; @@ -655,7 +655,7 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi } } } else if (!invalid) { /* short */ - if (((uint16_t)(current_address->l_address.address + 1 + ln) & 0xff00) != (oadr & 0xff00)) { + if (((uint16_t)(current_address->l_address + 1 + ln) & 0xff00) != (oadr & 0xff00)) { int diff = (int8_t)oadr; if (diff >= 0) diff++; if (!allowslowbranch) err_msg2(ERROR__BRANCH_CROSS, &diff, epoint2); @@ -696,7 +696,7 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi } branchok: if (s != NULL) { - address_t st = ((current_address->l_address.address + 1 + ln) & 0xffff) | current_address->l_address.bank; + address_t st = (current_address->l_address + 1 + ln) & all_mem; if (starexists && s->addr != st) { if (fixeddig && pass > max_pass) err_msg_cant_calculate(NULL, epoint); fixeddig = false; @@ -913,9 +913,9 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi if (touaddress(val, &uval, all_mem_bits, epoint2)) break; uval2 = uval; } - if ((current_address->l_address.bank ^ uval2) <= 0xffff) { + if ((current_address->l_address ^ uval2) <= 0xffff) { adr = uval; - if ((current_address->l_address.bank ^ uval) > 0xffff) err_msg_pbank_wrap(epoint2); + if ((current_address->l_address ^ uval) > 0xffff) err_msg_pbank_wrap(epoint2); break; } err_msg2(ERROR_CANT_CROSS_BA, val, epoint2); @@ -1075,15 +1075,15 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi ln = 2; if (touaddress(val, &uval, 16, epoint2)) break; uval &= 0xffff; - adr = uval - current_address->l_address.address - ((opcode != c65ce02.opcode && opcode != c4510.opcode) ? 3 : 2); + adr = uval - current_address->l_address - ((opcode != c65ce02.opcode && opcode != c4510.opcode) ? 3 : 2); break; case AG_RELL: if (w != 3 && w != 1) return err_addressize((w != 0) ? ERROR__NO_LONG_ADDR : ERROR__NO_BYTE_ADDR, epoint2, prm); ln = 2; if (touaddress(val, &uval, all_mem_bits, epoint2)) break; uval &= all_mem; - if ((current_address->l_address.bank ^ uval) <= 0xffff) { - adr = uval - current_address->l_address.address - ((opcode != c65ce02.opcode && opcode != c4510.opcode) ? 3 : 2); + if ((current_address->l_address ^ uval) <= 0xffff) { + adr = uval - current_address->l_address - ((opcode != c65ce02.opcode && opcode != c4510.opcode) ? 3 : 2); break; } err_msg2(ERROR_CANT_CROSS_BA, val, epoint2); @@ -1093,7 +1093,7 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi if (touaddress(val, &uval, all_mem_bits, epoint2)) w = (cnmemonic[ADR_ADDR] == ____) ? 2 : 1; else { uval &= all_mem; - if (cnmemonic[ADR_ADDR] != ____ && (current_address->l_address.bank ^ uval) <= 0xffff) {adr = uval; w = 1;} + if (cnmemonic[ADR_ADDR] != ____ && (current_address->l_address ^ uval) <= 0xffff) {adr = uval; w = 1;} else {adr = uval; w = 2;} } } else { @@ -1102,7 +1102,7 @@ MUST_CHECK Error *instruction(int prm, unsigned int w, Obj *vals, linepos_t epoi if (cnmemonic[opr - 1] == ____) return err_addressize(ERROR__NO_WORD_ADDR, epoint2, prm); if (touaddress(val, &uval, all_mem_bits, epoint2)) break; uval &= all_mem; - if ((current_address->l_address.bank ^ uval) <= 0xffff) adr = uval; + if ((current_address->l_address ^ uval) <= 0xffff) adr = uval; else err_msg2(ERROR_CANT_CROSS_BA, val, epoint2); break; case 2: diff --git a/inttypes.h b/inttypes.h index 82cae38..f818fa0 100644 --- a/inttypes.h +++ b/inttypes.h @@ -1,5 +1,5 @@ /* - $Id: inttypes.h 1589 2018-07-08 19:29:16Z soci $ + $Id: inttypes.h 2245 2020-10-17 08:09:10Z soci $ 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 @@ -85,7 +85,6 @@ typedef uint32_t line_t; #define PRIuline PRIu32 #define PRIxline PRIx32 typedef uint32_t address_t; -typedef struct { address_t address, bank; } address2_t; #define PRIaddress PRIx32 typedef uint32_t linecpos_t; struct linepos_s {line_t line;linecpos_t pos;}; diff --git a/listing.c b/listing.c index ced482f..91a3b2e 100644 --- a/listing.c +++ b/listing.c @@ -1,5 +1,5 @@ /* - $Id: listing.c 2215 2020-05-21 20:52:43Z soci $ + $Id: listing.c 2245 2020-10-17 08:09:10Z soci $ 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 @@ -115,7 +115,7 @@ static void out_db(Listing *ls, unsigned int adr) { static void out_pb(Listing *ls, unsigned int adr) { ls->s[ls->i++] = '$'; - if (current_address->l_address.bank != 0) out_hex(ls, current_address->l_address.bank >> 16); + if (current_address->l_address > 0xffff) out_hex(ls, current_address->l_address >> 16); out_hex(ls, adr >> 8); out_hex(ls, adr); } @@ -349,13 +349,13 @@ static void printmon(Listing *ls, unsigned int cod, int ln, uint32_t adr) { case ADR_ZP_Y: out_zp(ls, adr); break; case ADR_ADDR_I: case ADR_ADDR_LI: out_word(ls, adr); break; - case ADR_REL: if (ln > 0) out_pb(ls, (address_t)((int8_t)adr + (int)current_address->l_address.address)); else ls->i--; return; + case ADR_REL: if (ln > 0) out_pb(ls, (address_t)((int8_t)adr + (int)current_address->l_address)); else ls->i--; return; case ADR_BIT_ZP_REL: out_bit(ls, cod, adr); ls->s[ls->i++] = ','; - out_pb(ls, (address_t)((int8_t)(adr >> 8) + (int)current_address->l_address.address)); + out_pb(ls, (address_t)((int8_t)(adr >> 8) + (int)current_address->l_address)); return; - case ADR_REL_L: if (ln > 0) out_pb(ls, adr + (((cod & 0x0F) == 3) ? -1U : 0) + current_address->l_address.address); else ls->i--; return; + case ADR_REL_L: if (ln > 0) out_pb(ls, adr + (((cod & 0x0F) == 3) ? -1U : 0) + current_address->l_address); else ls->i--; return; case ADR_MOVE: out_byte(ls, adr >> 8); ls->s[ls->i++] = ','; ls->s[ls->i++] = '#'; out_byte(ls, adr); return; } while (*mode != 0) ls->s[ls->i++] = *mode++; @@ -394,7 +394,7 @@ FAST_CALL void listing_line(Listing *ls, linecpos_t pos) { if (ls == NULL) { address_t addr; if (!fixeddig || constcreated || listing_pccolumn || !arguments.source) return; - addr = (current_address->l_address.address & 0xffff) | current_address->l_address.bank; + addr = current_address->l_address; i = 0; while (i < pos && (llist[i] == 0x20 || llist[i] == 0x09)) i++; if (i < pos && current_address->address != addr) listing_pccolumn = true; @@ -408,7 +408,7 @@ FAST_CALL void listing_line(Listing *ls, linecpos_t pos) { printline(ls); padding2(ls, ls->columns.addr); } - printaddr(ls, '.', current_address->address, (current_address->l_address.address & 0xffff) | current_address->l_address.bank); + printaddr(ls, '.', current_address->address, current_address->l_address); } if (ls->verbose) { if (ls->i != 0) flushbuf(ls); @@ -430,12 +430,10 @@ FAST_CALL void listing_line_cut(Listing *ls, linecpos_t pos) { size_t i; if (nolisting != 0 || temporary_label_branch != 0 || llist == NULL) return; if (ls == NULL) { - address_t addr; if (!fixeddig || constcreated || listing_pccolumn || !arguments.source) return; - addr = (current_address->l_address.address & 0xffff) | current_address->l_address.bank; i = 0; while (i < pos && (llist[i] == 0x20 || llist[i] == 0x09)) i++; - if (i < pos && current_address->address != addr) listing_pccolumn = true; + if (i < pos && current_address->address != current_address->l_address) listing_pccolumn = true; return; } if (!ls->source) return; @@ -446,7 +444,7 @@ FAST_CALL void listing_line_cut(Listing *ls, linecpos_t pos) { printline(ls); padding2(ls, ls->columns.addr); } - printaddr(ls, '.', current_address->address, (current_address->l_address.address & 0xffff) | current_address->l_address.bank); + printaddr(ls, '.', current_address->address, current_address->l_address); printsource(ls, pos); } llist = NULL; @@ -476,7 +474,7 @@ void listing_instr(Listing *ls, unsigned int cod, uint32_t adr, int ln) { if (nolisting != 0 || temporary_label_branch != 0) return; if (ls == NULL) { if (!fixeddig || constcreated || listing_pccolumn) return; - addr = ((current_address->l_address.address - ln - 1) & 0xffff) | current_address->l_address.bank; + addr = (current_address->l_address - ln - 1) & all_mem; addr2 = (current_address->address - ln - 1) & all_mem2; if (addr2 != addr) listing_pccolumn = true; return; @@ -486,7 +484,7 @@ void listing_instr(Listing *ls, unsigned int cod, uint32_t adr, int ln) { if (llist != NULL) printline(ls); padding2(ls, ls->columns.addr); } - addr = ((current_address->l_address.address - ln - 1) & 0xffff) | current_address->l_address.bank; + addr = (current_address->l_address - ln - 1) & all_mem; addr2 = (current_address->address - ln - 1) & all_mem2; printaddr(ls, '.', addr2, addr); if (ln >= 0) { @@ -567,7 +565,7 @@ void listing_mem(Listing *ls, const uint8_t *data, size_t len, address_t myaddr, } current.data[current.len++] = data[p++]; myaddr = (myaddr + 1) & all_mem2; - myaddr2 = ((myaddr2 + 1) & 0xffff) | (myaddr2 & ~(address_t)0xffff); + myaddr2 = (myaddr2 + 1) & all_mem; len--; } } diff --git a/macro.c b/macro.c index 791df2e..c029335 100644 --- a/macro.c +++ b/macro.c @@ -1,5 +1,5 @@ /* - $Id: macro.c 2243 2020-07-30 18:48:58Z soci $ + $Id: macro.c 2246 2020-10-17 09:51:34Z soci $ 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 @@ -858,13 +858,11 @@ Obj *mfunc2_recurse(Mfunc *mfunc, struct values_s *vals, size_t args, linepos_t push_context(context); temporary_label_branch++; - section_address.wrapwarn = section_address.moved = section_address.unionmode = false; + section_address.moved = section_address.wrapwarn = section_address.bankwarn = section_address.unionmode = false; section_address.address = 0; section_address.start = 0; - section_address.l_start.address = 0; - section_address.l_start.bank = 0; - section_address.l_union.address = 0; - section_address.l_union.bank = 0; + section_address.l_start = 0; + section_address.l_union = 0; section_address.end = 0; section_address.mem = new_memblocks(0, 0); section_address.mem->lastaddr = 0; @@ -877,9 +875,9 @@ Obj *mfunc2_recurse(Mfunc *mfunc, struct values_s *vals, size_t args, linepos_t val_destroy(current_address->l_address_val); val_destroy(¤t_address->mem->v); current_address = oldsection_address; - 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; } context_set_bottom(oldbottom); pop_context(); diff --git a/optimizer.c b/optimizer.c index dd6b3a0..3b085de 100644 --- a/optimizer.c +++ b/optimizer.c @@ -1,5 +1,5 @@ /* - $Id: optimizer.c 1595 2018-08-24 14:17:29Z soci $ + $Id: optimizer.c 2245 2020-10-17 08:09:10Z soci $ 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 @@ -607,9 +607,9 @@ void cpu_opt(uint8_t cod, uint32_t adr, int ln, linepos_t epoint) { cpu = current_section->optimizer; } - if (cpu->branched || cpu->pc != current_address->l_address.address) { + if (cpu->branched || cpu->pc != (current_address->l_address & 0xffff)) { cpu_opt_invalidate(); - cpu->pc = current_address->l_address.address & 0xffff; + cpu->pc = current_address->l_address & 0xffff; } cpu->pc = ((int)cpu->pc + ln + 1) & 0xffff; diff --git a/section.c b/section.c index 67b9418..6a8c922 100644 --- a/section.c +++ b/section.c @@ -1,5 +1,5 @@ /* - $Id: section.c 2103 2019-12-01 08:25:43Z soci $ + $Id: section.c 2246 2020-10-17 09:51:34Z soci $ 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 @@ -99,7 +99,7 @@ struct section_s *new_section(const str_t *name) { else str_cfcpy(&lastsc->cfname, NULL); lastsc->parent = current_section; lastsc->provides = ~(uval_t)0;lastsc->requires = lastsc->conflicts = 0; - lastsc->address.end = lastsc->address.address = lastsc->address.l_address.address = lastsc->address.l_address.bank = lastsc->address.l_start.address = lastsc->address.l_start.bank = lastsc->address.l_union.address = lastsc->address.l_union.bank = lastsc->size = 0; + lastsc->address.end = lastsc->address.address = lastsc->address.l_address = lastsc->address.l_start = lastsc->address.l_union = lastsc->size = 0; lastsc->address.l_address_val = (Obj *)ref_int(int_value[0]); lastsc->defpass = 0; lastsc->usepass = 0; @@ -108,6 +108,7 @@ struct section_s *new_section(const str_t *name) { lastsc->logicalrecursion = 0; lastsc->address.moved = false; lastsc->address.wrapwarn = false; + lastsc->address.bankwarn = false; lastsc->next = NULL; lastsc->optimizer = NULL; prev_section->next = lastsc; @@ -145,13 +146,14 @@ struct section_s *find_this_section(const char *here) { void reset_section(struct section_s *section) { section->provides = ~(uval_t)0; section->requires = section->conflicts = 0; - section->address.end = section->address.start = section->restart = section->l_restart.address = section->l_restart.bank = section->address.address = section->address.l_address.address = section->address.l_address.bank = section->address.l_start.address = section->address.l_start.bank = section->address.l_union.address = section->address.l_union.bank = 0; + section->address.end = section->address.start = section->restart = section->l_restart = section->address.address = section->address.l_address = section->address.l_start = section->address.l_union = 0; val_destroy(section->address.l_address_val); section->address.l_address_val = (Obj *)ref_int(int_value[0]); section->structrecursion = 0; section->logicalrecursion = 0; section->address.moved = false; section->address.wrapwarn = false; + section->address.bankwarn = false; section->address.unionmode = false; } diff --git a/section.h b/section.h index 2d80fff..fc528a9 100644 --- a/section.h +++ b/section.h @@ -1,5 +1,5 @@ /* - $Id: section.h 2016 2019-10-20 06:41:22Z soci $ + $Id: section.h 2246 2020-10-17 09:51:34Z soci $ 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 @@ -28,13 +28,14 @@ struct optimizer_s; struct section_address_s { address_t address; - address2_t l_address; + address_t l_address; address_t start; address_t end; - address2_t l_start; - address2_t l_union; + address_t l_start; + address_t l_union; bool moved; bool wrapwarn; + bool bankwarn; bool unionmode; struct Obj *l_address_val; struct Memblocks *mem; @@ -50,7 +51,7 @@ struct section_s { uval_t conflicts; uval_t provides; address_t restart; - address2_t l_restart; + address_t l_restart; address_t size; struct section_address_s address; uint8_t usepass;