From 98f35937e3aa00132610d63c4b227ef0e4482e21 Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Fri, 12 Jul 2019 13:29:59 +0200 Subject: [PATCH] Improve text encodings on Atari --- docs/lang/text.md | 20 +++++++++++------ include/a8.ini | 1 + .../scala/millfork/parser/TextCodec.scala | 22 ++++++++++++++++++- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/docs/lang/text.md b/docs/lang/text.md index d83a36aa..d97b14a4 100644 --- a/docs/lang/text.md +++ b/docs/lang/text.md @@ -30,6 +30,10 @@ * `iso_de`, `iso_no`, `iso_se`, `iso_yu` – various variants of ISO/IEC-646 * `iso_dk`, `iso_fi` – aliases for `iso_no` and `iso_se` respectively + +* `atascii` or `atari` – ATASCII as seen on Atari 8-bit computers + +* `atasciiscr` or `atariscr` – screencodes used by Atari 8-bit computers When programming for Commodore, use `pet` for strings you're printing using standard I/O routines @@ -65,11 +69,13 @@ control codes for changing the text background color ##### Escape sequence availability -Encoding | new line | braces | backspace | cursor movement | text colour and reverse | background colour ---|--|--|--|--|--|-- -`pet` | yes | no | no | yes | yes | no -`petscr` | no | no | no | no | no | no -`sinclair` | yes | yes | no | yes | yes | yes -`ascii`, `iso_*` | yes | yes | yes | no | no | no -`apple2` | no | yes | no | no | no | no +Encoding | new line | braces | backspace | cursor movement | text colour and reverse | background colour +--|--|--|--|--|--|-- +`pet` | yes | no | no | yes | yes | no +`petscr` | no | no | no | no | no | no +`sinclair` | yes | yes | no | yes | yes | yes +`ascii`, `iso_*` | yes | yes | yes | no | no | no +`apple2` | no | yes | no | no | no | no +`atascii` | yes | no | yes | yes | no | no +`atasciiscr` | no | no | no | no | no | no all the rest | yes | yes | no | no | no | no diff --git a/include/a8.ini b/include/a8.ini index 1b4512b1..ffb3d1e6 100644 --- a/include/a8.ini +++ b/include/a8.ini @@ -2,6 +2,7 @@ arch=strict modules=a8_kernel,default_panic,stdlib encoding=atascii +screen_encoding=atasciiscr [allocation] ; TODO diff --git a/src/main/scala/millfork/parser/TextCodec.scala b/src/main/scala/millfork/parser/TextCodec.scala index 84527940..224bf56a 100644 --- a/src/main/scala/millfork/parser/TextCodec.scala +++ b/src/main/scala/millfork/parser/TextCodec.scala @@ -139,6 +139,8 @@ object TextCodec { case (_, "petscr") => TextCodec.CbmScreencodes case (_, "atascii") => TextCodec.Atascii case (_, "atari") => TextCodec.Atascii + case (_, "atasciiscr") => TextCodec.AtasciiScreencodes + case (_, "atariscr") => TextCodec.AtasciiScreencodes case (_, "bbc") => TextCodec.Bbc case (_, "sinclair") => TextCodec.Sinclair case (_, "apple2") => TextCodec.Apple2 @@ -347,7 +349,25 @@ object TextCodec { "\ufffd" * 11 + 0x20.to(0x5f).map(_.toChar).mkString + "♢abcdefghijklmnopqrstuvwxyz♠|", - Map('♥' -> 0, '·' -> 0x14), Map.empty, MinimalEscapeSequencesWithBraces + ("n" -> List(0x9b)) + Map('♥' -> 0, '·' -> 0x14), Map.empty, MinimalEscapeSequencesWithoutBraces ++ Seq( + "n" -> List(0x9b), + "up" -> List(0x1c), + "down" -> List(0x1d), + "left" -> List(0x1e), + "right" -> List(0x1f), + "b" -> List(0x7e), + ) + ) + + val AtasciiScreencodes = new TextCodec("ATASCII-Screen", + 0x20.to(0x3f).map(_.toChar).mkString + + 0x40.to(0x5f).map(_.toChar).mkString + + "♡" + + "\ufffd" * 15 + + "♣\ufffd–\ufffd•" + + "\ufffd" * 7 + "↑↓←→"+ + "♢abcdefghijklmnopqrstuvwxyz♠|", + Map('♥' -> 0x40, '·' -> 0x54), Map.empty, MinimalEscapeSequencesWithoutBraces ) val Bbc = new TextCodec("BBC",