-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is It Possible to Implement 10 PRINT #7
Comments
Unicode recently added a block containing characters for legacy computing to support representing most old 8-bit character sets in Unicode (https://en.wikipedia.org/wiki/Symbols_for_Legacy_Computing). Here is the code points mapping array for the Commodore 64: CHR$ just needs to pick the value at the requested index from the array and return it as a string according to the encoding of strings in your environment. Beware many are outside of the Unicode Basic Multilingual Plane and will require a surrogate pair in UTF-16, or proper multibyte encoding in UTF-8 up to 4 bytes) Here's what they look like with the unscii font (http://viznut.fi/unscii/): Other mapping arrays could be used to support different character sets, for example a CHR$MODE global variable or function could be used to select between PET, C64, TRS-80, Apple2, ... |
Here's a more complete fix with an array of string that contains the Unicode characters as well as most control codes as VT escape sequences. The array that maps PETSCII to Unicode and VT sequences: In CHROUT, both
And all cases handling special characters, except The following demo is running in gnome-terminal: Note some characters are printed with an extra space following them. This seems to be a problem with terminals currently assuming the new Unicode Symbols for Legacy Computing to be double-width, not a bug in the output of cbmbasic itself. Basic code for the demo:
Extra details: |
Hi,
Is it possible to run the classic
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
program?I'm probably splitting hairs with this one, since I assume it's not really straight forward to emulate the graphical PETSCII characters across all the platforms. I was more curious than anything else:
The text was updated successfully, but these errors were encountered: