Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Tektronix 4010(4014) graphic terminal (emulator) library

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-AVR code here
View previous topic :: View next topic  
Author Message
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 320
Location: Japan

japan.gif
PostPosted: Fri Oct 03, 2014 2:23 am    Post subject: Tektronix 4010(4014) graphic terminal (emulator) library Reply with quote

Tektronix 4010 (4014) is a computer graphics terminal of an old time.
Catalog: Tektronix 4010 Computer Display Terminal

Terminal emulator software "Tera Term" has a TEK4010 (4014) terminal emulation function.
BASCOM makes a graph draw to a personal computer using this function.

It connects by "RS-232C" or "USB-serial conversion" using UART of AVR.
Since the Arduino board carries "USB-serial conversion", the addition of an option is unnecessary.

AVR obtains the display screen of high resolution, and acquires the capability to print(Hard copy) it with a printer!

Computer screen Hard copy


1.Download and install the latest version of "Tera Term" from "SourceForge.jp".

2.[Setup] -> [Serial port] -> "Serial port setup" dialog box.Set the baud rate.

3.[Setup] -> [Terminal] -> "Terminal setup" dialog box. Enable the "Auto switch (VT<->TEK)".

4.[Control] -> [Open TEK] -> Opens the TEK window.
[Setup] -> [Font] -> "Font" dialog box. Font size is changed into any value. (Example: Size 16)

5.[Setup] -> [Window] -> "Window setup" dialog box. The color of "Text" and "Background" is changeable.

6.[VT-window] -> Return to the "VT-window".
[Setup] -> [Save setup] -> "Save setup" dialog box. Save the settings.

Code:

   '
   '  ***************************************************
   '  *  Tektronix 4010(4014) Graphic Terminal Library  *
   '  *                       O-Family   2014. 9.29     *
   '  ***************************************************
   '

$regfile = "m88pdef.dat"                                    'Any chip.
$crystal = 16000000                                         'Any frequency.
   '
$hwstack = 64
$swstack = 32
$framesize = 24


$baud = 9600                                                'Set the baud rate.

'--------- Include a control instruction of TEK4010. ---------
Dim _temptx As Byte                                         'Internal variables of the library.
_temptx = &H1F : Printbin _temptx                           '[US] Changes Terminal to Alpha Mode.
$lib "TEK4010emu.lib"                                       'Tektronix 4010(4014) graphic terminal (emulator) library.
$external Tekcls , Tekline , Tekbox , Tekpset , Teklocate , Tekgraph , Tekalpha , Tekplot
Declare Sub Tekcls : Declare Sub Tekalpha : Declare Sub Teklocate(byval _tekx0 As Word , Byval _teky0 As Word)
Declare Sub Tekline(byval _tekx0 As Word , Byval _teky0 As Word , Byval _tekx1 As Word , Byval _teky1 As Word , Byval _tekvt As Byte)
Declare Sub Tekbox(byval _tekx0 As Word , Byval _teky0 As Word , Byval _tekx1 As Word , Byval _teky1 As Word , Byval _tekvt As Byte)
Declare Sub Tekpset(byval _tekx0 As Word , Byval _teky0 As Word)
Declare Sub Tekgraph(byval _tekvt As Byte) : Declare Sub Tekplot(byval _tekx0 As Word , Byval _teky0 As Word)
'
   ' Tekcls  <Clear the Vector and Alpha Screen.>
   ' Tekline X(start) , Y(start) , X(end) , Y(end) , Vector-Type  [X = 0 - 1023 , Y = 0 - 778 , Vector-Type = 0 - 23]  <Draws a line.>
   '         [Vector-Type = 0:normal line , 1:dotted line , 2:dot-dashed , 3:short-dashed , 4:long-dashed]
   ' Tekbox X(left corner) , Y(top position) , X(right corner) , Y(bottom position) , Vector-Type  <Write a box.>
   ' Tekpset X(location) , Y(location)  [X = 0 - 1023 , Y = 0 - 778]  <Set a single pixel.>
   ' Teklocate X(location) , Y(location)  [X = 0 - 1023 , Y = 0 - 778]  <Moves the Alpha cursor to the specified position.>
   ' Tekgraph Vector-Type  [Vector-Type = 0 - 23]  <Sets Terminal to Graph Mode , Select the vector type.>
   ' Tekplot X(location) , Y(location)  [X = 0 - 1023 , Y = 0 - 778]  <Plot the graph line.>  Note: Perform Tekgraph.
   ' Tekalpha  <Terminal is returned to alpha mode.>
