/[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

M6502/Orao.pm revision 97 by dpavlin, Thu Aug 2 14:07:52 2007 UTC Orao.pm revision 165 by dpavlin, Mon Aug 6 07:04:40 2007 UTC
# Line 4  use warnings; Line 4  use warnings;
4  use strict;  use strict;
5    
6  use Carp qw/confess/;  use Carp qw/confess/;
 use lib './lib';  
 #use Time::HiRes qw(time);  
7  use File::Slurp;  use File::Slurp;
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
 use List::Util qw/first/;  
9  use M6502;  use M6502;
10    use Screen;
11    
12  use base qw(Class::Accessor M6502 Screen Prefs);  use base qw(Class::Accessor VRac M6502 Screen Prefs Tape Session);
13  __PACKAGE__->mk_accessors(qw(booted));  #__PACKAGE__->mk_accessors(qw());
14    
15  =head1 NAME  =head1 NAME
16    
# Line 20  Orao - Orao emulator Line 18  Orao - Orao emulator
18    
19  =head1 VERSION  =head1 VERSION
20    
21  Version 0.04  Version 0.06
22    
23  =cut  =cut
24    
25  our $VERSION = '0.04';  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    
 my @kbd_ports = (  
     0x87FC,0x87FD,0x87FA,0x87FB,0x87F6,0x87F7,  
     0x87EE,0x87EF,0x87DE,0x87DF,0x87BE,0x87BF,  
     0x877E,0x877F,0x86FE,0x86FF,0x85FE,0x85FF,  
     0x83FE,0x83FF,  
 );  
   
33  =head1 FUNCTIONS  =head1 FUNCTIONS
34    
35  =head2 boot  =head2 run
   
 Start emulator, open L<Screen>, load initial ROM images, and render memory  
36    
37    my $orao = Orao->new({});  Start emulator, open L<Screen>, load initial ROM images, and start emulator loop
   $orao->boot;  
38    
39  =cut  =cut
40    
41  our $orao;  our $emu;
42    
43  select(STDERR); $| = 1;  sub run {
   
 sub boot {  
44          my $self = shift;          my $self = shift;
45    
46          warn "Orao calling upstream init\n";          warn "Orao calling upstream init\n";
47          $self->SUPER::init(          $self->SUPER::init(
48                  read => sub { $self->read( @_ ) },                  read => sub { $self->read( @_ ) },
# Line 66  sub boot { Line 53  sub boot {
53    
54          warn "emulating ", $#mem, " bytes of memory\n";          warn "emulating ", $#mem, " bytes of memory\n";
55    
56    #       $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({
62                  0x1000 => 'dump/SCRINV.BIN',  #               0x1000 => 'dump/SCRINV.BIN',
63                  # should be 0x6000, but oraoemu has 2 byte prefix                  # should be 0x6000, but oraoemu has 2 byte prefix
64                  0x5FFE => 'dump/screen.dmp',  #               0x5FFE => '/home/dpavlin/orao/dump/screen.dmp',
65                  0xC000 => 'rom/BAS12.ROM',  #               0xC000 => 'rom/Orao/BAS12.ROM',
66                  0xE000 => 'rom/CRT12.ROM',  #               0xE000 => 'rom/Orao/CRT12.ROM',
67                    0xC000 => 'rom/Orao/BAS13.ROM',
68                    0xE000 => 'rom/Orao/CRT13.ROM',
69          });          });
70    
71  #       $PC = 0xDD11;   # BC  #       $PC = 0xDD11;   # BC
# Line 80  sub boot { Line 73  sub boot {
73    
74          $PC = 0xff89;          $PC = 0xff89;
75    
76          $orao = $self;          $emu = $self;
77    
78  #       $self->prompt( 0x1000 );  #       $self->prompt( 0x1000 );
79    
# Line 88  sub boot { Line 81  sub boot {
81          $self->trace( 0 );          $self->trace( 0 );
82          $self->debug( 0 );          $self->debug( 0 );
83    
84          $self->render( @mem[ 0x6000 .. 0x7fff ] );          warn "rendering memory\n";
85            $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 107  sub boot { Line 97  sub boot {
97                          0xE000, 0xFFFF, 'sistemski ROM',                          0xE000, 0xFFFF, 'sistemski ROM',
98                  );                  );
99    
100          } else {                  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    
                 warn "rendering video memory\n";  
                 $self->render( @mem[ 0x6000 .. 0x7fff ] );  
           
107          }          }
108          $self->sync;  
109          $self->trace( $trace );          $self->trace( $trace );
110          $self->debug( $debug );          $self->debug( $debug );
111    
         #( $A, $P, $X, $Y, $S, $IPeriod ) = ( 1, 2, 3, 4, 5, 6 );  
   
