View Full Version : I REALLY like the "VGA_HiRes_Text" object; here's a simple demo with it

Bill Henning
10-14-2006, 12:52 PM

I REALLY like the VGA HiRes Text object; I think that will be a mainstay in my projects - it lets me output very large ammounts of information using relatively little in the way of hub memory. Thank you Parallax!

Here's a simple demo for the mode; it shows all 64 possible background colors, with the opposite color for foreground; one combination per line. The first sixty four characters are 'normal', the second sixty four have the 'inverse' bit set.

--- cut here ---

' simple hires_text_demo - WH
· vga : "VGA_HiRes_Text"

· _clkmode = xtal1 + pll16x
· _xinfreq = 5_000_000

· byte scrn[8192]
· word pal[64]
· byte cursors[6]
· long vsync
· long i

pub main
· vga.stop

· ' set up frame buffer
· repeat i from 0 to 8191
··· scrn[i] := (i & 127) | (i & 64) << 1

· ' set up palette
· repeat i from 0 to 63
··· pal[i] := (i << 10) | (255 - (i << 2))
· vga.start(16,@scrn,@pal,@cursors,@vsync)


I have finally absorbed enough information to see how the video registers and hub instructions work, very cool; I think I'll try generating some other useful modes soon.



10-14-2006, 01:49 PM

Good job! The best way to get a handle on an object is to exercise it completely in some short demo program just like this. This builds your confidence in·the object and makes it easy for you·to apply·it in a real application. The best way to learn is by actually trying things out.


Chip Gracey
Parallax, Inc.

Post Edited (Chip Gracey (Parallax)) : 10/14/2006 9:05:04 AM GMT

El Paisa
10-14-2006, 06:50 PM
Once again,

This program·does not·work with the basic VGA (640x480).

There is a way to make this things running in all VGA resolutions.

Or at least specify which resolution the program is designed for?

It is too much to ask?

BTW VGA_Hires_Text_demo does.

Mike Green
10-14-2006, 09:03 PM
El Paisa,
How about taking what Bill has done and modifying it to adjust to the different resolutions? If you look at VGA_hires_Text, it does make the resolution information available as constants which can be referenced in your program as vga#cols for example which is 40 for 640 x 480, 50 for 800 x 600, and 64 for 1024 x 768.

10-14-2006, 09:11 PM
Mike, I take it that this does not apply to OS_vga_hires_text.


Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)

Mike Green
10-14-2006, 11:17 PM
The OS_vgaHiresText object is essentially the same as the one El Paisa is talking about. The OS routine has some additional features (like windowing support) as well as the methods (functions/procedures) furnished with the other display drivers. It's also been split into a program interface part and an initialization part (with the assembly language driver). The screen buffer and color palette are allocated in a different part of memory, but Bill's program could be modified to work with it.

Graham Stabler
10-14-2006, 11:43 PM
El Paisa said...
Once again,

This program does not work with the basic VGA (640x480).

There is a way to make this things running in all VGA resolutions.

Or at least specify which resolution the program is designed for?

It is too much to ask?

BTW VGA_Hires_Text_demo does.

Yes I think it is too much to ask from a persons first demo with an object.


El Paisa
10-14-2006, 11:50 PM
It is too much to ask when somebody writes an VGA object to specify the resolution of the machine is using?

Graham Stabler
10-15-2006, 01:11 AM
What I mean is, he might not have realized that some people (like you and me) have screens that don't support higher resolutions.

You sounded almost offended by the ommision of this information.


Mike Green
10-15-2006, 01:29 AM
People (myself included sometimes) tend to underestimate the amount of work needed to document a program for others to use or adapt a program originally written just for yourself for wider use. Often what we are willing to put up with is far far short of what others can reasonably be expected to accept. That's a lesson for all of us and we also need to be tolerant of people who, in the excitement of the moment, want to share their new creation with others without the sometimes agonizing delay of sprucing it up for others.

James Long
10-15-2006, 07:27 AM

I tend to agree......but I hope people who are submitting objects to the exchange go back and do a detailed documentation of their objects.....it will really cut down on the problems associated with them. There will always be confusion....like I had....but good documentation is really a necessity.

But....I also have to remember the objects here are shared through the forum...not the exchange.....so we have to figure them out for our own use.....which is a good learning tool.

Guys please remember.....we do appreciate all that you share.

James L

Bill Henning
10-15-2006, 09:09 AM

I never expected such a debate over a simple off-the-cuff quick hack!

In order of replies:

Chip - Thanks!

Especially for making the Propeller! I'm having a blast with it, I think I'm going to become a long term resident of this forum and propeller hardware... I'd better, given how much I've blown in the past month on components, lcd's etc to play with.

El Paisa,

This was a short hack for testing the default high-rez text mode, which is 128x64. See attached resolution independent one, with bonus animation at the end. Only took a few minutes.

Mike Green,

Thanks, I did it for him - see new source at the end of the message. It is still not commented, I do not consider this a "tutorial" or a released piece of code, just a quick hack to share on the forum. As a matter of fact, I deliberately left the "animation" code undocumented. After I play with the raw hardware some more, I am going to check out your Spin OS...


See the new constants on top. As long as you can pass the code the base address of the frame buffer, the color palette, and the sizes of both, it should work with any byte oriented text mode, including TV object (which I may play with tomorrow). I've been working 6.5 long days a week and have not had as much time to play with my propeller as I'd like... but tomorrow I am FREE!!!


If he had simply asked, I'd have obliged him - even though the changes were trivial. As is, given the interest, I obliged him anyway, and added some pseudo-animation code too... (which is too slow in spin, but its still a neat effect)


If I had intended this as an object for the exchange, I would have documented it. I have 24 years experience in IT, including being a project manager so I know how valuable documentation is; however I was just posting a neat, short hack that I whipped up for fun after a long day.


I have to use an attachment :-(

I could not find an 'formatted' mcode and it kept messing with my spacing.

Post Edited (Bill Henning) : 10/15/2006 2:26:57 AM GMT