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

fixed a few bugs related to BSD plotlib

This commit is contained in:
¨Rene Richarz
2019-03-27 16:44:45 +01:00
parent a78641c64d
commit e80bed76ce
3 changed files with 44 additions and 19 deletions

View File

@@ -26,7 +26,11 @@ There is a file "captured_data" in the repo, which you can use to test the tek40
./tek4010 /bin/cat captured_data -noexit
Don't forget the absolute path to "cat" and the LAST argument "-noexit", which tells
If you want to test text output, type for example
./tek4010 /usr/bin/head -n 32 tek4010.c -noexit
Don't forget the absolute path to "cat" or "head" and the LAST argument "-noexit", which tells
tek4010 to stay alive after cat has finished so that you have a chance to look at the output.
By the way, the "-noexit" as the LAST argument might also be helpful if you want to
experiment with other commands. Let me know if you find anything which works and makes sense.
@@ -60,11 +64,7 @@ If this works properly, you can use the tek4010 emulator. Call it as follows:
It the current alpha-testing version, there are very few useful hints if this does not work.
If the terminal window is closed right away, there is a problem with your rsh call or you
forgot to use the absolute path for rsh. If it does not work, you might want to try
./tek4010 /usr/bin/rsh -l user_name system -noexit
If you are lucky, rsh will produce an output which might tell you something.
forgot to use the absolute path for rsh.
The following keys are not transmitted to the Unix system, but are executed locally
in the terminal emulator and clear the persistent screen:

BIN
tek4010

Binary file not shown.

View File

@@ -33,13 +33,13 @@ float memv[MEM];
*/
int count = 0;
static int x0,y0,x2,y2;
static int x0,y0,x2,y2,xh,xl,yh,yl;
// mode handles the current state of the emulator:
//
// mode 0 alpha mode
//
// mode 1 expecting first byte of dark mode (move to) address
// mode 1 expecting address byte of dark mode (move to) address
// mode 2 expecting second byte of dark mode (move to) address
// mode 3 expecting third byte of dark mode (move to) address
// mode 4 expecting fourth byte of dark mode (move to) address
@@ -242,8 +242,8 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int width, int height, int first)
if (ch == -1) todo--; // no char available, need to allow for updates
if ((mode>=1) && (mode <=9) &&
((ch==31) || (ch==13))) {
mode = 0; // leave graphics mode
((ch==31) || (ch==13))) {
mode = 0; // exit from graphics mode
showCursor = 0;
ch = -1;
}
@@ -252,15 +252,40 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int width, int height, int first)
if ((ch>='0') && (ch<='9')) mode = 30;
}
switch (mode) {
case 1: y0 = 32 * (ch - 32); mode++; break;
case 2: y0 = y0 + ch - 96; mode++; break;
case 3: x0 = 32 * (ch - 32); mode++; break;
case 4: x0 = x0 + ch - 64; mode++; break;
case 5: y2 = 32 * (ch - 32); mode++; break;
case 6: y2 = y2 + ch - 96; mode++; break;
case 7: x2 = 32 * (ch - 32); mode++; break;
case 8: x2 = x2 + ch - 64;
if ((mode>=1)&&(mode<=8)) {
if ((mode == 5) && (ch == 29)) {
mode = 1; return;
}
int tag = ch >> 5;
if (tag == 0) {
return;
}
// if (mode & 1)
// printf("H%d-%d,",tag, 32 * (ch & 31));
// else
// printf("L%d-%d,",tag, ch & 31);
if (tag > 0) { // bytes identified by tag, some can be skipped
if ((mode == 5) && (tag != 1)) mode = 6;
if ((mode == 6) && (tag != 3)) mode = 7;
if ((mode == 7) && (tag != 1)) mode = 8;
}
}
switch (mode) {
case 1: yh = 32 * (ch & 31); mode++; break;
case 2: yl = (ch & 31); y0 = yh + yl; mode++; break;
case 3: xh = 32 * (ch & 31); mode++; break;
case 4: xl = (ch & 31); x0= xh + xl; mode++;
// printf("\nMoving to (%d,%d)\n",x0,y0);
break;
case 5: yh = 32 * (ch & 31); mode++; break;
case 6: yl = (ch & 31); mode++; break;
case 7: xh = 32 * (ch & 31); mode++; break;
case 8: xl = (ch & 31);
x2 = xh + xl;
y2 = yh + yl;
// printf("\nDrawing vector to (%d,%d)\n",x2,y2);
cairo_move_to(cr, x0, WINDOW_HEIGHT - y0);
cairo_line_to(cr, x2, WINDOW_HEIGHT - y2);
cairo_stroke (cr);