![]() |
| TI99 Environment |
| Syntax |
| CALL_CHARLOAD() |
| Description |
This function offers an alternate method of creating custom characters and graphics. It simplifies the character definition by reading graphic bit patterns from data statements instead of reading hex patterns from strings. When this function is called, it will look inside the program for a label named _CHARLOAD: followed by data statements in a specific format: The first data statement is the character's ASCII code being customized. The next 8 data statements or elements contain the character definition's 8x8 pattern string.
data 128 data " xxxx " data " xx x " data " xx " data " xxxxxx " data " x x " data " xxxxxx " data " x x " data " x x "Each individual character within the data statement string represents either an on or off bit. For convenience, any non-space character will be treated as an on bit and will carry the foreground color assigned to the character in the specific color set. A space character is always treated as an off bit, which will carry the background color. The string data within the quotes must consist of exactly 8 characters. You can define as many custom characters as you want using this format, but the last DATA statement (after all the custom character data statements) should always be the number zero (0) to tell the function that it has reached the end of the character definition data. The ASCII codes in the data statements do not have to follow a specific sequence or order; you can define character 128 first and follow it with character 65 and so on. Every time you call this function the program will reload all the graphic definitions in the DATA statements under the _CHARLOAD: label; you cannot reload specific images. |
| Example Code |
CALL_CHARLOAD() ` Looks for characters 128 and 129, robot images.
call_screen(2)
call_sprite(1,128,16,96,128,1,1)
tiwaitkey()
do
call_pattern(1,129)
tiwaitkey()
call_pattern(1,128)
tiwaitkey()
loop
Note: For the example above to work as intended, copy, and paste the following data statements below the _CHARLOAD: label in the program. Make sure that the last data statement is a single 0 (zero).
` ROBOT 1
data 128
data " xxxx "
data " xx x "
data " xx "
data " xxxxxx "
data " x x "
data " xxxxxx "
data " x x "
data " x x "
` ROBOT 2
data 129
data " xxxx "
data " x xx "
data " xx "
data "xxx xxx"
data " xxxx "
data " xxxxxx "
data " x x "
data " x x "
data 0 ` Note: A zero used as the ascii element indicates the end of the character definition data.
The above program uses the CHARLOAD() function to redefine the ASCII characters 128 and 129 with robot graphic characters, then creates a moving sprite that changes its pattern every time a key is pressed.
Note: It is always a good practice to place a comment next to the Call_Charload() statement to indicate the number of images expected and the ASCII characters used.
| Go back to ... |
| TI99E Commands Menu |
| Main Menu |
Copyright © Carlos Santiago Lebron - TI99 Environment 2020
![]() |