5 |
|
|
6 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
7 |
use Carp qw/confess/; |
use Carp qw/confess/; |
8 |
|
use Exporter 'import'; |
9 |
|
our @EXPORT = qw'@mem'; |
10 |
|
|
11 |
=head1 NAME |
=head1 NAME |
12 |
|
|
23 |
# program counter |
# program counter |
24 |
our $PC = 0xbeef; |
our $PC = 0xbeef; |
25 |
# CPU registars |
# CPU registars |
26 |
our ( $A, $P, $X, $Y, $S ) = (0) x 5; |
our ( $A, $P, $X, $Y, $S ) = (0x42) x 5; |
27 |
# Set IPeriod to number of CPU cycles between calls to Loop6502 |
# Set IPeriod to number of CPU cycles between calls to Loop6502 |
28 |
our $IPeriod = 1; |
our $IPeriod = 1; |
29 |
|
|
34 |
=cut |
=cut |
35 |
|
|
36 |
sub init { |
sub init { |
37 |
warn "inside init\n"; |
my $self = shift; |
38 |
print "stdout\n"; |
warn dump(@_); |
39 |
|
warn "inside init low-level M6502 from $self\n"; |
40 |
}; |
}; |
41 |
|
|
42 |
=head2 read |
=head2 read |
83 |
$mem[$addr++] = $_ foreach @_; |
$mem[$addr++] = $_ foreach @_; |
84 |
} |
} |
85 |
|
|
86 |
|
=head2 write_chunk |
87 |
|
|
88 |
|
$emu->write_chunk( $address, $chunk_of_data ); |
89 |
|
|
90 |
|
=cut |
91 |
|
|
92 |
|
sub write_chunk { |
93 |
|
my ($self, $addr, $chunk) = @_; |
94 |
|
my $len = length($chunk); |
95 |
|
splice @mem, $addr, $len, unpack('C*', $chunk); |
96 |
|
} |
97 |
|
|
98 |
=head2 ram |
=head2 ram |
99 |
|
|
100 |
Read searies of bytes from memory without passing through MMU |
Read searies of bytes from memory without passing through MMU |