112          warn "Orao boot finished",          warn "Orao boot finished",
113                  $self->trace ? ' trace' : '',                  $self->trace ? ' trace' : '',
114                  $self->debug ? ' debug' : '',                  $self->debug ? ' debug' : '',
# Line 126  sub boot { Line 116  sub boot {
116    
117          M6502::reset();          M6502::reset();
118    
119          $self->booted( 1 );  #       $self->load_tape( '../oraoigre/bdash.tap' );
 }  
   
 =head2 run  
   
 Run interactive emulation loop  
   
   $orao->run;  
   
 =cut  
   
 sub run {  
         my $self = shift;  
   
         $self->show_mem( 1 );  
120    
121          $self->boot if ( ! $self->booted );          $self->loop( sub {
122          $self->loop;                  my $run_for = shift;
123                    warn sprintf("about to exec from PC %04x for %d cycles\n", $PC, $run_for) if $self->trace;
124                    M6502::exec( $run_for );
125                    $self->render_vram;
126            });
127  };  };
128    
129    
130  =head1 Helper functions  =head1 Helper functions
131    
132  =head2 load_rom  =head2 write_chunk
133    
134  called to init memory and load initial rom images  Write chunk directly into memory, updateing vram if needed
135    
136    $orao->load_rom;    $emu->write_chunk( 0x1000, $chunk_data );
137    
138  =cut  =cut
139    
140  sub load_rom {  sub write_chunk {
     my ($self, $loaded_files) = @_;  
   
     #my $time_base = time();  
   
         foreach my $addr ( sort keys %$loaded_files ) {  
                 my $path = $loaded_files->{$addr};  
                 $self->load_image( $path, $addr );  
         }  
 }  
   
 # write chunk directly into memory, updateing vram if needed  
 sub _write_chunk {  
141          my $self = shift;          my $self = shift;
142          my ( $addr, $chunk ) = @_;          my ( $addr, $chunk ) = @_;
143          $self->write_chunk( $addr, $chunk );          $self->SUPER::write_chunk( $addr, $chunk );
144          my $end = $addr + length($chunk);          my $end = $addr + length($chunk);
145          my ( $f, $t ) = ( 0x6000, 0x7fff );          my ( $f, $t ) = ( 0x6000, 0x7fff );
146    
# Line 184  sub _write_chunk { Line 153  sub _write_chunk {
153          $t = $end if ( $end < $t );          $t = $end if ( $end < $t );
154    
155          warn sprintf("refresh video ram %04x-%04x\n", $f, $t);          warn sprintf("refresh video ram %04x-%04x\n", $f, $t);
156  #       foreach my $a ( $f .. $t ) {          $self->render_vram;
157  #               $self->vram( $a - 0x6000 , $mem[ $a ] );          $self->render_mem( @mem );
 #       }  
         $self->render( @mem[ 0x6000 .. 0x7fff ] );  
         $self->render_mem( @mem ) if $self->show_mem;  
158  }  }
159    
160  =head2 load_image  =head2 load_image
161    
162  Load binary files, ROM images and Orao Emulator files  Load binary files, ROM images and Orao Emulator files
163    
164    $orao->load_image( '/path/to/file', 0x1000 );    $emu->load_image( '/path/to/file', 0x1000 );
165    
166  Returns true on success.  Returns true on success.
167    
# Line 217  sub load_image { Line 183  sub load_image {
183          if ( $size == 65538 ) {          if ( $size == 65538 ) {
184                  $addr = 0;                  $addr = 0;
185                  warn sprintf "loading oraoemu 64k dump %s at %04x - %04x %02x\n", $path, $addr, $addr+$size-1, $size;                  warn sprintf "loading oraoemu 64k dump %s at %04x - %04x %02x\n", $path, $addr, $addr+$size-1, $size;
186                  $self->_write_chunk( $addr, substr($buff,2) );                  $self->write_chunk( $addr, substr($buff,2) );
187                  return 1;                  return 1;
188          } elsif ( $size == 32800 ) {          } elsif ( $size == 32800 ) {
189                  $addr = 0;                  $addr = 0;
190                  warn sprintf "loading oraoemu 1.3 dump %s at %04x - %04x %02x\n", $path, $addr, $addr+$size-1, $size;                  warn sprintf "loading oraoemu 1.3 dump %s at %04x - %04x %02x\n", $path, $addr, $addr+$size-1, $size;
191                  $self->_write_chunk( $addr, substr($buff,0x20) );                  $self->write_chunk( $addr, substr($buff,0x20) );
192                  return 1;                  return 1;
193          }          }
         printf "loading %s at %04x - %04x %02x\n", $path, $addr, $addr+$size-1, $size;  
         $self->_write_chunk( $addr, $buff );  
         return 1;  
   
         my $chunk;  
   
         my $pos = 0;  
   
         while ( my $long = substr($buff,$pos,4) ) {  
                 my @b = split(//, $long, 4);  
                 $chunk .=  
                         ( $b[3] || '' ) .  
                         ( $b[2] || '' ) .  
                         ( $b[1] || '' ) .  
                         ( $b[0] || '' );  
                 $pos += 4;  
         }  
   
         $self->_write_chunk( $addr, $chunk );  
194    
195            printf "loading %s at %04x - %04x %02x\n", $path, $addr, $addr+$size-1, $size;
196            $self->write_chunk( $addr, $buff );
197          return 1;          return 1;
198  };  };
199    
 =head2 save_dump  
   
   $orao->save_dump( 'filename', $from, $to );  
   
 =cut  
   
 sub save_dump {  
         my $self = shift;  
   
         my ( $path, $from, $to ) = @_;  
   
         $from ||= 0;  
         $to ||= 0xffff;  
   
         open(my $fh, '>', $path) || die "can't open $path: $!";  
         print $fh $self->read_chunk( $from, $to );  
         close($fh);  
   
         my $size = -s $path;  
         warn sprintf "saved %s %d %x bytes\n", $path, $size, $size;  
 }  
   
 =head2 hexdump  
   
   $orao->hexdump( $address );  
   
 =cut  
   
 sub hexdump {  
         my $self = shift;  
         my $a = shift;  
         return sprintf(" %04x %s\n", $a,  
                 join(" ",  
                         map {  
                                 if ( defined($_) ) {  
                                         sprintf( "%02x", $_ )  
                                 } else {  
                                         '  '  
                                 }  
                         } @mem[ $a .. $a+8 ]  
                 )  
         );  
 }  
