10 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
11 |
use M6502; |
use M6502; |
12 |
|
|
13 |
use base qw(Class::Accessor M6502 Screen Prefs); |
use base qw(Class::Accessor M6502 Screen Prefs Tape); |
14 |
__PACKAGE__->mk_accessors(qw(booted)); |
__PACKAGE__->mk_accessors(qw(booted)); |
15 |
|
|
16 |
=head1 NAME |
=head1 NAME |
131 |
my $self = shift; |
my $self = shift; |
132 |
|
|
133 |
$self->boot if ( ! $self->booted ); |
$self->boot if ( ! $self->booted ); |
134 |
|
|
135 |
|
$self->load_tape( '../oraoigre/bdash.tap' ); |
136 |
|
|
137 |
$self->loop; |
$self->loop; |
138 |
}; |
}; |
139 |
|
|
330 |
} elsif ( $self->key_down( 'left shift' ) || $self->key_down( 'right shift' ) ) { |
} elsif ( $self->key_down( 'left shift' ) || $self->key_down( 'right shift' ) ) { |
331 |
warn "shift\n"; |
warn "shift\n"; |
332 |
return 16; |
return 16; |
333 |
|
# } elsif ( $self->tape ) { |
334 |
|
# warn "has tape!"; |
335 |
|
# return 0; |
336 |
} |
} |
337 |
return $keyboard_none; |
return $keyboard_none; |
338 |
}, |
}, |
449 |
return $keyboard_none; |
return $keyboard_none; |
450 |
} |
} |
451 |
|
|
452 |
|
if ( $addr == 0x87ff ) { |
453 |
|
return $self->read_tape; |
454 |
|
} |
455 |
|
|
456 |
$self->mmap_pixel( $addr, 0, $byte, 0 ); |
$self->mmap_pixel( $addr, 0, $byte, 0 ); |
457 |
return $byte; |
return $byte; |
458 |
} |
} |
584 |
} elsif ( $c =~ m/^s/i ) { |
} elsif ( $c =~ m/^s/i ) { |
585 |
$self->save_dump( $v || 'mem.dump', @v ); |
$self->save_dump( $v || 'mem.dump', @v ); |
586 |
$last = ''; |
$last = ''; |
587 |
} elsif ( $c =~ m/^r/i ) { |
} elsif ( $c =~ m/^re/i ) { # reset |
588 |
|
M6502::reset(); |
589 |
|
$last = 'r 1'; |
590 |
|
} elsif ( $c =~ m/^r/i ) { # run |
591 |
$run_for = $v || 1; |
$run_for = $v || 1; |
592 |
print "run_for $run_for instructions\n"; |
print "run_for $run_for instructions\n"; |
593 |
$show_R = 1; |
$show_R = 1; |
594 |
last; |
last; |
595 |
} elsif ( $c =~ m/^(u|j)/ ) { |
} elsif ( $c =~ m/^(u|j)/i ) { |
596 |
my $to = $v || $a; |
my $to = $v || $a; |
597 |
printf "set pc to %04x\n", $to; |
printf "set pc to %04x\n", $to; |
598 |
$PC = $to; # remember for restart |
$PC = $to; # remember for restart |
600 |
$last = "r $run_for"; |
$last = "r $run_for"; |
601 |
$show_R = 1; |
$show_R = 1; |
602 |
last; |
last; |
603 |
} elsif ( $c =~ m/^t/ ) { |
} elsif ( $c =~ m/^tape/ ) { |
604 |
|
if ( $c =~ m/rate/ ) { |
605 |
|
$self->tape_rate( $v ); |
606 |
|
warn "will read table with rate $v\n"; |
607 |
|
} elsif ( ! $v ) { |
608 |
|
warn "ERROR: please specify tape name!\n"; |
609 |
|
} elsif ( ! -e $v ) { |
610 |
|
warn "ERROR: tape $v: $!\n"; |
611 |
|
} else { |
612 |
|
$self->load_tape( $v ); |
613 |
|
} |
614 |
|
$last = ''; |
615 |
|
} elsif ( $c =~ m/^t/i ) { |
616 |
$self->trace( not $self->trace ); |
$self->trace( not $self->trace ); |
617 |
print "trace ", $self->trace ? 'on' : 'off', "\n"; |
print "trace ", $self->trace ? 'on' : 'off', "\n"; |
618 |
$last = ''; |
$last = ''; |
619 |
} elsif ( $c =~ m/^d/ ) { |
} elsif ( $c =~ m/^d/i ) { |
620 |
$self->debug( not $self->debug ); |
$self->debug( not $self->debug ); |
621 |
print "debug ", $self->debug ? 'on' : 'off', "\n"; |
print "debug ", $self->debug ? 'on' : 'off', "\n"; |
622 |
$last = ''; |
$last = ''; |