300 |
} |
} |
301 |
|
|
302 |
if ( $addr > 0xafff ) { |
if ( $addr > 0xafff ) { |
303 |
confess sprintf "write access 0x%04x > 0xafff aborting\n", $addr; |
warn sprintf "write access 0x%04x > 0xafff aborting\n", $addr; |
304 |
|
return; |
305 |
} |
} |
306 |
|
|
307 |
$self->mmap_pixel( $addr, $byte, 0, 0 ); |
$self->mmap_pixel( $addr, $byte, 0, 0 ); |
344 |
|
|
345 |
=cut |
=cut |
346 |
|
|
347 |
|
my $show_R = 0; |
348 |
|
|
349 |
sub cli { |
sub cli { |
350 |
my $self = shift; |
my $self = shift; |
351 |
my $a = $PC || confess "no pc?"; |
my $a = $PC || confess "no pc?"; |
352 |
|
warn $self->dump_R() if $show_R; |
353 |
while ( my ($line, @v) = $self->prompt( $a, $last ) ) { |
while ( my ($line, @v) = $self->prompt( $a, $last ) ) { |
354 |
my $c = shift @v; |
my $c = shift @v; |
355 |
next unless defined($c); |
next unless defined($c); |
374 |
d\t\tdebug [$d] |
d\t\tdebug [$d] |
375 |
|
|
376 |
__USAGE__ |
__USAGE__ |
377 |
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; |
378 |
} elsif ( $c =~ m/^e/i ) { |
} elsif ( $c =~ m/^e/i ) { |
379 |
$a = $v if defined($v); |
$a = $v if defined($v); |
380 |
my $to = shift @v; |
my $to = shift @v; |
386 |
$a += 8; |
$a += 8; |
387 |
} |
} |
388 |
$last = '+'; |
$last = '+'; |
389 |
|
$show_R = 0; |
390 |
} elsif ( $c =~ m/^\+/ ) { |
} elsif ( $c =~ m/^\+/ ) { |
391 |
$a += 8; |
$a += 8; |
392 |
|
$show_R = 0; |
393 |
} elsif ( $c =~ m/^\-/ ) { |
} elsif ( $c =~ m/^\-/ ) { |
394 |
$a -= 8; |
$a -= 8; |
395 |
|
$show_R = 0; |
396 |
} elsif ( $c =~ m/^m/i ) { |
} elsif ( $c =~ m/^m/i ) { |
397 |
$a = $v; |
$a = $v if defined($v); |
398 |
$self->poke_code( $a, @v ); |
$self->poke_code( $a, @v ); |
399 |
printf "poke %d bytes at %04x\n", $#v + 1, $a; |
printf "poke %d bytes at %04x\n", $#v + 1, $a; |
400 |
$last = '+'; |
$last = '+'; |
401 |
|
$show_R = 0; |
402 |
} elsif ( $c =~ m/^l/i ) { |
} elsif ( $c =~ m/^l/i ) { |
403 |
my $to = shift @v || 0x1000; |
my $to = shift @v || 0x1000; |
404 |
$a = $to; |
$a = $to; |
410 |
} elsif ( $c =~ m/^r/i ) { |
} elsif ( $c =~ m/^r/i ) { |
411 |
$run_for = $v || 1; |
$run_for = $v || 1; |
412 |
print "run_for $run_for instructions\n"; |
print "run_for $run_for instructions\n"; |
413 |
|
$show_R = 1; |
414 |
last; |
last; |
415 |
} elsif ( $c =~ m/^(u|j)/ ) { |
} elsif ( $c =~ m/^(u|j)/ ) { |
416 |
my $to = $v || $a; |
my $to = $v || $a; |
417 |
printf "set pc to %04x\n", $to; |
printf "set pc to %04x\n", $to; |
418 |
$PC = $to; # remember for restart |
$PC = $to; # remember for restart |
419 |
$run_for = 1; |
$run_for = 1; |
420 |
$last = sprintf('m %04x', $to); |
$last = "r $run_for"; |
421 |
|
$show_R = 1; |
422 |
last; |
last; |
423 |
} elsif ( $c =~ m/^t/ ) { |
} elsif ( $c =~ m/^t/ ) { |
424 |
$self->trace( not $self->trace ); |
$self->trace( not $self->trace ); |
425 |
print "trace ", $self->trace ? 'on' : 'off', "\n"; |
print "trace ", $self->trace ? 'on' : 'off', "\n"; |
426 |
|
$last = ''; |
427 |
} elsif ( $c =~ m/^d/ ) { |
} elsif ( $c =~ m/^d/ ) { |
428 |
$self->debug( not $self->debug ); |
$self->debug( not $self->debug ); |
429 |
print "debug ", $self->debug ? 'on' : 'off', "\n"; |
print "debug ", $self->debug ? 'on' : 'off', "\n"; |
430 |
|
$last = ''; |
431 |
} else { |
} else { |
432 |
warn "# ignored $line\n" if ($line); |
warn "# ignored $line\n" if ($line); |
433 |
$last = ''; |
$last = ''; |