/[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 32 by dpavlin, Mon Jul 30 18:37:37 2007 UTC revision 33 by dpavlin, Mon Jul 30 21:00:36 2007 UTC
# Line 38  Start emulator Line 38  Start emulator
38    
39  our $orao;  our $orao;
40    
41    our $PC = 0x1000;
42    
43  sub init {  sub init {
44          my $self = shift;          my $self = shift;
45          warn "call upstream init\n";          warn "call upstream init\n";
46          $self->SUPER::init( @_ );          $self->SUPER::init( $self, @_ );
47    
48          warn "staring Orao $Orao::VERSION emulation\n";          warn "staring Orao $Orao::VERSION emulation\n";
49    
50          $self->open_screen;          $self->open_screen;
51          $self->load_rom;          $self->load_rom({
52                    0x1000 => 'dump/SCRINV.BIN',
53                    0xC000 => 'rom/BAS12.ROM',
54                    0xE000 => 'rom/CRT12.ROM',
55            });
56    
57          $orao = $self;          $orao = $self;
58    
59          $self->prompt( 0x1000 );  #       $self->prompt( 0x1000 );
 }  
60    
61  my $loaded_files = {          warn "rendering memory map\n";
62          0xC000 => 'rom/BAS12.ROM',  
63          0xE000 => 'rom/CRT12.ROM',          my @mmap = (
64  };                  0x0000, 0x03FF, 'nulti blok',
65                    0x0400, 0x5FFF, 'korisnički RAM (23K)',
66                    0x6000, 0x7FFF, 'video RAM',
67                    0x8000, 0x9FFF, 'sistemske lokacije',
68                    0xA000, 0xAFFF, 'ekstenzija',
69                    0xB000, 0xBFFF, 'DOS',
70                    0xC000, 0xDFFF, 'BASIC ROM',
71                    0xE000, 0xFFFF, 'sistemski ROM',
72            );
73    
74            foreach my $i ( 0 .. $#mmap / 3 ) {
75                    my $o = $i * 3;
76                    my ( $from, $to, $desc ) = @mmap[$o,$o+1,$o+2];
77                    printf "%04x - %04x - %s\n", $from, $to, $desc;
78    #               for my $a ( $from .. $to ) {
79    #                       $orao->read( $a );
80    #               }
81    #               $self->sync;
82            }
83    
84    }
85    
86  =head2 load_rom  =head2 load_rom
87    
# Line 67  called to init memory and load initial r Line 92  called to init memory and load initial r
92  =cut  =cut
93    
94  sub load_rom {  sub load_rom {
95      my ($self) = @_;      my ($self, $loaded_files) = @_;
96    
97      #my $time_base = time();      #my $time_base = time();
98    
99          foreach my $addr ( sort keys %$loaded_files ) {          foreach my $addr ( sort keys %$loaded_files ) {
100                  my $path = $loaded_files->{$addr};                  my $path = $loaded_files->{$addr};
                 warn sprintf "loading '%s' at %04x\n", $path, $addr;  
101                  $self->load_oraoemu( $path, $addr );                  $self->load_oraoemu( $path, $addr );
102          }          }
103  }  }
# Line 93  sub load_oraoemu { Line 117  sub load_oraoemu {
117    
118          if ( $size == 65538 ) {          if ( $size == 65538 ) {
119                  $addr = 0;                  $addr = 0;
120                  warn sprintf "loading oraoemu 64k dump %s at %04x - %04x %02x\n", $path, $addr, $addr+$size, $size;                  warn sprintf "loading oraoemu 64k dump %s at %04x - %04x %02x\n", $path, $addr, $addr+$size-1, $size;
121                  $self->write_chunk( $addr, substr($buff,2) );                  $self->write_chunk( $addr, substr($buff,2) );
122                  return;                  return;
123          } elsif ( $size == 32800 ) {          } elsif ( $size == 32800 ) {
124                  $addr = 0;                  $addr = 0;
125                  warn sprintf "loading oraoemu 1.3 dump %s at %04x - %04x %02x\n", $path, $addr, $addr+$size, $size;                  warn sprintf "loading oraoemu 1.3 dump %s at %04x - %04x %02x\n", $path, $addr, $addr+$size-1, $size;
126                  #$self->write_chunk( $addr, substr($buff,0x20) );                  #$self->write_chunk( $addr, substr($buff,0x20) );
127                  $self->poke_code( $addr, map { ord($_) } split(//,substr($buff,0x20)) );                  $self->poke_code( $addr, map { ord($_) } split(//,substr($buff,0x20)) );
128                  return;                  return;
129          }          }
130          printf "loading %s at %04x - %04x %02x\n", $path, $addr, $addr+$size, $size;          printf "loading %s at %04x - %04x %02x\n", $path, $addr, $addr+$size-1, $size;
131          return $self->write_chunk( $addr, $buff );          return $self->write_chunk( $addr, $buff );
132    
133          my $chunk;          my $chunk;
# Line 202  Read from memory Line 226  Read from memory
226  =cut  =cut
227    
228  sub read {  sub read {
229          my $self = $orao;          my $self = shift;
230          my ($addr) = @_;          my ($addr) = @_;
231          my $byte = $mem[$addr];          my $byte = $mem[$addr];
232          warn "# Orao::read(",dump(@_),") = ",dump( $byte ),"\n" if $self->debug;          warn "# Orao::read(",dump(@_),") = ",dump( $byte ),"\n" if $self->debug;
233          mmap_pixel( $addr, 0, $byte, 0 );          $self->mmap_pixel( $addr, 0, $byte, 0 );
234          return $byte;          return $byte;
235  }  }
236    
# Line 219  Write into emory Line 243  Write into emory
243  =cut  =cut
244    
245  sub write {  sub write {
246          my $self = $orao;          my $self = shift;
247          warn "# Orao::write(",dump(@_),")\n" if $self->debug;          warn "# Orao::write(",dump(@_),")\n" if $self->debug;
248          my ($addr,$byte) = @_;          my ($addr,$byte) = @_;
249    
# Line 235  sub write { Line 259  sub write {
259                  warn sprintf "sound ignored: %x\n", $byte;                  warn sprintf "sound ignored: %x\n", $byte;
260          }          }
261    
262          mmap_pixel( $addr, $byte, 0, 0 );          $self->mmap_pixel( $addr, $byte, 0, 0 );
263    
264          $mem[$addr] = $byte;          $mem[$addr] = $byte;
265  }  }

Legend:
Removed from v.32  
changed lines
  Added in v.33

  ViewVC Help
Powered by ViewVC 1.1.26