200    
201  =head1 Memory management  =head1 Memory management
202    
# Line 307  Read from memory Line 213  Read from memory
213    
214  =cut  =cut
215    
216    my $keyboard_none = 255;
217    
218    my $keyboard = {
219            0x87FC => {
220                    'right'         => 16,
221                    'down'          => 128,
222                    'up'            => 192,
223                    'left'          => 224,
224                    'backspace' => 224,
225            },
226            0x87FD => sub {
227                    my ( $self, $key ) = @_;
228                    if ( $key eq 'return' ) {
229                            M6502::_write( 0xfc, 13 );
230                            warn "return\n";
231                            return 0;
232                    } elsif ( $key =~ m/ ctrl/ || $self->key_down( 'left ctrl' ) || $self->key_down( 'right ctrl' ) ) {
233                            warn "ctrl\n";
234                            return 16;
235                    }
236                    return $keyboard_none;
237            },
238            0x87FA => {
239                    'f4' => 16,
240                    'f3' => 128,
241                    'f2' => 192,
242                    'f1' => 224,
243            },
244            0x87FB => sub {
245                    my ( $self, $key ) = @_;
246                    if ( $key eq 'space' ) {
247                            return 32;
248                    } elsif ( $self->key_down( 'left shift' ) || $self->key_down( 'right shift' ) ) {
249                            warn "shift\n";
250                            return 16;
251    #               } elsif ( $self->tape ) {
252    #                       warn "has tape!";
253    #                       return 0;
254                    }
255                    return $keyboard_none;
256            },
257            0x87F6 => {
258                    '6' => 16,
259                    't' => 128,
260                    'y' => 192,     # hr: z
261                    'r' => 224,
262            },
263            0x87F7 => {
264                    '5' => 32,
265                    '4' => 16,
266            },
267            0x87EE => {
268                    '7' => 16,
269                    'u' => 128,
270                    'i' => 192,
271                    'o' => 224,
272            },
273            0x87EF => {
274                    '8' => 32,
275                    '9' => 16,
276            },
277            0x87DE => {
278                    '1' => 16,
279                    'w' => 128,
280                    'q' => 192,
281                    'e' => 224,
282            },
283            0x87DF => {
284                    '2' => 32,
285                    '3' => 16,
286            },
287            0x87BE => {
288                    'm' => 16,
289                    'k' => 128,
290                    'j' => 192,
291                    'l' => 224,
292            },
293            0x87BF => {
294                    ',' => 32,      # <
295                    '.' => 16,      # >
296            },
297            0x877E => {
298                    'z' => 16,      # hr:y
299                    's' => 128,
300                    'a' => 192,
301                    'd' => 224,
302            },
303            0x877F => {
304                    'x' => 32,
305                    'c' => 16,
306            },
307            0x86FE => {
308                    'n' => 16,
309                    'g' => 128,
310                    'h' => 192,
311                    'f' => 224,
312            },
313            0x86FF => {
314                    'b' => 32,
315                    'v' => 16,
316            },
317            0x85FE => {
318                    '<' => 16,              # :
319                    '\\' => 128,    # ¾
320                    '\'' => 192,    # ę
321                    ';' => 224,             # č
322            },
323            0x85FF => {
324                    '/' => 32,
325                    'f11' => 16,    # ^
326            },
327            0x83FE => {
328                    'f12' => 16,    # ;
329                    '[' => 128,             # ¹
330                    ']' => 192,             # š
331                    'p' => 224,
332            },
333            0x83FF => {
334                    '-' => 32,
335                    '0' => 16,
336            },
337    };
338    
339  sub read {  sub read {
340          my $self = shift;          my $self = shift;
341          my ($addr) = @_;          my ($addr) = @_;
342            return if ( $addr > 0xffff );
343          my $byte = $mem[$addr];          my $byte = $mem[$addr];
344          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);
345          warn sprintf("# Orao::read(%04x) = %02x\n", $addr, $byte) if $self->trace;          warn sprintf("# Orao::read(%04x) = %02x\n", $addr, $byte) if $self->trace;
346    
347          # keyboard          # keyboard
348    
349          if ( first { $addr == $_ } @kbd_ports ) {          if ( defined( $keyboard->{$addr} ) ) {
350                  warn sprintf("keyboard port: %04x\n",$addr) if $self->trace;                  warn sprintf("keyboard port: %04x\n",$addr) if $self->trace;
351          } elsif ( $addr == 0x87fc ) {                  my $key = $self->key_pressed;
352                  warn "0x87fc - arrows/back\n";                  if ( defined($key) ) {
353  =for pascal                          my $ret = $keyboard_none;
354                  if VKey=VK_RIGHT then Result:=16;                          my $r = $keyboard->{$addr} || confess "no definition for keyboard port found";
355                  if VKey=VK_DOWN then Result:=128;                          if ( ref($r) eq 'CODE' ) {
356                  if VKey=VK_UP then Result:=192;                                  $ret = $r->($self, $key);
357                  if VKey=VK_LEFT then Result:=224;                          } elsif ( defined($r->{$key}) ) {
358                  if Ord(KeyPressed)=VK_BACK then Result:=224;                                  $ret = $r->{$key};
359  =cut                                  if ( ref($ret) eq 'CODE' ) {
360          } elsif ( $addr == 0x87fd ) {                                          $ret = $ret->($self);
361                  warn "0x87fd - enter\n";                                  }
362  =for pascal                          } else {
363      if KeyPressed=Chr(13) then begin                                  warn sprintf("keyboard port: %04x unknown key: '%s'\n", $addr, $key) if $debug;
364        Mem[$FC]:=13;                          }
365        Result:=0;                          warn sprintf("keyboard port: %04x key:%s code:%d\n",$addr,$key,$ret) if ( $ret != $keyboard_none );
366      end;                          return $ret;
367  =cut                  }
368          } elsif ( $addr == 0x87fa ) {                  return $keyboard_none;
369                  warn "0x87fa = F1 - F4\n";          }
370  =for pascal  
371      if VKey=VK_F4 then Result:=16;          if ( $addr == 0x87ff ) {
372      if VKey=VK_F3 then Result:=128;                  return $self->read_tape;
     if VKey=VK_F2 then Result:=192;  
     if VKey=VK_F1 then Result:=224;  
 =cut  
         } elsif ( $addr == 0x87fb ) {  
                 warn "0x87fb\n";  
 =for pascal  
     if KeyPressed=Chr(32) then Result:=32;  
     if KeyPressed='"' then Result:=16;  
     if KeyPressed='!' then Result:=16;  
     if KeyPressed='$' then Result:=16;  
     if KeyPressed='%' then Result:=16;  
     if KeyPressed='&' then Result:=16;  
     if KeyPressed='(' then Result:=16;  
     if KeyPressed=')' then Result:=16;  
     if KeyPressed='=' then Result:=16;  
     if KeyPressed='#' then Result:=16;  
     if KeyPressed='+' then Result:=16;  
     if KeyPressed='*' then Result:=16;  
     if KeyPressed='?' then Result:=16;  
     if KeyPressed='<' then Result:=16;  
     if KeyPressed='>' then Result:=16;  
     if VKey=191 then Result:=16;  
 =cut  
373          }          }
374    
375          $self->mmap_pixel( $addr, 0, $byte, 0 );          $self->mmap_pixel( $addr, 0, $byte, 0 ) if $self->show_mem;
376          return $byte;          return $byte;
377  }  }
378    
# Line 382  sub write { Line 389  sub write {
389          my ($addr,$byte) = @_;          my ($addr,$byte) = @_;
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    
         if ( $addr >= 0x6000 && $addr < 0x8000 ) {  
                 $self->vram( $addr - 0x6000 , $byte );  
         }  
   
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 394  sub write { Line 398  sub write {
398                  confess sprintf "write access 0x%04x > 0xafff aborting\n", $addr;                  confess sprintf "write access 0x%04x > 0xafff aborting\n", $addr;
399          }          }
400    
401          $self->mmap_pixel( $addr, $byte, 0, 0 );          $self->mmap_pixel( $addr, $byte, 0, 0 ) if $self->show_mem;
   
