1
0
mirror of https://github.com/rricharz/Tek4010.git synced 2026-04-13 15:34:44 +00:00

improved acharacter size handling, added -autoClear argument

This commit is contained in:
¨Rene Richarz
2019-06-20 09:26:38 +02:00
parent c0199f1022
commit bcbd8a2d3f
7 changed files with 57 additions and 30 deletions

View File

@@ -272,6 +272,10 @@ tek4010 has the following options:
-APL emulate Tektronix 4013/4015 with alternative APL character set.
Details see below.
-autoClear erase screen if a line feed is executed at the bottom of the screen.
This makes it sometimes easier to use tek4010 as the only terminal. It
is not the behaviour of the original hardware.
**APL mode**
@@ -381,6 +385,11 @@ http://sci-hub.tw/https://dl.acm.org/citation.cfm?id=356582&dl=ACM&coll=DL
Detailed pictures of the terminal and the original mouse built by CDI can be found in the 1968
ARDS manual (see manuals folder)
**Using other fonts**
The font used by tek4010 is defined in tube.h. If you prefer to use a different font (for example a
dotted font), define STANDARD_FONT and STANDARD_FONT_SIZE in tube.h and recompile the program.
**Help wanted**
I am interested to find any recoverable original software using the graphical input modes of the

2
ards.c
View File

@@ -89,7 +89,7 @@ void ards_draw(cairo_t *cr, cairo_t *cr2, int first)
efactor = windowWidth / 1080.0;
// fprintf (stderr, "efactor: %0.2f\n", efactor);
refresh_interval = 30;
tube_changeCharacterSize(cr, cr2, 80, 50, (int)(efactor * 20));
tube_changeCharacterSize(cr, cr2, 80, 50, efactor * 1.1);
}

BIN
tek4010

Binary file not shown.

View File

