6 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
7 |
use Carp qw/confess/; |
use Carp qw/confess/; |
8 |
use Exporter 'import'; |
use Exporter 'import'; |
9 |
our @EXPORT = qw'@mem $PC $A $P $X $Y $S $IPeriod $ICount $IRequest $IAutoReset $TrapBadOps $Trap $Trace $run_for $debug'; |
our @EXPORT = qw'dump_R @mem $PC $A $P $X $Y $S $IPeriod $ICount $IRequest $IAutoReset $TrapBadOps $Trap $Trace $run_for $debug'; |
10 |
our $VERSION = '0.0.2'; |
our $VERSION = '0.0.2'; |
11 |
require XSLoader; |
require XSLoader; |
12 |
XSLoader::load('M6502', $VERSION); |
XSLoader::load('M6502', $VERSION); |
17 |
|
|
18 |
=cut |
=cut |
19 |
|
|
20 |
my $debug = 0; |
our $debug = 0; |
21 |
|
|
22 |
our @mem = (0xff) x 0x10000; # 64M |
our @mem = (0xff) x 0x10000; # 64M |
23 |
|
|
137 |
return 1; |
return 1; |
138 |
} |
} |
139 |
|
|
140 |
=head2 push_R |
=head2 _update_perl_R |
141 |
|
|
142 |
called by C<perl.c> to push changes in registars back to perl variables |
called by C<M6502.xs> to push changes in registars back to perl variables |
143 |
|
|
144 |
=cut |
=cut |
145 |
|
|
146 |
sub push_R { |
sub _update_perl_R { |
147 |
warn "## M6502::push_R(",dump(@_),")\n" if $debug; |
warn "## M6502::update_perl_R(",dump(@_),")\n" if $debug; |
148 |
( $A, $P, $X, $Y, $S, $PC, $IPeriod, $ICount, $IRequest, $IAutoReset, $TrapBadOps, $Trap, $Trace ) = @_; |
( $A, $P, $X, $Y, $S, $PC, $IPeriod, $ICount, $IRequest, $IAutoReset, $TrapBadOps, $Trap, $Trace ) = @_; |
149 |
dump_R(); |
dump_R(); |
150 |
} |
} |
167 |
return $dump; |
return $dump; |
168 |
} |
} |
169 |
|
|
170 |
|
=head2 debug |
171 |
|
|
172 |
|
Turn perl and C-level debugging on/off |
173 |
|
|
174 |
|
$emu->debug( 0 ); |
175 |
|
$emu->debug( 1 ); |
176 |
|
print $emu->debug; |
177 |
|
|
178 |
|
=cut |
179 |
|
|
180 |
|
sub debug { |
181 |
|
my $self = shift; |
182 |
|
my $value = shift; |
183 |
|
if (defined($value)) { |
184 |
|
$debug = M6502::set_debug($value); |
185 |
|
} else { |
186 |
|
$debug = M6502::get_debug(); |
187 |
|
} |
188 |
|
return $debug; |
189 |
|
} |
190 |
|
|
191 |
=head1 SEE ALSO |
=head1 SEE ALSO |
192 |
|
|
193 |
L<Orao> is sample implementation using this module |
L<Orao> is sample implementation using this module |