DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Mon Apr 12, 2021 2:13 pm

EvanEscent wrote:
Mon Apr 12, 2021 4:26 am
Really impressive work @DarkElvenAngel!

Love that retro font.

Have you posted the code?

I'm sure I'm not the only one who could learn from it.
The code needs a tidy up right now it's a hodgepodge of example code slapped together with huge sections commented out and there are a few bugs too.

I have to sort it out and put it into it's own projects folder so can I can post the code.

Just have to find a good block of time to sit down to do it.

User avatar
el_pelayo
Posts: 12
Joined: Sun Apr 11, 2021 5:30 pm

Re: Serial terminal project

Mon Apr 12, 2021 8:55 pm

hello dear Herrmann


many thanks for sharing this info.
HermannSW wrote:
Thu Apr 08, 2021 6:03 pm
There are many ways to program an ESP01 module.

I use this cheap USB programmer for ESP01:
https://www.aliexpress.com/item/32693314450.html
<1$ on aliexpress.com, quicker a bit more expensive on amazon.

I did solder switch between GP0 and GP2 of the programmer under left module
(allows to easily switch to flash mode):
Image
i will try to get these via Alieexpress too.

thanks for the hint - with uart too

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Wed Apr 14, 2021 9:01 pm

I've come up to a slight road block. I'm testing my terminal against nano it's throwing codes at my terminal that I can't decode. I've got the Wiki for ANSI codes that's been helpful and a vt100 document about some of its codes but not all of them are in these documents.

Anyone know where I can find a complete list of codes and what they should do?

Edit:. Just located a very useful tool vttest for testing terminals to see if they behave properly!

EvanEscent
Posts: 23
Joined: Thu Apr 01, 2021 10:45 pm
Location: Blighty
Contact: Website Yahoo Messenger Facebook Skype Twitter

Re: Serial terminal project

Fri Apr 16, 2021 5:27 am

DarkElvenAngel wrote:
Wed Apr 14, 2021 9:01 pm
Anyone know where I can find a complete list of codes and what they should do?
Is this any use to you?

https://geoffg.net/Downloads/Terminal/V ... _Guide.pdf
I read, I tinker, I test, I repeat.
Sometimes I learn.

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Fri Apr 16, 2021 12:41 pm

EvanEscent wrote:
Fri Apr 16, 2021 5:27 am
DarkElvenAngel wrote:
Wed Apr 14, 2021 9:01 pm
Anyone know where I can find a complete list of codes and what they should do?
Is this any use to you?

https://geoffg.net/Downloads/Terminal/V ... _Guide.pdf
Thanks I can use this.

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Sat Apr 17, 2021 5:25 am

Thanks to that manual and a complete rewrite of my escape code decoder I'm closer than ever to a fully functional terminal.

I can now pass some tests in vttest my terminal is Identified now as a VT100 vanilla terminal. This didn't work before. Also the VT52 mode is correctly returning it's ID now. Still not getting the proper output from most tests but getting better. Nano is starting to look right still completely in usable.

Slowly getting somewhere. Still bugs to squash and a ton of escape codes to implement.

Can I set the terminal type for the serial port via the cmdline.txt? Once I log in and can check the value or $TERM it's vt220 I can set this on login just thinking is there an automatic way?

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Thu Apr 22, 2021 3:51 pm

I'm still banging along I've added to the extended don't set.
P_20210422_112936_1.jpg
P_20210422_112936_1.jpg (130.62 KiB) Viewed 412 times
I have decoded control character, a thin font, the vt100 graphicial set, custom set for the terminal UI, and PETSCII graphic characters. There's still more room left for more.

I'm also adding xmodem transfers the idea is to grab screen shots, transfer settings, and possibly font sets.

EvanEscent
Posts: 23
Joined: Thu Apr 01, 2021 10:45 pm
Location: Blighty
Contact: Website Yahoo Messenger Facebook Skype Twitter

Re: Serial terminal project

Thu Apr 22, 2021 4:19 pm

@DarkElvenAngel: Lovin' this! Kudos; You're making a complete round.

For those wondering "why we do this?" reply: Everest.

I think in @DarkElvenAngel's case something Dark and Elven might
be involved. Fully With that!

I love it when a project is almost within reach of its ultimate
purpose and new additions and curlicues of featurism spring
up, sometimes to justify themselves!

That's the best kind of evolution, that is.

In the spirit of making this praising post relevant to the TIH,
what character cell size you can cope with? (Some fonts
are too good to be left to moulder).
I read, I tinker, I test, I repeat.
Sometimes I learn.

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Thu Apr 22, 2021 5:24 pm

Thanks for the reply and interest!

Currently I'm using an 8x8 font set. The layout is 8px by 8px, row major, big endian.
That gives a nice 80 column output though it's possible to use a taller font it would take a bit more work to deal with wider fonts however. Though I should say that I'm looking at how to implement the double wide and double height modes of the vt100. The 132 column mode I don't think will work.

I've been actively looking for fonts to include had to draw my own with the help of http://dotmatrixtool.com/# and reference images. I also scored a ROM dump from a pet so I finally have the PETSCII set.

EvanEscent
Posts: 23
Joined: Thu Apr 01, 2021 10:45 pm
Location: Blighty
Contact: Website Yahoo Messenger Facebook Skype Twitter

Re: Serial terminal project

Thu Apr 22, 2021 5:50 pm

DarkElvenAngel wrote:
Thu Apr 22, 2021 5:24 pm
Thanks for the reply and interest!

Currently I'm using an 8x8 font set. The layout is 8px by 8px, row major, big endian.
That gives a nice 80 column output though it's possible to use a taller font it would take a bit more work to deal with wider fonts however. Though I should say that I'm looking at how to implement the double wide and double height modes of the vt100. The 132 column mode I don't think will work.

I've been actively looking for fonts to include had to draw my own with the help of http://dotmatrixtool.com/# and reference images. I also scored a ROM dump from a pet so I finally have the PETSCII set.
So first: PETSCII - inspired! Didn't even imagine it would be an option but
well done for including it. Sometimes far-sightedness looks shorter; in this
case: not remotely so!

Second: I know little about scanlines and probs less about fonts but the 8x8
works very well. Perhaps the oblongular pixels are more conducive to readability
(or my eyes were programmed when receptive). So "taller" may not even be an
issue.

I mentioned it because so many fonts (pres. on sq. pixels) seem so "unsatisfying"
these days and - from what I read, and personal attempts at it - the design of 'good'
auto-readable fonts seems to fall between science (or mathematics) and art.

Your attempts at drawing produce great results because the PETSCII font
seemed to be aimed at a more 1:1 pixel-point ratio and it's 'iconic' (which I think
means we have to sacrifice expedience for authenticity ;) )

Lastly, I'll say that some of the VT100 double-height-double-wide fonts didn't really
work (except technically) and there's no shame in overscanning them (since, I think
you have the power in this case) to more shapely versions. Just a thought.

So, keep it up! Marvellous work!
I read, I tinker, I test, I repeat.
Sometimes I learn.

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Thu Apr 22, 2021 6:33 pm

Not having a real vt100 to play with my understanding of how the double height and width works it simply draws each pixel twice. These modes aren't support on many terminal so it might be another fun feature it I can pull it off.

The way the driver I've mashed into here works it already automatically doubles the scanline so the 640x480 is actually only 640x240 and all the processing I'm doing during a scanline required an overclock. I need to optimize this if I can.

Thanks again for the interest

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Fri Apr 23, 2021 2:43 pm

I decided to write my own VGA drive so I could more easily see what it's doing an make it more efficient. As a happy accident I generated scanlines!

This is all working to make supporting double height and width mode support. I've had a successful test in getting the double width but there are some code changes require for double height.

once I have more I'll try to get some images to share.

User avatar
scruss
Posts: 4029
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Serial terminal project

Fri Apr 23, 2021 6:09 pm

neat! If you're needing more font sources, my friend Steve can sort you out: PET/CBM Character ROMS. All the cool kids (= near retirement age) at TPUG have Steve's 901447-10m.bin as their chargen ROM. digwuren/pixitie has lots of bitmaps, as has phooky/PROM. Osbourne 1 (sic) is particularly nice for an 8×8, but YMMV
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Fri Apr 23, 2021 6:22 pm

