mirror of
https://github.com/rricharz/Tek4010.git
synced 2026-01-11 23:53:16 +00:00
added circles.c in tektests, good test for skipping coordinate bytes
This commit is contained in:
parent
512e2031f0
commit
12c6b413cf
@ -234,7 +234,7 @@ tek4010 has the following options:
|
||||
-full in this mode the tek4010 emulator creates a full screen window, and
|
||||
uses the full resolution of the 4014 with the enhanced graphics module
|
||||
installed, scaled down to the actual window size. Use control-q to
|
||||
close the tek4010 window. This option is experimental.
|
||||
close the tek4010 window.
|
||||
|
||||
-ARDS display ARDS data
|
||||
|
||||
|
||||
74
tektests/circles.c
Normal file
74
tektests/circles.c
Normal file
@ -0,0 +1,74 @@
|
||||
#define MAXX 1024
|
||||
#define MAXY 680
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
int xs,ys;
|
||||
|
||||
void startDraw(int x1,int y1)
|
||||
{
|
||||
if (x1 < 0) x1 = 0;
|
||||
if (x1 >= MAXX) x1 = MAXX -1;
|
||||
if (y1 < 0) y1 = 0;
|
||||
if (y1 >= MAXY) y1 = MAXY - 1;
|
||||
putchar(29);
|
||||
putchar((y1 >> 5) + 32);
|
||||
putchar((y1 & 31) + 96);
|
||||
putchar((x1 >> 5) + 32);
|
||||
putchar((x1 & 31) + 64);
|
||||
xs = x1;
|
||||
ys = y1;
|
||||
}
|
||||
|
||||
void draw(int x2,int y2)
|
||||
{
|
||||
int hxchange, lychange;
|
||||
|
||||
if (x2 < 0) x2 = 0;
|
||||
if (x2 >= MAXX) x2 = MAXX -1;
|
||||
if (y2 < 0) y2 = 0;
|
||||
if (y2 >= MAXY) y2 = MAXY - 1;
|
||||
|
||||
if ((y2 >> 5) != (ys >> 5)) /* if high y has changed */
|
||||
putchar((y2 >> 5) + 32);
|
||||
hxchange = (x2 >> 5) != (xs >> 5);
|
||||
lychange = (y2 & 31) != (ys & 31);
|
||||
if (hxchange || lychange) putchar((y2 & 31) + 96);
|
||||
if (hxchange) /* if high order x has changed */
|
||||
putchar((x2 >> 5) + 32);
|
||||
putchar((x2 & 31) + 64);
|
||||
xs = x2;
|
||||
ys = y2;
|
||||
}
|
||||
|
||||
void endDraw()
|
||||
{
|
||||
putchar(31);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
int drawCircle(int x,int y,int r)
|
||||
{
|
||||
int i;
|
||||
double arg;
|
||||
startDraw(x + r, y);
|
||||
for (i = 0; i <= r; i++) {
|
||||
arg = (double)(i) * 6.283185307 / (double) r;
|
||||
draw(x + (int)((double)r * cos(arg)), y + (int)((double)r * sin(arg)));
|
||||
}
|
||||
endDraw();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
drawCircle(512, 340, 200);
|
||||
drawCircle(612, 340, 100);
|
||||
drawCircle(412, 340, 100);
|
||||
drawCircle(512, 240, 100);
|
||||
drawCircle(512, 440, 100);
|
||||
startDraw(212,340); draw(812,340); endDraw();
|
||||
startDraw(512,040); draw(512,640); endDraw();
|
||||
|
||||
startDraw(1,1); endDraw(); // move the cursor out of the way
|
||||
}
|
||||
1
tektests/circles.plt
Normal file
1
tektests/circles.plt
Normal file
@ -0,0 +1 @@
|
||||
*t6HHzG+`GfGmFsEyDC,eAk@q5^w\}Y-cWiTnRtOyLH.dEiAn4^sZxV|Q/aMeHjDn3_rZuUyP|K0`Ec@f2ZhUkOmIpCr1]tWuQwKxEy0_zY{RLF|@{/ZTNzGyAx.[wUuOtIrCp-]mWkQhKfFc@`,[/|UyPuKrFnAj+\eXaS.|OxJsFnBi*_d[-XyTtQnNiLcI,}GwDqBk@e)_+]y\s[mZfY`Y*zYtXnYhYbY){Zu[o\i]c_(}*@wBqDkGeI'LzNtQoTiXd[&_z+BuFpJlOgScX%~\z,AvFsKoPlUh[e-@bF`K$}Q{Wx]v.CtIsOqUp[o/AnGmNTZl0@mFLRnYo_p1EqKsQtWv]x2C{I}O%`UbZe3@hElKoPsUvZz_~4D&cHgMlQpVuZz^5A'dEiHoLtOzRT(eWkYq\w^}6@)cAiCoDuE{F*bGhG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|
||||
putchar(31);
|
||||
fflush(stdout);
|
||||
|
||||
7
tektests/makefile
Normal file
7
tektests/makefile
Normal file
@ -0,0 +1,7 @@
|
||||
all: incremental circles
|
||||
|
||||
incremental: incremental.c
|
||||
gcc -o incremental incremental.c -lm
|
||||
|
||||
circles: circles.c
|
||||
gcc -o circles circles.c -lm
|
||||
Loading…
x
Reference in New Issue
Block a user