Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VESA True Colour mode, 1024x768 issue
#1
Hi to all of you,

I'm working on the VESA true colour mode, and I managed to have a set of routines that allow plotting in a 1024x768 screen with full 24bits RGB capacities.

But...

While it works OK when you plot squares, lines etc..., an overflow occurs at the POKE level when you try to plot, for example, a plain white square greater than 40x40

I seems that QB saturates after too many Pokes in a row.

I post the source here, sorry if it's long... but I really need to know if it is a technical limit or only a bug of mine...

DECLARE SUB Pset24 (X%, Y%, r%, g%, b%)
DECLARE SUB SetVGA ()
DECLARE SUB SetText ()

' $DYNAMIC

TYPE RegType
AX AS INTEGER
BX AS INTEGER
CX AS INTEGER
DX AS INTEGER
BP AS INTEGER
SI AS INTEGER
DI AS INTEGER
FLAGS AS INTEGER
DS AS INTEGER
ES AS INTEGER
END TYPE

DIM SHARED Regs AS RegType
DIM SHARED CurBank AS INTEGER

SetVGA

Size = 40

FOR i% = 300 TO 300 + Size
FOR j% = 300 TO 300 + Size
Pset24 i%, j%, 255, 255, 255
NEXT j%
NEXT i%

DO WHILE INKEY$ = ""
LOOP

SetText

REM $STATIC
DEFINT A-Z
SUB Pset24 (X, Y, r, g, b)
DEF SEG = &HA000

Offset& = (1024& * Y + X) * 3&
Bank& = Offset& \ &H10000
Offset& = Offset& - Bank& * &H10000
IF Bank& <> CurBank THEN
CurBank = Bank&
Regs.AX = &H4F05
Regs.BX = 0
Regs.DX = CurBank
CALL INTERRUPT(&H10, Regs, Regs)
END IF

POKE Offset&, r
POKE Offset& + 1, g
POKE Offset& + 2, b

ExitSub:
END SUB

DEFSNG A-Z
SUB SetText
Regs.AX = &H3
CALL INTERRUPT(&H10, Regs, Regs)
END SUB

SUB SetVGA
SCREEN 13

DIM modeInfo(127)
Regs.AX = &H4F01
Regs.CX = &H118
Regs.ES = VARSEG(modeInfo(0))
Regs.DI = VARPTR(modeInfo(0))
CALL INTERRUPTX(&H10, Regs, Regs)

Regs.AX = &H4F02
Regs.BX = &H118
CALL INTERRUPT(&H10, Regs, Regs)

DEF SEG = &HA000
CurBank = 0

END SUB
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#2
Well, the experimented programmers will not learn anything, but I post for the others, who, like me, try to build Hi-Res display (1024x768, 16.7 million colours in my case) with Quick-Basic.

as compared to my previous post, the PSET24 subroutine must be modified as follows :

DEFINT A-Z
SUB Pset24 (X, Y, r, g, b)
DEF SEG = &HA000

Offsetb& = (1024& * Y + X) * 3&
Offsetg& = Offsetb& + 1&
Offsetr& = Offsetg& + 1&

Bankb& = INT(Offsetb& / 65536)
Offsetb& = Offsetb& - Bankb& * 65536
IF Bankb& <> CurBank THEN
CurBank = Bankb&
Regs.AX = &H4F05
Regs.BX = 0
Regs.DX = Bankb&
CALL INTERRUPT(&H10, Regs, Regs)
END IF
POKE Offsetb&, b

Bankg& = INT(Offsetg& / 65536)
Offsetg& = Offsetg& - Bankg& * 65536
IF Bankg& <> CurBank THEN
CurBank = Bankg&
Regs.AX = &H4F05
Regs.BX = 0
Regs.DX = Bankg&
CALL INTERRUPT(&H10, Regs, Regs)
END IF
POKE Offsetg&, g

Bankr& = INT(Offsetr& / 65536)
Offsetr& = Offsetr& - Bankr& * 65536
IF Bankr& <> CurBank THEN
CurBank = Bankr&
Regs.AX = &H4F05
Regs.BX = 0
Regs.DX = Bankr&
CALL INTERRUPT(&H10, Regs, Regs)
END IF
POKE Offsetr&, r



ExitSub:
END SUB

When I'm through with this works, I will write a tutorial (in french and english) to tell how the VESA video modes work with QB. As a matter of fact, I must thank many times Biskbart for his help, but I have to admit there is no explicit tutorial on this subject on the web... (at least based on QB).

Check my site in a few weeks...
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#3
yeah, your bank size was too 1 byte big, but in your former code it still would've only come out to a little less than 57k. funky.

btw, my sexy, sexy graphics programming hero, hugo-elias, made a tutorial on using the svga (in pseudocode), but it's the only one i know of without scouring the internet (in which case, yeah, you're going to find tons):

http://freespace.virgin.net/hugo.elias/g...x_svga.htm
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#4
The page by hugo should give me a lot of new ideas...

One of the goals of my site is to teach through QBasic (because I find it easier to read than other languages) the techniques to draw Mandelbrot Sets, Fractal Landscapes, Raytracing pics, with Hi-Res True-colour results. The reader can focus on the principles and the algorithms rather than the bits and bytes.

As for today, since the fractal pics are very long to calculate, I used directly 24bits bitmaps. I started the Vesa modes 3 days ago... now it works, 1024x768, 16.7 million colours on screen !

I'm preparing real nice and sexy page about the Nephroid curve, with a 3D cup of tea merged with a Mandelbrot set, a pretty piece of littrature and a ... foxy lady ! Check "The Mandelbrot Dazibao" in the next weeks. Smile

Btw, if you are comfortable with ray-tracing, your opinion about my approach would help me a lot : check my fractal videos page, it's in English (I did not translate the raytracing pages from French yet)

Thanks for reading my long post... I'm too talkative !
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#5
nonsense. QB is good to talk about.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)