ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/vt102/vt102
(Generate patch)

Comparing vt102/vt102 (file contents):
Revision 1.30 by root, Fri Dec 5 07:34:56 2014 UTC vs.
Revision 1.34 by root, Wed Dec 9 09:23:52 2015 UTC

93 <DATA> 93 <DATA>
94}; 94};
95 95
960x6801 == length $ROMS or die "corrupted rom image"; 960x6801 == length $ROMS or die "corrupted rom image";
97 97
98my @M = (0xff) x 65536; # main memory, = (0xff) x 65536; 98my @M = (0xff) x 65536; # main memory
99 99
100# populate mem with rom contents 100# populate mem with rom contents
101if ($VT102) { 101if ($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;
538sub display { 538sub 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_sgr; 553 my $prev_attr;
554 my ($c, $attr); # declare here for speedup
554 555
555 $scr .= sprintf "%2d \xe2\x94\x82", $y; 556 $scr .= sprintf "%2d \xe2\x94\x82", $y;
556 557
557 for (0..139) { 558 for (0..139) {
558 my $c = $M[$i]; 559 $c = $M[$i];
559 560
560 if ($c == 0x7f) { # also 0xff, but the firmware avoids that 561 if ($c == 0x7f) { # also 0xff, but the firmware avoids that
561 $scr .= "\e[m\xe2\x94\x82\e[K\n"; 562 $scr .= "\e[m\xe2\x94\x82\e[K\n";
562 563
563 my $a1 = $M[$i + 1]; 564 my $a1 = $M[$i + 1];
566 $i = 0x2000 + (($a1 * 256 + $a0) & 0xfff); 567 $i = 0x2000 + (($a1 * 256 + $a0) & 0xfff);
567 568
568 next line; 569 next line;
569 } 570 }
570 571
572 $scr .= $SGR[$prev_attr = $attr]
571 my $sgr = $SGR[ ($M[$i++ + 0x1000] & 15) | ($c & 0x80)]; 573 if $prev_attr != ($attr = ($M[$i++ + 0x1000] & 15) | ($c & 0x80));
572
573 $scr .= $prev_sgr = $sgr if $sgr ne $prev_sgr;
574 574
575 $scr .= $CHARMAP[$c & 0x7f]; 575 $scr .= $CHARMAP[$c & 0x7f];
576 } 576 }
577 577
578 $scr .= "\e[K\nvideo overflow\e[K\n"; 578 $scr .= "\e[K\nvideo overflow\e[K\n";
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
765 } 765 }
766 766
767 $insn .= "$op;\n"; 767 $insn .= "$op;\n";
768 } 768 }
769 769
770
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: $@"
775 })->(); 774 })->();
785 784
786 # pty/serial I/O 785 # pty/serial I/O
787 if ($PTY && (vec $x, fileno $PTY, 1) && (@PUSARTRECV < 128) && !@KQUEUE) { 786 if ($PTY && (vec $x, fileno $PTY, 1) && (@PUSARTRECV < 128) && !@KQUEUE) {
788 sysread $PTY, my $buf, 256; 787 sysread $PTY, my $buf, 256;
789 788
790 # 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.
791 push @PUSARTRECV, grep { ($_ & 0x7f) != 0x13 } unpack "C*", $buf; 791 push @PUSARTRECV, grep { ($_ & 0x7f) != 0x13 } unpack "C*", $buf;
792 } 792 }
793 793
794 # keyboard input 794 # keyboard input
795 if ($KBD && (vec $x, 0, 1)) { 795 if ($KBD && (vec $x, 0, 1)) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines