--- M6502/M6502.pm 2007/08/01 22:25:37 86 +++ M6502/M6502.pm 2007/08/02 11:08:10 87 @@ -17,7 +17,7 @@ =cut -my $debug = 1; +our $debug = 0; our @mem = (0xff) x 0x10000; # 64M @@ -137,14 +137,14 @@ return 1; } -=head2 push_R +=head2 _update_perl_R -called by C to push changes in registars back to perl variables +called by C to push changes in registars back to perl variables =cut -sub push_R { - warn "## M6502::push_R(",dump(@_),")\n" if $debug; +sub _update_perl_R { + warn "## M6502::update_perl_R(",dump(@_),")\n" if $debug; ( $A, $P, $X, $Y, $S, $PC, $IPeriod, $ICount, $IRequest, $IAutoReset, $TrapBadOps, $Trap, $Trace ) = @_; dump_R(); } @@ -167,6 +167,27 @@ return $dump; } +=head2 debug + +Turn perl and C-level debugging on/off + + $emu->debug( 0 ); + $emu->debug( 1 ); + print $emu->debug; + +=cut + +sub debug { + my $self = shift; + my $value = shift; + if (defined($value)) { + $debug = M6502::set_debug($value); + } else { + $debug = M6502::get_debug(); + } + return $debug; +} + =head1 SEE ALSO L is sample implementation using this module