From 5c98f7c7e8901684700c88feec787f6e487ed1f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Henrik=20Sk=C3=A5rstedt?= Date: Tue, 12 Jan 2021 16:59:41 +0100 Subject: [PATCH] added c64 screen codes as a text option --- x65.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/x65.cpp b/x65.cpp index e74fea3..b7d8764 100644 --- a/x65.cpp +++ b/x65.cpp @@ -3073,6 +3073,16 @@ void Section::AddText(strref line, strref text_prefix) { if (CheckOutputCapacity((uint32_t)line.get_len()) == STATUS_OK) { if (!text_prefix || text_prefix.same_str("ascii")) { AddBin((const uint8_t*)line.get(), (int)line.get_len()); + } else if (text_prefix.same_str("c64screen")) { + while (line) { + char c = line.get_first(), o = c; + if (c >= 'a' && c <= 'z') { o = c - 'a' + 1; } + else if (c == '@') { o = 0; } + else if (c == '[') { o = 27; } + else if (c == ']') { o = 29; } + AddByte(o >= 0x60 ? ' ' : o); + ++line; + } } else if (text_prefix.same_str("petscii")) { while (line) { char c = line[0]; @@ -5778,7 +5788,8 @@ StatusCode Asm::ApplyDirective(AssemblerDirective dir, strref line, strref sourc } while (line[0] != '"') { strref word = line.get_word_ws(); - if (word.same_str("petscii") || word.same_str("petscii_shifted")) { + if (word.same_str("petscii") || word.same_str("petscii_shifted") || + word.same_str("c64screen")) { text_prefix = line.get_word_ws(); line += text_prefix.get_len(); line.skip_whitespace();