Qbasicnews.com

Full Version: colorprint sub and doulble buffing in screen 13
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I am using the doulble buffering sub that (i think it was Relsoft) made, but it won't work with the sub i got off someone that prints to the screen without a black box around the text, it just doesn't print the text?

Anyone know why or got any ideas of how i can do it without having to make all the text into sprites(they work).
It would be nice that you told us which double buffering routine and which print routine you are using, as we are not fortune-tellers Big Grin

Y'know it's only that there are like 10 different ways to do a double buffer, and 10 different routines that print text Wink
And combining those 10 different ways usually doesn't work either Wink Try the text-printing routine of the same creator as the Double-Buffer routine.
or better yet, make your own double buffer routine and text-printing routine. you'd understand it better.

like neo said, the text routine probably isn't compatible with the buffer routine. for example, the text routine might be sending it's text to a different spot in memory instead to relsofts buffer. or something like that.
colour print routine

Code:
SUB COLORPRINT (ROW, COLUMN, text2$, TEXTCOLOR)
startx = (COLUMN - 1) * 8
starty = (ROW - 1) * 8
FOR x = 1 TO LEN(text2$)
  char = ASC(MID$(text2$, x, 1))
  FOR y = &HFA6E + char * 8 TO &HFA6E + 7 + char * 8
    DEF SEG = &HF000 ' poss 000
    bits = PEEK(y)
    DEF SEG = &HA000
    Offset& = starty * 320& + startx
    IF bits AND 128 THEN POKE Offset&, TEXTCOLOR
    Offset& = Offset& + 1
    IF bits AND 64 THEN POKE Offset&, TEXTCOLOR
    Offset& = Offset& + 1
    IF bits AND 32 THEN POKE Offset&, TEXTCOLOR
    Offset& = Offset& + 1
    IF bits AND 16 THEN POKE Offset&, TEXTCOLOR
    Offset& = Offset& + 1
    IF bits AND 8 THEN POKE Offset&, TEXTCOLOR
    Offset& = Offset& + 1
    IF bits AND 4 THEN POKE Offset&, TEXTCOLOR
    Offset& = Offset& + 1
    IF bits AND 2 THEN POKE Offset&, TEXTCOLOR
    Offset& = Offset& + 1
    IF bits AND 1 THEN POKE Offset&, TEXTCOLOR
    Offset& = Offset& + 1
    starty = starty + 1
  NEXT
  startx = startx + 8
  starty = (ROW - 1) * 8
NEXT
DEF SEG

END SUB

double buffing routine
DEFINT A-Z
SUB setVideoSeg (SEGMENT) STATIC ' By Plasma357

DEF SEG

IF videoAddrOff& = 0 THEN ' First time the sub is called

' We need to find the location of b$AddrC, which holds the graphics
' offset (b$OffC) and segment (b$SegC). Since b$AddrC is in the default
' segment, we can find it by setting it to a certain value, and then
' searching for that value.

SCREEN 13 ' Set b$SegC to A000 (00A0 in memory)
PSET (160, 100), 0 ' Set b$OffC to 7DA0 (not needed in the IDE)

FOR Offset& = 0 TO 32764 ' Search for b$AddrC, which is
IF PEEK(Offset&) = &HA0 THEN ' in the default segment and
IF PEEK(Offset& + 1) = &H7D THEN ' should have a value of
IF PEEK(Offset& + 2) = &H0 THEN ' A0 7D 00 A0.
IF PEEK(Offset& + 3) = &HA0 THEN
videoAddrOff& = Offset& + 2 ' If we found it, record the
EXIT FOR ' offset of b$SegC and quit
END IF ' looking. (Oddly, changing
END IF ' the b$OffC doesn't seem to
END IF ' do anything, so this is why
END IF ' this sub only changes b$SegC)
NEXT

END IF

' Change b$SegC to the specified Segment

POKE videoAddrOff&, SEGMENT AND &HFF
POKE videoAddrOff& + 1, (SEGMENT AND &HFF00&) \ &H100


'setVideoSeg myBufferSegment%
'WAIT &H3DA, 8: WAIT &H3DA, 8, 8
'setVideoSeg &HA000
'PUT (0, 0), myBuffer%(6), PSET

END SUB
Code:
I would make my own, but I am no good at memory stuff, I don't know anything about def seg, var seg, poke, peek, or tuff like &h3da.
Setvideoseg is based on creating a "virtual screen" somewhere in memory. It changes some stuff so QB drawing commands draw in you array and not in video memory, so you can afterwards copy that array to the actual video memory -> double buffer.

The print routine you are using is POKING to video memory directly, so they are not compatible. Use PSET instead of those POKEs for a quick fix.
Plasma made SetVideoSeg

Plasma<>Rel

And I didn't make ClrPrint either. Though I made a similar version.

Yeah, what Nathan said. PSET instead of POKE.
cheers, sorry about the name I get confused easily
Quote:Plasma<>Rel

love the way you phrased that Rel. Big Grin
Yeah but maybe he ment:
"Rel" <> "Plasma"

as that is more correct Wink.
Pages: 1 2