Hi
I don't want to bore you, but about the behavior of the terminal emulator, I try to clarify some issues about development with embedded Forth systems and I contribute my opinion.
To display the sent text in a color and the received text in a different color, first it would be necessary to clarify what is the sent text and what is the received one?
It would seem obvious that the sent is the one that comes out through TX of the serial channel, and the received one that arrives through RX.
But I think it is not so.
In a communication with a Forth system, normally the terminal emulator never presents what is sent.
It is the Forth system that echoes what it receives, and adds the reply.
For example, if we type '1 .<CR>' we send it without displaying anything to the terminal console, and then we receive '1 . 1 ok<CR>'.
How would the system have to behave in order to output color attribute-1 in the part '1 .' and color attribute-2 the part ' ok<CR>'?
(I want to keep it simple, regardless of whether the terminal sends each character or processes the line before.)
There are many possible solutions, but they all involve some code or behavior alteration in the embedded Forth system.
If the terminal emulator supports the input of VT100-type escape sequences, the simplest and most compatible is that the Forth system control and modify the attributes of the text it sends.
I was doing tests with FlashForth from TeraTerm with a PIC18F from the K22 family, programming a Forth and asm debugger, VT100 text attribute control was the best solution for me. Then with TermFF.
Some videos can be seen at
https://www.youtube.com/@termff450 and in the final part of 'TermFF showing' how the control of text attributes is handled running a 'debug' in a FlashForth system.
And the predecessor of this debugger with TeraTerm at
https://www.youtube.com/watch?v=3L-cOGtUGzg
Some time later I opted to have my own terminal emulator (TermFF) and a Forth with more features, for the Q4x family.
In TermFF I tried several alternatives, and the best option for me was the control of VT100 text attributes from the remote Forth system.
TermFF controls and allows changing different text colors for local mode (in the PC itself) and remote mode (the serial channel). (I am unable to attach a screenshot showing this.)
In the case of managing a buffer of console lines (as TermFF does) the presentation of characters is more complex, since characters are presented as they are typed and when pressing <CR> they are deleted from the screen, to later present the ones that we arrives from the remote Forth system.
On the other hand, when files are sent from the terminal, if the Forth system echoes what it receives, the screen fills up and the console buffer is overrun, without contributing anything. And if there is an error in the compilation and we keep sending the file, everything is full of lines of errors and we have difficulty in looking in the console where the error occurs.
I have chosen to include in the Forth system the option of working without echo. Support in this mode is the ability to count lines and return to echo mode on error. And use some control character to notify the terminal of the status, so it stops sending lines of the file.
This all involves some code on the Forth system side, but will work on any terminal emulator that supports VT100 (except notifying of an error to stop the download of the file).
In summary, I would encourage you to program a few small modifications to the embedded Forth system, to make compilation more comfortable and have better text visibility.
Regarding the control characters, I see even more questions to clarify.
Is it about 'seeing' the recieved characters and executing them?
I would not know how it should behave, for example when CTrl-C or Crtl-Q arrives, or when receiving XON or LF?
There are terminal emulators or serial channel sniffers that can be show in Hex or/and in ascii.
It has been useful for me to display the input flow in a separate window. Different from the ascii-VT100 terminal window itself.
In TermFF, to be able to see the input stream, I have a Dump window of the reception, which is started with F9.
There I present the hexadecimal value of the received bytes and in the right margin the corresponding character, if it is printable.
Pablo