Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:05 02 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: VGA output and Terminal Control Escape Sequences

Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 03:40pm 17 Jun 2020
Copy link to clipboard 
Print this post

Hi folks,

I think this is a noob question that I already know the answer to, but if I PRINT VT100 escape codes then whilst my Putty, Tera Term or the like terminal might behave as I expect the VGA output is just going to print those codes verbatim?

From which am I correct in surmising that the behaviour of the inbuilt editor where both the serial console and VGA show the same "rich" text UI is not possible from within BASIC ?

Related questions, from within BASIC:
1. Can I detect if VGA is connected?
2. Can I detect that a serial console is connected?
3. Can I detect height/width of any connected serial console?

Regards,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 04:16pm 17 Jun 2020
Copy link to clipboard 
Print this post

  Quote  1. Can I detect if VGA is connected?
2. Can I detect that a serial console is connected?
3. Can I detect height/width of any connected serial console?


No to all of them

  Quote  From which am I correct in surmising that the behaviour of the inbuilt editor where both the serial console and VGA show the same "rich" text UI is not possible from within BASIC ?


You can get round this with a bit of Basic code.
Set OPTION CONSOLE SERIAL at the top of your program. This means PRINT statements don't go to the VGA screen
Then create a Basic subroutine that does a PRINT for the serial console and a TEXT for the screen. Needs a little bit of work but nothing too difficult.

You can also use the PRINT @ command (see manual) which is interpreted for both the serial console and the VGA screen depending on how "rich" you need the text to be - it only supports cursor positioning on the serial console
Edited 2020-06-18 02:25 by matherp
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 05:00pm 17 Jun 2020
Copy link to clipboard 
Print this post

Thanks Peter sounds like there is something I can work with if necessary.

Follow up questions:

1. The manual documents POS as obsolete, what replaces it for querying the current cursor column?

2. Is there a way to query the current cursor row? - I may be repeating myself having asked that question wrt the CMM1 months ago.

Best regards,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 05:35pm 17 Jun 2020
Copy link to clipboard 
Print this post

Further follow up question:

3. Do the serial and VGA consoles share state or can you safetly toggle between them using OPTION CONSOLE and PRINT differently to each ?
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 06:28pm 17 Jun 2020
Copy link to clipboard 
Print this post

  Quote  Is there a way to query the current cursor row?


MM.INFO(VPOS)

  Quote  The manual documents POS as obsolete, what replaces it for querying the current cursor column?


MM.INFO(HPOS)
A graphic screen characters can start at any column. If we go text 5,0,"A";
MM.INFO(HPOS) will be equal to 13 assuming font 1

  Quote  Do the serial and VGA consoles share state or can you safetly toggle between them using OPTION CONSOLE and PRINT differently to each ?


As long as you cursor position before each it should be OK as the cursor position is shared. However, the strong recommendation is that the TEXT command is used for graphics rather than PRINT
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 10:03pm 17 Jun 2020
Copy link to clipboard 
Print this post

  [ said  QUOTE=thwill
2. Can I detect that a serial console is connected?
3. Can I detect height/width of any connected serial console?

Regards,

Tom


It would depend on the capabilities of the serial console connected.
Some of the terminal program will respond to queries.

Most Terminal programs will answer with their terminal version.
Some might be able to give their size.

If you get an answer to a query, you know something is out there but if no answer, it still might be a silent terminal connected.

Jim
VK7JH
MMedit
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025