scruss wrote:
Fri Apr 23, 2021 6:09 pm
neat! If you're needing more font sources, my friend Steve can sort you out: PET/CBM Character ROMS. All the cool kids (= near retirement age) at TPUG have Steve's 901447-10m.bin as their chargen ROM. digwuren/pixitie has lots of bitmaps, as has phooky/PROM. Osbourne 1 (sic) is particularly nice for an 8×8, but YMMV
Thanks for the links I will check them out.

I've finished testing my new monochrome pallets green and amber
P_20210423_140951_1.jpg
Green
P_20210423_140951_1.jpg (195.64 KiB) Viewed 327 times
P_20210423_141105_1.jpg
Amber
P_20210423_141105_1.jpg (198.1 KiB) Viewed 327 times
I have scan lines on and the screen is show the current font set nothing new here and the xmodem packet with coloured text. I've got a full 16 levels for each colour. I also have a gray scale mode but I didn't take a shot of that.


Now I'm going to look at some new font sets thanks scruss!

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Mon Apr 26, 2021 5:53 pm

I found one font that jumped out and said use me!
P_20210426_134536_1.jpg
P_20210426_134536_1.jpg (105.18 KiB) Viewed 287 times
I'm still working out how to lay it out better. I wrote a small tool that reads a font layout and the ROM and generates the font C code for me no more cut and paste.

User avatar
scruss
Posts: 4029
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Serial terminal project

Mon Apr 26, 2021 6:01 pm

Yeah, that Data70 / Westminster / OCR-A inspired font does tend to attract people.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Mon Apr 26, 2021 6:36 pm

scruss wrote:
Mon Apr 26, 2021 6:01 pm
Yeah, that Data70 / Westminster / OCR-A inspired font does tend to attract people.
It does have that retro future vibe going for it. A lot of then look similar so it stands out.

I'm trying to have the process automate a bit better and detect when duplicate character are present. Then there is room to put something else.

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Wed Apr 28, 2021 2:03 am

Doing some code clean up and fixing some little things along the way.

I've decided that I won't support the double wide and height modes right away they aren't widely used in anything I've seen anyway if I'm wrong about that I'll give it another look. What I have done and I'm testing it out is 40 Columns mode.

I've made pallet switching available at runtime and not compile time I've set 5 pallets ANSI Colour, C64, monochrome, Green CRT, and Amber CRT. I'm toying with the idea of a user defined pallet. I've also added the option to enable and disable scan lines as well during runtime.

Most of my screenshot so far show the header and footer status bars these are now able to be turned off.

Everything is available with the correct escape codes. I've been careful to select codes that a typical vt100 terminal doesn't understand and if possible aren't defined at all.

Some escape sequences are still buggy and I need to sort them out.

User avatar
Gavinmc42
Posts: 5482
Joined: Wed Aug 28, 2013 3:31 am

Re: Serial terminal project

Wed Apr 28, 2021 2:21 am

Cool project, going to need some more Picos.
Add LCD for portable serial terminal.

Matrix screen saver for that green mode?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Wed Apr 28, 2021 3:23 am

Gavinmc42 wrote:
Wed Apr 28, 2021 2:21 am
Cool project, going to need some more Picos.
Add LCD for portable serial terminal.

Matrix screen saver for that green mode?
That's a cool idea! I hadn't thought of that. The LCD should be and easy drop in just replace the VGA video driver of the LCD.

I've added Matrix Screen Saver to my to do list!

User avatar
Gavinmc42
Posts: 5482
Joined: Wed Aug 28, 2013 3:31 am

Re: Serial terminal project

Wed Apr 28, 2021 4:08 am

Got two of these that need a purpose.
Have not had a chance to reverse engineer the SPI interface.
https://core-electronics.com.au/3-5inch ... -pi-3.html
Uses a driver I can only get working on Raspberry OS.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 5482
Joined: Wed Aug 28, 2013 3:31 am

Re: Serial terminal project

Wed Apr 28, 2021 4:11 am

Just found out about these reflective front light displays, daylight visible?
https://www.digikey.com.au/product-deta ... D/10492348
Only 3bit colour but that's good enough?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

hippy
Posts: 9707
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Serial terminal project

Wed Apr 28, 2021 11:02 am

