1
0
mirror of https://github.com/rricharz/Tek4010.git synced 2026-01-13 15:27:31 +00:00

Merge pull request #6 from larsbrinkhoff/lars/ards

ARDS support.
This commit is contained in:
Rene Richarz 2019-04-13 16:03:24 +02:00 committed by GitHub
commit 5b49d4eca4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 161 additions and 12 deletions

165
ards.c
View File

@ -40,6 +40,39 @@
static long startPaintTime;
// mode handles the current state of the emulator:
//
// mode 0 symbol mode
// mode 1 set point mode
// mode 2 extended vector mode
// mode 3 short vector mode
static int mode;
static int args;
static unsigned char data[4];
static int x0 = -485, y0 = 450, x2, y2;
static void draw_char (cairo_t *cr, cairo_t *cr2, char ch)
{
tube_x0 = (x0 + 540)/2;
tube_y0 = (y0 + 707)/2;
//fprintf (stderr, "[tube: %d,%d]", tube_x0, tube_y0);
tube_drawCharacter(cr, cr2, ch);
x0 += 9;
}
static void draw_vector (cairo_t *cr, cairo_t *cr2)
{
tube_x0 = (x0 + 540)/2;
tube_y0 = (y0 + 707)/2;
tube_x2 = (x2 + 540)/2;
tube_y2 = (y2 + 707)/2;
//fprintf (stderr, "[tube: %d,%d - %d,%d]", tube_x0, tube_y0, tube_x2, tube_y2);
tube_drawVector(cr, cr2);
}
void ards_draw(cairo_t *cr, cairo_t *cr2, int first)
// draw onto the main window using cairo
// cr is used for persistent drawing, cr2 for temporary drawing
@ -65,10 +98,7 @@ void ards_draw(cairo_t *cr, cairo_t *cr2, int first)
refresh_interval = 30;
}
windowWidth = actualWidth;
tube_changeCharacterSize(cr, cr2, 74, 35, (int) (18.0 * efactor));
// printf("Scaling: %0.2f\n", efactor);
// printf("Offset: %d\n",eoffx);
// printf("Refresh interval: %d\n",refresh_interval);
tube_changeCharacterSize(cr, cr2, 74, 35, (int) (10.0 * efactor));
}
startPaintTime = tube_mSeconds(); // start to measure time for this draw operation
@ -89,14 +119,125 @@ void ards_draw(cairo_t *cr, cairo_t *cr2, int first)
do {
ch = tube_getInputChar();
// decode and act here
printf("-ARDS mode not yet implemented\n");
exit(1);
if (tube_isInput() == 0) {
}
if (ch == -1) {
return; // no char available, need to allow for updates
}
//fprintf (stderr, "\n[INPUT %03o [%d/%d]]", ch, mode, args);
if (args > 0) {
data[--args] = ch;
}
switch (ch) {
case 007:
mode = 0;
args = 0;
break;
case 010:
mode = 0;
args = 0;
x0 -= hDotsPerChar;
break;
case 012:
mode = 0;
args = 0;
y0 -= vDotsPerChar;
break;
case 014:
mode = 0;
args = 0;
x0 = -485;
y0 = 450;
tube_clearPersistent(cr, cr2);
break;
case 015:
mode = 0;
args = 0;
x0 = -479;
break;
case 034:
mode = 0;
args = 0;
break;
case 035:
//fprintf (stderr, "[POINT]");
mode = 1;
args = 4;
break;
case 036:
//fprintf (stderr, "[E VEC]");
mode = 2;
args = 4;
break;
case 037:
//fprintf (stderr, "[S VEC]");
mode = 3;
args = 2;
break;
default:
if (args == 0) {
switch (mode) {
case 0:
//fprintf (stderr, "[SYMBOL %c @ %d, %d]", ch, x0, y0);
draw_char (cr, cr2, ch);
break;
case 1:
args = 4;
x0 = (data[3] & 076) >> 1;
x0 |= (data[2] & 037) << 5;
if (data[3] & 1)
x0 = -x0;
y0 = (data[1] & 076) >> 1;
y0 |= (data[0] & 037) << 5;
if (data[1] & 1)
y0 = -y0;
//fprintf (stderr, "[POINT @ %d, %d]", x0, y0);
break;
case 2:
args = 4;
x2 = (data[3] & 076) >> 1;
x2 |= (data[2] & 037) << 5;
if (data[3] & 1)
x2 = -x2;
x2 += x0;
y2 = (data[1] & 076) >> 1;
y2 |= (data[0] & 037) << 5;
if (data[1] & 1)
y2 = -y2;
y2 += y0;
//fprintf (stderr, "[E VEC @ %d,%d - %d,%d]", x0, y0, x2, y2);
if (data[2] & 040)
; //fprintf (stderr, "[INVISIBLE]");
else
draw_vector(cr, cr2);
if (data[0] & 040)
; //fprintf (stderr, "[DOTTED]");
x0 = x2;
y0 = y2;
break;
case 3:
args = 2;
x2 = (data[1] & 076) >> 1;
if (data[1] & 1)
x2 = -x2;
x2 += x0;
y2 = (data[0] & 076) >> 1;
if (data[0] & 1)
y2 = -y2;
y2 += y0;
draw_vector(cr, cr2);
//fprintf (stderr, "[S VEC @ %d,%d - %d,%d]", x0, y0, x2, y2);
x0 = x2;
y0 = y2;
break;
}
}
break;
}
}
while (((tube_mSeconds() - startPaintTime) < refresh_interval));

