Using blue colour palette in VGA, with QBasic - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html) +--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html) +--- Thread: Using blue colour palette in VGA, with QBasic (/thread-9390.html) |
Using blue colour palette in VGA, with QBasic - torstum - 06-10-2006 Hello everyone I've always been able to use the green and red colour palettes, but whenever I try that for the blue colour, an error message appears. It's been years since I last tried it, but I think the message was "Invalid Function Parameter", but in portuguese. I think it has to do with the number being too big for the function, but I used the procedure described in tutorials, something like: "Green + Red * 64 + Blue * 128" (again, this is from memory so it may not be entirely correct). Is it because I'm using the Interpreter, and it only works with the Compiler (technically making it a bug), or am I doing something wrong? Could you give a very brief code snippet that works? Sorry if this is discussed in tutorials or faqs that I haven't looked into. Thanks. (I've read the palette tutorial on the site, but it doesn't work for me, since I usually avoid direct port calls and assembly statements). Using blue colour palette in VGA, with QBasic - Anonymous - 06-11-2006 Here you go dude: Code: '' QB palette shifting example RGB is implemented in FB as a macro, which means it's lots faster than using a function to shift the values, like in the QB version. You can calculate the rgb value inline of course, but that gets messy. ;p Using blue colour palette in VGA, with QBasic - torstum - 06-11-2006 I'll try that Chaos, thanks. Using blue colour palette in VGA, with QBasic - na_th_an - 06-12-2006 This is generally faster (in most computers): Code: SUB SetDAC (Index%, r%, g%, b%) Using blue colour palette in VGA, with QBasic - torstum - 06-16-2006 In QBasic 1.1 , the PALETTE command doesn't appear to accept extended integers. Could someone try it, using the blue colour, and corroborate this? I still haven't tried the code snippet (QBasic is installed in my 486, not my net machine), but I can predict that it won't work, because the PALETTE command won't work itself, unless you use only the green and red colours. Thanks Nathan, but I won't do port output, my 486 is way too valuable for me to do that, no safety-net there if I do a typing mistake. Using blue colour palette in VGA, with QBasic - torstum - 06-16-2006 OK, let me correct myself, the code snippet does work with QBasic 1.1. I've never been able to do it because, for some reason, QBasic doesn't think 256*256 is the same thing as 65536. Go figure. Using blue colour palette in VGA, with QBasic - RyanKelly - 06-18-2006 Keep in mind that the pallete command performs error checking on the supplied RGB values to ensure that they are in the range of 0 to 63, not 0 to 255. Consequently not every 24 bit value (3 eight bit fields) is a legal parameter. This is done because the VGA DAC only provided six bits for the RGB values. Using blue colour palette in VGA, with QBasic - na_th_an - 06-18-2006 Man, you won't break your computer OUTing to the VGA BIOS I/O ports. Every program you use on it does it for everything. Try this: Code: a& = 256*256 Always use the correct data type. |