--- Galaksija.pm 2007/08/05 20:01:44 162 +++ Galaksija.pm 2007/08/05 20:02:14 163 @@ -8,7 +8,7 @@ use Data::Dump qw/dump/; use Z80; # import -use base qw(Class::Accessor VRac Z80 Screen Prefs); +use base qw(Class::Accessor VRac Z80 Screen Prefs Session); __PACKAGE__->mk_accessors(qw(booted)); =head1 NAME @@ -17,11 +17,11 @@ =head1 VERSION -Version 0.00 +Version 0.01 =cut -our $VERSION = '0.00'; +our $VERSION = '0.01'; =head1 SUMMARY @@ -116,8 +116,6 @@ =cut -my $keyboard = {}; - sub read { my $self = shift; my ($addr) = @_; @@ -151,6 +149,44 @@ =head1 Architecture specific +=cut + +my @keymap = ( + 'a' .. 'z', + qw/up down left right space/, + '0' .. '9', + ':', '"', ',', '=', '.', '/', 'enter', 'tab', + 'left alt', 'delete', 'scroll lock', 'left shift' +); + +my $remap; +my $o = 1; + +foreach my $key ( @keymap ) { + $remap->{$key} = $o; + $o++; +} + +=head2 key_down + +=cut + +sub key_down { + my ( $self, $key ) = @_; + warn "key down: $key ", $remap->{$key}; + $self->write( 0x2000 + $remap->{$key}, 0xfe ); +} + +=head2 key_up + +=cut + +sub key_up { + my ( $self, $key ) = @_; + warn "key up: $key ", $remap->{$key}; + $self->write( 0x2000 + $remap->{$key}, 0xff ); +} + =head2 render_vram Simple hex dumper of text buffer