Shop OBEX P1 Docs P2 Docs Learn Events
VGA Resolution Settings — Parallax Forums

VGA Resolution Settings

PropProp Posts: 4
edited 2013-11-27 23:53 in General Discussion
Hello,

I'm using the "VGA_HiRes_Text" code (from OBEX) for a display interface, running on a serial-VGA board.
The "VGA_HiRes_Text" file has pre-defined resloution settings, and allows user-defined characters. I use 640x480 display settings and have modified many of the characters (fonts), on top of other interface changes.

I would like to change the display resolution from 640x480 (80x40 characters) to a much lower 24x12 or 32x15 characters. I found on OBEX the "VGA_Text" demo program which does just that, but uses only internal ROM characters. Is there a way to integrate the "VGA_Text" resolution settings into the "HiRes_Text" code?
The VGA interface assembly code and display parameters in both programs look very different, and I wouldn't know where to start.

Is there a simple way to change the display parameters to acheive this, or integrate the two programs?

Appreciate the help.
NZ

Comments

  • Mark_TMark_T Posts: 1,981
    edited 2013-11-13 07:51
    Probably not easily, the hires code binds in the font dimensions quite closely and may require font data to be in contiguous bits
    (ROM fonts have font data in alternating bits).

    I'd not be surprised if there is already a driver that does what you want though - have you scoured the Obex for all VGA drivers?
  • PropProp Posts: 4
    edited 2013-11-19 02:39
    Thanks Mark.
    Unfortunately I haven't found any existing code which allows user-defined fonts that match the ROM characters (32x16 and interleaved).
    I decided to stick with the VGA_Text program and not try to combine it with the HiRes code. But I'm still missing user-defined characters.
    Any idea?
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-11-19 06:20
    If you can spare half of the hub RAM for the font table you could just modify VGA_TEXT to point to RAM instead of location $8000 in ROM. If you only need the first 128 characters you can reduce the memory requirement down to 8K instead of 16K.
  • PropProp Posts: 4
    edited 2013-11-19 07:43
    I only need to modify about 26 specific characters (ascii 97...122). The rest will remain sourced from ROM.

    How would I point to RAM instead of location $8000 in ROM?
    And how would I create the character map?
    I found a few different methods (defining long arrays) to create new font, but they don't match the ROM assignment and interleaving, or the VGA_Text code.

    Do I need to modify the VGA_Text Print(c) routine to replace ROM character "c" with the address of alternate user fonts?

    screen[row * cols + col] := (color << 1 + c & 1) << 10 + $200 + c & $FE


    Thanks!

  • Mark_TMark_T Posts: 1,981
    edited 2013-11-19 09:24
    That is just encoding colour and character code, not converting to address. The main issue you have with VGA
    drivers is the very limited cycles per character scanline, adding complexity to the font addressing will likely lose
    you the timing you need. Simply changing the fontbase pointer is easy, but will need a couple of modifications
    to the code I'd guess.

    Once you're accessing font from RAM you can copy and alter any ROM chars you like into that RAM table.
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-11-19 13:15
    Prop wrote: »
    screen[row * cols + col] := (color << 1 + c & 1) << 10 + $200 + c & $FE
    Prop, the $200 is the starting address of the font table shifted down by 6 bits. $200 << 6 is $8000, which is the start of the ROM font. I have attached a modified VGA_Text.spin file that offset the font table by 32 characters, which is 32*64=2048 bytes. In the print routine I add 32 to the character value and mask to 8 bits to compensate for the font offset. This basically maps the character values from 224 to 255 to the RAM font table. The routine InitFont just copies the ROM font for "`abc...xyz..." to the RAM area.

    I defined the constant NUM_CUSTOM_CHARS to 32. You can change this to some other number. You'll have to put your own font in RAM, and if you want to map 97-122 to this area you'll have to add some code to the print routine to change the values 97-122 to 224-249 prior adding the NUM_CUSTOM_CHARS offset.
  • PropProp Posts: 4
    edited 2013-11-27 23:53
    Thanks Dave!! It works great.
Sign In or Register to comment.