/[VRac]/Tape.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Tape.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 110 by dpavlin, Fri Aug 3 12:21:47 2007 UTC revision 114 by dpavlin, Fri Aug 3 20:01:51 2007 UTC
# Line 33  sub _warn { Line 33  sub _warn {
33          }          }
34  }  }
35    
36  my $loop;  my @tape_bits;
37    
38  sub read_tape {  sub read_tape {
39          my $self = shift;          my $self = shift;
# Line 47  sub read_tape { Line 47  sub read_tape {
47                  _warn "end of tape [$pos]";                  _warn "end of tape [$pos]";
48                  return -1;                  return -1;
49          }          }
         my $byte = ord(substr($self->tape,$pos,1));  
50    
51          if ( ++$loop % $self->tape_rate == 0 ) {          if ( ! @tape_bits ) {
52                    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);
54    
55                  $pos++;                  $pos++;
56                  $self->tape_pos( $pos );                  $self->tape_pos( $pos );
57    
58                    @tape_bits = split(//, unpack("B8",$byte) );
59          }          }
60          return $byte;          my $bit = shift @tape_bits ? 0xff : 0x00;
61            warn "\t$bit\n";
62            return $bit;
63  }  }
64    
65  =head2 load_tape  =head2 load_tape

Legend:
Removed from v.110  
changed lines
  Added in v.114

  ViewVC Help
Powered by ViewVC 1.1.26