'Future.Library redefining Get and Put to use segment and offset
'
REM $INCLUDE: 'future.bi'

DECLARE SUB SVGAput (BYVAL x1%, BYVAL y1%, BYVAL offset%, BYVAL segment%)
DECLARE SUB SVGAget (BYVAL x1%, BYVAL y1%, BYVAL x2%, BYVAL y2%, BYVAL offset%, BYVAL segment%)

'$DYNAMIC
DIM Buffer%(129, 3, 3, 3, 3)'(4*4*4*4) sprites (16x16) +4 bytes for the sprite info (using zero base)

'bytes per sprite is (256+4) bytes, integer allocation is ((256+4)/2)-1=129 using a zero base

Set640x480 8

'load something in the fist two sprites
FOR i% = 0 TO 7
Future.BOX 7 - i%, 7 - i%, 7 + i%, 7 + i%, i%
NEXT
SVGAget 0, 0, 15, 15, VARPTR(Buffer%(0, 0, 0, 0, 0)), VARSEG(Buffer%(0, 0, 0, 0, 0))
FOR i% = 16 TO 0 STEP -1
Future.FILLCIRCLE 8, 8, i%, i%
NEXT
SVGAget 0, 0, 15, 15, VARPTR(Buffer%(0, 1, 0, 0, 0)), VARSEG(Buffer%(0, 1, 0, 0, 0))


Future.CLS 0

'draw from the first two sprites
FOR i% = 0 TO 5000
SVGAput RND * 640, RND * 480, VARPTR(Buffer%(0, 0, 0, 0, 0)), VARSEG(Buffer%(0, 0, 0, 0, 0))
NEXT

SLEEP
FOR i% = 0 TO 5000
SVGAput RND * 640, RND * 480, VARPTR(Buffer%(0, 1, 0, 0, 0)), VARSEG(Buffer%(0, 1, 0, 0, 0))
NEXT

SLEEP
ReSetScreen

