OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [bin/] [console_starter] - Blame information for rev 36

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wfjm
#!/usr/bin/perl -w
2 27 wfjm
# $Id: console_starter 581 2014-08-10 21:48:46Z mueller $
3 2 wfjm
#
4 27 wfjm
# Copyright 2009-2014 by Walter F.J. Mueller 
5 2 wfjm
#
6
# This program is free software; you may redistribute and/or modify it under
7
# the terms of the GNU General Public License as published by the Free
8
# Software Foundation, either version 2, or at your option any later version.
9
#
10
# This program is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
12
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13
# for complete details.
14
#
15
#  Revision History:
16 22 wfjm
# Date         Rev  Vers    Comment
17 27 wfjm
# 2014-08-10   581   1.1    rename to console_starter
18 2 wfjm
# 2010-07-04   312   1.0.3  correct telnet_wrapper path
19
# 2010-04-26   284   1.0.2  add error check for GetOptions
20
# 2009-11-08   248   1.0.1  proper -h handling & text; add -t support;
21
# 2009-11-07   247   1.0    Initial version
22
#
23
 
24
use 5.005;                                  # require Perl 5.005 or higher
25
use strict;                                 # require strict checking
26
 
27
use Getopt::Long;
28
 
29
my %opts = ();
30
GetOptions(\%opts, "h", "t:s", "d:s", "s", "w", "l")
31
  or die "bad options";
32
 
33
if (exists $opts{h}) {
34 27 wfjm
  print "usage: console_starter [-h] [-t type] [-d type] [-s] [-w] [-l]\n";
35 2 wfjm
  print "  -h       help, print this text and quit\n";
36
  print "  -t term  set terminal type, vt100 or vt52 (def: vt100)\n";
37
  print "  -d dev   set device type, DLx or DZx for x'the line (def: DL0)\n";
38
  print "  -s       use simh ports, default is to use rri ports\n";
39
  print "  -w       use wide 132 column screen (default 80 columns)\n";
40
  print "  -l       use long 48 lines screen (default 24 lines)\n";
41
  exit 0;
42
}
43
 
44
my $emu    = "xterm";
45
my $telnet = $ENV{"RETROBASE"} . "/tools/bin/telnet_wrapper";
46
 
47
my @args;
48
my $term = "vt100";
49
my $dev  = "DL";
50
my $line = 0;
51
my $port;
52
my $title;
53
 
54
if (exists $opts{t}) {
55
  if ($opts{t} =~ m{^(vt100|vt52)$} ) {
56
    $term = $opts{t};
57
  } else {
58
    printf "unsupported terminal type: %s\n", $opts{t};
59
    exit 1;
60
  }
61
}
62
 
63
if (exists $opts{d}) {
64
  if ($opts{d} =~ m{^(DL|DZ)(\d*)$}i ) {
65
    $dev  = uc $1;
66
    $line = int $2;
67
  } else {
68
    printf "unsupported device type: %s\n", $opts{d};
69
    exit 1;
70
  }
71
}
72
 
73
if (exists $opts{s}) {                      # simh ports
74
  $port = 5670 if ($dev eq "DL");
75
  $port = 5671 if ($dev eq "DZ");
76
  $title = sprintf "\"%s %s\"", $dev, $term;
77
} else {                                    # rri ports
78
  $port = 8000+$line if ($dev eq "DL");
79
  $port = 8002+$line if ($dev eq "DZ");
80
  $title = sprintf "\"%s%d %s\"", $dev, $line, $term;
81
}
82
 
83
my $geo_w = 80;
84
my $geo_l = 24;
85
$geo_w = 132 if exists $opts{w};
86
$geo_l =  48 if exists $opts{l};
87
 
88
push @args, "-j", "-rightbar", "-sb", "-sl", "500";
89
push @args, "-bg", "gray90", "-fg", "black";
90
push @args, "-ti", $term;
91
push @args, "-geo", sprintf("%dx%d", $geo_w, $geo_l);
92
push @args, "-T", $title;
93
push @args, "-e", $telnet, "localhost", sprintf("%d",$port);
94
 
95
print $emu, " ", join " ",@args, "\n";
96
 
97
my $rc = system $emu, @args;
98
if ($rc != 0) {
99
  print STDERR "xterm failed with rc=$rc\n";
100
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.