/[VRac]/Galaksija.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 /Galaksija.pm

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

revision 131 by dpavlin, Sat Aug 4 20:50:33 2007 UTC revision 139 by dpavlin, Sat Aug 4 23:01:25 2007 UTC
# Line 43  sub run { Line 43  sub run {
43          warn "Galaksija $Galaksija::VERSION emulation starting\n";          warn "Galaksija $Galaksija::VERSION emulation starting\n";
44    
45          $self->show_mem( 1 );          $self->show_mem( 1 );
46          $self->trace( 1 );          #$self->trace( 1 );
47    
48          $self->SUPER::init(          $self->SUPER::init(
49                  read => sub { $self->read( @_ ) },                  read => sub { $self->read( @_ ) },
# Line 65  sub run { Line 65  sub run {
65          $mem[$_] = 0xff foreach ( 0x2000 .. 0x2800 );          $mem[$_] = 0xff foreach ( 0x2000 .. 0x2800 );
66    
67          # display          # display
68          $mem[$_] = ' '  foreach ( 0x2800 .. 0x2a00 );          $mem[$_] = 0x20 foreach ( 0x2800 .. 0x2a00 );
69    
70          # 6116-ice          # 6116-ice
71          $mem[$_] = 0    foreach ( 0x2a00 .. 0x4000 );          $mem[$_] = 0    foreach ( 0x2a00 .. 0x4000 );
# Line 76  sub run { Line 76  sub run {
76          $self->trace( 0 );          $self->trace( 0 );
77          $self->debug( 0 );          $self->debug( 0 );
78    
79          warn "rendering video memory\n";          warn "rendering memory\n";
80          #$self->render_vram( @mem[ 0x2800 .. 0x2a00 ] );          $self->render_mem( @mem );
81    
82          #$self->sync;          #$self->sync;
83          $self->trace( $trace );          $self->trace( $trace );
# Line 92  sub run { Line 92  sub run {
92    
93          $self->loop( sub {          $self->loop( sub {
94                  Z80::exec( $_[0] );                  Z80::exec( $_[0] );
95                  #$self->render_vram;                  $self->render_vram;
96          });          });
97    
98  }  }
# Line 100  sub run { Line 100  sub run {
100    
101  =head1 Memory management  =head1 Memory management
102    
 Galaksija implements all I/O using mmap addresses. This was main reason why  
 L<Acme::6502> was just too slow to handle it.  
   
103  =cut  =cut
104    
105  =head2 read  =head2 read
# Line 124  sub read { Line 121  sub read {
121          confess sprintf("can't find memory at address %04x",$addr) unless defined($byte);          confess sprintf("can't find memory at address %04x",$addr) unless defined($byte);
122          warn sprintf("# Galaksija::read(%04x) = %02x\n", $addr, $byte) if $self->trace;          warn sprintf("# Galaksija::read(%04x) = %02x\n", $addr, $byte) if $self->trace;
123    
124            $self->mmap_pixel( $addr, 0, $byte, 0 ) if $self->show_mem;
125          return $byte;          return $byte;
126  }  }
127    
# Line 140  sub write { Line 138  sub write {
138          my ($addr,$byte) = @_;          my ($addr,$byte) = @_;
139          warn sprintf("# Galaksija::write(%04x,%02x)\n", $addr, $byte) if $self->trace;          warn sprintf("# Galaksija::write(%04x,%02x)\n", $addr, $byte) if $self->trace;
140    
141            $self->mmap_pixel( $addr, $byte, 0, 0 ) if $self->show_mem;
142          $mem[$addr] = $byte;          $mem[$addr] = $byte;
143          return;          return;
144  }  }
145    
146    =head1 Architecture specific
147    
148    =head2 render_vram
149    
150    Simple hex dumper of text buffer
151    
152    =cut
153    
154    my $last_dump = '';
155    
156    sub render_vram {
157            my $self = shift;
158    
159            my $addr = 0x2800;
160    
161            my $dump;
162    
163            for my $y ( 0 .. 15 ) {
164                    $dump .= sprintf "%2d: %s\n",$y, join('', map { sprintf("%02x ",$_) } @mem[ $addr .. $addr+31 ] );
165                    $addr += 32;
166            }
167            if ( $dump ne $last_dump ) {
168                    print $dump;
169                    $last_dump = $dump;
170            }
171    }
172    
173  =head2 cpu_PC  =head2 cpu_PC
174    
175  Helper metod to set or get PC for current architecture  Helper metod to set or get PC for current architecture
# Line 159  sub cpu_PC { Line 185  sub cpu_PC {
185          return $PC;          return $PC;
186  }  }
187    
188    =head1 SEE ALSO
189    
190    L<VRac>, L<Screen>, L<Z80>
191    
192  =head1 AUTHOR  =head1 AUTHOR
193    
194  Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>  Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>
195    
196    Based on Galaxy Win emulator L<http://emulator.galaksija.org/>
197    
198  =head1 BUGS  =head1 BUGS
199    
200  =head1 ACKNOWLEDGEMENTS  =head1 ACKNOWLEDGEMENTS

Legend:
Removed from v.131  
changed lines
  Added in v.139

  ViewVC Help
Powered by ViewVC 1.1.26