'-------------------------------------------------------------



   ' ************************
   ' * Drawing test program *
   ' ************************

   Dim W1 As Word , W2 As Word , W3 As Word , S1 As Single , S2 As Single , B As Byte

   Tekcls                                                   'Clear the Vector and Alpha Screen.
   Print "Tektronix 4010(4014) graphic terminal (emulator)"


   Tekline 0 , 0 , 1023 , 0 , 1                             'Outer frame.
   Tekline 1023 , 0 , 1023 , 778 , 1
   Tekline 1023 , 778 , 0 , 778 , 1
   Tekline 0 , 778 , 0 , 0 , 1
   '
   Tekline 0 , 430 , 1023 , 430 , 0                         'Vector Type.
   Tekline 0 , 420 , 1023 , 420 , 1
   Tekline 0 , 410 , 1023 , 410 , 2
   Tekline 0 , 400 , 1023 , 400 , 3
   Tekline 0 , 390 , 1023 , 390 , 5
   '
   Teklocate 900 , 388                                      'Moves the Alpha cursor.
   Print "Vector Type"


   For W1 = 448 To 778 Step 10                              'Slanting line.
      Tekline 0 , 448 , 1023 , W1 , 0
   Next W1


   Tekbox 80 , 720 , 280 , 580 , 1                          'Write a box.
   Tekbox 100 , 700 , 200 , 600 , 0
   '
   Teklocate 134 , 638                                      'Moves the Alpha cursor.
   Print "BOX"


   Tekline 30 , 195 , 390 , 195 , 1                         'Scale line.
   Tekline 30 , 45 , 30 , 345 , 0
   '
   For W1 = 0 To 360                                        'Sign waveform.
      S1 = W1
      S1 = Deg2rad(s1)
      S1 = Sin(s1)
      S1 = S1 * 150
      S1 = S1 + 195
      W2 = Int(s1)
      W3 = W1 + 30
      Tekpset W3 , W2                                       'Set a single pixel.
   Next W1
   '
   Teklocate 240 , 270                                      'Moves the Alpha cursor.
   Print "Sign Wave"


   Tekline 450 , 195 , 710 , 195 , 3                        'Scale line.
   Tekline 580 , 65 , 580 , 325 , 3
   '
   For W1 = 0 To 360                                        'Circle.
      S1 = W1
      S1 = Deg2rad(s1)
      S2 = Cos(s1)
      S1 = Sin(s1)
      S1 = S1 * 120
      S1 = S1 + 195
      W2 = Int(s1)
      S2 = S2 * 120
      S2 = S2 + 580
      W3 = Int(s2)
      Tekpset W3 , W2                                       'Set a single pixel.
   Next W1
   '
   Teklocate 500 , 230                                      'Moves the Alpha cursor.
   Print "Circle"


   Tekline 770 , 80 , 1000 , 80 , 0                         'Scale line.
   Tekline 770 , 80 , 770 , 310 , 0
   '
   Restore Graphdata                                        'Drawing a graph.
   W1 = 770                                                 'X position.
   Tekgraph 1                                               'Sets Terminal to Graph Mode , Select the vector type.
   For B = 1 To 5
      Read W2
      Tekplot W1 , W2                                       'Plot the graph line.
      W1 = W1 + 50
   Next B
   Tekalpha                                                 'Terminal is returned to alpha mode.
   '
   Teklocate 860 , 280                                      'Moves the Alpha cursor.
   Print "Graph"


   Teklocate 50 , 520                                       'Moves the Alpha cursor.
   Print "END"

   End


