PETSCII reader for Sinclair ZX Spectrum
It was a long time that I was designing a "C64 simulator" for ZX Spectrum, the weird idea had been spinning in my head for several years now, but when a few weeks ago my friend Francesco published his font "Sinclair" for C64 he gave me the urge to lose a few more nights of sleep to finalize my suspended work for years. The way to handle the character set is quite different between C64 and ZX Spectrum. On the C64 there are two character sets, consisting of 128 characters, one with all the PETSCII symbols and only the uppercase characters (default) and the other set with uppercase and lowercase alphabetic characters and a reduced PETSCII set, the two font-sets they are alternative and cannot be used simultaneously. The ZX Spectrum instead uses only one set of 96 characters with alphabetic and uppercase letters and relegates the possibility of graphic characters to a set of 16 non-editable characters (the set of 4 à 4 pixel blocks) and ânâ set of 21 characters redefinable mapped from A to U called "UDG" (User Defined Graphics). The different UDG sets can be used by selecting them with a POKE and once printed they do not change, so you can define a number of characters according to the available memory, to create the complete set of all the characters PETSCII + uppercase and lowercase set I used 3 banks of UDG characters in addition to the set of 21 basic characters. Once the complete conversion of the charset is over, since "the appetite comes with eating" why stop? I then gave birth to the idea of ââcreating an automatic PETSCII ART converter that was built for C64. For this purpose I have specifically created a second set, restricted, only for uppercase characters and complete PETSCII graphic character sets but which also corresponded as sorting to the original C64 charset in order to facilitate the conversion of the ASCII codes of the characters. There was also to solve the problem of color conversion, the Commodore 64 has 16 different colors while the ZX Spectrum manages 8 colors with two brightness levels (Bright 0 and 1) but the black does not change between the two levels therefore the total of the colors on ZX Spectrum is 15. Furthermore the two palettes are VERY different chromatically. For the conversion of PETSCII ART into binary files I used the PETMATE program. The files are saved in binary format, the structure is very simple, they are files of 2002 bytes: the first byte defines the border color, the second the background color (paper), followed by 1000 bytes to define the 40 à 25 characters of the drawing and another 1000 bytes for the colors (attributes). Everything was developed with BORIEL BASIC, a BASIC compiler compatible with SINCLAIR BASIC but which also provides the most modern BASIC dialect structures and also allows to include Z80 assembler parts directly "inline". At the attached link you can download the program "ZX64 Simulator" containing the complete set of PETSCII characters with direct correspondences to the ZX Spectrum set and therefore usable normally in SINCLAIR BASIC and the PETSCII SLIDE SHOW which instead has a charset ordered with correspondence to the C64 set to allow a simpler conversion of PETSCII ART, the slide show in executable TAP format already contains 10 PETSCII ART. Always in the attached link you will find the complete listings, they are commented so it should be easy enough to understand the sources. http://www.santagostino.eu/commodore-petscii-reader-on-the-sinclair-zx-spectrum/ ---------------------------------------------------
[ back to the prod ]