DECLARE FUNCTION DQBsetBaseLayer (BYVAL Layer)
Layer - Layer in conventional memory to allocate
0 if base layer was already allocated or there's not enough free conventional memory, otherwise the segment of the new memory block used as layer.
DQBsetBaseLayer tryes to allocate conventional memory for a new base layer, as specified by the Layer parameter. If successfull, this function returns a segment address to the allocated memory chunk used as layer, which is exactly 64000 bytes; then you can refer to this layer as you do with normal layers in EMS memory.
Keep in mind that base layers requires a lot of base memory, but they're accessed a lot faster than normal EMS layers. Also, before calling DQBsetBaseLayer you should free 64K of conventional memory by calling the QB function SETMEM, as you do with DQBcreateBMap. To refer to base layers you should always use the B0..B9 constants as explained in appendix A.
*****************************************************************************
' All integers for speed
DEFINT A-Z
'$INCLUDE: 'DIRECTQB.BI'
' Let's initialize the library with no extra layers nor sounds nor EMS
IF DQBinit(0, 0, 0) THEN DQBclose: PRINT DQBerror$: END
' Releases memory for a base layer
dummy& = SETMEM(-66000)
' Assign our array to base layer 0
Seg0 = DQBsetBaseLayer(B0)
IF Seg0 = 0 THEN
' Not enough memory
DQBclose
PRINT DQBerror$
END
ELSE
' Prints some info
PRINT "Layer allocated at address " + HEX$(Seg0) + ":0000"
WHILE INKEY$ = "": WEND
END IF
DQBinitVGA
' Let's print some text on layer B0
DQBprint B0, "DirectQB!", 124, 96, 40
' Copy layer B0 to the screen
DQBcopyLayer B0, VIDEO
' Wait for the user to press a key...
WHILE INKEY$ = "": WEND
' Ends program
DQBclose
dummy& = SETMEM(66000)
*****************************************************************************