|
Acme::6502 - Pure Perl 65C02 simulator. |
Acme::6502 - Pure Perl 65C02 simulator.
This document describes Acme::6502 version 0.0.6
use Acme::6502;
my $cpu = Acme::6502->new();
# Set start address
$cpu->set_pc(0x8000);
# Load ROM image
$cpu->load_rom('myrom.rom', 0x8000);
# Run for 1,000,000 instructions then return
$cpu->run(1_000_000);
=head1 DESCRIPTION
Imagine the nightmare scenario: your boss tells you about a legacy system you have to support. How bad could it be? COBOL? Fortran? Worse: it's an embedded 6502 system run by a family of squirrels (see Dilberts passim). Fortunately there's a pure Perl 6502 emulator that works so well the squirrels will never know the difference.
call_os( $vec_number )make_vector. When the vector is called call_os() will be called
with the vector number.
get_a()get_p()get_pc()get_s()get_x()get_y()get_xy()get_state()set_a( $value )set_p( $value )set_pc( $value )set_s( $value )set_x( $value )set_y( $value )set_xy( $value )set_jumptab( $addr )load_rom( $filename, $addr )make_vector( $jmp_addr, $vec_addr, $vec_number )$jmp_addr is the
address where an indirect JMP instruction (6C) will be placed,
$vec_addr is the address of the vector and $vec_number will be
passed to call_os when the OS call is made.
poke_code( $addr, @bytes )read_8( $addr )read_16( $addr )read_32( $addr )read_chunk( $start, $end )$start to $end - 1 into a string.
read_str( $addr )run( $count [, $callback ] )
my $cb = sub {
my ($pc, $inst, $a, $x, $y, $s, $p) = @_;
# Maybe output trace info
}
$cpu->run(100, $cb);
write_8( $addr, $value )write_16( $addr, $value )write_32( $addr, $value )write_chunk( $addr, $string )
Bad instruction at %s (%s)
Acme::6502 requires no configuration files or environment variables.
Acme::6502 needs Class::Std.
None reported.
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
bug-acme-6502@rt.cpan.org, or through the web interface at
http://rt.cpan.org.
Andy Armstrong <andy@hexten.net>
Copyright (c) 2006, Andy Armstrong <andy@hexten.net>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See the perlartistic manpage.
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
Acme::6502 - Pure Perl 65C02 simulator. |