/[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 82 by dpavlin, Wed Aug 1 21:40:17 2007 UTC revision 94 by dpavlin, Thu Aug 2 13:04:29 2007 UTC
# Line 20  Orao - Orao emulator Line 20  Orao - Orao emulator
20    
21  =head1 VERSION  =head1 VERSION
22    
23  Version 0.02  Version 0.03
24    
25  =cut  =cut
26    
27  our $VERSION = '0.02';  our $VERSION = '0.03';
28    
29  =head1 SUMMARY  =head1 SUMMARY
30    
# Line 55  select(STDERR); $| = 1; Line 55  select(STDERR); $| = 1;
55  sub boot {  sub boot {
56          my $self = shift;          my $self = shift;
57          warn "Orao calling upstream init\n";          warn "Orao calling upstream init\n";
58          $self->SUPER::init( $self, @_ );          $self->SUPER::init(
59                    read => sub { $self->read( @_ ) },
60                    write => sub { $self->write( @_ ) },
61            );
62    
63          warn "Orao $Orao::VERSION emulation starting\n";          warn "Orao $Orao::VERSION emulation starting\n";
64    
65            warn "emulating ", $#mem, " bytes of memory\n";
66    
67          $self->open_screen;          $self->open_screen;
68          $self->load_rom({          $self->load_rom({
69                  0x1000 => 'dump/SCRINV.BIN',                  0x1000 => 'dump/SCRINV.BIN',
# Line 119  sub boot { Line 124  sub boot {
124    
125          M6502::reset();          M6502::reset();
126    
         warn dump( M6502->run );  
127  }  }
128    
129  =head2 load_rom  =head2 load_rom
# Line 137  sub load_rom { Line 141  sub load_rom {
141    
142          foreach my $addr ( sort keys %$loaded_files ) {          foreach my $addr ( sort keys %$loaded_files ) {
143                  my $path = $loaded_files->{$addr};                  my $path = $loaded_files->{$addr};
144                  $self->load_oraoemu( $path, $addr );                  $self->load_image( $path, $addr );
145          }          }
146  }  }
147    
# Line 165  sub _write_chunk { Line 169  sub _write_chunk {
169          $self->render_mem( @mem ) if $self->show_mem;          $self->render_mem( @mem ) if $self->show_mem;
170  }  }
171    
172  =head2 load_oraoemu  =head2 load_image
173    
174  Load binary files, ROM images and Orao Emulator files  Load binary files, ROM images and Orao Emulator files
175    
176    $orao->load_oraoemu( '/path/to/file', 0x1000 );    $orao->load_image( '/path/to/file', 0x1000 );
177    
178  Returns true on success.  Returns true on success.
179    
180  =cut  =cut
181    
182  sub load_oraoemu {  sub load_image {
183          my $self = shift;          my $self = shift;
184          my ( $path, $addr ) = @_;          my ( $path, $addr ) = @_;
185    
# Line 285  sub read { Line 289  sub read {
289          my $self = shift;          my $self = shift;
290          my ($addr) = @_;          my ($addr) = @_;
291          my $byte = $mem[$addr];          my $byte = $mem[$addr];
292            confess sprintf("can't find memory at address %04x",$addr) unless defined($byte);
293          warn sprintf("# Orao::read(%04x) = %02x\n", $addr, $byte) if $self->trace;          warn sprintf("# Orao::read(%04x) = %02x\n", $addr, $byte) if $self->trace;
294    
295          # keyboard          # keyboard
# Line 364  sub write { Line 369  sub write {
369          }          }
370    
371          if ( $addr > 0xafff ) {          if ( $addr > 0xafff ) {
372                  warn sprintf "write access 0x%04x > 0xafff aborting\n", $addr;                  confess sprintf "write access 0x%04x > 0xafff aborting\n", $addr;
                 return;  
373          }          }
374    
375          $self->mmap_pixel( $addr, $byte, 0, 0 );          $self->mmap_pixel( $addr, $byte, 0, 0 );
# Line 467  __USAGE__ Line 471  __USAGE__
471                  } elsif ( $c =~ m/^l/i ) {                  } elsif ( $c =~ m/^l/i ) {
472                          my $to = shift @v || 0x1000;                          my $to = shift @v || 0x1000;
473                          $a = $to;                          $a = $to;
474                          $self->load_oraoemu( $v, $a );                          $self->load_image( $v, $a );
475                          $last = '';                          $last = '';
476                  } elsif ( $c =~ m/^s/i ) {                  } elsif ( $c =~ m/^s/i ) {
477                          $self->save_dump( $v || 'mem.dump', @v );                          $self->save_dump( $v || 'mem.dump', @v );

Legend:
Removed from v.82  
changed lines
  Added in v.94

  ViewVC Help
Powered by ViewVC 1.1.26