/* Copyright (C) 2016 Joel Yliluoma - http://iki.fi/bisqwit/ * Redistribution and modifications are permitted under the rules * of Creative Commons Attribution-ShareAlike 3.0 license * https://creativecommons.org/licenses/by-sa/3.0/ */ #include #include #include #include static std::vector rom; static std::vector space; static char TranslateChar(unsigned char c) { switch(c) { case 0xA1: return '1'; case 0xA2: return '2'; case 0xA3: return '3'; case 0x40: return ' '; case 0x94: return '-'; case 0x5F: return '!'; case 0x5C: return '.'; default: return c; } } static char TranslateEndingChar(unsigned char c) { switch(c) { case 0x1C: return '.'; case 0x1E: return '\''; case 0x20: return ' '; case 0x30 ... 0x39: return c; default: return c + 0x40; } } static unsigned ReadLEword(unsigned address) { return rom[address] + rom[address+1]*256; } static unsigned ReadBEword(unsigned address) { return rom[address]*256 + rom[address+1]; } static void MarkFree(unsigned fromaddress, unsigned length) { while(length--) space[fromaddress++] = true; } template void DumpText(unsigned fromaddress, unsigned length, Translator Translate) { std::printf("\""); for(unsigned p=0; p> references) { std::printf("SCREENTABLE\n"); MarkFree(tableaddress, tablelength); for(const auto p: references) std::printf("\tREFER %04X %u\n", p.first, p.second); for(unsigned t=0; t> references) { std::printf("ENDINGTABLE\n"); for(auto r: references) { std::printf("REFER %X %u\n", r.first, r.second); } for(unsigned a=0; a