Graphdata:
   Data 120% , 220% , 250% , 150% , 180%                    'Graph data.
 


Coordinate

By changing a part of embedded program and library, software UART can also be used for AVR without UART.
"Printbin" -> "Printbin #1"


Last edited by O-Family on Mon Jan 09, 2023 9:32 am; edited 5 times in total
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Fri Oct 03, 2014 10:44 am    Post subject: Reply with quote

Hello O-Family,

great nostalgic application Very Happy
It was nice to read the brochure. $3500 for a terminal, wow !

Your lib is a good example for a serial based display.
Because of the emulator it is simple to try.
Thanks for sharing.

_________________
Mark
Back to top
View user's profile Visit poster's website
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 320
Location: Japan

japan.gif
PostPosted: Wed Jan 07, 2015 2:21 am    Post subject: Reply with quote

The above was corresponds to 4010 (4014) of monochrome display.
"Tera Term" also corresponds to 410x of color display.
Therefore, I added the "Tekcolor" command for specifying the drawing color.

Computer screen

1.Download and install the latest version of "Tera Term" from "SourceForge.jp".

2.[Setup] -> [Serial port] -> "Serial port setup" dialog box.Set the baud rate.

3.[Setup] -> [Terminal] -> "Terminal setup" dialog box. Enable the "Auto switch (VT<->TEK)".

4.[Control] -> [Open TEK] -> Opens the TEK window.
[Setup] -> [Font] -> "Font" dialog box. Font size is changed into any value. (Example: Size 16)

5.[Setup] -> [Window] -> "Window setup" dialog box. Enable the "Color emulation".
Background color, you can change by "Reverse" button.

6.[VT-window] -> Return to the "VT-window".
[Setup] -> [Save setup] -> "Save setup" dialog box. Save the settings.

Code:


   '
   '  ********************************************************
   '  *  Tektronix 4010(4014,410x) Graphic Terminal Library  *
   '  *            [Ver.2]         O-Family   2015. 1. 5     *
   '  ********************************************************
   '

$regfile = "m88pdef.dat"                                    'Any chip.
$crystal = 16000000                                         'Any frequency.
   '
$hwstack = 64
$swstack = 32
$framesize = 24


$baud = 9600                                                'Set the baud rate.

'--------- Include a control instruction of TEK4010. ---------
Dim _temptx As Byte                                         'Internal variables of the library.
_temptx = &H1F : Printbin _temptx                           '[US] Changes Terminal to Alpha Mode.
$lib "TEK4010emu.lib"                                       'Tektronix 4010(4014,410x) graphic terminal (emulator) library.
$external Tekcls , Tekline , Tekbox , Tekpset , Teklocate , Tekgraph , Tekalpha , Tekplot , Tekcolor
Declare Sub Tekcls : Declare Sub Tekalpha : Declare Sub Teklocate(byval _tekx0 As Word , Byval _teky0 As Word)
Declare Sub Tekline(byval _tekx0 As Word , Byval _teky0 As Word , Byval _tekx1 As Word , Byval _teky1 As Word , Byval _tekvt As Byte)
Declare Sub Tekbox(byval _tekx0 As Word , Byval _teky0 As Word , Byval _tekx1 As Word , Byval _teky1 As Word , Byval _tekvt As Byte)
Declare Sub Tekpset(byval _tekx0 As Word , Byval _teky0 As Word) : Declare Sub Tekcolor(byval _tekcol As Byte)
Declare Sub Tekgraph(byval _tekvt As Byte) : Declare Sub Tekplot(byval _tekx0 As Word , Byval _teky0 As Word)
'
   ' Tekcls  <Clear the Vector and Alpha Screen.>
   ' Tekcolor Color  [0 = Black, 1 = Red, 2 = Green, 3 = Yellow, 4 = Blue, 5 = Magenta, 6 = Cyan, 7 = White]  <Set a color of the drawing.>
   ' Tekline X(start) , Y(start) , X(end) , Y(end) , Vector-Type  [X = 0 - 1023 , Y = 0 - 778 , Vector-Type = 0 - 23]  <Draws a line.>
   '         [Vector-Type = 0:normal line , 1:dotted line , 2:dot-dashed , 3:short-dashed , 4:long-dashed]
   ' Tekbox X(left corner) , Y(top position) , X(right corner) , Y(bottom position) , Vector-Type  <Write a box.>
   ' Tekpset X(location) , Y(location)  [X = 0 - 1023 , Y = 0 - 778]  <Set a single pixel.>
   ' Teklocate X(location) , Y(location)  [X = 0 - 1023 , Y = 0 - 778]  <Moves the Alpha cursor to the specified position.>
   ' Tekgraph Vector-Type  [Vector-Type = 0 - 23]  <Sets Terminal to Graph Mode , Select the vector type.>
   ' Tekplot X(location) , Y(location)  [X = 0 - 1023 , Y = 0 - 778]  <Plot the graph line.>  Note: Perform Tekgraph.
   ' Tekalpha  <Terminal is returned to alpha mode.>
