--- M6502/Orao.pm 2007/07/31 16:22:10 61 +++ M6502/Orao.pm 2007/07/31 17:34:52 70 @@ -300,7 +300,8 @@ } if ( $addr > 0xafff ) { - confess sprintf "write access 0x%04x > 0xafff aborting\n", $addr; + warn sprintf "write access 0x%04x > 0xafff aborting\n", $addr; + return; } $self->mmap_pixel( $addr, $byte, 0, 0 ); @@ -343,9 +344,12 @@ =cut +my $show_R = 0; + sub cli { my $self = shift; my $a = $PC || confess "no pc?"; + warn $self->dump_R() if $show_R; while ( my ($line, @v) = $self->prompt( $a, $last ) ) { my $c = shift @v; next unless defined($c); @@ -370,7 +374,7 @@ d\t\tdebug [$d] __USAGE__ - 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; } elsif ( $c =~ m/^e/i ) { $a = $v if defined($v); my $to = shift @v; @@ -382,15 +386,19 @@ $a += 8; } $last = '+'; + $show_R = 0; } elsif ( $c =~ m/^\+/ ) { $a += 8; + $show_R = 0; } elsif ( $c =~ m/^\-/ ) { $a -= 8; + $show_R = 0; } elsif ( $c =~ m/^m/i ) { - $a = $v; + $a = $v if defined($v); $self->poke_code( $a, @v ); printf "poke %d bytes at %04x\n", $#v + 1, $a; $last = '+'; + $show_R = 0; } elsif ( $c =~ m/^l/i ) { my $to = shift @v || 0x1000; $a = $to; @@ -402,20 +410,24 @@ } elsif ( $c =~ m/^r/i ) { $run_for = $v || 1; print "run_for $run_for instructions\n"; + $show_R = 1; last; } elsif ( $c =~ m/^(u|j)/ ) { my $to = $v || $a; printf "set pc to %04x\n", $to; $PC = $to; # remember for restart $run_for = 1; - $last = sprintf('m %04x', $to); + $last = "r $run_for"; + $show_R = 1; last; } elsif ( $c =~ m/^t/ ) { $self->trace( not $self->trace ); print "trace ", $self->trace ? 'on' : 'off', "\n"; + $last = ''; } elsif ( $c =~ m/^d/ ) { $self->debug( not $self->debug ); print "debug ", $self->debug ? 'on' : 'off', "\n"; + $last = ''; } else { warn "# ignored $line\n" if ($line); $last = '';