Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color text example #48

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

raphlinus
Copy link

This commit is fairly messy and should probably be cleaned up if it is to be merged. It renders proportionally spaced bitmap text with background and foreground colors.

This commit is fairly messy and should probably be cleaned up if it is to be merged. It renders proportionally spaced bitmap text with background and foreground colors.
@raphlinus
Copy link
Author

This draft PR contains much of the experimentation I've been doing with PicoDVI in the last few weeks. The main runnable example is the colortext application, but there are also additional pixel modes added to libdvi and some other things. It probably needs cleanup if it is to be merged, but I wanted to at least start that discussion with what I have now.

There's a lot going on here. Rendering is in a 2-stage pipeline, the first of which generates a "scan list" of spans of 1 bit image (from a proportionally spaced bitmap font) with a palette to control background and foreground color. That scan list is interpreted (in the interrupt) to generate TMDS symbols. Everything is based on a 12bpp RGB palette. The TMDS generation itself works on pairs of 4bpp pixels, generating a DC balanced symbol pair. The script to generate that palette is included.

The ideas here are intended to be expanded. In particular, the scan list could contain many different types of inputs, including potentially 4 bit gray, 4 bit palette, and possibly other things. The implementation is a form of "direct threaded code," which does lend itself to such expansion.

The first stage of the pipeline generates the scan lists, and is at heart a 1 bit blit engine from a proportionally spaced font. This is currently in C, but the direction would be direct threaded code similar to the TMDS generation, which would allow lots more special casing without needing branches. The rendering of individual scanlines is striped across both cores. The idea here is to keep core 1 maximally busy, so that as much of core 0 is available to an application as possible. The idea is for that rendering to be done in an interrupt so the application doesn't need to have fine-grained yield points, but at the moment it's just a loop processing a multicore queue.

There is additionally a 4bpp/channel pixel mode added to libdvi. This actually not used by the colortext example and could be stripped out, but may be of interest. Originally I was hoping to generate 12bpp RGB, but I now feel that takes too many cycles at full res; it would limit the ability of the app to do much useful. There may still be some use for it. I do think it's very much worth exploring for the pixel-doubled modes, as I think it gives more visual richness than 8bpp modes and is potentially just as efficient, if not more so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant