… | |
… | |
93 | <DATA> |
93 | <DATA> |
94 | }; |
94 | }; |
95 | |
95 | |
96 | 0x6801 == length $ROMS or die "corrupted rom image"; |
96 | 0x6801 == length $ROMS or die "corrupted rom image"; |
97 | |
97 | |
98 | my @M = (0xff) x 65536; # main memory, = (0xff) x 65536; |
98 | my @M = (0xff) x 65536; # main memory |
99 | |
99 | |
100 | # populate mem with rom contents |
100 | # populate mem with rom contents |
101 | if ($VT102) { |
101 | if ($VT102) { |
102 | @M[0x0000 .. 0x1fff] = unpack "C*", substr $ROMS, 0x2000, 0x2000; |
102 | @M[0x0000 .. 0x1fff] = unpack "C*", substr $ROMS, 0x2000, 0x2000; |
103 | @M[0x8000 .. 0x9fff] = unpack "C*", substr $ROMS, 0x4000, 0x2000; |
103 | @M[0x8000 .. 0x9fff] = unpack "C*", substr $ROMS, 0x4000, 0x2000; |
… | |
… | |
538 | sub display { |
538 | sub display { |
539 | # this is for the powersave mode - check whether the cursor is on here, |
539 | # this is for the powersave mode - check whether the cursor is on here, |
540 | # and only allow powersave later when it was on the last display time |
540 | # and only allow powersave later when it was on the last display time |
541 | $CURSOR_IS_ON = $M[$VT102 ? 0x207b : 0x21ba]; |
541 | $CURSOR_IS_ON = $M[$VT102 ? 0x207b : 0x21ba]; |
542 | |
542 | |
|
|
543 | my $leds = join " ", map $KSTATUS & 2**$_ ? "\e[7m$LED[$_]\e[m" : "$LED[$_]", reverse 0 .. $#LED; |
|
|
544 | |
|
|
545 | my $scr = sprintf "\e[H--- LED [ %s ] CLK %d\e[K\n", $leds, $CLK; |
|
|
546 | |
|
|
547 | $scr .= "\e[?5" . ($DC11_REVERSE ? "h" : "l"); |
|
|
548 | |
543 | my $i = 0x2000; |
549 | my $i = 0x2000; |
544 | |
|
|
545 | my $leds = join " ", map $KSTATUS & 2**$_ ? "\e[7m$LED[$_]\e[m" : "$LED[$_]", reverse 0 .. $#LED; |
|
|
546 | |
|
|
547 | my $scr = sprintf "\e[H--- LED [ %s ] CLK %d\e[K\n", $leds, $CLK; |
|
|
548 | |
|
|
549 | $scr .= "\e[?5" . ($DC11_REVERSE ? "h" : "l"); |
|
|
550 | |
550 | |
551 | line: |
551 | line: |
552 | for my $y (0 .. 25) { # ntsc, two vblank delay lines, up to 24 text lines |
552 | for my $y (0 .. 25) { # ntsc, two vblank delay lines, up to 24 text lines |
553 | my $prev_attr; |
553 | my $prev_attr; |
554 | my ($c, $attr); # declare here for speedup |
554 | my ($c, $attr); # declare here for speedup |
… | |
… | |
764 | s/\bOUT\b/sprintf "out_%02x \$A ", $M[$pc++]/xge; # out likewise |
764 | s/\bOUT\b/sprintf "out_%02x \$A ", $M[$pc++]/xge; # out likewise |
765 | } |
765 | } |
766 | |
766 | |
767 | $insn .= "$op;\n"; |
767 | $insn .= "$op;\n"; |
768 | } |
768 | } |
769 | |
|
|
770 | |
769 | |
771 | $insn .= $pc; |
770 | $insn .= $pc; |
772 | $insn =~ s/\x00.*$//s; |
771 | $insn =~ s/\x00.*$//s; |
773 | |
772 | |
774 | eval "sub { $insn }" or die "$insn: $@" |
773 | eval "sub { $insn }" or die "$insn: $@" |