Terminal code for Home Cursor

That's neat. I looked but my 4010 code was split off a few years ago and I can't find it. I will look and post it if I can. All I can find now is:

// change TEK4010 mode
const char VT_4010_MODE[] = "\x1B[?38h";
const char VT_100_MODE[] = "\x1B[?38l";
const char VT_4010_GRAPHIC[] = "\x1D";
const char VT_4010_ALPHA[] = "\x1F";

const char VT_4010_SHOWCURSOR[] = "\x1B\x1A";
const char VT_4010_REQUESTPOS[] = "\x1B\x05";
const char VT_4010_GIN[] = "\x1B[?38h";
const char VT_4010_ERASE[] = "\x1B\x0C";

// TEK 4010 specific

void drawPoint(int x, int y) {
	if (x < 0)
		x = 0;
	if (x >= 1024)
		x = 1023;
	if (y < 0)
		y = 0;
	if (y >= 768)
		y = 767;
	Serial.write(y / 32 + 0x20);
	Serial.write((y & 31) + 0x60);
	Serial.write(x / 32 + 0x20);
	Serial.write((x & 31) + 0x40);

void drawLine(int x, int y, int x1, int y1) {
	drawPoint(x, y);
	drawPoint(x1, y1);

Edit - a sneaky thing about Tera Term that you should know if you don't already - TEK4010 mode is disabled by default, probably to avoid accidental triggering of the mode by junk characters. So you have to enable it, and either create a new profile and save it, or save it in the default profile, if you want it to be automatically set the next time you use it.

You can see the vintage of this piece - needs and will get some comments and defined constants. But the VT100/TEK4010 manuals are also a must have for working with this virtual device.

Also, IIRC with the code above (actually heavily impacted by the terminal protocol requirements), 'drawPoint' should be private in a class because it won't function alone. To make a screen point, you must draw a line from and to the same coordinates. That is just the way I remember it.

It would be fun to test it on an actual TEK4010. :slight_smile:

i wouldn't be surprised if there were a few of them still around somewhere. But what can a TEK do that other ones like putty can't do?

A mouse driven GUI.

wow now THAT'S something i never even heard of. An arduino with a GUI interface. The possibilities are vast :open_mouth:
if that was an actual option that we could do it would change the landscape for weenie developers. i gotta contemplate that one for a while...

just thought of something else. A gui for my PC software. The windows API is a nightmare. Like the simplest user input is a PITA. Could i use this instead for my desktop apps?

Certainly, but the limited resolution and beam deflection paradigm of the TEK4010 pale in comparison to today's displays. So it's more of a fun curiosity than a daily workhorse. I am having trouble digging it up though... stay tuned.

So I continue to dig but I finally found at least a screen shot of the GUI:

Clicking on "toggle LED" changes the state of the on board LED.

beam deflection paradigm? that's how it works? you're creating a pair of deflection signals and a raster signal?

Yes, the TEK4010 was really a "memory oscilloscope" with digital beam deflection circuitry. The CRT had a bias current system, any area that is hit by the beam, remains energized for a few minutes by the bias. So it's like writing with a pen. All in CRT hardware. So the emulation consists of line drawing and erase commands exclusively.

damn that's pretty amazing in itself. But a mouse driven GUI? How does it take input from a mouse?