ZX81 characters replacing ASCII special characters

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
MOB-i-L
Posts: 74
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

ZX81 characters replacing ASCII special characters

Post by MOB-i-L »

Here are suggestions for replacement of ASCII characters not in the ZX81 character set. The idea is to use these replacements when entering BASIC programs originally in ASCII. They should look similar to the ASCII character they replace. They are named using their UTF8 name. An alternative is after comma. I thought it was better to use the ZX81 graphic characters as first choice, and inverse non letters as second choice, since inverse letters might mean capitals.

https://en.wikipedia.org/wiki/ZX81_character_set
https://freestuff.grok.co.uk/zxtext2p/
https://en.wikipedia.org/wiki/Symbols_f ... _Computing

ASCII [ZXText2P] [char] \uXXXX| UTF-8 name

Code: Select all

! [\: ] [▌] \u258C| LEFT HALF BLOCK
# [\##] [▒] \u2592| MEDIUM SHADE
% [\.'] [▞] \u259E| QUADRANT UPPER RIGHT AND LOWER LEFT
& [\:.] [▙] \u2599| QUADRANT UPPER LEFT AND LOWER LEFT AND LOWER RIGHT, INVERSE 6
' [\' ] [▘] \u2598| QUADRANT UPPER LEFT
@ [\.:] [▟] \u259F| QUADRANT UPPER RIGHT AND LOWER LEFT AND LOWER RIGHT, INVERSE 0
[ [\ .] [▗] \u2597| QUADRANT LOWER RIGHT, INVERSE (
\ [\'.] [▚] \u259A| QUADRANT UPPER LEFT AND LOWER RIGHT
] [\. ] [▖] \u2596| QUADRANT LOWER LEFT, INVERSE )
^ [\''] [▀] \u2580| UPPER HALF BLOCK
_ [\..] [▄] \u2584| LOWER HALF BLOCK
` [\ '] [▝] \u259D| QUADRANT UPPER RIGHT
{ [\':] [▜] \u259C| QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER RIGHT, INVERSE <
| [\ :] [▐] \u2590| RIGHT HALF BLOCK
} [\:'] [▛] \u259B| QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER LEFT, INVERSE >
~ [\~~] [🮎] \U0001FB8E| UPPER HALF MEDIUM SHADE
© [\::] [█] \u2588| FULL BLOCK (© in ZX Spectrum, but the control character Delete in ASCII)
£ [£] [£] \u00A3| POUND SIGN (from ISO8859-15 etc)
Updated 2024-Nov-27

Unused:

Code: Select all

[\,,] [🮏] \u0001FB8F| LOWER HALF MEDIUM SHADE
[\@@] [🮐] \u0001FB90| INVERSE MEDIUM SHADE
[\!!] [🮒] \u0001FB92| UPPER HALF INVERSE MEDIUM SHADE AND LOWER HALF BLOCK
[\;;] [🮑] \u0001FB91| UPPER HALF BLOCK AND LOWER HALF INVERSE MEDIUM SHADE
Do you have any suggestions for improvements?
Last edited by MOB-i-L on Sat Nov 30, 2024 7:00 am, edited 9 times in total.
David G
Posts: 632
Joined: Thu Jul 17, 2014 7:58 am
Location: 48 North

Re: ZX81 characters replacing ASCII special characters

Post by David G »

Finally someone interested in this

First we need an encoding -- is that your proposal? I like the fact that yours look kinda similar to the graphics characters

Next, ideally, we need a font to display them


Graphics characters can be displayed in your favorite note-pad using a special font. There are two traditional ZX81 fonts:
  • SinclairZX
  • ZX_81_riched

If you don't already have the font, to correctly render the ZX graphic characters install the font to the operating system (MacOS/Windows/Linux). Then it will appear as a font choice which you can select in your note-pad
The font "Sinclair.ttf" uses this encoding:

For graphics CHR 0-10: ¡¢¦¤¬²¹º¾½
For graphics CHR 128-138 ±µ¶ª¸¯³¥¼ÁÀ
inverse punctuation 139-155 ÂÃÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ
inverse alphanumeric 156-191 ÔÕרÙÚÛÝÞàáâãåæçèéêëìíîïðñòóôõ÷øùúûý

Notepad++ with Courier font
Notepad++ with Courier font
Notepad++ with SinclairZX font
Notepad++ with SinclairZX font
MOB-i-L wrote: Sun Nov 17, 2024 8:17 pm Here are suggestions for replacement of ASCII characters not in the ZX81 character set. They are named using their UTF8 name, but are in ZX81 (since the ZX81 graphic characters doesn't seem to work on this site in my browser). An alternative is after comma. I thought it was better to use the ZX81 graphic characters as first choice, and inverse non letters as second choice, since inverse letters might mean capitals. The idea is to use these replacements when entering BASIC programs originally in ASCII. They should look similar to the ASCII character they replace.
MOB-i-L
Posts: 74
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

Re: ZX81 characters replacing ASCII special characters

Post by MOB-i-L »

My goal is to be able to enter e.g. BASIC and Forth programs in ASCII into a ZX81. When it comes to listing those, originally ASCII encoded, programs, they would be converted back to ASCII. The ZX81 characters I chose reminds of the corresponding ASCII character, a part of it, or look similar from a distance.

Another problem is to list original ZX81 programs, but in modern editors, terminals, and browsers all ZX81 characters are supported in Unicode, at least if you change character set in an editor or a terminal. One should not need to use character sets that doesn't support Unicode. It is difficult to type the special ZX81 characters, but one can design a special keyboard mapping (depending on OS), or write a special editor.

In browsers the characters in a fixed width font are not always fixed width for all characters, but this is a bug; it works in terminals, at least in LXTerminal 0.4.0.
David G
Posts: 632
Joined: Thu Jul 17, 2014 7:58 am
Location: 48 North

Re: ZX81 characters replacing ASCII special characters

Post by David G »

all ZX81 characters are supported in Unicode
Thank you! I have never seen this mentioned before .... [sense of wonderment]

from the article:
Symbols for Legacy Computing is a Unicode block containing graphic characters that were used for various home computers from the 1970s and 1980s [including] ... ZX81
...
Unicode version history
13.0 (2020)

Do any common fonts support the new Unicode Block 1FB00? On my Windows 11 machine the characters just display as an empty square glyph
but i think it is a 2021 machine, so too old


We could break this into two problems:

1. How to display/share ZX81 program listings in common ASCII. Back in the day with magazine type-ins, many different schemes were used, usually with multi-character encoding. Example'GR-8' ,or lower-case for inverse A-Z. Often the magazine did not try and just provided a screen shot image. You are suggesting a new scheme? E.g. '#' for the MEDIUM SHADE character?


2. How to display the ZX81 character on modern devices. In addition to the two fonts I previously mentioned, we can use any font that supports the new Unicode Block. The advantage of this -- at first thought -- is that it requires no special encoding

MOB-i-L wrote: Mon Nov 18, 2024 9:49 pm My goal is to be able to enter e.g. BASIC and Forth programs in ASCII into a ZX81
How do you plan to enter the ASCII into the ZX81?

Regarding viewing the actual characters in ASCII, I was going to mention how ZX_riched font used a different encoding from SinclairZX font making all those BASIC text files incompatible when it comes to ZX81 characters. If I recall correctly, PtoText uses the encoding that ZX_riched supports, but it looks very annoying with regular ASCII. It basically only works well in the ecosystem of translating back-and-forth

On the other hand, SinclairZX encoding uses only extended ASCII for the graphics characters, so it is much more livable and regular ASCII text looks fine along with the character graphics. The only editor I know of that uses it is the ZX-IDE Assembler and it provides an on-screen keypad for the ZX81 characters

ZX-IDE character keypad
ZX-IDE character keypad

Maybe this new Unicode Block is the ultimate answer. Instead of ASCII, simply use Unicode. We could have a text file with all the graphics characters and then copy-paste as needed, or someone could write a special system utility On-Screen-Keyboard. Memorizing the 5-digit codes for the new Unicode characters would be a challenge
MOB-i-L
Posts: 74
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

Re: ZX81 characters replacing ASCII special characters

Post by MOB-i-L »

I mean I want to type or translate automatically programs in ASCII or close to ASCII (e.g. ZX Spectrum character set) into ZX81 BASIC or Forth. In BASIC I just type the characters I decided in strings, but in Forth I can do this in strings, but would need to define new words with the right characters, or develop a new Forth (or hack an old), since Forth uses most ASCII characters in its words (i.e. commands).

I usually use Raspberry Pi OS (Linux) and that supports Symbols for Legacy Computing in Chromium and LXTerminal, at least version 13.0 (2020), but perhaps not 16.0 (2024). Now I'm testing this in Windows, and Chrome, Edge, and Windows-terminal doesn't support Symbols for Legacy Computing, but Firefox 132.0.2 does (at least version 13.0). Regarding Windows-terminal it might be enough to find the right font, but I have not got it to work even though I tried many modern fonts e.g. Roboto Regular.

For presentation of ZX81 code one can use gray colored block characters for the shaded blocks:
# [\##] [▒] \u2592| MEDIUM SHADE
~ [\~~] [🮎] \U0001FB8E| UPPER HALF MEDIUM SHADE

# [\##] [] \u2588| FULL BLOCK gray
~ [\~~] [] \u2580| UPPER HALF BLOCK gray

For comparison, but wrong color:
# [\##] [█] \u2588| FULL BLOCK black
~ [\~~] [▀] \u2580| UPPER HALF BLOCK black
I requested that some medium shade characters should be added to a font that is used by Windows Terminal: https://github.com/microsoft/cascadia-c ... 2489850324

BTW I updated my proposal in the first post.
David G
Posts: 632
Joined: Thu Jul 17, 2014 7:58 am
Location: 48 North

Re: ZX81 characters replacing ASCII special characters

Post by David G »

your proposal looks good. I like how it is a one-to-one mapping but still uses the idea of ZXText2P (symbol should look like the graphics character for easy sight-identification and memorization)

! represents: [▌] LEFT HALF BLOCK
# represents: [▒] MEDIUM SHADE


this one seems reversed, but maybe I'm looking at it wrong?
% represents: [▞] QUADRANT UPPER RIGHT AND LOWER LEFT
'/' looks more like the QUADRANT to me and is orthogonal with your choice of '\' for the inverse. But '/' is already used by the ZX81 character set...so that's out


Regarding fonts, Yes, the new Unicode "Symbols for Legacy Computing" is a mess: it doesn't implement a consistent set of the symbols (missing some inverse in particular) but even worse is the font support. Google's 'Noto Sans Symbols 2' is not a fixed-width, so program listings look bad in a code editor or Notepad++. 'Cascadia Code' (2024 version) from Microsoft is missing some of the new glyphs, particularly those for the shaded characters (1FB8E-1FB93) of which three are crucial for the ZX81. Also, Microsoft makes it difficult to update this font (an older version ships with Windows -- the default font for Windows Terminal). It is automatically blocked by Windows
MOB-i-L
Posts: 74
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

Re: ZX81 characters replacing ASCII special characters

Post by MOB-i-L »

I think it is important that backslash \ has a sensible translation into ZX81 characters and then ▚ [\'.] seemed best, and percent % cannot be the same, but the division sign in % looks like ▞ [\.']. Sometimes it's only part of a character that looks like the translation, e.g. ▜ and ▛ are the lower parts of { and }.
MOB-i-L
Posts: 74
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

Re: ZX81 characters replacing ASCII special characters

Post by MOB-i-L »

I added £ (Pound sign) and show unused characters from the ZX81 character set to top post.
Post Reply