DarkElvenAngel wrote:
Wed Apr 28, 2021 2:03 am
I've decided that I won't support the double wide and height modes right away they aren't widely used in anything I've seen anyway if I'm wrong about that I'll give it another look.
Not saying you need to make it a priority, and it might not be needed on a VDT, but doubled width and/or height are very handy for headings on LCD menu displays. Double width can be a stand-in for bold. Italics can also look reasonable merely by shifting the pixels to the right as one moves up rows rows.

I also found that removing a couple of rows and/or columns gave extra, not perfect but usable, fonts without needing a font table.

I would say that having a variable width font was the thing which really made my LCD displays look good.

DarkElvenAngel
Posts: 1610
Joined: Tue Mar 20, 2018 9:53 pm

Re: Serial terminal project

Wed Apr 28, 2021 12:47 pm

hippy wrote:
Wed Apr 28, 2021 11:02 am
DarkElvenAngel wrote:
Wed Apr 28, 2021 2:03 am
I've decided that I won't support the double wide and height modes right away they aren't widely used in anything I've seen anyway if I'm wrong about that I'll give it another look.
Not saying you need to make it a priority, and it might not be needed on a VDT, but doubled width and/or height are very handy for headings on LCD menu displays. Double width can be a stand-in for bold. Italics can also look reasonable merely by shifting the pixels to the right as one moves up rows rows.

I also found that removing a couple of rows and/or columns gave extra, not perfect but usable, fonts without needing a font table.

I would say that having a variable width font was the thing which really made my LCD displays look good.
Thanks for the input there, every little bit helps. I need to look into how it should work more I'm using the same fonts I just stretch them. The vttest program is the only place so far I've seen this used. Italics is there an escape code for that?

From what I have sorted out there are three flags one for double wide and two for height the height flags simple stretch the top or bottom have of the font. However it seems to work like an attribute so per character and not a line by line command. But I need to look more into it. I haven't abandoned the idea I just lowered it's priority.

Right now I'm figuring out cursor positioning errors the terminal isn't going where the programs want it to. I have been testing with nano and vttest. Nano is almost usable. I believe the problem is in my incomplete origin mode once that's sorted out I can move to another escape sequence.

Memotech Bill
Posts: 85
Joined: Sun Nov 18, 2018 9:23 am

Re: Serial terminal project

Fri Apr 30, 2021 2:49 pm

For the keyboard LEDs, try this code:

Code: Select all

static uint8_t led_flags = 0;   // This must be in persistent memory (not on call stack)

void set_leds (uint8_t leds)
    {
    if ( leds != led_flags )
        {
        uint8_t const addr = 1;
        led_flags = leds;

        tusb_control_request_t ledreq = {
            .bmRequestType_bit.recipient = TUSB_REQ_RCPT_INTERFACE,
            .bmRequestType_bit.type = TUSB_REQ_TYPE_CLASS,
            .bmRequestType_bit.direction = TUSB_DIR_OUT,
            .bRequest = HID_REQ_CONTROL_SET_REPORT,
            .wValue = HID_REPORT_TYPE_OUTPUT << 8,
            .wIndex = 0,    // Interface number
            .wLength = sizeof (led_flags)
            };
    
        tuh_control_xfer (addr, &ledreq, &led_flags, NULL);
        }
    }

void on_keydown (uint8_t key)
    {
    uint8_t leds = led_flags;
    switch (key)
        {
        case HID_KEY_NUM_LOCK:
            leds ^= KEYBOARD_LED_NUMLOCK;
            set_leds (leds);
            break;
        case HID_KEY_CAPS_LOCK:
            leds ^= KEYBOARD_LED_CAPSLOCK;
            set_leds (leds);
            break;
        case HID_KEY_SCROLL_LOCK:
            leds ^= KEYBOARD_LED_SCROLLLOCK;
            set_leds (leds);
            break;
        default:
            break;
        }
    }
I figured this out by looking at how it was done in Circle, and then trying to replicate it using tinyusb.

Then a lot of head-scratching to understand why my original version did not work. Eventually discovered that tuh_control_xfer() returns before all the data has been sent to the keyboard. The led_flags data is actually transferred to the keyboard by a callback from within tuh_task() some time later.

Raspberry Pi Foundation could do everyone a favour by producing some decent documentation for tinyusb. I am sure it would be within their educational remit.

Return to “General”