402          $mem[$addr] = $byte;          $mem[$addr] = $byte;
403          return;          return;
404  }  }
405    
406  =head1 Command Line  =head1 Architecture specific
407    
408  Command-line debugging intrerface is implemented for communication with  =head2 render_vram
 emulated device  
409    
410  =head2 prompt  Render one frame of video ram
411    
412    my ( $entered_line, @p ) = $orao->prompt( $address, $last_command );    $self->render_vram;
413    
414  =cut  =cut
415    
416  my $last = 'r 1';  sub render_vram {
   
 sub prompt {  
417          my $self = shift;          my $self = shift;
418          $self->app->sync;  
419          my $a = shift;          my $pixels = pack("C*", map { $flip[$_] } @mem[ 0x6000 .. 0x7fff ]);
420          print $self->hexdump( $a ),  
421                  $last ? "[$last] " : '',          my $vram = SDL::Surface->new(
422                  "> ";                  -width => 256,
423          my $in = <STDIN>;                  -height => 256,
424          chomp($in);                  -depth => 1,    # 1 bit per pixel
425          warn "## prompt got: $in\n" if $self->debug;                  -pitch => 32,   # bytes per line
426          $in ||= $last;                  -from => $pixels,
427          $last = $in;          );
428          return ( $in, split(/\s+/, $in) ) if $in;          $vram->set_colors( 0, $black, $white );
429    
430            $self->render_frame( $vram );
431  }  }
432    
433  =head2 cli  =head2 cpu_PC
434    
435    $orao->cli();  Helper metod to set or get PC for current architecture
436    
437  =cut  =cut
438    
439  my $show_R = 0;  sub cpu_PC {
440            my ( $self, $addr ) = @_;
441            if ( defined($addr) ) {
442                    $PC = $addr;
443                    warn sprintf("running from PC %04x\n", $PC);
444            };
445            return $PC;
446    }
447    
448  sub cli {  =head1 SEE ALSO
         my $self = shift;  
         my $a = $PC || confess "no pc?";  
         my $run_for = 0;  
         warn $self->dump_R() if $show_R;  
         while ( my ($line, @v) = $self->prompt( $a, $last ) ) {  
                 my $c = shift @v;  
                 next unless defined($c);  
                 my $v = shift @v;  
                 $v = hex($v) if $v && $v =~ m/^[0-9a-f]+$/;  
                 @v = map { hex($_) } @v;  
                 printf "## a: %04x parsed cli: c:%s v:%s %s\n", $a, $c, ($v || 'undef'), join(",",@v) if $self->debug;  
                 if ( $c =~ m/^[qx]/i ) {  
                         exit;  
                 } elsif ( $c eq '?' ) {  
                         my $t = $self->trace ? 'on' : 'off' ;  
                         my $d = $self->debug ? 'on' : 'off' ;  
                         warn <<__USAGE__;  
 Usage:  
   
 x|q\t\texit  
 e 6000 6010\tdump memory, +/- to walk forward/backward  
 m 1000 ff 00\tput ff 00 on 1000  
 j|u 1000\t\tjump (change pc)  
 r 42\t\trun 42 instruction opcodes  
 t\t\ttrace [$t]  
 d\t\tdebug [$d]  
   
 __USAGE__  
                         warn $self->dump_R;  
                         $last = '';  
                 } elsif ( $c =~ m/^e/i ) {  
                         $a = $v if defined($v);  
                         my $to = shift @v;  
                         $to = $a + 32 if ( ! $to || $to <= $a );  
                         $to = 0xffff if ( $to > 0xffff );  
                         my $lines = int( ($to - $a + 8) / 8 );  
                         printf "## e %04x %04x (%d bytes) lines: %d\n", $a, $to, ($to-$a), $lines;  
                         while ( --$lines ) {  
                                 print $self->hexdump( $a );  
                                 $a += 8;  
                         }  
                         $last = '+';  
                         $show_R = 0;  
                 } elsif ( $c =~ m/^\+/ ) {  
                         $a += 8;  
                         $show_R = 0;  
                 } elsif ( $c =~ m/^\-/ ) {  
                         $a -= 8;  
                         $show_R = 0;  
                 } elsif ( $c =~ m/^m/i ) {  
                         $a = $v if defined($v);  
                         $self->poke_code( $a, @v );  
                         printf "poke %d bytes at %04x\n", $#v + 1, $a;  
                         $last = '+';  
                         $show_R = 0;  
                 } elsif ( $c =~ m/^l/i ) {  
                         my $to = shift @v || 0x1000;  
                         $a = $to;  
                         $self->load_image( $v, $a );  
                         $last = '';  
                 } elsif ( $c =~ m/^s/i ) {  
                         $self->save_dump( $v || 'mem.dump', @v );  
                         $last = '';  
                 } elsif ( $c =~ m/^r/i ) {  
                         $run_for = $v || 1;  
                         print "run_for $run_for instructions\n";  
                         $show_R = 1;  
                         last;  
                 } elsif ( $c =~ m/^(u|j)/ ) {  
                         my $to = $v || $a;  
                         printf "set pc to %04x\n", $to;  
                         $PC = $to;      # remember for restart  
                         $run_for = 1;  
                         $last = "r $run_for";  
                         $show_R = 1;  
                         last;  
                 } elsif ( $c =~ m/^t/ ) {  
                         $self->trace( not $self->trace );  
                         print "trace ", $self->trace ? 'on' : 'off', "\n";  
                         $last = '';  
                 } elsif ( $c =~ m/^d/ ) {  
                         $self->debug( not $self->debug );  
                         print "debug ", $self->debug ? 'on' : 'off', "\n";  
                         $last = '';  
                 } else {  
                         warn "# ignored $line\n" if ($line);  
                         $last = '';  
                 }  
         }  
449    
450          return $run_for;  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.97  
changed lines
  Added in v.165

  ViewVC Help
Powered by ViewVC 1.1.26