diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-07-27 11:05:54 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-07-27 11:05:54 -0700 |
commit | 880bfb78741956af52e94c6abab27c0dca620315 (patch) | |
tree | 3c5c582ca23c71c7e8e23d1605b75c2e2c9ce8d2 | |
parent | 53e6c50aeb9341945245e245582d4fb9f78708a6 (diff) | |
download | mu-880bfb78741956af52e94c6abab27c0dca620315.tar.gz |
4439
-rw-r--r-- | subx/026labels.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/subx/026labels.cc b/subx/026labels.cc index 33ab8a2d..eb3c255d 100644 --- a/subx/026labels.cc +++ b/subx/026labels.cc @@ -50,15 +50,12 @@ void compute_addresses_for_labels(const segment& code, map<string, uint32_t> add else { if (contains_any_operand_metadata(curr)) raise << "'" << to_string(inst) << "': label definition (':') not allowed in operand\n" << end(); - if (j == 0) { - string label = curr.data.substr(0, SIZE(curr.data)-1); - put(address, label, current_byte); - trace(99, "label") << "label '" << label << "' is at address " << (current_byte+code.start) << end(); - // no modifying current_byte; label definitions won't be in the final binary - } - else { + if (j > 0) raise << "'" << to_string(inst) << "': labels can only be the first word in a line.\n" << end(); - } + string label = curr.data.substr(0, SIZE(curr.data)-1); + put(address, label, current_byte); + trace(99, "label") << "label '" << label << "' is at address " << (current_byte+code.start) << end(); + // no modifying current_byte; label definitions won't be in the final binary } } } |