Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 18:45 24 Apr 2024 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 : PicoM + GFXterm: editor highlighting not correct

     Page 1 of 3    
Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3838
Posted: 02:50pm 12 Jun 2021
Copy link to clipboard 
Print this post

Hi Rob/folks,

I noticed that Editor syntax highlighting from the PicoMite is not display properly in GFXterm (20-may-2020, RC) on the Raspberry Pi.

Using "nes.bas":

   nes.zip

PuTTY shows:



GFXterm shows:



Note the incorrect colours starting at Option Default and again at Pin(CLOCK_PIN%).

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2285
Posted: 04:18pm 12 Jun 2021
Copy link to clipboard 
Print this post

hi tom,
   it seems the pico port of mmbasic is sending some really weird/obscure escape sequences to set text colours. many terminal emulators (including GFXterm) simply ignore such text colour/attribute sequences, as there are far too many variants to support them all and throwing an error would be 'unreasonable'.

here are a list of what i get from my pico (a25) with a typical page:

ok?      sequence             occurrences    effect/colour

yes     <ESC>[0m                    2       normal text (reset to defaults)

yes     <ESC>[32m                   3       green

yes     <ESC>[36m                  23       cyan

NO      <ESC>[38;2;128;128;128m     2       bright black (grey)

NO      <ESC>[38;2;192;192;0m       2       yellow

NO      <ESC>[38;2;255;128;0m       4       orange

NO      <ESC>[38;2;255;128;128m    29       pink

yes     <ESC>[4m                    2       dim foreground

NO!!!   <ESC>[97m                 150       bright white (aixterm standard)


the aixterm one (<ESC>[97m) is a doozy - i'm surprised anything supports that.

fyi, here is the portion of code that handles SGR codes in GFXterm - i'd expect putty to be fairly similar in it's abilities:

                'm':begin                             // set up character colours and attributes
                      if S='' then S:='0';
                      n:=PC(S);
//                    ShowMessage(IntToStr(n)+'  |'+S+'|');
                      if n=-1 then fail else
                      begin
                        for I:=1 to n do
                        begin
                          J:= Pn(S,I);
                          case J of 0:begin
//                                      ShowMessage('reset colours and attributes');
                                        DimText:=false;
                                        InvText:=false;
                                        TxtStyle:=[];
                                        FGcolour:=FGdefault;
                                        BGcolour:=BGdefault
                                      end;
                                    1:TxtStyle:= TxtStyle+[fsBold];       // bold
                                    2:DimText:=true;                      // dim FGcolour
                                    4:TxtStyle:=TxtStyle+[fsUnderline];   // underline
                                    5:begin end;                          // (not supported)
                                    7:InvText:=true;                      // reverse video
                               30..37:FGcolour:=J-30;
                                   39:FGcolour:=FGdefault;
                               40..47:BGcolour:=J-40;
                                   49:BGcolour:=BGdefault
                          end  { of case }
                        end;
                        pass
                      end
                    end;


cheers,
rob   :-)
Edited 2021-06-13 02:34 by robert.rozee
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3838
Posted: 10:45pm 12 Jun 2021
Copy link to clipboard 
Print this post

Hi Rob,

Those "VT" codes do look odd, and unexpected too. I would have thought the Editor code would have been lifted from an earlier 'mite but I've had a very superficial grep through my archive of 'mite firmware source without seeing any such oddities; I only found code that generates the escape codes that GFXterm expects.

Perhaps something else is at play. We may need Peter to explain this mystery.

GFXterm is written in Pascal, Modula 2/3 or some derivative by the looks of that snippet?

Best wishes,

Tom
Edited 2021-06-13 09:06 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2285
Posted: 12:17pm 13 Jun 2021
Copy link to clipboard 
Print this post

  thwill said  Perhaps something else is at play. We may need Peter to explain this mystery.

GFXterm is written in Pascal, Modula 2/3 or some derivative by the looks of that snippet?


it is indeed written in pascal, i've always found it much easier to work with than C. under windows i used "Delphi" version 5 (dating from 1999) for the original version of GFXterm, while for the linux version i use Lazarus (incorporating FPC). at some point i want to back-port the linux version to windows, so that a single set of source files can generate executables for linux, mac, win32, and RPi. lazarus supports this, i just need to get a win32 VM up and running.


cheers,
rob   :-)



Edited 2021-06-13 22:22 by robert.rozee
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8573
Posted: 12:46pm 13 Jun 2021
Copy link to clipboard 
Print this post

You Linux types should like the escape sequences. They are standard RGB codes. See the Wikipedia page on Ansi escape codes
Edited 2021-06-13 22:48 by matherp
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8573
Posted: 12:54pm 13 Jun 2021
Copy link to clipboard 
Print this post

You Linux types should like the escape sequences. They are standard RGB codes. See the Wikipedia page on Ansi escape codes.
FC
The RGB escape sequence is definitely supported by teraterm and putty
Edited 2021-06-13 22:54 by matherp
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2285
Posted: 01:42pm 13 Jun 2021
Copy link to clipboard 
Print this post

hi peter,
   it would seem that they are not supported on the putty Tom is running on his Raspberry Pi. perhaps Raspian has a special cut-down putty version?

you have a palette of 16 standard colours (8 dim, 8 bright) available that is supported by just about every terminal emulator out there. the only things lacking are the colours pink and orange. why not just use that palette to maintain compatibility?


btw, i used to be a windows 'type', exclusively, up until a couple of years ago. i clung on to windows until the very last moment, but in the end it just became too difficult. when i finally gave in and changed over to linux (as an absolute beginner) i was amazed at how much simpler life became - it was like returning to the early days of computing when the computer did what you told it to do, as opposed to the computer telling you what you were allowed to do.

i am still only a linux beginner   :-)


cheers,
rob   :-)
Edited 2021-06-13 23:53 by robert.rozee
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3838
Posted: 03:54pm 13 Jun 2021
Copy link to clipboard 
Print this post

  robert.rozee said  it would seem that they are not supported on the putty Tom is running on his Raspberry Pi. perhaps Raspian has a special cut-down putty version?


Tom says "Huh?"

If you look at my original email it is GFXterm which isn't displaying the correct syntax highlighting ... unless they are both wrong and the output should be more colourful ... I did think it was a rather grey palette.

  Quote  you have a palette of 16 standard colours (8 dim, 8 bright) available that is supported by just about every terminal emulator out there. the only things lacking are the colours pink and orange. why not just use that palette to maintain compatibility?


+1

Peter can you confirm that the PicoMite EDITor is using different syntax highlighting colours to the earlier 'mites ? I (briefly) looked at the source for them and they all seemed to be using the standard 16 colour palette.

  Quote  btw, i used to be a windows 'type', exclusively ...


I wouldn't call myself a "Linux type" either, I muddle along in both for work and it just so happens that the machine in my hobby area is a Raspberry Pi so that is what I use most often to access 'mites. As it happens I am more productive in Linux but I think that is because I have learned to favour command line tools and Linux comes with a better / more standardised collection of these - perhaps things will change if/as the Windows Subsystem for Linux takes off.

Best wishes,

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

Joined: 11/12/2012
Location: United Kingdom
Posts: 8573
Posted: 04:12pm 13 Jun 2021
Copy link to clipboard 
Print this post

The PicoMite uses the same colours as other of my ports. It was a cut and paste. The standard MM2 colours don't work on a black background
Edited 2021-06-14 02:13 by matherp
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3650
Posted: 04:44pm 13 Jun 2021
Copy link to clipboard 
Print this post

Tom,

What does
echo $TERM

show?

(For non-Linux users, a brief note: TERM can be set to ask the terminal to emulate the device TERM is set to. It can be set to something unsupported, though...)

John
Edited 2021-06-14 02:46 by JohnS
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2285
Posted: 04:46pm 13 Jun 2021
Copy link to clipboard 
Print this post

  matherp said  The standard MM2 colours don't work on a black background


peter: that is correct wrt teraterm - teraterm maps 'light black' (gray) to completely black, hence you get black text on a black background. there have been numerous postings on here about how to fix this problem with teraterm:
https://www.thebackshed.com/forum/ViewTopic.php?TID=10445#118834

as far as i am aware, most other terminal emulators (including GFXterm) work fine with the MM2.


tom: with all that cyan and white, i'd assumed there was something wrong in putty too. can you get any other colours (ie, pink and orange) in the editor?


cheers,
rob   :-)
Edited 2021-06-14 02:48 by robert.rozee
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3650
Posted: 06:09pm 13 Jun 2021
Copy link to clipboard 
Print this post

Tom,

As you're using GFXterm I think TERM is likely irrelevant, sorry.

John
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3838
Posted: 09:18am 14 Jun 2021
Copy link to clipboard 
Print this post

Thanks all,

  robert.rozee said  tom: with all that cyan and white, i'd assumed there was something wrong in putty too. can you get any other colours (ie, pink and orange) in the editor?


OK, no I haven't seen any other colours. The EDITors of the CMM1 and CMM2 both show the correct colours in PuTTY (though I believe the CMM2 EDITor source is completely independent of all the others) and I don't have any other 'mites to test on ... though BigMik is sending me one of his MX170 based-boards, coincidentally also called the Picomite

  matherp said  The PicoMite uses the same colours as other of my ports. It was a cut and paste. The standard MM2 colours don't work on a black background


I must be looking at the wrong piece of source-code, I was looking at the "VT100" constants in the Armmite H7's "Editor.c" file:

//======================================================================================
//      Attribute               VT100 Code      VT 100 Colour       LCD Screen Colour
//======================================================================================
#define VT100_C_NORMAL          "\033[30m"      // Black            Foreground Colour
#define VT100_C_COMMENT         "\033[33m"      // Yellow               Yellow
#define VT100_C_KEYWORD         "\033[36m"      // Cyan                 Cyan
#define VT100_C_QUOTE           "\033[32m"      // Green                Green
#define VT100_C_NUMBER          "\033[31m"      // Red                  Red
#define VT100_C_LINE            "\033[37m"      // White                Grey
#define VT100_C_STATUS          "\033[30m"      // Black                Brown
#define VT100_C_ERROR           "\033[31m"      // Red                  Red


  JohnS said  As you're using GFXterm I think TERM is likely irrelevant, sorry.


No worries, I believe the same applies to PuTTY which is also implementing its own terminal independent of the Linux one.

Best wishes,

Tom
Edited 2021-06-14 19:19 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2285
Posted: 11:11am 14 Jun 2021
Copy link to clipboard 
Print this post

tom: yep, that colour table looks correct:"\033[30m" to "\033[37m", giving a choice of white, red, green, blue, cyan, magenta, yellow. combined with "\033[2m" to select dim foreground gives a total of 15 different colours.

although i have a feeling that teraterm fails (a bug?) to implement the VT sequence "\033[2m", which then limits you to just the 8 bright foreground colours. with some tinkering with the teraterm configuration it may be possible to rectify this, although historically folks have struggled with working out how to reconfiguring teraterm and just opted for monochrome in the micromite editor!


cheers,
rob
Edited 2021-06-14 21:12 by robert.rozee
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3838
Posted: 11:57am 14 Jun 2021
Copy link to clipboard 
Print this post

  robert.rozee said  ... although i have a feeling that teraterm fails (a bug?) to implement the VT sequence "\033[2m", which then limits you to just the 8 bright foreground colours.


I've just had a quick tinker and that does appear to be the case as demonstrated by

Print Chr$(27) + "[33m"
Print "Hello"
Print Chr$(27) + "[2m"
Print "Hello"


I guess we'll all have to abandon TeraTerm since it isn't as perfect as previously advertised

You can of course go BOLD instead for 16 variations:

Print Chr$(27) + "[33m"
Print "Hello"
Print Chr$(27) + "[1m"
Print "Hello"


Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2285
Posted: 12:47pm 14 Jun 2021
Copy link to clipboard 
Print this post

just realized i had a win10 netbook here that i haven't wiped yet, so did some experiments comparing teraterm to GFXterm. each has exactly the same code loaded onto an MX170 or pico.

GFXterm, MX170:



TeraTerm, MX170:



TeraTerm, RP2040:



note: TeraTerm has the palette change made so that grey text is visible.

the file sizes (screen captures), despite being roughly the same dimensions, came out quite different, with the one from GFXterm about 4x larger than the TeraTerm ones. i eventually figured out what was going on - while GFXterm uses font dithering for the displayed text, TeraTerm seems to turn dithering off. this is, partly, why the TeraTerm text appears to be less smooth.


cheers,
rob   :-)
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3838
Posted: 12:56pm 14 Jun 2021
Copy link to clipboard 
Print this post

You missed out GFXterm + RP2040 ?
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3506
Posted: 01:13pm 14 Jun 2021
Copy link to clipboard 
Print this post

pi pico MMBasic a25

GFXterm windows


Putty Windows


Teraterm (windows ...)

Edited 2021-06-14 23:36 by Volhout
PicomiteVGA PETSCII ROBOTS
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3838
Posted: 01:22pm 14 Jun 2021
Copy link to clipboard 
Print this post

  Volhout said  GFXterm windows


Thank you; that is what I observed previously and is similar (if worse) than what PuTTY on the Pi does.

It seems the PicoMite, and presumably the Armmite, and maybe other recent 'mites (but not the CMM2 which has a different EDITor lineage) are "doing something different" to the earlier 'mites (as Peter has acknowledged). I only took a casual look at the Armmite source but it wasn't obvious why the standard VT100 colours were not being used ... the constants for them are still defined ... I wonder if the code-path/colours defined for rendering the console to an LCD panel are being used instead ?

I guess it is in Peter's court now if he wants to "fix" this.

Best wishes,

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

Joined: 11/12/2012
Location: United Kingdom
Posts: 8573
Posted: 01:53pm 14 Jun 2021
Copy link to clipboard 
Print this post

There is nothing to fix. I'm using a perfectly valid escape sequence which as demonstrated above is correctly handled by both teraterm and putty
 
     Page 1 of 3    
Print this page
© JAQ Software 2024