1
0
mirror of https://github.com/ksherlock/x65.git synced 2025-01-16 08:33:28 +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 7d59943d35
commit 0605a1d6d2
2 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) * irp (indefinite repeat)
**FIXED** **FIXED**
* INCSYM failed with local labels
* INCBIN and IMPORT BINARY always failed (force 0 bytes length) * INCBIN and IMPORT BINARY always failed (force 0 bytes length)
* Using more than 16 bytes of Pool labels was flawed * Using more than 16 bytes of Pool labels was flawed
* Fixed STRUCT directive (failed if contained line was empty) * Fixed STRUCT directive (failed if contained line was empty)

38
x65.cpp
View File

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