Qbasicnews.com

Full Version: screen modes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Is there a way to get the color of screen mode 13 with the resolution of screen 12 in qbasic. I know that screen 12 has 256 atributes but only 16 colors. And, by the time you make picture in mode 13 you don't have room for anything else on screen.
SCREEN 12 has 256[B]K - attributes, that is: 262,144 different colours, but only 16 can be displayed at the same time. To get more simmultaneous colours just use a SVGA library (such as SVGALib, Future.Lib or UncompatibleGL). Otherwise you'll have to toss with ports, interrupts and do all the low-level code for yourself, implement the blitters, the line/circle tracers, etc.
If microsoft could make 256 distinct colors in screen 13 they should have been able to in screen 12. And, they should have.
But one of the tutorials says there are ways of geting other screen modes. I have never understood why high resolution in basic had to have less colors. Applesoft does the same thing 16 colors in lores and 6 colors in hires. Hires is 280 X 192, lores is 40 x 48.
It has nothing to do with BASIC itself, but with hardware limitations. When QB was released in 1987 the newest video cards around were VGA with 256 Kb of memory, capable only to achieve 256 colours in 320x200 or 16 in 640x480. You could tweak the video card to achieve different resollutions, but nothing very fancy (I've seen 360x480 in 256 colours) and of course non standard. Microsoft just implemented the standard video modes that were available in video cards in that age.

This is not hard to understand. It has to do with memory. The more colours you want per pixel, the less resollution you get. Take for example 32 Kb. You could make a 320x200x16 display (320x200\2 = 32000, four bits per pixel) or a 640x200x4 display (640x200\4 = 32000, two bits per pixel). If you wanted 16 colours in your 640x200 display you would have to add 32 Kb more of memory.

In order to work with wider and deeper video modes you have to deal directly with the VESA standard... Or use a library.
peace, take my advice dont use UGL. I dont understand why nathan is so afraid to speak up the truth. Everyone knows that UGL has compatibility issues. It is too bloated so you cant compile using the IDE lest you strip it down.

I feel Future.Lib is the *BEST* library. Its very userfriendly =)
at least 320 X 200 is more useful than 40 X 48. And, I do get the same number colors in 640 X 320 as in applesofts 40 X 48.
Though trying to make programs that work similiarly using graphics is hard in basic. I have seen other programs get alot picture quailty graphics on an Apple 2. Just wish you could get that level in basic. I was thinking since they made room for 256 atributes there should be a way to use these extra atributes with more video memory. Tough for now I will porobaly use screen 13 until I get better with graphics. And, anyone nkow why you can't use data statements in subs.
You can get 'picture' quality in QB using Future.Lib(high colour depth modes like 16, 24, 32 bit can do it)
I downloaded both svgalib and futurelib v3.5.
Goto www.basix.8m.net , there you will find a nice tut on how to install FL v3.5 =) and a small 'getting started' tut as well.
Quote: I was thinking since they made room for 256 atributes there should be a way to use these extra atributes with more video memory.

Because that space don't exist. VGA modes (12 and 13 in QB) can use 256 K-attributes 'cause of the hardware. When a color has to be drawn, the VGA looks in a set of special registers: the DAC registers. those registers specify the actual colour components R, G and B using 6 bits of precission for each, this you get 64x64x64 attributes = 256 K-atributes (262,144 attributes). So the "room" for those attributes is just a set of 256 registers of 18 bits.

But that only happened in the VGA cards. In modern SVGA cards you have megs and megs to play with. Even the most ancient 486 you can come accross has 1 meg of memory in its graphics card so you can get 16.7 millions of simmultaneous colours in 640x480, for example, or 65536 simmultaneous colours in 800x600, or 256 in 1024x768. The problem is that QB was never updated to take advantage of the new hardware. No problem, libs are great to solve that issue: they just add QB such functionality to work with those missing modes.

Quote: Tough for now I will porobaly use screen 13 until I get better with graphics. And, anyone nkow why you can't use data statements in subs.

Well, you can't. DATA statements are stored in the main DATA segment of each module, so they are still accesible from the subs:

Code:
MyData: DATA 1,2,3,4

SUB readData
   RESTORE MyData
   FOR i=1 TO 4
      READ a
      PRINT a
   NEXT i
END SUB

So it doesn't matter if they can't be inside a sub 'cause they can be read from that. Note how RESTORE knows which label we are talking about.

Anyhow I would not use DATA for big amounts of idem 'cause they will make your EXE bigger. Being so much limited in size by the compiler and the environment, it is desirable to stuff as much things as possible in extern files.
Pages: 1 2