+use utf8;
+use strict;
+use warnings;
+use Shiar_Sheet::KeyboardChars 'kbchars';
+
+my %c64 = (
+ # control keys not on pet2001
+ '1' => "๐ค\nBLacK",
+ '2' => "๐ค\nWHiTe",
+ '3' => "โค๏ธ\nRED",
+ '4' => "๐ฉต\nCYaN",
+ '5' => "๐\nPURple",
+ '6' => "๐\nGReeN",
+ '7' => "๐\nBLUe",
+ '8' => "๐\nYELlow",
+ '9' => "๐\nREverSe video ON",
+ '0' => "๐\nREverSe video OFF",
+);
+
+my %rows = (%c64,
+ # literal petscii control characters, unaltered from pet2001
+ 'a' => 'โ ',
+ 'b' => '๐ญฒ',
+ 'c' => '๐ญธ',
+ 'd' => '๐ญท',
+ 'e' => '๐ญถ',
+ 'f' => '๐ญบ',
+ 'g' => '๐ญฑ',
+ 'h' => '๐ญด',
+ 'i' => 'โฎ',
+ 'j' => 'โฐ',
+ 'k' => 'โฏ',
+ 'l' => '๐ญผ',
+ 'm' => 'โฒ',
+ 'n' => 'โฑ',
+ 'o' => '๐ญฝ',
+ 'p' => '๐ญพ',
+ 'q' => 'โ',
+ 'r' => '๐ญป',
+ 's' => 'โฅ',
+ 't' => '๐ญฐ',
+ 'u' => 'โญ',
+ 'v' => 'โณ',
+ 'w' => 'โ',
+ 'x' => 'โฃ',
+ 'y' => '๐ญต',
+ 'z' => 'โฆ',
+ ']' => 'โ', # @
+
+ # literal pet2001 keys reassigned on c64
+ ',' => 'โผ', # [ c64 +
+ '.' => 'โ', # ] c64 -
+ '\\'=> 'ฯ', # โ c64 \
+ '}' => 'โฅ', # โ c64 *
+ '>' => '๐ฎ', # \ c64 ^-
+ 'B' => 'โ', # ?
+
+ # ! " # $ % ' & \ ( ) โ ยป 1 2 3 4 5 6 7 8 9 0 + - ยฃ
+ # Q W E R T Y U I O P โ 7 8 9 / ยป Q W E R T Y U I O P @ * โ
+ # A S D F G H J K L : 4 5 6 * ยป A S D F G H J K L : ; =
+ # Z X C V B N M , ; ? 1 2 3 + ยป Z X C V B N M , . /
+ # @ [ ] < > 0 . - =
+
+ # pet2001 top row
+ 'K' => 'โ', # A pet !
+ 'I' => 'โ', # B pet "
+ 'T' => 'โ', # C pet #
+ '{' => 'โ', # D pet $
+ 'G' => 'โ', # E pet %
+ 'M' => 'โ', # G pet '
+ '<' => 'โ', # F pet & c64 ^+
+ '/' => '๐ฎ', # H pet ( c64 ^ยฃ
+ '?' => 'โค', # I pet ) c64 ยฃ
+
+ # pet2001 bottom rows
+ '[' => '๐ญฟ', # Z pet :
+ 'D' => 'โ', # L pet ,
+ 'F' => 'โ', # { pet ;
+ 'C' => 'โ', # | pet <
+ 'V' => 'โ', # ~ pet >
+
+ # pet2001 numpad
+ 'Y' => '๐ฎ', # W pet 7
+ 'U' => '๐ฎ', # X pet 8
+ 'O' => 'โ', # Y pet 9
+ 'P' => 'โ', # O pet /
+ 'H' => 'โ', # T pet 4
+ 'J' => 'โ', # U pet 5
+ 'L' => '๐ฎ', # V pet 6
+ 'N' => '๐ฎ', # J pet *
+ 'E' => 'โด', # Q pet 1
+ 'R' => 'โฌ', # R pet 2
+ 'W' => 'โค', # S pet 3
+ 'Q' => 'โ', # K pet +
+ 'A' => 'โ', # P pet 0
+ 'S' => 'โ', # N pet .
+ 'Z' => 'โ', # M pet -
+ 'X' => 'โ', # } pet =
+);
+
+my $groups = kbchars(\%rows);
+
+while (my ($k, $c) = each %rows) {
+ $groups->{def}{''}{$k}[0] = (
+ $c64{$k} ? 'g9' :
+ $c =~ /\p{In=1.1}/ ? 'g2' :
+ $c =~ /\p{In=4.0}/ ? 'g3' :
+ $c =~ /[\x{1FB00}-\x{1FBFF}]/ ? 'g5' : # Age=V13.0
+ 'g0'
+ );
+}
+
++{
+ %{ $groups },
+ version => '1.0',
+ title => 'Commodore graphics',
+ category => 'legacy/graph',
+ moderows => '21-1',
+ intro => join("\n",
+ '<abbr title="PET Standard Code of Information Interchange">PETSCII</abbr>',
+ 'characters designed for the 1977 PET 2001 machine',
+ 'as found on the VIC-20 and C-64.',
+ 'See also <a href="/keyboard/altgr/msx-graph">MSX graph</a> and',
+ '<a href="/keyboard/altgr/unigraph">modern Unicode</a>.',
+ ),
+ image => 'data/keyboard/thumb/c64.jpg',
+ flag => {
+ g2 => ['standard' => 'original Unicode 1993'],
+ g3 => ['extended' => 'Unicode 4.0'],
+ g5 => ['legacy' => 'exceptional <em>symbols for legacy computing</em> in Unicode since <abbr title="Unicode 13.0">2020</abbr>'],
+ g9 => ['color' => 'presentational controls represented by anachronistic hearts'],
+ },
+}