Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PP256 Graphics Problem
#1
I read the post http://forum.qbasicnews.com/viewtopic.php?t=8812 and adjusted my variables accordingly, but when I run it the program crashes...It doesn't give me any kind of memory error but it never displays the graphics and the program crashes.

I would post the code but it is on my laptop and it doesn't have a floppy drive, and I can't connect it to the internet here at work.
url=http://www.smithcosoft.com]SmithcoSoft Creations[/url]
"If you make it idiot proof, someone will make a better idiot" - Murphy's Law
Reply
#2
Hey. I made a tileset loader for pp256 and an index maker. hold on... Hey, I'll even throw in a pp256 palette loader. Wink

Code:
sub loadtileset (filename$, tilesets())
dim arraysize as ushort
dim lengthoftiles as ushort
filetempnum = freefile

open filename$ for binary as #filetempnum
lengthoftiles = lof(filetempnum)
close #filetempnum

arraysize = (lengthoftiles - 7) \ 2

redim tilesets(arraysize)

   bload filename$, varptr(tilesets(0))
      
end sub

sub makeindex (imagearray() as short, indexarray() as short)
  
dim temparray(1 to 1000) as short

lastint = ubound(imagearray)
do
   x = imagearray(lastarray&) \ 8
   y = imagearray(lastarray& + 1)
   temparray(listimages + 1) = lastarray&
   arraysize& = x * y
   if arraysize& mod 2 then arraysize& = arraysize& + 1
   arraysize& = arraysize& \ 2
   lastarray& = lastarray& + arraysize&
  
   listimages = listimages + 1
   listimages2 = listimages2 + ((x * y)\ 2) + 1
loop until lastint <= lastarray&

listimages = listimages - 1

redim indexarray(1 to listimages) as short

for x = 1 to listimages
   indexarray(x) = temparray(x)
next

end sub


SUB InitPaletteData (FileName$, PaletteArray&())

    'Size array to hold all 256 colours.
    REDIM PaletteArray&(0 TO 255)

    IF FileName$ <> "" THEN
        '*** Read palette data from file ***
        FileNo = FREEFILE
        OPEN FileName$ FOR BINARY AS #FileNo
        FOR n = 0 TO 255
            GET #FileNo, , colour&
            PaletteArray&(n) = colour&
        NEXT n
        CLOSE #FileNo
        for i = 0 to 255
           palette i, palettearray&(i)
           next i
    ELSE
        '*** Read palette data from DATA statements ***
        FOR n = 0 TO 255
            READ colour&
            PaletteArray&(n) = colour&
        NEXT n
    END IF

END SUB
Jumping Jahoolipers!
Reply
#3
That would have saved me trouble before rewriting the code on a couple old projects. I'll gladly use it now, though. :wink: Do you suppose you can do the palette manipulation sub as well?
Reply
#4
Palette manipulation sub? do you mean a palette loader? It's there.

Heheheheh... it's funny now, but a few days ago, i was looking at code that was laying on my jumpdrive (i was cleaning it out) When i came across my old copy of scale2x... and after looking at it for about 10 minutes, i realized it had all the subs that are needed!!! (initpalettedata, initimagedata, makeimageindex) I'm thinking i should be mad at Rel, for making me rewrite all of this when he secretly put it on my hd by making me think i was downloading a scaling program. Wink j/k... You rule rel! Just really wished i looked at that program before i tried to convert those subs... would of saved me ALOT of time, lol.
Jumping Jahoolipers!
Reply
#5
I always include the source so... Hey, you could spank me if you want. :*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#6
I know that and am eternally greatful for it!

I'll save that spanking for another day... You just watch your step Mr. Relly! :lol:
Jumping Jahoolipers!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)