… | |
… | |
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 |
… | |
… | |
668 | ############################################################################# |
668 | ############################################################################# |
669 | # initial key input, to set up online mode etc. |
669 | # initial key input, to set up online mode etc. |
670 | # could be done via nvram defaults |
670 | # could be done via nvram defaults |
671 | |
671 | |
672 | @KQUEUE = ( |
672 | @KQUEUE = ( |
673 | 0x7b, -0x7b, # setup |
673 | 0x7b, -0x7b, # setup |
674 | 0, # delay |
674 | 0, # delay |
675 | 0x28, -0x28, # 4, toggle local/online |
675 | 0x28, -0x28, # 4, toggle local/online |
676 | 0x38, -0x38, # 5, setup b |
676 | 0x38, -0x38, # 5, setup b |
677 | 0, # delay |
677 | 0, # delay |
678 | (0x10, -0x10) x 2, # cursor right |
678 | (0x10, -0x10) x 2, # cursor right |
679 | 0x37, -0x37, # 6 toggle soft scroll |
679 | 0x37, -0x37, # 6 toggle soft scroll |
680 | (0x10, -0x10) x 1, # cursor right |
680 | (0x10, -0x10) x 1, # cursor right |
681 | 0x37, -0x37, # 6 toggle autorepeat off |
681 | 0x37, -0x37, # 6 toggle autorepeat off |
682 | (0x10, -0x10) x 8, # cursor right |
682 | (0x10, -0x10) x 8, # cursor right |
683 | 0x37, -0x37, # 6 toggle keyclick |
683 | 0x37, -0x37, # 6 toggle keyclick |
684 | (0x10, -0x10) x 1, # cursor right |
684 | (0x10, -0x10) x 1, # cursor right |
685 | $VT102 ? () : (0x37, -0x37), # 6 toggle ansi/vt52 |
685 | $VT102 ? () : (0x37, -0x37), # 6 toggle ansi/vt52 |
686 | (0x10, -0x10) x 7, # cursor right |
686 | (0x10, -0x10) x 7, # cursor right |
687 | 0x37, -0x37, # 6 toggle wrap around |
687 | 0x37, -0x37, # 6 toggle wrap around |
688 | 0x7b, -0x7b, # leave setup |
688 | 0x7b, -0x7b, # leave setup |
689 | ); |
689 | ); |
690 | |
690 | |
691 | ############################################################################# |
691 | ############################################################################# |
692 | # process/pty management |
692 | # process/pty management |
693 | |
693 | |
… | |
… | |
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: $@" |