/*
* string_table.cpp -- part of ZilUtils/ZilAsm
*
- * Copyright (C) 2019 Jason Self <j@jxself.org>
+ * Copyright (C) 2019, 2020 Jason Self <j@jxself.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
}
else if (c == ' ')
{
- write_one_word_to_string_table (zmb, &w, &numberOfSymbolsInWord, 0);
+ //if (numberOfSymbolsInWord != 0)
+ //{
+ // zmem_putbyte(zmb, (w >> 8) & 255);
+ // zmem_putbyte(zmb, w & 255);
+ // numberOfSymbolsInWord = 0;
+ // w = 0;
+ //}
+ write_one_word_to_string_table (zmb, &w, &numberOfSymbolsInWord, 0);
}
else
{
numberOfSymbolsInWord = 0;
w = 0;
}
- zmb->contents[zmb->used_size - 2] |= 0x80;
+
+ if ((zmb->contents[zmb->used_size - 1] & 31) == 0) // if the last symbol is a space or not filled
+ zmb->contents[zmb->used_size - 2] |= 0x80; // then we mark this word as the last word
+ else
+ {
+ zmem_putbyte(zmb, 0x80); // otherwise we add one more empty word
+ zmem_putbyte(zmb, 0x0); // with 15-th bit set
+ }
return zmb;
}