19 |
our @mem = (0xff) x 0x10000; # 64M |
our @mem = (0xff) x 0x10000; # 64M |
20 |
|
|
21 |
# program counter |
# program counter |
22 |
our $PC = 0xbeef; |
our $PC = 0xdd11; |
23 |
# CPU registars |
# CPU registars |
24 |
our ( $A, $P, $X, $Y, $S ) = (0) x 5; |
our ( $A, $P, $X, $Y, $S ) = (0) x 5; |
25 |
# Set IPeriod to number of CPU cycles between calls to Loop6502 |
# Set IPeriod to number of CPU cycles between calls to Loop6502 |
32 |
=cut |
=cut |
33 |
|
|
34 |
sub init { |
sub init { |
35 |
warn "inside init\n"; |
my $self = shift; |
36 |
print "stdout\n"; |
warn dump(@_); |
37 |
|
warn "inside init low-level M6502 from $self\n"; |
38 |
}; |
}; |
39 |
|
|
40 |
=head2 read |
=head2 read |
81 |
$mem[$addr++] = $_ foreach @_; |
$mem[$addr++] = $_ foreach @_; |
82 |
} |
} |
83 |
|
|
84 |
|
=head2 write_chunk |
85 |
|
|
86 |
|
$emu->write_chunk( $address, $chunk_of_data ); |
87 |
|
|
88 |
|
=cut |
89 |
|
|
90 |
|
sub write_chunk { |
91 |
|
my ($self, $addr, $chunk) = @_; |
92 |
|
my $len = length($chunk); |
93 |
|
splice @mem, $addr, $len, unpack('C*', $chunk); |
94 |
|
} |
95 |
|
|
96 |
=head2 ram |
=head2 ram |
97 |
|
|
98 |
Read searies of bytes from memory without passing through MMU |
Read searies of bytes from memory without passing through MMU |