diff --git a/README.md b/README.md index 5451e37..d21979e 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/x65.cpp b/x65.cpp index 9b4d6df..61b9aab 100644 --- a/x65.cpp +++ b/x65.cpp @@ -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);