sbLoadGfxBuffer

Last Modified: 11/15/2026

Loads the SecondBASIC graphic buffer with tile data either in sprite or background layouts and converts it into BMP style image in the buffer for the sbTransform command.

Arguments

NameTypeRequiredDescription
SrcGraphicAddress Long Integer Yes The address of the graphics to load into the graphic buffer.
Size Integer Yes The size of the sprite. Valid values are 1, 2, 3, and 4.
Type Integer Yes Tells the routine if it's a background or sprite source. 0 is for background, 1 is for sprites.

Example

Syntax: sbLoadGfxBuffer <SrcGraphicAddress>, <Size>, <Type>
    Option UseSBGfxLib
 
    Global sbGfxBuffer&(511) As Long, sbVRAMBuffer&(511) As Long, sbBuffer&(511) As Long
 
    TxfmTbl& = LblPtr&(MyTxfm)
 
    sbLoadGfxBuffer LblPtr&(MyGfx), 4, 1
    sbTransform TxfmTbl&, Frame, 4, 0, VarPtr&(myBuffer&)
    LoadTiles myBuffer&, 16, 256
 
MyGfx:
    DataFile "c:\SecondBASIC\MyGfx.bny", Bin
MyTxfm:
    DataFile "c:\SecondBASIC\MyTransformation.txm", Bin

Remarks

In order to use the sbLoadGfxBuffer and sbTransform, you'll need to set the Option UseSBGfxLib setting, and then you'll need to set a Global variable called sbGfxBuffer&() as a Long, sbVRAMBuffer&() as a Long, and sbBuffer&() as a Long arrays for the graphic routines.

The size of the graphics must be square (i.e., 1x1, 2x2, 3x3, or 4x4 tiles). This will be expanded upon in the future.

Currently only 4x4 sprites can be loaded into the graphic buffer. This will be expanded upon in the next update.