Experiences with PicoVGA Text Modes
Last post I talked about the amazing PicoVGA library. In this post I talk about my first experiences in using it to implement a text mode that I can use in may serial terminal.
The first line is truncated, it turned out I only need to adjust the monitor. |
The PicoVGA does not uses the official Raspberry Pico SDK development environment. It requires the "GNU Arm Embedded Toolchain" (as the SDK) and contains an adapted (and simplified) version of the SDK.
As described in the documentation, you need only to edit two batch files to tell were the compiler is installed. With that done, I had no problems to compile all the examples with the compiler I had installed for use with the official SDK.
Things went sour when I tried to include the USB keyboard code I adapted from picoterm. First I was confused by some defines in the picoterm code and them I noticed that the Pico SDK in Pico VGA is an old version, particularly the TinyUSB library. I tried to upgrade only this library, but I ran into conflicts with other parts of the SDK that use USB functionality. So for my terminal project I will change PicoVGA to compile with the official SDK environment.
Studying the PicoVGA code, I notice it supports six text modes! Two of them are a little too exotic (they use color gradients), leaving four candidates for mu project:
- "mono text": all characters in the screen have the same foreground an background colors. The advantage is less memory usage (only one byte per screen position) and faster processing.
- "foreground color text": here we have two bytes per screen position. The first is the character code and the second is the foreground color. The background color is the same for all screen. This is the mode used bu the "matrix rain" demo.
- "attribute text": here we also use two bytes per screen position and the first byte is the character code. The second byte has the foreground and background colors (4 bit each) like the CGA ana VGA text modes. I wanted to use this, but the output was not good for 80 columns because of excessive processing.
- "color text": this mode uses three bytes per screen position: character code, background color and foreground color. Its slightly faster than "attribute text"; enough to get a good 80 columns display.
All these modes work only with an 8 dot character width.
At this point I cannot guarantee that "color text" will ok with USB and serial processing, but I am very optimistic.
Note: This post is an adaptation of a post I wrote in March 22 in my Portuguese blog. Since them my terminal project has advanced and is near its completion (as far as projects are ever complete). More or this in the next posts.
Comments
Post a Comment