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

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

revision 135 by dpavlin, Sat Aug 4 22:14:09 2007 UTC revision 165 by dpavlin, Mon Aug 6 07:04:40 2007 UTC
# Line 6  use strict; Line 6  use strict;
6  use Carp qw/confess/;  use Carp qw/confess/;
7  use File::Slurp;  use File::Slurp;
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9  use M6502; # import @mem $PC and friends  use M6502;
10  use Screen qw/$white $black/;  use Screen;
11    
12  use base qw(Class::Accessor VRac M6502 Screen Prefs Tape);  use base qw(Class::Accessor VRac M6502 Screen Prefs Tape Session);
13  #__PACKAGE__->mk_accessors(qw());  #__PACKAGE__->mk_accessors(qw());
14    
15  =head1 NAME  =head1 NAME
# Line 18  Orao - Orao emulator Line 18  Orao - Orao emulator
18    
19  =head1 VERSION  =head1 VERSION
20    
21  Version 0.05  Version 0.06
22    
23  =cut  =cut
24    
25  our $VERSION = '0.05';  our $VERSION = '0.06';
26    
27  =head1 SUMMARY  =head1 SUMMARY
28    
29  Emulator or Orao 8-bit 6502 machine popular in Croatia  Emulator for Orao 8-bit 6502 machine popular in Croatia (especially schools)
30    
31  =cut  =cut
32    
# Line 54  sub run { Line 54  sub run {
54          warn "emulating ", $#mem, " bytes of memory\n";          warn "emulating ", $#mem, " bytes of memory\n";
55    
56  #       $self->scale( 2 );  #       $self->scale( 2 );
57    #       $self->show_mem( 1 );
58            $self->load_session( 'session.pl' );
59    
60          $self->open_screen;          $self->open_screen;
61          $self->load_rom({          $self->load_rom({
# Line 79  sub run { Line 81  sub run {
81          $self->trace( 0 );          $self->trace( 0 );
82          $self->debug( 0 );          $self->debug( 0 );
83    
84          warn "rendering video memory\n";          warn "rendering memory\n";
85          $self->render_vram;          $self->render_mem( @mem );
86    
87          if ( $self->show_mem ) {          if ( $self->show_mem ) {
88    
                 warn "rendering memory map\n";  
   
                 $self->render_mem( @mem );  
   
89                  my @mmap = (                  my @mmap = (
90                          0x0000, 0x03FF, 'nulti blok',                          0x0000, 0x03FF, 'nulti blok',
91                          0x0400, 0x5FFF, 'korisnički RAM (23K)',                          0x0400, 0x5FFF, 'korisnički RAM (23K)',
# Line 99  sub run { Line 97  sub run {
97                          0xE000, 0xFFFF, 'sistemski ROM',                          0xE000, 0xFFFF, 'sistemski ROM',
98                  );                  );
99    
100                    print "Orao memory map:";
101    
102                    while ( @mmap ) {
103                            my ( $from, $to, $desc ) = splice(@mmap, 0, 3);
104                            printf("%04x-%04x %s\n", $from, $to, $desc);
105                    }
106    
107          }          }
108          $self->sync;  
109          $self->trace( $trace );          $self->trace( $trace );
110          $self->debug( $debug );          $self->debug( $debug );
111    
# Line 385  sub write { Line 390  sub write {
390          warn sprintf("# Orao::write(%04x,%02x)\n", $addr, $byte) if $self->trace;          warn sprintf("# Orao::write(%04x,%02x)\n", $addr, $byte) if $self->trace;
391    
392          if ( $addr == 0x8800 ) {          if ( $addr == 0x8800 ) {
393                    $self->write_tape( $byte );
394                  warn sprintf "sound ignored: %x\n", $byte;                  warn sprintf "sound ignored: %x\n", $byte;
395          }          }
396    
# Line 397  sub write { Line 403  sub write {
403          return;          return;
404  }  }
405    
406    =head1 Architecture specific
407    
408  =head2 render_vram  =head2 render_vram
409    
410  Render one frame of video ram  Render one frame of video ram
# Line 405  Render one frame of video ram Line 413  Render one frame of video ram
413    
414  =cut  =cut
415    
 my @flip;  
   
 foreach my $i ( 0 .. 255 ) {  
         my $t = 0;  
         $i & 0b00000001 and $t = $t | 0b10000000;  
         $i & 0b00000010 and $t = $t | 0b01000000;  
         $i & 0b00000100 and $t = $t | 0b00100000;  
         $i & 0b00001000 and $t = $t | 0b00010000;  
         $i & 0b00010000 and $t = $t | 0b00001000;  
         $i & 0b00100000 and $t = $t | 0b00000100;  
         $i & 0b01000000 and $t = $t | 0b00000010;  
         $i & 0b10000000 and $t = $t | 0b00000001;  
         #warn "$i = $t\n";  
         $flip[$i] = $t;  
 }  
   
   
416  sub render_vram {  sub render_vram {
417          my $self = shift;          my $self = shift;
418    
# Line 441  sub render_vram { Line 432  sub render_vram {
432    
433  =head2 cpu_PC  =head2 cpu_PC
434    
435    Helper metod to set or get PC for current architecture
436    
437  =cut  =cut
438    
439  sub cpu_PC {  sub cpu_PC {
# Line 452  sub cpu_PC { Line 445  sub cpu_PC {
445          return $PC;          return $PC;
446  }  }
447    
448    =head1 SEE ALSO
449    
450    L<VRac>, L<M6502>, L<Screen>, L<Tape>
451    
452  =head1 AUTHOR  =head1 AUTHOR
453    
454  Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>  Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>
455    
 =head1 BUGS  
   
456  =head1 ACKNOWLEDGEMENTS  =head1 ACKNOWLEDGEMENTS
457    
458  See also L<http://www.foing.hr/~fng_josip/orao.htm> which is source of all  See also L<http://www.foing.hr/~fng_josip/orao.htm> which is source of all

Legend:
Removed from v.135  
changed lines
  Added in v.165

  ViewVC Help
Powered by ViewVC 1.1.26