1
ardsfiles/dragon.pic Executable file

File diff suppressed because one or more lines are too long

5
ardsfiles/foobar.pic Executable file
View File

@ -0,0 +1,5 @@
bgWQRHrF~FECeHkFmF~BD@yAdF{BD@tAC`oAjHJF@@@@@@@@@@@@vGwAK@PBycnATDPCV@J@R@E@R@G@J@]@oCaChctCN@Q@E@U@K@O@[CICIikD\As@Wat@@Aj@S`GAh@^@BafAC@@@U@K@G@Y@J@U@\@W@X@D@R@@@N@R@G@Z@U@V@W@F@O@@@\aFAG@@@M@a@R@W@b@M@R@B@X@N@B@Z@U@R@U@L@U@@@_@I@fbb@L@G@P@D@G@N@K@E@E@C@{`d@C@B@H@N@R@B@F@Q@J@I@F@G@D@G@F@G@Q@H@a@F@G@F@@@J@KqFHEnjoy the delicious FOO-BAR,
a product of:
Gopher Baroque, Inc.
1 Star Drive
Sonova Beach, CA 94040

1
ardsfiles/snoopy.pic Normal file
View File

@ -0,0 +1 @@
_hhIHAPPINESSofHHIS_ihFNOT USING MulticsqahEAI@@@@`D@I@@@@aDlcEF_J\cOEJFJDNCHGJS@dp@SGOFGJDRFCFGDGFEHIdfuEOVGTEXCVBVCHBJDRxeFC@SGG^@_Cd@eCd@eEf@iCh@gEhBiEh@mCl@mEl@mEn@oEl@mEp@qEp@qEr@uEt@uCt@wEv@wGx@yEx@wEx@{Ez@yGz@{Ex@yEx@{E|@{E|@{Ex@yEz@{Ex@yGx@yEx@wCv@wEv@wEv@uGv@wCt@sGr@qEn@mEl@iEf@gEf@eEb@_C\@CC[C\@[CVCSCvepBXBU@FBGBFBGDDBGFrepBCQEmBgB[FUNYJENDLhCDBZC\GVEPCNGPKJKBEREEDfYAuOCByWGGGIDGNBhJhTVTvdCGmQR`NhDtKhKNOLUCUSKSk@KBG[B[JSdKhEjB`DZJPhLVJ\VxBXCXC\EZKZGPSZJCERONKRCRBBCRrdKBIWGSSS[SWO[OKOWISKGMCSJCRJRbsDDSJQVBJJ@TBcEEV@EBheAHVQBBDAR@RBUNOVeJSCZeTBE@AAJyHYJONKR@NJPNN\JZCvOxO`WZaXyF{GeWQWGUCYD]BQIMKO_oMiCqD[JaFQRGTM\FRFPJVBN@BEDfW@MOGSIYESZbsAGGGGGICKBKJIRBJLLH@NBcxBMEKGSGJbYDFTNNLFJ@BEFGpbIHYC@@@PhB@@@Sk`GHIJ@\NdLA@@JVF|uFCJEJGHKFKDMBM@MEKGIIGKCK@KBKFKHIJGLEL@LBJDJFFHDJBJI`cECHEHGFIFIDIBICIEIGGGEICIBIDIFGHGHEHCHBHDHFFFDHBHm`SFE]FMr`cF~Ag@DaiFRN@ShasFRN@SLbニRN@SYa{Dkp}biC\fYaWDq@XAWbaBXy`WDCrUaEC!W`kDN@FAI`ECsacg`]BJh]`SAas`IABd潸@Qqay@?WaYAJqSbcAZyaCBTiyohT

1
ardsfiles/world.pic Executable file

File diff suppressed because one or more lines are too long