--- M6502/Orao.pm 2007/08/02 12:23:18 90 +++ M6502/Orao.pm 2007/08/02 13:19:19 95 @@ -12,7 +12,7 @@ use M6502; use base qw(Class::Accessor M6502 Screen Prefs); -__PACKAGE__->mk_accessors(qw(run_for)); +__PACKAGE__->mk_accessors(qw(booted run_for)); =head1 NAME @@ -20,11 +20,11 @@ =head1 VERSION -Version 0.03 +Version 0.04 =cut -our $VERSION = '0.03'; +our $VERSION = '0.04'; =head1 SUMMARY @@ -39,6 +39,8 @@ 0x83FE,0x83FF, ); +=head1 FUNCTIONS + =head2 boot Start emulator, open L, load initial ROM images, and render memory @@ -124,8 +126,30 @@ M6502::reset(); + $self->booted( 1 ); } +=head2 run + +Run interactive emulation loop + + $orao->run; + +=cut + +sub run { + my $self = shift; + + $self->boot if ( ! $self->booted ); + + while ( 1 ) { + $self->cli; + M6502::exec($run_for); + } +}; + +=head1 Helper functions + =head2 load_rom called to init memory and load initial rom images @@ -141,7 +165,7 @@ foreach my $addr ( sort keys %$loaded_files ) { my $path = $loaded_files->{$addr}; - $self->load_oraoemu( $path, $addr ); + $self->load_image( $path, $addr ); } } @@ -169,17 +193,17 @@ $self->render_mem( @mem ) if $self->show_mem; } -=head2 load_oraoemu +=head2 load_image Load binary files, ROM images and Orao Emulator files - $orao->load_oraoemu( '/path/to/file', 0x1000 ); + $orao->load_image( '/path/to/file', 0x1000 ); Returns true on success. =cut -sub load_oraoemu { +sub load_image { my $self = shift; my ( $path, $addr ) = @_; @@ -471,7 +495,7 @@ } elsif ( $c =~ m/^l/i ) { my $to = shift @v || 0x1000; $a = $to; - $self->load_oraoemu( $v, $a ); + $self->load_image( $v, $a ); $last = ''; } elsif ( $c =~ m/^s/i ) { $self->save_dump( $v || 'mem.dump', @v );