@@ -86,7 +86,7 @@ int intensityTable[] = {14,16,17,19, 20,22,23,25, 28,31,34,38, 41,33,47,50,
56,62,69,75, 81,88,94,100, 56,63,69,75, 81,88};
void tek4010_checkLimits()
void tek4010_checkLimits(cairo_t *cr, cairo_t *cr2)
/* check whether char is in visibel space */
{
/* don't check here for leftmargin, graphics needs to write characters to the whole screen */
@@ -95,10 +95,14 @@ void tek4010_checkLimits()
if (tube_x0 > windowWidth - hDotsPerChar) {
tube_x0 = leftmargin; tube_y0 -= vDotsPerChar;
}
if (tube_y0 < 4) {
if (tube_y0 < 4) { // new line at bottom of page
tube_y0 = windowHeight - vDotsPerChar;
if (leftmargin) leftmargin = 0;
else leftmargin = windowWidth / 2;
if (argAutoClear) {
leftmargin = 0;
tube_clearPersistent(cr,cr2);
}
/* check here for leftmargin */
if (tube_x0 < leftmargin) tube_x0 = leftmargin;
}
@@ -183,22 +187,22 @@ void tek4010_escapeCodeHandler(cairo_t *cr, cairo_t *cr2, int ch)
case 8: // backspace during ESC
tube_x0 -= hDotsPerChar;
tek4010_checkLimits();
tek4010_checkLimits(cr, cr2);
mode = 0; break;
case 9: // tab during ESC
if (argTab1)
tube_x0 += hDotsPerChar;
else
tube_x0 = tube_x0 - (tube_x0 % (8 * hDotsPerChar)) + 8 * hDotsPerChar;
tek4010_checkLimits();
tek4010_checkLimits(cr, cr2);
mode = 0; break;
case 11:// VT during ESC, move one line up
tube_y0 += vDotsPerChar;
tek4010_checkLimits();
tek4010_checkLimits(cr, cr2);
mode = 0; break;
case 12:// FF during ESC
tube_changeCharacterSize(cr, cr2, 74, 35, (int) (18.0 * efactor));
tube_changeCharacterSize(cr, cr2, 74, 35, efactor);
tube_clearPersistent(cr,cr2);
mode = 0; break;
case 13:mode = 0; break;
@@ -232,10 +236,10 @@ void tek4010_escapeCodeHandler(cairo_t *cr, cairo_t *cr2, int ch)
int defocussed = 0;
break;
case '8': tube_changeCharacterSize(cr, cr2, 74, 35, (int)(efactor * 18)); mode = 0; break;
case '9': tube_changeCharacterSize(cr, cr2, 81, 38, (int)(efactor * 16)); mode = 0; break;
case ':': tube_changeCharacterSize(cr, cr2, 121, 58, (int)(efactor * 11)); mode = 0; break;
case ';': tube_changeCharacterSize(cr, cr2, 133, 64, (int)(efactor * 10)); mode = 0; break;
case '8': tube_changeCharacterSize(cr, cr2, 74, 35, efactor); mode = 0; break;
case '9': tube_changeCharacterSize(cr, cr2, 81, 38, efactor * 0.9); mode = 0; break;
case ':': tube_changeCharacterSize(cr, cr2, 121, 58, efactor * 0.65); mode = 0; break;
case ';': tube_changeCharacterSize(cr, cr2, 133, 64, efactor * 0.55); mode = 0; break;
case '[': // a second escape code follows, do not reset mode
break;
@@ -314,7 +318,7 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int first)
first = 0;
efactor = windowWidth / 1024.0;
refresh_interval = 30;
tube_changeCharacterSize(cr, cr2, 74, 35, (int) (18.0 * efactor));
tube_changeCharacterSize(cr, cr2, 74, 35, efactor);
if (windowWidth != 1024) printf("Scaling: %0.3f\n", efactor / 4.0);
}
@@ -329,7 +333,7 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int first)
// clear persistent surface, if necessary
if (tube_doClearPersistent) {
tube_clearPersistent(cr,cr2);
tube_changeCharacterSize(cr, cr2, 74, 35, (int) (18.0 * efactor));
tube_changeCharacterSize(cr, cr2, 74, 35, efactor);
}
if (aplMode)
@@ -380,7 +384,7 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int first)
case 10: // new line
tube_y0 -= vDotsPerChar;
if (!argRaw) tube_x0 = leftmargin;
tek4010_checkLimits();
tek4010_checkLimits(cr, cr2);
goto endDo;
case 13: // return
if (mode != 30) { // special handling in ESC mode
@@ -608,25 +612,25 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int first)
case 0: break;
case 8: // backspace
tube_x0 -= hDotsPerChar;
tek4010_checkLimits();
tek4010_checkLimits(cr, cr2);
break;
case 9: // tab
if (argTab1)
tube_x0 += hDotsPerChar;
else
tube_x0 = tube_x0 - (tube_x0 % (8 * hDotsPerChar)) + 8 * hDotsPerChar;
tek4010_checkLimits();
tek4010_checkLimits(cr, cr2);
break;
case 11: // VT, move one line up
tube_y0 += vDotsPerChar;
tek4010_checkLimits();
tek4010_checkLimits(cr, cr2);
break;
case 23: // ctrl-w screen dump
system("scrot --focussed");
break;
default: if ((ch >= 32) && (ch <127)) { // printable character
tek4010_checkLimits();
tek4010_checkLimits(cr, cr2);
tube_drawCharacter(cr,cr2, ch);
todo-= 2;
}

23
tube.c
View File

