BASIC Tile Statements and Functions - fvdhoef/aquarius-plus GitHub Wiki
TYPE: plusBASIC graphics statement
FORMAT: SET TILE tile TO tiledata
Action: Populates the pixels in a tile.
- tile is the tile number in the range 0 through 511.
- tiledata is string containing the binary pixel color indexes
Example
SET TILE 128 TO $"FFFFFFFFF0000000FF0000000FF0000000FF0000000FF0000000FF0000000FFFFFFFFF"
Sets tile 128 to an unfilled square with color index 15.
FORMAT: SET TILE tileno TO CHR char , fg_color , bg_color
Action: Creates a tile from a character definition in Character RAM.
- tileno is the index of the tile to be populated.
-
char is the character the character to be copied. It can be either:
- A numeric byte value.
- Error 5, Illegal quantity, results if char is less than
0or greater than255.
- Error 5, Illegal quantity, results if char is less than
- A string, in which case the first character is used.
- Error 31, Empty string, results if the string has a length of
0.
- Error 31, Empty string, results if the string has a length of
- A numeric byte value.
- fg_color and bg_color are the color indexes to use for pixels copied from foreground and background pixels in the character definition.
-
bg_color is the color index to use for pixels that copied from background pixels in the character definition.
- Error 5, Illegal quantity, results if fg_color or bg_color are less than
0or greater than15.
- Error 5, Illegal quantity, results if fg_color or bg_color are less than
Examples
SET TILE 200 TO CHR 0,7,0
Copies the character definition from ASCII character to 0 (English Pound) to tile 200, using white on black pixels.
..7777..
..7.....
..7.....
.7777...
..7.....
.77.....
7.7.77..
........
FORMAT: SET TILE * strarray
Action: Populates the pixels in multiple tiles.
-
strarray is a string array containing tile indexes and tile data.
- Each element of the array is a binary string containing a 2 byte tile index followed by 32 bytes of pixel data.
Examples
A$(0)=WORD$(200)+$"..888888..844444..844444..888888....7777....8444....8444....8444"
A$(1)=WORD$(201)+$"88888...444448..444448..88888...77.......8....11.81111...8....11"
A$(2)=WORD$(202)+$"...84444...84444...84444...77777.88888888FFFFFFF8FFFFFFF.8888888"
A$(3)=WORD$(203)+$"448.....4448....44448...788888......77..8....88.8...8FF8.....88."
SET TILE *A$
Sets tiles
200,201,202, and203to the specified tile definitions.
TYPE: plusBASIC graphics function
FORMAT: GETTILE$ ( tile )
Action: Returns the pixel date of the specified tile.
- tile is a tile number in the range 0 through 155.
- Returns a 32 character binary string containing the tile pixels.
Example
T$ = GETTILE$(13)
SET TILE 130
Copies the tile data from tile
13to tile130.
TYPE: plusBASIC graphics function
FORMAT: TILEOFFSET
Action: Returns the first available tile number for the current graphics mode.
- If no graphics mode is enabled, the first tile number for tilemap mode is returned.
Examples
PRINT TILEOFFSET
Prints
288if 1bpp mode is active or500if 2bpp mode is active. Otherwise, prints128.
FORMAT: TILEOFFSET ( gfxmode )
Action: Returns the first available tile number for the specified graphics mode.
-
gfxmode is the graphics mode as used in the second parameter of the
SCREENstatement. - Error 5, Illegal quantity, results if gfxmode is less than 0 or greater than 3.
Examples
PRINT TILEOFFSET(0)
Prints
128
PRINT TILEOFFSET(1)
Prints
128
PRINT TILEOFFSET(2)
Prints
288
PRINT TILEOFFSET(3)
Prints
500
Tile attributes are used to modify the appearance of a tile when used in a tilemap or sprite.
- Attributes for a sprite can be specified as:
- A numeric byte value calculated by adding the following values for each desired property:
-
2= Horizontal Flip -
4= Vertical Flip -
8- Double Height (sprite only)
-
- The value
0resets all properties. - Error 5, Illegal Quantity, results if the byte value is less than
0or greater than255 - A string containing one or more of the following letters, either upper or lowercase:
- H - Horizontal Flip
- V - Vertical Flip
- D - Double Height (sprite only)
- P - Priority
- The string
""resets all properties. - Error 5, Illegal Quantity, results if the string contains any character other than the ones listed.
- A numeric byte value calculated by adding the following values for each desired property: