/[VRac]/M6502/M6502.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /M6502/M6502.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 26 by dpavlin, Mon Jul 30 14:23:22 2007 UTC revision 27 by dpavlin, Mon Jul 30 15:45:03 2007 UTC
# Line 3  package M6502; Line 3  package M6502;
3  use strict;  use strict;
4  use warnings;  use warnings;
5    
6    use Data::Dump qw/dump/;
7    
8  # Dobrica Pavlinusic, <dpavlin@rot13.org> 07/30/07 13:23:19 CEST  # Dobrica Pavlinusic, <dpavlin@rot13.org> 07/30/07 13:23:19 CEST
9  #  #
10  # Simple Orao emulation  # Simple Orao emulation
11    
12  my $mem = (0) x 0x10000;        # 64M  my $debug = 1;
13    
14    my @mem = (0x42) x 0x10000;     # 64M
15    
16  # program counter  # program counter
17  our $PC = 0xbeef;  our $PC = 0xbeef;
18  # CPU registars  # CPU registars
19  our ( $A, $P, $X, $Y, $S ) = (0) x 5;  our ( $A, $P, $X, $Y, $S ) = (0) x 5;
20  # Set IPeriod to number of CPU cycles between calls to Loop6502  # Set IPeriod to number of CPU cycles between calls to Loop6502
21  our $IPeriod = 20000;  our $IPeriod = 1;
22    
23  =head1 init  =head1 init
24    
# Line 26  sub init { Line 30  sub init {
30          warn "inside init\n";          warn "inside init\n";
31          print "stdout\n";          print "stdout\n";
32  };  };
33    
34    =head2 read
35    
36    Read from memory
37    
38      $byte = read( $address );
39    
40    =cut
41    
42    sub read {
43            my ($addr) = @_;
44            my $byte = $mem[$addr];
45            warn "# read(",dump(@_),") = ",dump( $byte ),"\n" if $debug;
46            return $byte;
47    }
48    
49    =head2 write
50    
51    Write into emory
52    
53      write( $address, $byte );
54    
55    =cut
56    
57    sub write {
58            warn "# write(",dump(@_),")\n" if $debug;
59            my ($addr,$byte) = @_;
60            $mem[$addr] = $byte;
61    }
62  1;  1;

Legend:
Removed from v.26  
changed lines
  Added in v.27

  ViewVC Help
Powered by ViewVC 1.1.26