Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Screen 13 buffer
#1
I'm in the process of writing subs to enable me to have a buffer in screen buffer in Screen 13. The only problem is, they have ended up being very, very slow. It takes quite a long time for each of them to run and thus my graphics are fairly slow (although there are no flicker problmes Smile ). Anyway, I was just wondering what suggestions, if any, you guys had as to what to do to increase the speed of my routines. One thought I had, don't know if its worth doing, or even possible (due to the offset limit size) was to only define my segment once and then just use offsets to reference my memory locations. As you can probably see, the routine I use below (te equivelant of put) is quite calculation intensive and redifnes the segment 2 times per cycle. BTW, page() is the screen buffer.

Code:
SUB fastput (x%, y%, img%())                         'has automasking feature
   wimg& = img%(0) / 8                                'determines width of the image to be put
   himg& = img%(1)                                 'determines height of the image
   wpage& = page(0) / 8                                'determines width of the page to be written to
   simg& = VARPTR(img%(2))                            'finds the start of the img to be displayed
   spage& = VARPTR(page(2))                            'finds the start of the actual graphics data
   FOR ycnt& = 0 TO himg& - 1                             'loops through the images rows
      FOR xcnt& = 0 TO wimg& - 1                          'loops through the columns of a row in the image
         oimg& = wimg& * ycnt& + xcnt& + simg&          'finds the pixel in the images offset
         'DEF SEG = VARSEG(img%(0)) + INT(oimg& / 16)    'sets the segment of the pixel being pulled from the image
         DEF SEG = VARSEG(img%(0))
         'pixeltocopy% = PEEK(oimg& MOD 16)              'gets the value at the pixel
         pixeltocopy% = PEEK(oimg&)
         'PSET (xcnt& + 20, ycnt& + 20), pixeltocopy%
         IF pixeltocopy% THEN
            opage& = wpage& * (ycnt& + y%) + xcnt& + x% + spage&   'finds offset in screen buffer
            DEF SEG = VARSEG(page%(0)) + INT(opage& / 16) 'sets the segment of the pixel being placed on the page
            POKE opage& MOD 16, pixeltocopy%               'places the pixel in the page buffer
         END IF
      NEXT xcnt&
   NEXT ycnt&
   DEF SEG                                              'returns segment to basic's default

END SUB
Reply


Messages In This Thread
Screen 13 buffer - by Aaron - 05-04-2003, 10:37 AM
Screen 13 buffer - by toonski84 - 05-04-2003, 07:06 PM
Screen 13 buffer - by relsoft - 05-05-2003, 10:53 AM
Screen 13 buffer - by Aaron - 05-05-2003, 07:40 PM
Screen 13 buffer - by Aaron - 05-06-2003, 09:00 AM
Screen 13 buffer - by relsoft - 05-09-2003, 12:29 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)