Sketchy Tweaks

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Post Reply
Reboot
Posts: 4
Joined: Mon Aug 17, 2020 1:22 am

Sketchy Tweaks

Post by Reboot »

When executing sketchy locally, garbled text was displayed on the buttons. "CLS" was seen as "DMT", "SAVE" was seen as "TBWF", "LOAD" was seen as "MPBE", ...etc. It didn't take an expert cryptographer to realized a character code was off by 1. A look at dfilezx81.js showed:

Code: Select all

let zeddycs = " ??????????\"£$:?()><=+-*/;,.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
On my system, '£' is two byte encoded, shifting remaining characters. Replacing '£' (Shift-3 on a UK keyboard) with my keyboard's mapping to '#' fixed the buttons while keeping the keyboard mapping; however, a couple more problems remained.

Cursor keys left '?' characters and typing a '?' inserted a graphics upper left quadrant character. The cause of the later issue can be seen in the same line of code. A '?' matches the zeddycs character code 1, a graphics upper left quadrant character. Substituting '~' to avoid a match gives:

Code: Select all

let zeddycs = " ~~~~~~~~~~\"#$:?()><=+-*/;,.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
The assignment of variable 'i', a few lines down, controls the output on a match failure, i.e. CODE("?")==15. However, this doesn't solve the remaining failure. We need to block output of unmatched characters. Tracing what happens when a key is typed revealed an appropriate place to insert a filter, LMode.prototype.keyTyped in modes.js:

Code: Select all

if (zxcc!=1)
  dfile.rst10_zeddy(zxcc);
Now sketchy can be used as intended:
sketchy_model-zx81.png
A save and a little processing...

Code: Select all

head -5 sketchy-screen-nl.txt | cut -d\, -f 2-20 | sed -e s/\$0\\\([0-9]\\\)/\\\1/g -e s/\$0\\\([a-f]\\\)/\$\\\1/g -e s/,//g
...results in the model data of a retro pride splash screen.
Post Reply