51 |
$self->open_screen; |
$self->open_screen; |
52 |
$self->load_rom({ |
$self->load_rom({ |
53 |
0x1000 => 'dump/SCRINV.BIN', |
0x1000 => 'dump/SCRINV.BIN', |
54 |
|
# should be 0x6000, but oraoemu has 2 byte prefix |
55 |
|
0x5FFE => 'dump/screen.dmp', |
56 |
0xC000 => 'rom/BAS12.ROM', |
0xC000 => 'rom/BAS12.ROM', |
57 |
0xE000 => 'rom/CRT12.ROM', |
0xE000 => 'rom/CRT12.ROM', |
58 |
}); |
}); |
59 |
|
|
60 |
$PC = 0xDD11; # BC |
# $PC = 0xDD11; # BC |
61 |
# $PC = 0xC274; # MC |
# $PC = 0xC274; # MC |
62 |
|
|
63 |
$orao = $self; |
$orao = $self; |
68 |
$self->trace( 0 ); |
$self->trace( 0 ); |
69 |
$self->debug( 0 ); |
$self->debug( 0 ); |
70 |
|
|
71 |
|
$self->render( @mem[ 0x6000 .. 0x7fff ] ); |
72 |
|
|
73 |
if ( $self->show_mem ) { |
if ( $self->show_mem ) { |
74 |
|
|
75 |
warn "rendering memory map\n"; |
warn "rendering memory map\n"; |
76 |
|
|
77 |
|
$self->render_mem( @mem ); |
78 |
|
|
79 |
my @mmap = ( |
my @mmap = ( |
80 |
0x0000, 0x03FF, 'nulti blok', |
0x0000, 0x03FF, 'nulti blok', |
81 |
0x0400, 0x5FFF, 'korisnički RAM (23K)', |
0x0400, 0x5FFF, 'korisnički RAM (23K)', |
87 |
0xE000, 0xFFFF, 'sistemski ROM', |
0xE000, 0xFFFF, 'sistemski ROM', |
88 |
); |
); |
89 |
|
|
|
foreach my $i ( 0 .. $#mmap / 3 ) { |
|
|
my $o = $i * 3; |
|
|
my ( $from, $to, $desc ) = @mmap[$o,$o+1,$o+2]; |
|
|
printf "%04x - %04x - %s\n", $from, $to, $desc; |
|
|
for my $a ( $from .. $to ) { |
|
|
if ( $a >= 0x6000 && $a < 0x8000 ) { |
|
|
my $b = $self->read( $a ); |
|
|
$self->vram( $a - 0x6000, $b ); |
|
|
} else { |
|
|
$self->read( $a ); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
90 |
} else { |
} else { |
91 |
|
|
92 |
warn "rendering video memory\n"; |
warn "rendering video memory\n"; |
93 |
for my $a ( 0x6000 .. 0x7fff ) { |
$self->render( @mem[ 0x6000 .. 0x7fff ] ); |
|
$self->vram( $a - 0x6000, $mem[$a] ); |
|
|
} |
|
94 |
|
|
95 |
} |
} |
96 |
$self->sync; |
$self->sync; |
142 |
$t = $end if ( $end < $t ); |
$t = $end if ( $end < $t ); |
143 |
|
|
144 |
warn sprintf("refresh video ram %04x-%04x\n", $f, $t); |
warn sprintf("refresh video ram %04x-%04x\n", $f, $t); |
145 |
foreach my $a ( $f .. $t ) { |
# foreach my $a ( $f .. $t ) { |
146 |
$self->vram( $a - 0x6000 , $mem[ $a ] ); |
# $self->vram( $a - 0x6000 , $mem[ $a ] ); |
147 |
} |
# } |
148 |
|
$self->render( @mem[ 0x6000 .. 0x7fff ] ); |
149 |
|
$self->render_mem( @mem ) if $self->show_mem; |
150 |
} |
} |
151 |
|
|
152 |
=head2 load_oraoemu |
=head2 load_oraoemu |
240 |
return sprintf(" %04x %s\n", $a, |
return sprintf(" %04x %s\n", $a, |
241 |
join(" ", |
join(" ", |
242 |
map { |
map { |
243 |
sprintf( "%02x", $_ ) |
if ( defined($_) ) { |
244 |
|
sprintf( "%02x", $_ ) |
245 |
|
} else { |
246 |
|
' ' |
247 |
|
} |
248 |
} @mem[ $a .. $a+8 ] |
} @mem[ $a .. $a+8 ] |
249 |
) |
) |
250 |
); |
); |
296 |
} |
} |
297 |
|
|
298 |
if ( $addr > 0xafff ) { |
if ( $addr > 0xafff ) { |
299 |
confess sprintf "write access 0x%04x > 0xafff aborting\n", $addr; |
warn sprintf "write access 0x%04x > 0xafff aborting\n", $addr; |
300 |
|
return; |
301 |
} |
} |
302 |
|
|
303 |
$self->mmap_pixel( $addr, $byte, 0, 0 ); |
$self->mmap_pixel( $addr, $byte, 0, 0 ); |
340 |
|
|
341 |
=cut |
=cut |
342 |
|
|
343 |
|
my $show_R = 0; |
344 |
|
|
345 |
sub cli { |
sub cli { |
346 |
my $self = shift; |
my $self = shift; |
347 |
my $a = $PC || confess "no pc?"; |
my $a = $PC || confess "no pc?"; |
348 |
|
warn $self->dump_R() if $show_R; |
349 |
while ( my ($line, @v) = $self->prompt( $a, $last ) ) { |
while ( my ($line, @v) = $self->prompt( $a, $last ) ) { |
350 |
my $c = shift @v; |
my $c = shift @v; |
351 |
next unless defined($c); |
next unless defined($c); |
370 |
d\t\tdebug [$d] |
d\t\tdebug [$d] |
371 |
|
|
372 |
__USAGE__ |
__USAGE__ |
373 |
warn sprintf(" PC: %04x A:%02x P:%02x X:%02x Y:%02x S:%02x\n", $PC, $A, $P, $X, $Y, $S); |
warn $self->dump_R; |
374 |
} elsif ( $c =~ m/^e/i ) { |
} elsif ( $c =~ m/^e/i ) { |
375 |
$a = $v if defined($v); |
$a = $v if defined($v); |
376 |
my $to = shift @v; |
my $to = shift @v; |
377 |
$to = $a + 32 if ( ! $to || $to <= $a ); |
$to = $a + 32 if ( ! $to || $to <= $a ); |
378 |
|
$to = 0xffff if ( $to > 0xffff ); |
379 |
my $lines = int( ($to - $a + 8) / 8 ); |
my $lines = int( ($to - $a + 8) / 8 ); |
380 |
printf "## e %04x %04x (%d bytes) lines: %d\n", $a, $to, ($to-$a), $lines; |
printf "## e %04x %04x (%d bytes) lines: %d\n", $a, $to, ($to-$a), $lines; |
381 |
while ( --$lines ) { |
while ( --$lines ) { |
383 |
$a += 8; |
$a += 8; |
384 |
} |
} |
385 |
$last = '+'; |
$last = '+'; |
386 |
|
$show_R = 0; |
387 |
} elsif ( $c =~ m/^\+/ ) { |
} elsif ( $c =~ m/^\+/ ) { |
388 |
$a += 8; |
$a += 8; |
389 |
|
$show_R = 0; |
390 |
} elsif ( $c =~ m/^\-/ ) { |
} elsif ( $c =~ m/^\-/ ) { |
391 |
$a -= 8; |
$a -= 8; |
392 |
|
$show_R = 0; |
393 |
} elsif ( $c =~ m/^m/i ) { |
} elsif ( $c =~ m/^m/i ) { |
394 |
$a = $v; |
$a = $v if defined($v); |
395 |
$self->poke_code( $a, @v ); |
$self->poke_code( $a, @v ); |
396 |
printf "poke %d bytes at %04x\n", $#v + 1, $a; |
printf "poke %d bytes at %04x\n", $#v + 1, $a; |
397 |
$last = '+'; |
$last = '+'; |
398 |
|
$show_R = 0; |
399 |
} elsif ( $c =~ m/^l/i ) { |
} elsif ( $c =~ m/^l/i ) { |
400 |
my $to = shift @v || 0x1000; |
my $to = shift @v || 0x1000; |
401 |
$a = $to; |
$a = $to; |
407 |
} elsif ( $c =~ m/^r/i ) { |
} elsif ( $c =~ m/^r/i ) { |
408 |
$run_for = $v || 1; |
$run_for = $v || 1; |
409 |
print "run_for $run_for instructions\n"; |
print "run_for $run_for instructions\n"; |
410 |
|
$show_R = 1; |
411 |
last; |
last; |
412 |
} elsif ( $c =~ m/^(u|j)/ ) { |
} elsif ( $c =~ m/^(u|j)/ ) { |
413 |
my $to = $v || $a; |
my $to = $v || $a; |
415 |
$PC = $to; # remember for restart |
$PC = $to; # remember for restart |
416 |
$run_for = 1; |
$run_for = 1; |
417 |
$last = "r $run_for"; |
$last = "r $run_for"; |
418 |
|
$show_R = 1; |
419 |
last; |
last; |
420 |
} elsif ( $c =~ m/^t/ ) { |
} elsif ( $c =~ m/^t/ ) { |
421 |
$self->trace( not $self->trace ); |
$self->trace( not $self->trace ); |
422 |
print "trace ", $self->trace ? 'on' : 'off', "\n"; |
print "trace ", $self->trace ? 'on' : 'off', "\n"; |
423 |
|
$last = ''; |
424 |
} elsif ( $c =~ m/^d/ ) { |
} elsif ( $c =~ m/^d/ ) { |
425 |
$self->debug( not $self->debug ); |
$self->debug( not $self->debug ); |
426 |
print "debug ", $self->debug ? 'on' : 'off', "\n"; |
print "debug ", $self->debug ? 'on' : 'off', "\n"; |
427 |
|
$last = ''; |
428 |
} else { |
} else { |
429 |
warn "# ignored $line\n" if ($line); |
warn "# ignored $line\n" if ($line); |
430 |
$last = ''; |
$last = ''; |