@@ -74,6 +74,7 @@ int argTab1 = 0;
int argFull = 0;
int argARDS = 0;
int argAPL = 0;
int argAutoClear = 0;
int refresh_interval; // after this time in msec next refresh is done
@@ -273,7 +274,7 @@ void tube_init(int argc, char* argv[])
char *argv2[20];
size_t bufsize = 127;
int firstArg = 1;
printf("tek4010 version 1.4\n");
printf("tek4010 version 1.4.1\n");
windowName = "Tektronix 4010/4014 emulator";
if ((argc<2) || (argc>19)) {
printf("Error:number of arguments\n");
@@ -307,6 +308,8 @@ void tube_init(int argc, char* argv[])
argTab1 = 1;
else if (strcmp(argv[firstArg],"-full") == 0)
argFull = 1;
else if (strcmp(argv[firstArg],"-autoClear") == 0)
argAutoClear = 1;
else if (strcmp(argv[firstArg],"-APL") == 0) {
argAPL = 1;
windowName = "Tektronix 4013/4015 emulator (APL)";
@@ -706,16 +709,14 @@ void tube_drawCharacter(cairo_t *cr, cairo_t *cr2, char ch)
else if ((ch>=97) && (ch<=122)) sprintf(s,"%c", ch - 32); // capital letters
else sprintf(s," ");
break;
}
cairo_set_font_size(cr, currentFontSize + 2);
cairo_set_font_size(cr2,currentFontSize + 2);
}
}
else {
s[0] = ch;
s[1] = 0;
cairo_set_font_size(cr, currentFontSize);
cairo_set_font_size(cr2,currentFontSize);
}
cairo_set_font_size(cr, currentFontSize);
cairo_set_font_size(cr2,currentFontSize);
if (writeThroughMode) { // draw the write-through character
cairo_set_source_rgb(cr2, 0, WRITE_TROUGH_INTENSITY, 0);
@@ -849,14 +850,18 @@ void tube_setupPainting(cairo_t *cr, cairo_t *cr2, char *fontName)
cairo_select_font_face(cr2, fontName, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
}
void tube_changeCharacterSize(cairo_t *cr, cairo_t *cr2,int charsPerLine, int charsPerPage, int fontSize)
void tube_changeCharacterSize(cairo_t *cr, cairo_t *cr2,int charsPerLine, int charsPerPage, double fontSize)
{
int fontsize;
cairo_font_extents_t et;
hDotsPerChar = windowWidth / charsPerLine;
vDotsPerChar = windowHeight / charsPerPage;
leftmargin = 0;
currentFontSize = fontSize;
if (argARDS) {
currentFontSize = (int) (fontSize * APL_FONT_SIZE);
}
else {
currentFontSize = (int) (fontSize * STANDARD_FONT_SIZE);
}
cairo_set_font_size(cr, currentFontSize);
cairo_set_font_size(cr2,currentFontSize);
if (argARDS) {

5
tube.h
View File

@@ -2,7 +2,9 @@
// fonts
#define STANDARD_FONT "Monospace"
#define STANDARD_FONT_SIZE 18.0
#define APL_FONT "APL385 Unicode"
#define APL_FONT_SIZE 20.0
enum LineType {SOLID,DOTTED,DOTDASH,SHORTDASH,LONGDASH};
extern enum LineType ltype;
@@ -15,6 +17,7 @@ extern int argFull;
extern int argTab1;
extern int argRaw;
extern int argAPL;
extern int argAutoClear;
extern int hDotsPerChar;
extern int vDotsPerChar;
@@ -50,4 +53,4 @@ extern void tube_drawVector(cairo_t *cr, cairo_t *cr2);
extern void tube_drawCharacter(cairo_t *cr, cairo_t *cr2, char ch);
extern void tube_drawPoint(cairo_t *cr, cairo_t *cr2);
extern void tube_setupPainting(cairo_t *cr, cairo_t *cr2, char *fontName);
extern void tube_changeCharacterSize(cairo_t *cr, cairo_t *cr2, int charsPerLine, int charsPerPage, int fontSize);
extern void tube_changeCharacterSize(cairo_t *cr, cairo_t *cr2, int charsPerLine, int charsPerPage, double fontSize);

View File

@@ -1,5 +1,11 @@
Version 1.4 May 15
==================
Version 1.4.1 June 20, 2019
===========================
- argument -autoClear added
- improver character size handling for compilation with other fonts
Version 1.4 May 15, 2019
========================
- APL support released, Tek4010, 4013, 4014, 4015 emulation complete
Version 1.3.4 May 13, 2019