05-06-2003, 09:00 AM
So, here's it is, fixed:
previously, I was using two subs to do this same thing (one loaded the file into the array, and then passed it on to the other)
I now realize that this is what was slowing down my code so much, with this, and the total conversion to short integers, my sub puts grafix to the buffer in about 1/3 to 1/4 the time qbasics put can write them to the screen. Granted I still have to transfer them from the buffer to the screen, but that is rather quick in the overall scheme of things.
thanks for all your help with getting this little thing worked out, I appreciate the responses
Aaron
Code:
SUB bbput (x%, y%, filename$)
DIM img%(201)
DEF SEG = VARSEG(img%(0))
BLOAD "shipa.put", VARPTR(img%(0))
wimg% = img%(0) \ 8
himg% = img%(1)
wpage% = page(0) \ 8
simg% = VARPTR(img%(2))
spage% = VARPTR(page(2))
FOR ycnt% = 0 TO himg% - 1
FOR xcnt% = 0 TO wimg% - 1
oimg% = wimg% * ycnt% + xcnt% + simg%
DEF SEG = VARSEG(img%(0))
pixeltocopy% = PEEK(oimg%)
IF pixeltocopy% THEN
opage% = wpage% * (ycnt% + y%) + xcnt% + x% + spage%
DEF SEG = VARSEG(page(0))
POKE opage%, pixeltocopy%
END IF
NEXT xcnt%
NEXT ycnt%
DEF SEG
END SUB
previously, I was using two subs to do this same thing (one loaded the file into the array, and then passed it on to the other)
I now realize that this is what was slowing down my code so much, with this, and the total conversion to short integers, my sub puts grafix to the buffer in about 1/3 to 1/4 the time qbasics put can write them to the screen. Granted I still have to transfer them from the buffer to the screen, but that is rather quick in the overall scheme of things.
thanks for all your help with getting this little thing worked out, I appreciate the responses
Aaron