… | |
… | |
66 | SET UP Home |
66 | SET UP Home |
67 | BACKSPACE Rubout |
67 | BACKSPACE Rubout |
68 | CAPS LOCK Prior/PgUp |
68 | CAPS LOCK Prior/PgUp |
69 | NO SCROLL Next/PgDown |
69 | NO SCROLL Next/PgDown |
70 | BREAK End |
70 | BREAK End |
|
|
71 | CTRL-C Insert |
71 | |
72 | |
72 | Set-Up Guide: |
73 | Set-Up Guide: |
73 | |
74 | |
74 | http://vt100.net/docs/vt102-ug/chapter3.html#S3.6 |
75 | http://vt100.net/docs/vt102-ug/chapter3.html#S3.6 |
75 | |
76 | |
… | |
… | |
92 | <DATA> |
93 | <DATA> |
93 | }; |
94 | }; |
94 | |
95 | |
95 | 0x6801 == length $ROMS or die "corrupted rom image"; |
96 | 0x6801 == length $ROMS or die "corrupted rom image"; |
96 | |
97 | |
97 | my @M = (0xff) x 65536; # main memory, = (0xff) x 65536; |
98 | my @M = (0xff) x 65536; # main memory |
98 | |
99 | |
99 | # populate mem with rom contents |
100 | # populate mem with rom contents |
100 | if ($VT102) { |
101 | if ($VT102) { |
101 | @M[0x0000 .. 0x1fff] = unpack "C*", substr $ROMS, 0x2000, 0x2000; |
102 | @M[0x0000 .. 0x1fff] = unpack "C*", substr $ROMS, 0x2000, 0x2000; |
102 | @M[0x8000 .. 0x9fff] = unpack "C*", substr $ROMS, 0x4000, 0x2000; |
103 | @M[0x8000 .. 0x9fff] = unpack "C*", substr $ROMS, 0x4000, 0x2000; |
… | |
… | |
537 | sub display { |
538 | sub display { |
538 | # 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, |
539 | # 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 |
540 | $CURSOR_IS_ON = $M[$VT102 ? 0x207b : 0x21ba]; |
541 | $CURSOR_IS_ON = $M[$VT102 ? 0x207b : 0x21ba]; |
541 | |
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 | |
542 | my $i = 0x2000; |
549 | my $i = 0x2000; |
543 | |
|
|
544 | my $leds = join " ", map $KSTATUS & 2**$_ ? "\e[7m$LED[$_]\e[m" : "$LED[$_]", reverse 0 .. $#LED; |
|
|
545 | |
|
|
546 | my $scr = sprintf "\e[H--- LED [ %s ] CLK %d\e[K\n", $leds, $CLK; |
|
|
547 | |
|
|
548 | $scr .= "\e[?5" . ($DC11_REVERSE ? "h" : "l"); |
|
|
549 | |
550 | |
550 | line: |
551 | line: |
551 | 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 |
552 | my $prev_sgr; |
553 | my $prev_attr; |
|
|
554 | my ($c, $attr); # declare here for speedup |
553 | |
555 | |
554 | $scr .= sprintf "%2d \xe2\x94\x82", $y; |
556 | $scr .= sprintf "%2d \xe2\x94\x82", $y; |
555 | |
557 | |
556 | for (0..139) { |
558 | for (0..139) { |
557 | my $c = $M[$i]; |
559 | $c = $M[$i]; |
558 | |
560 | |
559 | if ($c == 0x7f) { # also 0xff, but the firmware avoids that |
561 | if ($c == 0x7f) { # also 0xff, but the firmware avoids that |
560 | $scr .= "\e[m\xe2\x94\x82\e[K\n"; |
562 | $scr .= "\e[m\xe2\x94\x82\e[K\n"; |
561 | |
563 | |
562 | my $a1 = $M[$i + 1]; |
564 | my $a1 = $M[$i + 1]; |
… | |
… | |
565 | $i = 0x2000 + (($a1 * 256 + $a0) & 0xfff); |
567 | $i = 0x2000 + (($a1 * 256 + $a0) & 0xfff); |
566 | |
568 | |
567 | next line; |
569 | next line; |
568 | } |
570 | } |
569 | |
571 | |
|
|
572 | $scr .= $SGR[$prev_attr = $attr] |
570 | my $sgr = $SGR[ ($M[$i++ + 0x1000] & 15) | ($c & 0x80)]; |
573 | if $prev_attr != ($attr = ($M[$i++ + 0x1000] & 15) | ($c & 0x80)); |
571 | |
|
|
572 | $scr .= $prev_sgr = $sgr if $sgr ne $prev_sgr; |
|
|
573 | |
574 | |
574 | $scr .= $CHARMAP[$c & 0x7f]; |
575 | $scr .= $CHARMAP[$c & 0x7f]; |
575 | } |
576 | } |
576 | |
577 | |
577 | $scr .= "\e[K\nvideo overflow\e[K\n"; |
578 | $scr .= "\e[K\nvideo overflow\e[K\n"; |
… | |
… | |
598 | "\x1e" => 0x24 | 0x100, # CTRL-~ |
599 | "\x1e" => 0x24 | 0x100, # CTRL-~ |
599 | "\x1f" => 0x75 | 0x100, # CTRL-? |
600 | "\x1f" => 0x75 | 0x100, # CTRL-? |
600 | |
601 | |
601 | # hardcoded rxvt keys |
602 | # hardcoded rxvt keys |
602 | "\e" => 0x2a, # ESC |
603 | "\e" => 0x2a, # ESC |
|
|
604 | "\e[2~" => 0x79 | 0x100, # CTRL-C (insert) |
603 | "\e[3~" => 0x03, # DC |
605 | "\e[3~" => 0x03, # DC |
604 | "\e[5~" => 0x7e, # CAPS LOCK (prior) |
606 | "\e[5~" => 0x7e, # CAPS LOCK (prior) |
605 | "\e[6~" => 0x6a, # NO SCROLL (next) |
607 | "\e[6~" => 0x6a, # NO SCROLL (next) |
606 | "\e[A" => 0x30, # UP |
608 | "\e[A" => 0x30, # UP |
607 | "\e[B" => 0x22, # DOWN |
609 | "\e[B" => 0x22, # DOWN |
… | |
… | |
666 | ############################################################################# |
668 | ############################################################################# |
667 | # initial key input, to set up online mode etc. |
669 | # initial key input, to set up online mode etc. |
668 | # could be done via nvram defaults |
670 | # could be done via nvram defaults |
669 | |
671 | |
670 | @KQUEUE = ( |
672 | @KQUEUE = ( |
671 | 0x7b, -0x7b, # setup |
673 | 0x7b, -0x7b, # setup |
672 | 0, # delay |
674 | 0, # delay |
673 | 0x28, -0x28, # 4, toggle local/online |
675 | 0x28, -0x28, # 4, toggle local/online |
674 | 0x38, -0x38, # 5, setup b |
676 | 0x38, -0x38, # 5, setup b |
675 | 0, # delay |
677 | 0, # delay |
676 | (0x10, -0x10) x 2, # cursor right |
678 | (0x10, -0x10) x 2, # cursor right |
677 | 0x37, -0x37, # 6 toggle soft scroll |
679 | 0x37, -0x37, # 6 toggle soft scroll |
678 | (0x10, -0x10) x 1, # cursor right |
680 | (0x10, -0x10) x 1, # cursor right |
679 | 0x37, -0x37, # 6 toggle autorepeat off |
681 | 0x37, -0x37, # 6 toggle autorepeat off |
680 | (0x10, -0x10) x 8, # cursor right |
682 | (0x10, -0x10) x 8, # cursor right |
681 | 0x37, -0x37, # 6 toggle keyclick |
683 | 0x37, -0x37, # 6 toggle keyclick |
682 | (0x10, -0x10) x 1, # cursor right |
684 | (0x10, -0x10) x 1, # cursor right |
683 | $VT102 ? () : (0x37, -0x37), # 6 toggle ansi/vt52 |
685 | $VT102 ? () : (0x37, -0x37), # 6 toggle ansi/vt52 |
684 | (0x10, -0x10) x 7, # cursor right |
686 | (0x10, -0x10) x 7, # cursor right |
685 | 0x37, -0x37, # 6 toggle wrap around |
687 | 0x37, -0x37, # 6 toggle wrap around |
686 | 0x7b, -0x7b, # leave setup |
688 | 0x7b, -0x7b, # leave setup |
687 | ); |
689 | ); |
688 | |
690 | |
689 | ############################################################################# |
691 | ############################################################################# |
690 | # process/pty management |
692 | # process/pty management |
691 | |
693 | |
… | |
… | |
763 | } |
765 | } |
764 | |
766 | |
765 | $insn .= "$op;\n"; |
767 | $insn .= "$op;\n"; |
766 | } |
768 | } |
767 | |
769 | |
768 | |
|
|
769 | $insn .= $pc; |
770 | $insn .= $pc; |
770 | $insn =~ s/\x00.*$//s; |
771 | $insn =~ s/\x00.*$//s; |
771 | |
772 | |
772 | eval "sub { $insn }" or die "$insn: $@" |
773 | eval "sub { $insn }" or die "$insn: $@" |
773 | })->(); |
774 | })->(); |
… | |
… | |
783 | |
784 | |
784 | # pty/serial I/O |
785 | # pty/serial I/O |
785 | if ($PTY && (vec $x, fileno $PTY, 1) && (@PUSARTRECV < 128) && !@KQUEUE) { |
786 | if ($PTY && (vec $x, fileno $PTY, 1) && (@PUSARTRECV < 128) && !@KQUEUE) { |
786 | sysread $PTY, my $buf, 256; |
787 | sysread $PTY, my $buf, 256; |
787 | |
788 | |
788 | # linux don't do cs7 and/or parity anymore, so we need to filter # out xoff characters to avoid freezes. |
789 | # linux don't do cs7 and/or parity anymore, so we need to filter |
|
|
790 | # out xoff characters to avoid freezes. |
789 | push @PUSARTRECV, grep { ($_ & 0x7f) != 0x13 } unpack "C*", $buf; |
791 | push @PUSARTRECV, grep { ($_ & 0x7f) != 0x13 } unpack "C*", $buf; |
790 | } |
792 | } |
791 | |
793 | |
792 | # keyboard input |
794 | # keyboard input |
793 | if ($KBD && (vec $x, 0, 1)) { |
795 | if ($KBD && (vec $x, 0, 1)) { |