Link to home
Start Free TrialLog in
Avatar of purplsun79
purplsun79

asked on

Pascal program using VT100

I need a very simple program that uses escape sequences.  The program needs to draw a box and inside the box prompt the user for input.  I know how to get the input and do what I need to do with the input.  I am just havign trouble using escape sequence to draw the boa and get inside the box to print lines.  
Avatar of Batalf
Batalf
Flag of United States of America image

Could you post the essential code here?

Avatar of purplsun79
purplsun79

ASKER

I do not have any code right now.... The first thing i have to do is make a box using hte control sequences in the VT100 manual and that is what I am having difficulties doing.  The box needs to be 80 by 60 and I need to be able to print infomation inside.
ASKER CERTIFIED SOLUTION
Avatar of dbrunton
dbrunton
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In VT100-like terminals, boxes are drawn by switching first to graphic mode and then sending some characters (simple letters, nothing complicated) which are shown in graph mode (rather than text mode).

Thus, the right sequence is something like this (NOTE the "$" used here is the ESCape control char, this is, ASCII 27 [decimal]):

a) set VT100 into graphic mode: $(0 (send the characters ESCape, left parenthesis and upper case "O", not zero).

b) draw your box. In graphic mode, you must use some of this chars to make your drawings (all characters are lower case):
    t      Left "T"
    u      Right "T"
    v      Bottom "T"
    w      Up "T"
    x      Vertical bar
    q      Horizontal bar

    j      Lower right corner
    k      Upper right
    l      Upper left
    m      Lower left
    n      Crossing lines

c) Finally, exit from graphic mode (which re-enters into text mode) by sending
      $(B

Of course, you will need to position the cursor. To do this, use the sequence

      $[r;cH

where "r" and "c" stand for row and column, i.e.: if you want to move to the center of the screen (row 12, column 40), VT100 must receive these chars

      $[12;40H

You have a ton of other control sequences (for erasing, text attributes, and a lot more), but that's enough for your job.
Comment accepted as answer