X-Git-Url: https://jxself.org/git/?p=zilutils.git;a=blobdiff_plain;f=zilasm%2Fstring_table.cpp;fp=zilasm%2Fstring_table.cpp;h=ed2b6d7c1db0e00b892e3a81a70c721830507524;hp=a086b8794c31bf29d137c3821f157def2e8a9a68;hb=633e24778bccbc5f035bdb8516e8cc75c85123d9;hpb=82b0f84ab797141758929d16894d42e12ef79af7 diff --git a/zilasm/string_table.cpp b/zilasm/string_table.cpp index a086b87..ed2b6d7 100644 --- a/zilasm/string_table.cpp +++ b/zilasm/string_table.cpp @@ -1,7 +1,7 @@ /* * string_table.cpp -- part of ZilUtils/ZilAsm * - * Copyright (C) 2019 Jason Self + * Copyright (C) 2019, 2020 Jason Self * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -90,7 +90,14 @@ String_table::encrypt_string (const char *str, ZMemblock * zmb) } 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 { @@ -130,7 +137,14 @@ String_table::encrypt_string (const char *str, ZMemblock * zmb) 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; }