'-------------------------------------------------------------



   ' ************************
   ' * Drawing test program *
   ' ************************

   Dim W1 As Word , W2 As Word , W3 As Word , S1 As Single , S2 As Single , B As Byte

   Tekcolor 7                                               'Drawing color [white].
   Tekcls                                                   'Clear the Vector and Alpha Screen.
   Print "Tektronix 4010(4014,410x) graphic terminal (emulator)"

   Tekcolor 1                                               'Drawing color [Red].
   Tekbox 0 , 0 , 1023 , 778 , 1                            'Outer frame.
   '
   Tekcolor 2                                               'Drawing color [Green].
   Tekline 0 , 430 , 1023 , 430 , 0                         'Vector Type.
   Tekline 0 , 420 , 1023 , 420 , 1
   Tekline 0 , 410 , 1023 , 410 , 2
   Tekline 0 , 400 , 1023 , 400 , 3
   Tekline 0 , 390 , 1023 , 390 , 5
   '
   Tekcolor 7                                               'Drawing color [White].
   Teklocate 900 , 388                                      'Moves the Alpha cursor.
   Print "Vector Type"

   Tekcolor 4                                               'Drawing color [Blue].
   W1 = 448
   For B = 1 To 34                                          'Slanting line.
      Tekline 0 , 448 , 1023 , W1 , 0
      W1 = W1 + 10
   Next B

   Tekcolor 3                                               'Drawing color [Yellow].
   Tekbox 80 , 720 , 280 , 580 , 1                          'Write a box.
   Tekbox 100 , 700 , 200 , 600 , 0
   '
   Teklocate 134 , 638                                      'Moves the Alpha cursor.
   Print "BOX"

   Tekcolor 7                                               'Drawing color [White].
   Tekline 30 , 195 , 390 , 195 , 1                         'Scale line.
   Tekline 30 , 45 , 30 , 345 , 0
   '
   Tekcolor 5                                               'Drawing color [Magenta].
   For W1 = 0 To 360                                        'Sign waveform.
      S1 = W1
      S1 = Deg2rad(s1)
      S1 = Sin(s1)
      S1 = S1 * 150
      S1 = S1 + 195
      W2 = Int(s1)
      W3 = W1 + 30
      Tekpset W3 , W2                                       'Set a single pixel.
   Next W1
   '
   Teklocate 240 , 270                                      'Moves the Alpha cursor.
   Print "Sign Wave"

   Tekcolor 7                                               'Drawing color [White].
   Tekline 450 , 195 , 710 , 195 , 3                        'Scale line.
   Tekline 580 , 65 , 580 , 325 , 3
   '
   Tekcolor 6                                               'Drawing color [Cyan].
   For W1 = 0 To 360                                        'Circle.
      S1 = W1
      S1 = Deg2rad(s1)
      S2 = Cos(s1)
      S1 = Sin(s1)
      S1 = S1 * 120
      S1 = S1 + 195
      W2 = Int(s1)
      S2 = S2 * 120
      S2 = S2 + 580
      W3 = Int(s2)
      Tekpset W3 , W2                                       'Set a single pixel.
   Next W1
   '
   Teklocate 500 , 230                                      'Moves the Alpha cursor.
   Print "Circle"

   Tekcolor 7                                               'Drawing color [White].
   Tekline 770 , 80 , 1000 , 80 , 0                         'Scale line.
   Tekline 770 , 80 , 770 , 310 , 0
   '
   Tekcolor 1                                               'Drawing color [Red].
   Restore Graphdata                                        'Drawing a graph.
   W1 = 770                                                 'X position.
   Tekgraph 1                                               'Sets Terminal to Graph Mode , Select the vector type.
   For B = 1 To 5
      Read W2
      Tekplot W1 , W2                                       'Plot the graph line.
      W1 = W1 + 50
   Next B
   Tekalpha                                                 'Terminal is returned to alpha mode.
   '
   Teklocate 860 , 280                                      'Moves the Alpha cursor.
   Print "Graph"

   Tekcolor 7                                               'Drawing color [White].
   Teklocate 50 , 520                                       'Moves the Alpha cursor.
   Print "END"

   End


