03-17-2005, 09:28 AM
i'm trying to port over pp256's image indexer sub to fb. (all that was needed was ptr& to be changed to something else) the program compiles fine, but during runtime the program crashes when makeimageindex is called.
i couldn't get it working so i tried making my own routine based off of that one..
i get the same problem.
during runtime, it tells me that memory could not be read. any help is appreciated!
p.s. i also had to make another change... i couldn't save pp256 images the way they are usually stored in arrays (starting at tiles(1)... the image doesn't display right.) so it starts at tiles(0) instead. that's another change i included in the routines.
Code:
SUB makeimageindex (imagearray(), IndexArray())
DIM Temp(1 TO 1000)
Ptr2& = 0: IndexNo = 1: LastInt = UBOUND(imagearray)
DO
Temp(IndexNo) = Ptr2&
IndexNo = IndexNo + 1
x& = (imagearray(Ptr2&) \ 8) * (imagearray(Ptr2& + 1)) + 4
IF x& MOD 2 THEN x& = x& + 1
Ptr2& = Ptr2& + (x& \ 2)
LOOP WHILE Ptr2& < LastInt
LastImage = IndexNo - 1
REDIM IndexArray(1 TO LastImage)
FOR N = 1 TO LastImage
IndexArray(N) = Temp(N)
NEXT N
end sub
i couldn't get it working so i tried making my own routine based off of that one..
Code:
sub makeindex (imagearray(), indexarray())
dim temparray(1 to 1000) as integer
lastint = ubound(imagearray)
do
x = imagearray(arraysize&) \ 8
y = imagearray(arraysize& + 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
loop until lastint <= lastarray&
listimages = listimages - 1
redim indexarray(1 to listimages)
for x = 1 to listimages
indexarray(x) = temparray(x)
next
end sub
i get the same problem.
during runtime, it tells me that memory could not be read. any help is appreciated!
p.s. i also had to make another change... i couldn't save pp256 images the way they are usually stored in arrays (starting at tiles(1)... the image doesn't display right.) so it starts at tiles(0) instead. that's another change i included in the routines.
Jumping Jahoolipers!