--- M6502/Orao.pm 2007/07/31 10:16:36 47 +++ M6502/Orao.pm 2007/07/31 10:52:06 49 @@ -62,8 +62,9 @@ # $self->prompt( 0x1000 ); - my $trace = $self->trace; + my ( $trace, $debug ) = ( $self->trace, $self->debug ); $self->trace( 0 ); + $self->debug( 0 ); if ( $self->show_mem ) { @@ -104,10 +105,14 @@ } $self->sync; $self->trace( $trace ); + $self->debug( $debug ); #( $A, $P, $X, $Y, $S, $IPeriod ) = ( 1, 2, 3, 4, 5, 6 ); - warn "Orao init finished", $self->trace ? ' trace on' : '', "\n"; + warn "Orao init finished", + $self->trace ? ' trace' : '', + $self->debug ? ' debug' : '', + "\n"; } @@ -252,6 +257,7 @@ "> "; my $in = ; chomp($in); + warn "## prompt got: $in\n" if $self->debug; $in ||= $last; $last = $in; return split(/\s+/, $in) if $in; @@ -332,8 +338,8 @@ my $c = shift @v; my $v = shift @v; $v = hex($v) if $v && $v =~ m/^[0-9a-f]+$/; - printf "## [%s] %s\n", ($v || 'undef'), join(",",@v) if $self->debug; @v = map { hex($_) } @v; + printf "## a: %04x parsed cli: c:%s v:%s %s\n", $a, $c, ($v || 'undef'), join(",",@v) if $self->debug; if ( $c =~ m/^[qx]/i ) { exit; } elsif ( $c eq '?' ) { @@ -344,9 +350,11 @@ m 1000 ff 00\tput ff 00 on 1000 j|u 1000\t\tjump (change pc) r 42\t\trun 42 instruction opcodes +t\t\ttrace on/off +d\t\tdebug on/off __USAGE__ } elsif ( $c =~ m/^e/i ) { - $a ||= $v; + $a = $v if defined($v); my $to = shift @v; $to = $a + 32 if ( ! $to || $to <= $a ); my $lines = int( ($to - $a - 8) / 8 ); @@ -384,6 +392,9 @@ } elsif ( $c =~ m/^t/ ) { $self->trace( not $self->trace ); print "trace ", $self->trace ? 'on' : 'off', "\n"; + } elsif ( $c =~ m/^d/ ) { + $self->debug( not $self->debug ); + print "debug ", $self->debug ? 'on' : 'off', "\n"; } else { warn "# ignore $c\n"; last;