1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-06-12 22:29:33 +00:00

Added ATASCII text codec

This commit is contained in:
Karol Stasiak 2018-03-26 00:01:29 +02:00
parent e32887b6b7
commit 0231e4c4fd
3 changed files with 15 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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)
)
}