Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VESA modes technical question
#1
Sorry for the double posting I got messed up by the quote system...

When I started working on the SVGA modes, I had to solve a issue, which I actually solved.

It's about the adapted Pset for SVGA 24/32 bits modes. When you try to fill in a screen by a double x,y loop, there is an overflow on the poke after a given number of pixels.

(The following pieces of codes are more pseudo-code than real QB code).

1) The prog which did not work:
Code:
Offset& = (ScreenWidth * y% + x%) * Bpp
SwitchBank
Offset& = Offset& + 0 : POKE Offset& , Blue%
Offset& = Offset& + 1 : POKE Offset& , Green%
Offset& = Offset& + 1 : POKE Offset& , Red%

2) The prog that works:
Code:
Offset& = (ScreenWidth * y% + x%) * Bpp
Bank& = INT(Offset& / 65536)
Offset& = Offset& - Bank& * 65536
SwitchBank
POKE Offset& , Blue%

Offset& = Offset& + 1
Bank& = INT(Offset& / 65536)
Offset& = Offset& - Bank& * 65536
SwitchBank
POKE Offset& , Green%

Offset& = Offset& + 1
Bank& = INT(Offset& / 65536)
Offset& = Offset& - Bank& * 65536
SwitchBank
POKE Offset& , Red%

In the two progs, SwitchBank is:
Code:
SUB SwitchBank
IF Bank& <> CurBank& THEN
CurBank& = Bank&
Regs.ax = &H4F05
Regs.bx = 0
Regs.dx = Bank&
CALL INTERRUPT(&H10, Regs, Regs)
END IF
END SUB

First Question : Toonski, can you tell me how you came to this 57k figure ? Can you give the details of your rational ?

Quote: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.

Second Question : the prog which does not work on my machine seems to work on other configurations. WHY ? Is that related to the VESA 2 standard, that allows direct linear pixel addressing ?
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#2
The second code should not work, even in your machine. For 24 bit modes you should re-calculate the current bank inside switchbank. BTW, that 's what you're doing in TCLib15.
In other computers, well, they use 24 bits or 32 bits?
For what I remember your machine not only has 24 bit colors, it does'nt allow to change the line length at all... If you can set up a suitable line length you can be sure you are in the same bank for the whole line.
Antoni
Reply
#3
I corrected the codes in my post: you were right, Antoni !

So, what I understand is that, with a 32 bits machine, the 3 components are always in the same bank, while they can be in different banks for a 24 bits machine. Do I get it right ?

I don't really have time to make detailed calculations, but that must come from the multiple of 4 versus multiple of 3 issues ?
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#4
Yes, it's a divisibility issue. That's right!
For the same reason, if you can setup the number of pixels in a row as a power of two, you are sure the whole line will be in the same bank.
I think you could avoid checking for the bank three times:
You calculate bank and offset once, then depending on the offset value you defer the bank change: If offset is 0 you change before plotting first color, if offset if &hFFFF you change after first color and if it's &FFFE you change after the second color. It would save a lot of divisions
Antoni
Reply
#5
I was thinking about that yesterday... I will thus upgrade the Pset24 module. It will gain speed for the TC-Lib, that definitely needs some !
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply
#6
This how I modified Tclib15's Pset24 sub:
Code:
SUB Pset24 (x%, y%)
' Plots a pixel using the current RGB combination

'DEF SEG = &HA000
IF x% < 0 OR x% >= ScrWidth THEN EXIT SUB
IF y% < 0 OR y% >= Scrheight THEN EXIT SUB
Offsetb& = (ScrWidth * y% + x%) * Bpp

bankb& = Offsetb& \ 65536
Offsetb& = Offsetb& MOD 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&, blue%

IF Offsetb& = &HFFFF THEN
  Offsetb& = -1
  curbank = curbank + 1
  Regs.ax = &H4F05
  Regs.bx = 0
  Regs.dx = curbank
  CALL INTERRUPT(&H10, Regs, Regs)
END IF
POKE Offsetb& + 1, green%

IF Offsetb& = &HFFFE THEN
  Offsetb& = -2
  curbank = curbank + 1
  Regs.ax = &H4F05
  Regs.bx = 0
  Regs.dx = curbank
  CALL INTERRUPT(&H10, Regs, Regs)
END IF
POKE Offsetb& + 2, red%

END SUB

It works for me, but i have a 32 bit card...

You could also try to set up a suitable line length. It would not increase speed in YOUR computer, but it would do it in many others. Big Grin
Antoni
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)