6 |
use warnings; |
use warnings; |
7 |
|
|
8 |
use base qw/Class::Accessor/; |
use base qw/Class::Accessor/; |
9 |
__PACKAGE__->mk_accessors(qw(tape tape_pos tape_rate)); |
__PACKAGE__->mk_accessors(qw(tape tape_pos tape_rate trace)); |
10 |
|
|
11 |
use File::Slurp; |
use File::Slurp; |
12 |
use Carp qw/confess/; |
use Carp qw/confess/; |
50 |
|
|
51 |
if ( ! @tape_bits ) { |
if ( ! @tape_bits ) { |
52 |
my $byte = ord( substr($self->tape,$pos,1) ); |
my $byte = ord( substr($self->tape,$pos,1) ); |
53 |
warn sprintf("tape pos %d = %02x\n", $pos, $byte); |
warn sprintf("tape pos %d = %02x\n", $pos, $byte) if $self->trace; |
54 |
|
|
55 |
$pos++; |
$pos++; |
56 |
$self->tape_pos( $pos ); |
$self->tape_pos( $pos ); |
58 |
@tape_bits = split(//, unpack("B8",$byte) ); |
@tape_bits = split(//, unpack("B8",$byte) ); |
59 |
} |
} |
60 |
my $bit = shift @tape_bits ? 0xff : 0x00; |
my $bit = shift @tape_bits ? 0xff : 0x00; |
61 |
warn "\t$bit\n"; |
warn "\t$bit\n" if $self->trace; |
62 |
return $bit; |
return $bit; |
63 |
} |
} |
64 |
|
|