Shop OBEX P1 Docs P2 Docs Learn Events
Writing to the VGA Driver in PASM — Parallax Forums

Writing to the VGA Driver in PASM

CynicCynic Posts: 8
edited 2009-06-07 16:59 in Propeller 1
Hello all

I would like to be able to output to·a VGA display using PASM.·Here's what I have done

·- made a copy of the standard VGA_Text.spin and VGA.spin
·- wrote spin code and launched it in a cog which accesses the spin VGA display code which displays one line on the screen. This is just used so I can set the colors and have some characters there so I can see the changes. This works fine
·- wrote a cog which gets the·the VGA_Text "screen" variable passed in as a PAR value to a PASM program
·- the PASM code in this cog should then be able to write to the hub ram "screen" buffer directly to display a character, using WRWORD to the screen buffer (plus suitable offsets for column and row)
·- ignoring column and row for a moment, I have been trying to write to the first word of the screen buffer which should·correspond to·position 0,0 on the display

However, the PASM code is not working well. I have tried various things but either nothing happens or very odd colors and characters appear - usually these colours and characters fill the entire screen·even though·I am only writing to the first word in the screen buffer. Below is an·example (from the VGA_Text) sample·of·the spin code which outputs a character to the screen buffer

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

I have tried to replicate this in my PASM code but·with no success. I have also tried just writing·$220 to the first word to blank only the first word (representing a character) of the screen buffer. I got this idea from·the spin code which·blanks the screen

wordfill(@screen, $220, screensize)··

Here is my version of that code in PASM

············· mov····· t1,#$22
············· shl······· t1,#4
············· wrword· t1,xScreen
Should this not work? I am getting a screen full of blue exclaimation marks on a green background?

Obviously·I do not understand how the color and character specification works. I have·carefully read and the discussion in the manual·the comments in the VGA.spin code - but the talk of pixel groups etc just isn't making sense. I would very much appreciate any suggestions and advice anyone has on this topic.·If anyone has a snippet of PASM to share which can take a byte value and write it out to the screen buffer at a specified column and row I would be doubly grateful.

Many thanks.
·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-07 15:39
    I've used the VGA Hires Text driver (obex.parallax.com/objects/69/) from assembly language. It's much easier to use because the characters are stored directly as bytes rather than as tile pointers to the ROM font table. You just use a WRBYTE to store the character itself.
  • CynicCynic Posts: 8
    edited 2009-06-07 16:59
    Hi Mike

    Thanks for that info - I did not know the high res driver·used a simple byte buffer. Actually I did download it - but did not pursue it once I noticed it took two cogs. I was trying to minimize the number of cogs used.
Sign In or Register to comment.