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

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

revision 109 by dpavlin, Fri Aug 3 10:29:33 2007 UTC revision 117 by dpavlin, Fri Aug 3 22:46:03 2007 UTC
# Line 37  Emulator or Orao 8-bit 6502 machine popu Line 37  Emulator or Orao 8-bit 6502 machine popu
37    
38  Start emulator, open L<Screen>, load initial ROM images, and render memory  Start emulator, open L<Screen>, load initial ROM images, and render memory
39    
40    my $orao = Orao->new({});    my $emu = Orao->new({});
41    $orao->boot;    $emu->boot;
42    
43  =cut  =cut
44    
45  our $orao;  our $emu;
46    
47  select(STDERR); $| = 1;  select(STDERR); $| = 1;
48    
# Line 74  sub boot { Line 74  sub boot {
74    
75          $PC = 0xff89;          $PC = 0xff89;
76    
77          $orao = $self;          $emu = $self;
78    
79  #       $self->prompt( 0x1000 );  #       $self->prompt( 0x1000 );
80    
# Line 123  sub boot { Line 123  sub boot {
123    
124  Run interactive emulation loop  Run interactive emulation loop
125    
126    $orao->run;    $emu->run;
127    
128  =cut  =cut
129    
# Line 131  sub run { Line 131  sub run {
131          my $self = shift;          my $self = shift;
132    
133          $self->boot if ( ! $self->booted );          $self->boot if ( ! $self->booted );
134    
135    #       $self->load_tape( '../oraoigre/bdash.tap' );
136    
137          $self->loop;          $self->loop;
138  };  };
139    
# Line 140  sub run { Line 143  sub run {
143    
144  called to init memory and load initial rom images  called to init memory and load initial rom images
145    
146    $orao->load_rom;    $emu->load_rom;
147    
148  =cut  =cut
149    
# Line 180  sub _write_chunk { Line 183  sub _write_chunk {
183    
184  Load binary files, ROM images and Orao Emulator files  Load binary files, ROM images and Orao Emulator files
185    
186    $orao->load_image( '/path/to/file', 0x1000 );    $emu->load_image( '/path/to/file', 0x1000 );
187    
188  Returns true on success.  Returns true on success.
189    
# Line 235  sub load_image { Line 238  sub load_image {
238    
239  =head2 save_dump  =head2 save_dump
240    
241    $orao->save_dump( 'filename', $from, $to );    $emu->save_dump( 'filename', $from, $to );
242    
243  =cut  =cut
244    
# Line 257  sub save_dump { Line 260  sub save_dump {
260    
261  =head2 hexdump  =head2 hexdump
262    
263    $orao->hexdump( $address );    $emu->hexdump( $address );
264    
265  =cut  =cut
266    
# Line 327  my $keyboard = { Line 330  my $keyboard = {
330                  } elsif ( $self->key_down( 'left shift' ) || $self->key_down( 'right shift' ) ) {                  } elsif ( $self->key_down( 'left shift' ) || $self->key_down( 'right shift' ) ) {
331                          warn "shift\n";                          warn "shift\n";
332                          return 16;                          return 16;
333    #               } elsif ( $self->tape ) {
334    #                       warn "has tape!";
335    #                       return 0;
336                  }                  }
337                  return $keyboard_none;                  return $keyboard_none;
338          },          },
# Line 485  emulated device Line 491  emulated device
491    
492  =head2 prompt  =head2 prompt
493    
494    my ( $entered_line, @p ) = $orao->prompt( $address, $last_command );    my ( $entered_line, @p ) = $emu->prompt( $address, $last_command );
495    
496  =cut  =cut
497    
# Line 508  sub prompt { Line 514  sub prompt {
514    
515  =head2 cli  =head2 cli
516    
517    $orao->cli();    $emu->cli();
518    
519  =cut  =cut
520    
# Line 578  __USAGE__ Line 584  __USAGE__
584                  } elsif ( $c =~ m/^s/i ) {                  } elsif ( $c =~ m/^s/i ) {
585                          $self->save_dump( $v || 'mem.dump', @v );                          $self->save_dump( $v || 'mem.dump', @v );
586                          $last = '';                          $last = '';
587                  } elsif ( $c =~ m/^r/i ) {                  } elsif ( $c =~ m/^re/i ) { # reset
588                            M6502::reset();
589                            $last = 'r 1';
590                    } elsif ( $c =~ m/^r/i ) {      # run
591                          $run_for = $v || 1;                          $run_for = $v || 1;
592                          print "run_for $run_for instructions\n";                          print "run_for $run_for instructions\n";
593                          $show_R = 1;                          $show_R = 1;
# Line 592  __USAGE__ Line 601  __USAGE__
601                          $show_R = 1;                          $show_R = 1;
602                          last;                          last;
603                  } elsif ( $c =~ m/^tape/ ) {                  } elsif ( $c =~ m/^tape/ ) {
604                          if ( ! $v ) {                          if ( $c =~ m/rate/ ) {
605                                    $self->tape_rate( $v );
606                                    warn "will read table with rate $v\n";
607                            } elsif ( ! $v ) {
608                                  warn "ERROR: please specify tape name!\n";                                  warn "ERROR: please specify tape name!\n";
609                          } elsif ( ! -e $v ) {                          } elsif ( ! -e $v ) {
610                                  warn "ERROR: tape $v: $!\n";                                  warn "ERROR: tape $v: $!\n";

Legend:
Removed from v.109  
changed lines
  Added in v.117

  ViewVC Help
Powered by ViewVC 1.1.26