--- M6502/M6502.pm 2007/07/30 14:23:22 26 +++ M6502/M6502.pm 2007/07/30 15:45:03 27 @@ -3,18 +3,22 @@ use strict; use warnings; +use Data::Dump qw/dump/; + # Dobrica Pavlinusic, 07/30/07 13:23:19 CEST # # Simple Orao emulation -my $mem = (0) x 0x10000; # 64M +my $debug = 1; + +my @mem = (0x42) x 0x10000; # 64M # program counter our $PC = 0xbeef; # CPU registars our ( $A, $P, $X, $Y, $S ) = (0) x 5; # Set IPeriod to number of CPU cycles between calls to Loop6502 -our $IPeriod = 20000; +our $IPeriod = 1; =head1 init @@ -26,4 +30,33 @@ warn "inside init\n"; print "stdout\n"; }; + +=head2 read + +Read from memory + + $byte = read( $address ); + +=cut + +sub read { + my ($addr) = @_; + my $byte = $mem[$addr]; + warn "# read(",dump(@_),") = ",dump( $byte ),"\n" if $debug; + return $byte; +} + +=head2 write + +Write into emory + + write( $address, $byte ); + +=cut + +sub write { + warn "# write(",dump(@_),")\n" if $debug; + my ($addr,$byte) = @_; + $mem[$addr] = $byte; +} 1;