/[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 71 by dpavlin, Tue Jul 31 17:42:03 2007 UTC
# Line 248  sub hexdump { Line 248  sub hexdump {
248          return sprintf(" %04x %s\n", $a,          return sprintf(" %04x %s\n", $a,
249                  join(" ",                  join(" ",
250                          map {                          map {
251                                  sprintf( "%02x", $_ )                                  if ( defined($_) ) {
252                                            sprintf( "%02x", $_ )
253                                    } else {
254                                            '  '
255                                    }
256                          } @mem[ $a .. $a+8 ]                          } @mem[ $a .. $a+8 ]
257                  )                  )
258          );          );
# Line 300  sub write { Line 304  sub write {
304          }          }
305    
306          if ( $addr > 0xafff ) {          if ( $addr > 0xafff ) {
307                  confess sprintf "write access 0x%04x > 0xafff aborting\n", $addr;                  warn sprintf "write access 0x%04x > 0xafff aborting\n", $addr;
308                    return;
309          }          }
310    
311          $self->mmap_pixel( $addr, $byte, 0, 0 );          $self->mmap_pixel( $addr, $byte, 0, 0 );
# Line 343  sub prompt { Line 348  sub prompt {
348    
349  =cut  =cut
350    
351    my $show_R = 0;
352    
353  sub cli {  sub cli {
354          my $self = shift;          my $self = shift;
355          my $a = $PC || confess "no pc?";          my $a = $PC || confess "no pc?";
356            warn $self->dump_R() if $show_R;
357          while ( my ($line, @v) = $self->prompt( $a, $last ) ) {          while ( my ($line, @v) = $self->prompt( $a, $last ) ) {
358                  my $c = shift @v;                  my $c = shift @v;
359                  next unless defined($c);                  next unless defined($c);
# Line 370  t\t\ttrace [$t] Line 378  t\t\ttrace [$t]
378  d\t\tdebug [$d]  d\t\tdebug [$d]
379    
380  __USAGE__  __USAGE__
381                          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;
382                  } elsif ( $c =~ m/^e/i ) {                  } elsif ( $c =~ m/^e/i ) {
383                          $a = $v if defined($v);                          $a = $v if defined($v);
384                          my $to = shift @v;                          my $to = shift @v;
385                          $to = $a + 32 if ( ! $to || $to <= $a );                          $to = $a + 32 if ( ! $to || $to <= $a );
386                            $to = 0xffff if ( $to > 0xffff );
387                          my $lines = int( ($to - $a + 8) / 8 );                          my $lines = int( ($to - $a + 8) / 8 );
388                          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;
389                          while ( --$lines ) {                          while ( --$lines ) {
# Line 382  __USAGE__ Line 391  __USAGE__
391                                  $a += 8;                                  $a += 8;
392                          }                          }
393                          $last = '+';                          $last = '+';
394                            $show_R = 0;
395                  } elsif ( $c =~ m/^\+/ ) {                  } elsif ( $c =~ m/^\+/ ) {
396                          $a += 8;                          $a += 8;
397                            $show_R = 0;
398                  } elsif ( $c =~ m/^\-/ ) {                  } elsif ( $c =~ m/^\-/ ) {
399                          $a -= 8;                          $a -= 8;
400                            $show_R = 0;
401                  } elsif ( $c =~ m/^m/i ) {                  } elsif ( $c =~ m/^m/i ) {
402                          $a = $v;                          $a = $v if defined($v);
403                          $self->poke_code( $a, @v );                          $self->poke_code( $a, @v );
404                          printf "poke %d bytes at %04x\n", $#v + 1, $a;                          printf "poke %d bytes at %04x\n", $#v + 1, $a;
405                          $last = '+';                          $last = '+';
406                            $show_R = 0;
407                  } elsif ( $c =~ m/^l/i ) {                  } elsif ( $c =~ m/^l/i ) {
408                          my $to = shift @v || 0x1000;                          my $to = shift @v || 0x1000;
409                          $a = $to;                          $a = $to;
# Line 402  __USAGE__ Line 415  __USAGE__
415                  } elsif ( $c =~ m/^r/i ) {                  } elsif ( $c =~ m/^r/i ) {
416                          $run_for = $v || 1;                          $run_for = $v || 1;
417                          print "run_for $run_for instructions\n";                          print "run_for $run_for instructions\n";
418                            $show_R = 1;
419                          last;                          last;
420                  } elsif ( $c =~ m/^(u|j)/ ) {                  } elsif ( $c =~ m/^(u|j)/ ) {
421                          my $to = $v || $a;                          my $to = $v || $a;
# Line 409  __USAGE__ Line 423  __USAGE__
423                          $PC = $to;      # remember for restart                          $PC = $to;      # remember for restart
424                          $run_for = 1;                          $run_for = 1;
425                          $last = "r $run_for";                          $last = "r $run_for";
426                            $show_R = 1;
427                          last;                          last;
428                  } elsif ( $c =~ m/^t/ ) {                  } elsif ( $c =~ m/^t/ ) {
429                          $self->trace( not $self->trace );                          $self->trace( not $self->trace );

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

  ViewVC Help
Powered by ViewVC 1.1.26