Shop OBEX P1 Docs P2 Docs Learn Events
VGA Font — Parallax Forums

VGA Font

NewzedNewzed Posts: 2,503
edited 2006-07-21 16:29 in Propeller 1
I have the Propeller program for my mill switched from TV to VGA and everything is working great.· However, sometimes it is necessary to display quite a bit of data on the monitor, especially when Autorunning, and the screen gets a bit crowded.· Is there an easy way to reduce the font size to perhaps 75 or 50 percent of its present size?· I can live with the present size but it would be nice to be able to avaid the "wrap arounds" I sometimes get.

Thanks

Sid

Comments

  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-07-21 13:58
    Sid:
    I ran into that as well while working on my mp3 player screens. I ended up switching to the VGA_Hires_Text driver, which gave me the option of 3 different res's.
    Maybe, if you have space, you can use that driver, and switch between the different modes as needed. You would have to reserve enough space for the biggest res you select, but, after that, it's a matter of changing the prams, stopping and restarting the video driver.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Propeller + Hardware - extra bits for the bit bucket =· 1 Coffeeless KaosKidd

    ·
  • NewzedNewzed Posts: 2,503
    edited 2006-07-21 14:25
    KK, can you show me exactly what you did to get the vga_hires running?· I put in what I thought was all the parameters -

    text.start(16,800,600,%%0020_3300,%10)

    and it seemed to accept that OK, but then the program was looking for a different expression instead of text.out and text.str.

    Thanks

    Sid
  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-07-21 16:29
    Sid;· There are lots of little things that have to happen to make this work, and a number of little things to make it easier to make it work.· I'm away from home for the next few days, so I won't be able to get to the code.· But I can tell and show you what needs to happen, and you should be good to go from there.· When I say demo below, it means the vga_high_res_demo program
    First off, you need to·copy the following lines from the demo into your·CON section.
      cols = vgatext#cols
      rows = vgatext#rows
      chrs = cols * rows
    

    Next, you need to make sure the program is running fast enough.· The demo lines uses the following, so if what you have is slower, you should update it.· This also goes into the CON section:
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000
    

    Next, you should use a var for the screen buffer, this way it's not hard coded (you have 800 as the pointer to the screen buffer.· The demo uses the following line, and it does work, and also requires these additional lines in the VAR section:
      long  sync                            'sync long - written to -1 by VGA driver after each screen refresh
      long  screen[noparse][[/noparse]cols*rows/4]             'screen buffer - could be bytes, but longs allow more efficient scrolling
      word  colors[noparse][[/noparse]rows]                    'row colors
      byte  cx0, cy0, cm0, cx1, cy1, cm1    'cursor control bytes
    

    Now that setup is complete, you can init the driver.· As a best method suggestion, use the VARS and not hard coded values.· Once this line is excuting, the vga driver should be up and running, and now it's time to insert some code to put stuff on the screen!· This code goes into your main starting routine:
    text.start(16, @screen, @colors, @cx0, @sync)
    

    You should note, I change the obj name to text, which is what you have in your code.· You should have noticed by now there are no routines called .out or .string or anything!· This is blank driver.· You (or someone else or I for that matter), have to supply the methods needed to get from here to there.· In my app, I included the color init code, (Ya, I don't like green, but I haven't had the gumpshion to figureout how to change the colors to something neat like the default colors on the vga_text demo of blue back with white letter.. (anyone... wink, wink, poke, poke , knudge, knudge, hint, hint, clue, clue).· I included this code right after the start line.
      'set up colors
      repeat i from 0 to rows - 1
        colors[noparse][[/noparse]i] := %%0100_1310
        
      colors[noparse][[/noparse]0] := %%3000_3330
      colors[noparse][[/noparse]1] := %%0000_0300
      colors[noparse][[/noparse]2] := %%1100_3300
      colors[noparse][[/noparse]3] := %%0020_3330
      colors[noparse][[/noparse]4] := %%3130_0000
      colors[noparse][[/noparse]5] := %%3310_0000
      colors[noparse][[/noparse]6] := %%1330_0000
      colors[noparse][[/noparse]7] := %%0020_3300
      
      colors[noparse][[/noparse]rows-1] := %%1110_2220
    

    ·Now this is where it gets fun and interesting.· The video buffer, the var screen, holds the array that represents the display.· Your current configuration of the vga_hires_text will determin the size screen you have, and at that, the X & Y dimensions of the screen.· This information is ready for your methods to use.· If I were to do it again, I'd put the methods in the vga_hires_text file and not my application, but you have the option of either.· TO·put a byte onto the display, you only need to calculate it's byte offset from Screen[noparse][[/noparse]0], then set that byte to the charactor you want to disply.· For example, to put a "A" on the display·at the 3·row down, 5th col across, would use the following:
    row := 3
    col := 5
    screen[noparse][[/noparse]row * cols + col] := 65
    

    At this point, you can see how it would be easy to create a method for outputting a string of chars to the X & Y cords you want:
    PUT(XCord, YCord, string)                             'This routine puts a string oc chars starting at x,y NO WW or LF support
      REPEAT STRSIZE(string)                              'for the length of the string, repeat the following code
        screen[noparse][[/noparse]YCord * cols + XCord++] := byte[noparse][[/noparse]string++]  'put the char byte into the video memory
    
    

    You would call the above method with:
    Text.Put(5,3,STRING("Some text..."))
    

    You can see how this was taken directly from the vga_text demo, and applied here.· The above code does NOT take into accout screen wraps or new lines.· And I should also note, I did all of this from memory, at the office, while still trying my first cup of coffee.· That means you may need to do some editing here!· This is just one code segment.· THere are quite a few other you could incorptate into the driver, simulating the same code layout and functionality·as·in the vga_text driver.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Propeller + Hardware - extra bits for the bit bucket =· 1 Coffeeless KaosKidd



    Post Edited (Kaos Kidd) : 7/21/2006 4:34:35 PM GMT
Sign In or Register to comment.