Shop OBEX P1 Docs P2 Docs Learn Events
Low Resolution Graphics mixed with ROM font text — Parallax Forums

Low Resolution Graphics mixed with ROM font text

localrogerlocalroger Posts: 3,452
edited 2009-08-20 20:56 in Propeller 1
I realized for this project I am targeting that I needed some simple graphics, but I wanted to use the ROM text font to save RAM. All of the graphic objects are horribly expensive in RAM. I found some code from days past for using user defined bitmaps with tv_text, but the resolution was way too fine and while they looked beautiful they ate RAM like mad. So it was time to learn PASM anyway...

This driver uses the ROM font to display 13 lines of 32 characters. I had to increase the hx from 4 to 5 to get enough time to run the code without missing waitvids. Starting at character code 256, it displays 8 by 8 bit characters bitmapped from $7FF8 down, so you don't have to declare how many characters you want to use; just reserve enough _stack for your maximum. The attached demo shows custom borders, 7-segment numbers mixed with normal text, and flicker free animation in a bitmapped field. The entire demo comes in at about 1400 longs, plus whatever bitmaps you want to define. The naked driver itself requires 1,039 longs, including the screen tile map.

In order to pull this off I had to create a 256 long table mapping 8-bit patterns to 32-bit patterns; I tried several other approaches but nothing else was fast enough even with hx stretched. At first this seems insane but it's not so bad because, if this were a true 8-bit tile machine incapable of using the ROM font, I'd need an 8-bit character font. 256 chars x 8 bytes = 2048 bytes or 512 longs, twice as much as my table takes. Even if you create a short table of only 128 chars it's a wash. And it lets you display the good looking ROM font along with simple graphics that don't take half the hub RAM.

I'd be interested if one of the PASM gurus could find a way to make it work at 40 characters, but it's not that important; this is for a display that doesn't need as much text as possible crammed in. It should work well with greater vx and hx, and it might even be amenable to the trick that ORs two ROM lines together per scan line, but there is an extra decision requiring 8 cycles before the ROM mapper can get to work and I haven't tried it.

I have included some simple tested graphics functions, but it's not compatible with the fast graphics package because the tiles are only 8 bits wide and not reversed.

Comments and suggestions appreciated; I'll put this in the obex if it looks useful to anyone else.

Comments

  • CassLanCassLan Posts: 586
    edited 2009-05-20 21:14
    This is very cool! Thanks!

    I like the balls in the demo also ; )

    Rick
  • localrogerlocalroger Posts: 3,452
    edited 2009-05-21 00:11
    @CassLan Thanks for the shout, I was starting to wonder if anyone found it interesting at all. (In retrospect I suppose "low resolution display with legacy font" might not be the sexiest come-on.) I am currently adding a capability which will be all but invisible if you decide not to use it, using less than 20 tiles to create REALLY BIG NUMBERS 5 lines high in the text display. (I am targeting this at instrumentation displays that you might want to read from across the room, or from Mars.) I've switched the screen from VAR to DAT (and might soon have a tech question about that soon though it's working) and if you don't want the number tiles, they just get overwritten when you turn on the display; if you do want them, you run a function first to write them to the bitmap space before starting the normal object code. Writing really big characters is something often overlooked in display design, but doing it fast is really a pain on pure bitmapped displays. The Prop gives me a really elegant solution for it.
  • Jim FouchJim Fouch Posts: 395
    edited 2009-08-20 20:56
    I'm working with the GreyScale display from Brilldea http://www.brilldea.com/product_LM9033A.html·and Tim has a driver that works with the Graphics.spin driver. You can use all the graphics commands including text, but the text function is somewhat slow and also does not always look the best as smaller sizes.

    I'm thinking of writing a few functions that will use the ROM font or have a custom font in 8x8 or 8x12 format.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jim Fouch

    FOUCH SOFTWARE
Sign In or Register to comment.