/[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 64 by dpavlin, Tue Jul 31 16:33:41 2007 UTC revision 73 by dpavlin, Tue Jul 31 21:43:57 2007 UTC
# Line 51  sub init { Line 51  sub init {
51          $self->open_screen;          $self->open_screen;
52          $self->load_rom({          $self->load_rom({
53                  0x1000 => 'dump/SCRINV.BIN',                  0x1000 => 'dump/SCRINV.BIN',
54    #               0x6000 => 'dump/screen.dmp',
55                  0xC000 => 'rom/BAS12.ROM',                  0xC000 => 'rom/BAS12.ROM',
56                  0xE000 => 'rom/CRT12.ROM',                  0xE000 => 'rom/CRT12.ROM',
57          });          });
58    
59          $PC = 0xDD11;   # BC  #       $PC = 0xDD11;   # BC
60  #       $PC = 0xC274;   # MC  #       $PC = 0xC274;   # MC
61    
62          $orao = $self;          $orao = $self;
# Line 66  sub init { Line 67  sub init {
67          $self->trace( 0 );          $self->trace( 0 );
68          $self->debug( 0 );          $self->debug( 0 );
69    
70            $self->render( @mem[ 0x6000 .. 0x7fff ] );
71    
72          if ( $self->show_mem ) {          if ( $self->show_mem ) {
73    
74                  warn "rendering memory map\n";                  warn "rendering memory map\n";
# Line 98  sub init { Line 101  sub init {
101          } else {          } else {
102    
103                  warn "rendering video memory\n";                  warn "rendering video memory\n";
104                  for my $a ( 0x6000 .. 0x7fff ) {  #               for my $a ( 0x6000 .. 0x7fff ) {
105                          $self->vram( $a - 0x6000, $mem[$a] );  #                       $self->vram( $a - 0x6000, $mem[$a] );
106                  }  #               }
107                    $self->render( @mem[ 0x6000 .. 0x7fff ] );
108                    
109          }          }
110          $self->sync;          $self->sync;
# Line 152  sub _write_chunk { Line 156  sub _write_chunk {
156          $t = $end if ( $end < $t );          $t = $end if ( $end < $t );
157    
158          warn sprintf("refresh video ram %04x-%04x\n", $f, $t);          warn sprintf("refresh video ram %04x-%04x\n", $f, $t);
159          foreach my $a ( $f .. $t ) {  #       foreach my $a ( $f .. $t ) {
160                  $self->vram( $a - 0x6000 , $mem[ $a ] );  #               $self->vram( $a - 0x6000 , $mem[ $a ] );
161          }  #       }
162            $self->render( @mem[ 0x6000 .. 0x7fff ] );
163  }  }
164    
165  =head2 load_oraoemu  =head2 load_oraoemu
# Line 248  sub hexdump { Line 253  sub hexdump {
253          return sprintf(" %04x %s\n", $a,          return sprintf(" %04x %s\n", $a,
254                  join(" ",                  join(" ",
255                          map {                          map {
256                                  sprintf( "%02x", $_ )                                  if ( defined($_) ) {
257                                            sprintf( "%02x", $_ )
258                                    } else {
259                                            '  '
260                                    }
261                          } @mem[ $a .. $a+8 ]                          } @mem[ $a .. $a+8 ]
262                  )                  )
263          );          );
# Line 300  sub write { Line 309  sub write {
309          }          }
310    
311          if ( $addr > 0xafff ) {          if ( $addr > 0xafff ) {
312                  confess sprintf "write access 0x%04x > 0xafff aborting\n", $addr;                  warn sprintf "write access 0x%04x > 0xafff aborting\n", $addr;
313                    return;
314          }          }
315    
316          $self->mmap_pixel( $addr, $byte, 0, 0 );          $self->mmap_pixel( $addr, $byte, 0, 0 );
# Line 343  sub prompt { Line 353  sub prompt {
353    
354  =cut  =cut
355    
356    my $show_R = 0;
357    
358  sub cli {  sub cli {
359          my $self = shift;          my $self = shift;
360          my $a = $PC || confess "no pc?";          my $a = $PC || confess "no pc?";
361            warn $self->dump_R() if $show_R;
362          while ( my ($line, @v) = $self->prompt( $a, $last ) ) {          while ( my ($line, @v) = $self->prompt( $a, $last ) ) {
363                  my $c = shift @v;                  my $c = shift @v;
364                  next unless defined($c);                  next unless defined($c);
# Line 370  t\t\ttrace [$t] Line 383  t\t\ttrace [$t]
383  d\t\tdebug [$d]  d\t\tdebug [$d]
384    
385  __USAGE__  __USAGE__
386                          warn sprintf(" PC: %04x A:%02x P:%02x X:%02x Y:%02x S:%02x\n", $PC, $A, $P, $X, $Y, $S);                          warn $self->dump_R;
387                  } elsif ( $c =~ m/^e/i ) {                  } elsif ( $c =~ m/^e/i ) {
388                          $a = $v if defined($v);                          $a = $v if defined($v);
389                          my $to = shift @v;                          my $to = shift @v;
390                          $to = $a + 32 if ( ! $to || $to <= $a );                          $to = $a + 32 if ( ! $to || $to <= $a );
391                            $to = 0xffff if ( $to > 0xffff );
392                          my $lines = int( ($to - $a + 8) / 8 );                          my $lines = int( ($to - $a + 8) / 8 );
393                          printf "## e %04x %04x (%d bytes) lines: %d\n", $a, $to, ($to-$a), $lines;                          printf "## e %04x %04x (%d bytes) lines: %d\n", $a, $to, ($to-$a), $lines;
394                          while ( --$lines ) {                          while ( --$lines ) {
# Line 382  __USAGE__ Line 396  __USAGE__
396                                  $a += 8;                                  $a += 8;
397                          }                          }
398                          $last = '+';                          $last = '+';
399                            $show_R = 0;
400                  } elsif ( $c =~ m/^\+/ ) {                  } elsif ( $c =~ m/^\+/ ) {
401                          $a += 8;                          $a += 8;
402                            $show_R = 0;
403                  } elsif ( $c =~ m/^\-/ ) {                  } elsif ( $c =~ m/^\-/ ) {
404                          $a -= 8;                          $a -= 8;
405                            $show_R = 0;
406                  } elsif ( $c =~ m/^m/i ) {                  } elsif ( $c =~ m/^m/i ) {
407                          $a = $v;                          $a = $v if defined($v);
408                          $self->poke_code( $a, @v );                          $self->poke_code( $a, @v );
409                          printf "poke %d bytes at %04x\n", $#v + 1, $a;                          printf "poke %d bytes at %04x\n", $#v + 1, $a;
410                          $last = '+';                          $last = '+';
411                            $show_R = 0;
412                  } elsif ( $c =~ m/^l/i ) {                  } elsif ( $c =~ m/^l/i ) {
413                          my $to = shift @v || 0x1000;                          my $to = shift @v || 0x1000;
414                          $a = $to;                          $a = $to;
# Line 402  __USAGE__ Line 420  __USAGE__
420                  } elsif ( $c =~ m/^r/i ) {                  } elsif ( $c =~ m/^r/i ) {
421                          $run_for = $v || 1;                          $run_for = $v || 1;
422                          print "run_for $run_for instructions\n";                          print "run_for $run_for instructions\n";
423                            $show_R = 1;
424                          last;                          last;
425                  } elsif ( $c =~ m/^(u|j)/ ) {                  } elsif ( $c =~ m/^(u|j)/ ) {
426                          my $to = $v || $a;                          my $to = $v || $a;
# Line 409  __USAGE__ Line 428  __USAGE__
428                          $PC = $to;      # remember for restart                          $PC = $to;      # remember for restart
429                          $run_for = 1;                          $run_for = 1;
430                          $last = "r $run_for";                          $last = "r $run_for";
431                            $show_R = 1;
432                          last;                          last;
433                  } elsif ( $c =~ m/^t/ ) {                  } elsif ( $c =~ m/^t/ ) {
434                          $self->trace( not $self->trace );                          $self->trace( not $self->trace );

Legend:
Removed from v.64  
changed lines
  Added in v.73

  ViewVC Help
Powered by ViewVC 1.1.26