misc cleanup

This commit is contained in:
Kelvin Sherlock 2019-12-15 13:06:05 -05:00
parent 57525d5464
commit dac2be0940

View File

@ -224,7 +224,14 @@ void define(std::string name, uint32_t value, int type) {
} }
void new_segment(void) { void new_segment(bool reset = false) {
if (reset) {
segments.clear();
relocations.clear();
save_file.clear();
}
segments.emplace_back(); segments.emplace_back();
relocations.emplace_back(); relocations.emplace_back();
@ -550,6 +557,7 @@ static void resolve(void) {
} }
} }
static void print_symbols2(void) { static void print_symbols2(void) {
for (const auto &e : symbol_table) { for (const auto &e : symbol_table) {
@ -630,6 +638,13 @@ static bool op_after_end(opcode_t op) {
switch(op) { switch(op) {
case OP_END: case OP_END:
case OP_CMD: case OP_CMD:
case OP_PFX:
case OP_DAT:
case OP_RES:
case OP_RID:
case OP_RTY:
case OP_RAT:
case OP_FIL:
return true; return true;
default: default:
return false; return false;
@ -859,10 +874,7 @@ void evaluate(label_t label, opcode_t opcode, const char *cursor) {
if (lkv == 0 || lkv == 1) { if (lkv == 0 || lkv == 1) {
finish(); finish();
// reset. could have another link afterwards. // reset. could have another link afterwards.
segments.clear(); new_segment(true);
relocations.clear();
save_file.clear();
new_segment();
} }
if (lkv == 2) { if (lkv == 2) {
/* add a new segment */ /* add a new segment */