1
0
mirror of https://github.com/ksherlock/x65.git synced 2024-06-02 18:41:34 +00:00

Fix for INCSYM directive when loading files with local labels

This commit is contained in:
Carl-Henrik Skårstedt 2016-02-14 12:36:01 -08:00
parent 736d4f1cac
commit 8fbf05520c
4 changed files with 24 additions and 15 deletions

View File

@ -100,6 +100,7 @@ Primarily tested with personal archive of sources written for Kick assmebler, DA
* irp (indefinite repeat)
**FIXED**
* INCSYM failed with local labels
* INCBIN and IMPORT BINARY always failed (force 0 bytes length)
* Using more than 16 bytes of Pool labels was flawed
* Fixed STRUCT directive (failed if contained line was empty)

Binary file not shown.

Binary file not shown.

38
x65.cpp
View File

@ -4152,22 +4152,30 @@ StatusCode Asm::IncludeSymbols(strref line)
strref symfile(buffer, strl_t(size));
while (symfile) {
symfile.skip_whitespace();
if (symfile[0]=='{') // don't include local labels
symfile.scoped_block_skip();
if (strref symdef = symfile.line()) {
strref symtype = symdef.split_token(' ');
strref label = symdef.split_token_trim('=');
bool constant = symtype.same_str(".const"); // first word is either .label or .const
if (symlist) {
strref symchk = symlist;
while (strref symwant = symchk.split_token_trim(',')) {
if (symwant.same_str_case(label)) {
AssignLabel(label, symdef, constant);
break;
strref symstart = symfile;
if (strref symline = symfile.line()) {
int scope_start = symline.find('{');
if (scope_start > 0) {
strref symdef = symline.get_substr(0, scope_start);
symdef.clip_trailing_whitespace();
strref symtype = symdef.split_token(' ');
strref label = symdef.split_token_trim('=');
bool constant = symtype.same_str(".const"); // first word is either .label or .const
if (symlist) {
strref symchk = symlist;
while (strref symwant = symchk.split_token_trim(',')) {
if (symwant.same_str_case(label)) {
AssignLabel(label, symdef, constant);
break;
}
}
}
} else
AssignLabel(label, symdef, constant);
} else
AssignLabel(label, symdef, constant);
}
if (scope_start >= 0) {
symfile = symstart + scope_start;
symfile.scoped_block_skip();
}
}
}
loadedData.push_back(buffer);