/[VRac]/Orao.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Orao.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 77 by dpavlin, Wed Aug 1 13:01:17 2007 UTC revision 78 by dpavlin, Wed Aug 1 13:52:39 2007 UTC
# Line 8  use lib './lib'; Line 8  use lib './lib';
8  #use Time::HiRes qw(time);  #use Time::HiRes qw(time);
9  use File::Slurp;  use File::Slurp;
10  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
11    use List::Util qw/first/;
12  use M6502;  use M6502;
13    
14  use base qw(Class::Accessor M6502 Screen Prefs);  use base qw(Class::Accessor M6502 Screen Prefs);
# Line 31  Emulator or Orao 8-bit 6502 machine popu Line 32  Emulator or Orao 8-bit 6502 machine popu
32    
33  =cut  =cut
34    
35    my @kbd_ports = (
36        0x87FC,0x87FD,0x87FA,0x87FB,0x87F6,0x87F7,
37        0x87EE,0x87EF,0x87DE,0x87DF,0x87BE,0x87BF,
38        0x877E,0x877F,0x86FE,0x86FF,0x85FE,0x85FF,
39        0x83FE,0x83FF,
40    );
41    
42  =head2 init  =head2 init
43    
44  Start emulator, open L<Screen>, load initial ROM images, and render memory  Start emulator, open L<Screen>, load initial ROM images, and render memory
# Line 60  sub init { Line 68  sub init {
68  #       $PC = 0xDD11;   # BC  #       $PC = 0xDD11;   # BC
69  #       $PC = 0xC274;   # MC  #       $PC = 0xC274;   # MC
70    
71            $PC = 0xff89;
72    
73          $orao = $self;          $orao = $self;
74    
75  #       $self->prompt( 0x1000 );  #       $self->prompt( 0x1000 );
# Line 270  sub read { Line 280  sub read {
280          my ($addr) = @_;          my ($addr) = @_;
281          my $byte = $mem[$addr];          my $byte = $mem[$addr];
282          warn sprintf("# Orao::read(%04x) = %02x\n", $addr, $byte) if $self->trace;          warn sprintf("# Orao::read(%04x) = %02x\n", $addr, $byte) if $self->trace;
283    
284            # keyboard
285    
286            if ( first { $addr == $_ } @kbd_ports ) {
287                    warn sprintf("keyboard port: %04x\n",$addr);
288            } elsif ( $addr == 0x87fc ) {
289                    warn "0x87fc - arrows/back\n";
290    =for pascal
291                    if VKey=VK_RIGHT then Result:=16;
292                    if VKey=VK_DOWN then Result:=128;
293                    if VKey=VK_UP then Result:=192;
294                    if VKey=VK_LEFT then Result:=224;
295                    if Ord(KeyPressed)=VK_BACK then Result:=224;
296    =cut
297            } elsif ( $addr == 0x87fd ) {
298                    warn "0x87fd - enter\n";
299    =for pascal
300        if KeyPressed=Chr(13) then begin
301          Mem[$FC]:=13;
302          Result:=0;
303        end;
304    =cut
305            } elsif ( $addr == 0x87fa ) {
306                    warn "0x87fa = F1 - F4\n";
307    =for pascal
308        if VKey=VK_F4 then Result:=16;
309        if VKey=VK_F3 then Result:=128;
310        if VKey=VK_F2 then Result:=192;
311        if VKey=VK_F1 then Result:=224;
312    =cut
313            } elsif ( $addr == 0x87fb ) {
314                    warn "0x87fb\n";
315    =for pascal
316        if KeyPressed=Chr(32) then Result:=32;
317        if KeyPressed='"' then Result:=16;
318        if KeyPressed='!' then Result:=16;
319        if KeyPressed='$' then Result:=16;
320        if KeyPressed='%' then Result:=16;
321        if KeyPressed='&' then Result:=16;
322        if KeyPressed='(' then Result:=16;
323        if KeyPressed=')' then Result:=16;
324        if KeyPressed='=' then Result:=16;
325        if KeyPressed='#' then Result:=16;
326        if KeyPressed='+' then Result:=16;
327        if KeyPressed='*' then Result:=16;
328        if KeyPressed='?' then Result:=16;
329        if KeyPressed='<' then Result:=16;
330        if KeyPressed='>' then Result:=16;
331        if VKey=191 then Result:=16;
332    =cut
333            }
334    
335          $self->mmap_pixel( $addr, 0, $byte, 0 );          $self->mmap_pixel( $addr, 0, $byte, 0 );
336          return $byte;          return $byte;
337  }  }

Legend:
Removed from v.77  
changed lines
  Added in v.78

  ViewVC Help
Powered by ViewVC 1.1.26