fadden / 6502bench

A workbench for developing 6502 code
https://6502bench.com
Apache License 2.0
165 stars 33 forks source link

Support PETSCII #43

Closed fadden closed 5 years ago

fadden commented 5 years ago

Having never worked with Commodore machines -- my background is pretty Apple II-centric -- I didn't know much of anything about PETSCII. Wikipedia was a bit confusing, but I got a bit of an education from the retrocomputing site. There's also a bit of history at the start of https://www.aivosto.com/articles/petscii.pdf, along with charts for VIC-20 and others.

I'm going to focus on C64/C128. There are three relevant character encodings: shifted, unshifted, and screen codes. A capital 'A' could be $41, $61, $C1, or $01 depending on the current mode.

I think a useful level of support can be provided with a few features:

  1. Add a project property that determines what set of characters are considered useful for string data detection. Options would be ASCII, Low+High ASCII, and shifted PETSCII. We probably want to recognize common format characters (e.g. clr/$93) as valid string data. PETSCII uses pretty much the full set of 256 possible values, but we should probably stick to recognizing basic typewriter characters so we don't identify graphics data as a bunch of strings.
  2. Allow runs of bytes to be identified as strings with a specific non-ASCII encoding: shifted, unshifted, or screen codes. Generated assembly will either use some clever approach to identify the encoding (e.g. ca65 charmap, 64tass .enc "screen") or just output hex if its not something the assembler handles easily.
  3. Expand the set of character encoding selections for the hex dump window so you can see text there. Maybe add a "default" option to the combo box that is configured based on project type. Add a PETSCII chart, similar to the existing ASCII chart.

However, I still don't have a good sense for what's actually useful. I need to ask around a bit.

Useful references:

I will need to find a decent set of examples to test with.

fadden commented 5 years ago

Added in v1.3.0-dev3.