Graphdata:
   Data 120% , 220% , 250% , 150% , 180%                    'Graph data.
Back to top
View user's profile Visit poster's website
rredding

Bascom Member



Joined: 25 Mar 2005
Posts: 63
Location: Tacoma WA

PostPosted: Sat Feb 27, 2016 5:55 pm    Post subject: TEK 4010 Reply with quote

Wow! That brought back memories. When I was quite a bit younger I bought a 4010 terminal surplus for about $20 or $30 USD. I think I had to fix up the power supply to get it to work. Anyway, these were fun to watch since they work kind of like an oscilloscope with persistence. I remember writing a 4010 driver for a program I wrote. I was able to output 2D graphs and such. Anyway, thanks for sharing this.
Back to top
View user's profile
Per Svensson

Bascom Member



Joined: 03 Oct 2004
Posts: 235
Location: Gothenburg, Sweden

sweden.gif
PostPosted: Mon Mar 21, 2016 10:42 am    Post subject: Reply with quote

This post reminded me that I have one of these old but faschinating A0-plotters from HP (the 7580 model) standing in a corner of the lab.
I remember that the price tag was USD15000 at the time (1985) so it still stand there. It is working but of no use.
Some day I will Power it up again and use it for something I yet have not figured out...
I wonder if some bascom-guy have written a driver for it? It is designed for HPGL so most commands are "standard" HPGL graphic commands.
Wathing this machine in full action is a true pleasure. Smile

/Per
Back to top
View user's profile Visit poster's website
Dave

Bascom Member



Joined: 05 Feb 2005
Posts: 314
Location: OR

usa.gif
PostPosted: Sun Jan 08, 2023 5:40 pm    Post subject: Reply with quote

Thank you O-Family for this lib. I was searching the web for a Tek4010 emulator and was surprised to end up here on the MCS forum. I didn't know that my favorite terminal program (tera term) had tek4010 emulation built in. I used one of these terminals way back in 1978 and 79 so for nostalgia I want to use this to display something. I've spent the last few days writing a rudimentary chart program that uses you lib. I've included a zip file with my demo and two Tek4010 user manuals. The demo shows how to get different fonts and how Gin mode can be used to display a cross-hair for user input.

I had to change one line of code in your lib file to get it to compile for AVRX processors:
At line 26 of the lib file:
'Comment out ---> ;*BASIC: Printbin _temptx 'Send to USART. *** REMOVED, WILL NOT COMPILE WITH MY COM CONFIG.
'Replace with --> *BASIC: Print #1, chr(_temptx); 'Send to USART. *** SAME THING USING PRINT.

I'm running at 38400 baud but with a few tricks it will plot at the fastest baud tera term will run at (921600 baud). If anyone is interested in plotting faster I'll share how I did that.

Also there is a beautiful Tek4010 emulator for Raspberry Pi. I had a Pi Zero laying around so I tried it and it works fine. That emulator simulates the 4010 in a much more realistic way.

Thanks again
Dave
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-AVR code here All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum