diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ff3f806..314a0c80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ * Added array initialization syntax with `for` (not yet finalized). +* Added `atascii` text codec. + * Fixed several bugs, most importantly invalid offsets for branching instructions. ## 0.2.2 diff --git a/src/main/scala/millfork/parser/MfParser.scala b/src/main/scala/millfork/parser/MfParser.scala index d281968c..06eaed5a 100644 --- a/src/main/scala/millfork/parser/MfParser.scala +++ b/src/main/scala/millfork/parser/MfParser.scala @@ -205,6 +205,8 @@ case class MfParser(filename: String, input: String, currentDirectory: String, o case (_, "petscii") => TextCodec.Petscii case (_, "pet") => TextCodec.Petscii case (_, "scr") => TextCodec.CbmScreencodes + case (_, "atascii") => TextCodec.Atascii + case (_, "atari") => TextCodec.Atascii case (p, x) => ErrorReporting.error(s"Unknown string encoding: `$x`", Some(p)) TextCodec.Ascii diff --git a/src/main/scala/millfork/parser/TextCodec.scala b/src/main/scala/millfork/parser/TextCodec.scala index a5ee46fd..8e5a8d3b 100644 --- a/src/main/scala/millfork/parser/TextCodec.scala +++ b/src/main/scala/millfork/parser/TextCodec.scala @@ -28,15 +28,24 @@ object TextCodec { "@abcdefghijklmnopqrstuvwxyz[£]↑←" + 0x20.to(0x3f).map(_.toChar).mkString + "–ABCDEFGHIJKLMNOPQRSTUVWXYZ", - Map('^' -> 0x3E, 'π' -> 0x5E)) + Map('^' -> 0x3E, 'π' -> 0x5E, '♥' -> 0x53, '♡' -> 0x53, '♠' -> 0x41, '♣' -> 0x58, '♢' -> 0x5A, '•' -> 0x51)) val Petscii = new TextCodec("PETSCII", "\ufffd" * 32 + 0x20.to(0x3f).map(_.toChar).mkString + "@abcdefghijklmnopqrstuvwxyz[£]↑←" + "–ABCDEFGHIJKLMNOPQRSTUVWXYZ", - Map('^' -> 0x5E, 'π' -> 0x7E) + Map('^' -> 0x5E, 'π' -> 0x7E, '♥' -> 0x73, '♡' -> 0x73, '♠' -> 0x61, '♣' -> 0x78, '♢' -> 0x7A, '•' -> 0x71) ) + val Atascii = new TextCodec("ATASCII", + "♡" + + "\ufffd" * 15 + + "♣\ufffd–\ufffd•" + + "\ufffd" * 11 + + 0x20.to(0x5f).map(_.toChar).mkString + + "♢abcdefghijklmnopqrstuvwxyz♠|", + Map('♥' -> 0, '·' -> 0x14) + ) }