Acme-6502
view release on metacpan or search on metacpan
inc/MyBuilder.pm view on Meta::CPAN
t/ lib/
)
);
}
sub ACTION_tidy {
my $self = shift;
my @extra = qw( Build.PL );
my %found_files = map { %$_ } $self->find_pm_files,
$self->_find_file_by_type( 'pm', 't' ),
$self->_find_file_by_type( 'pm', 'inc' ),
$self->_find_file_by_type( 't', 't' );
my @files = ( keys %found_files,
map { $self->localize_file_path( $_ ) } @extra );
for my $file ( @files ) {
system 'perltidy', '-b', $file;
unlink "$file.bak" if $? == 0;
}
}
1;
lib/Acme/6502.pm view on Meta::CPAN
my @OP_CACHE;
sub _BUILD {
my( $self, $args ) = @_;
$args ||= {};
$self->{ mem } = [ ( 0 ) x 65536 ];
$self->{ reg } = {
map { $_ => 0 } qw( a x y s p pc )
};
$self->{ os } = [ ];
$self->{ jumptab } = $args->{ jumptab } || 0xFA00;
$self->{ zn } = [ $self->Z, ( 0 ) x 127, ( $self->N ) x 128 ];
my $bad_inst = $self->can( '_bad_inst' );
@OP_CACHE = (
_inst( # 00 BRK
_push( '($pc + 1) >> 8', '($pc + 1)' ),
lib/Acme/6502.pm view on Meta::CPAN
=head1 DEPENDENCIES
None.
=head1 INCOMPATIBILITIES
None reported.
=head1 BUGS AND LIMITATIONS
Doesn't have support for hardware emulation hooks - so memory mapped I/O
is out of the question until someone fixes it.
Please report any bugs or feature requests to
C<bug-acme-6502@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
Andy Armstrong C<< <andy@hexten.net> >>
lib/Acme/6502/Tube.pm view on Meta::CPAN
my $blk = $self->get_xy();
if ( $a == 0x00 ) {
# Command line input
my $buf = $self->read_16( $blk );
my $len = $self->read_8( $blk + 2 );
my $min = $self->read_8( $blk + 3 );
my $max = $self->read_8( $blk + 4 );
my $y = 0;
if ( defined( my $in = <> ) ) {
my @c = map ord, split //, $in;
while ( @c && $len-- > 1 ) {
my $c = shift @c;
if ( $c >= $min && $c <= $max ) {
$self->write_8( $buf + $y++, $c );
}
}
$self->write_8( $buf + $y++, 0x0D );
$self->set_y( $y );
$self->set_p( $self->get_p() & ~$self->C );
}
lib/Acme/6502/Tube.pm view on Meta::CPAN
};
if ( $@ ) {
my $err = $@;
$self->write_16( ERROR, 0x7F00 );
$err =~ s/\s+/ /;
$err =~ s/^\s+//;
$err =~ s/\s+$//;
warn $err;
my $ep = ERROR + 2;
for ( map ord, split //, $err ) {
$self->write_8( $ep++, $_ );
}
$self->write_8( $ep++, 0x00 );
$self->set_pc( ERROR );
}
}
1;
__END__
t/monkeynes.t view on Meta::CPAN
$cmp, hex $3, "$1 $2 $3" );
}
elsif ( m{^op (.+)} ) {
my ( $op, $args_hex ) = split( ' ', $1 );
_diag( "OP: $1" );
$args_hex = '' unless defined $args_hex;
my @args = ( $args_hex =~ m{(..)}g );
my $pc = hex( 8000 );
$cpu->poke_code(
$pc,
map { hex( $_ || 0 ) } $op,
@args[ 0 .. 1 ]
);
$cpu->set_pc( $pc );
$cpu->run( 1 );
}
else {
use Data::Dumper;
warn Dumper $_;
}
}
( run in 1.651 second using v1.01-cache-2.11-cpan-140bd7fdf52 )