ICE Compiler Commands List v2.2
All the custom tokens and C functions are available by pressing [TRACE] in the program editor. Press the arrow keys to select one or switch menu's. Press [ENTER] to select the function or [CLEAR] to return.System
Command | Description |
---|---|
getKey |
Returns the key being pressed. See keycodes.png for the keycodes. |
getKey(KEY) |
Returns 1 if the key KEY is pressed, 0 otherwise. This routine is much faster than getKey , and handles repeated keypresses as well. See keycodes.png for the keycodes. |
Ans |
Returns Ans, the last answer that is stored in the calculator. An error is generated if Ans > 9999. |
rand |
Returns a random number between 0 and 16777215. |
randInt(EXP1,EXP2) |
Returns a random number between EXP1 and EXP2 inclusive. |
Asm(HEX) |
Assembly code written in hexadecimal is inserted into the program. |
AsmComp(PROGRAM) Preprocessor command |
Compiles the BASIC program PROGRAM . When it's done, ICE continues with compiling the previous program. |
Pause |
Pauses the program until the user presses ENTER . |
Pause EXP |
Pauses the program for EXP milliseconds. |
prgmPROGRAM |
Executes the BASIC program PROGRAM . Any error will be ignored and it will return normally. |
i Preprocessor command |
If the imaginary i (not the lowercase i) is the first token of a line, this line will be ignored during compiling. |
SetBrightness(LEVEL) |
Sets the brightness of the screen. 0=high (light), 255=low (dark). |
startTmr |
Returns the current timestamp of the 32KHz timer. This value can be used in checkTmr( . |
checkTmr(TIMESTAMP) |
Subtracts TIMESTAMP from the current timestamp of the 32KHz timer. |
Math
Command | Description |
---|---|
VAR |
Returns the value of VAR . Multiple-letter variables are allowed up to 20 letters. Valid letters are A-θ . |
°VAR |
Returns the address of VAR . |
CONST |
Returns CONST . |
EHEX Preprocessor command |
Returns the hexadecimal number HEX as an integer. The prefix is the scientific E. |
πBIN Preprocessor command |
Returns the binary number BIN as an integer. |
-EXP |
Returns the negative of EXP . This is the negative sign, not the minus sign! |
EXP1+EXP2 |
Adds EXP2 to EXP1 . |
EXP1-EXP2 |
Substracts EXP2 from EXP1 . |
EXP1*EXP2 |
Multiplies EXP1 with EXP2 . |
EXP1/EXP2 |
Divides EXP1 by EXP2 . |
EXP1=EXP2 |
Returns 1 if EXP1=EXP2 , 0 otherwise. |
EXP1≠EXP2 |
Returns 1 if EXP1≠EXP2 , 0 otherwise. |
EXP1>EXP2 |
Returns 1 if EXP1>EXP2 , 0 otherwise. |
EXP1≥EXP2 |
Returns 1 if EXP1≥EXP2 , 0 otherwise. |
EXP1≤EXP2 |
Returns 1 if EXP1≤EXP2 , 0 otherwise. |
EXP1<EXP2 |
Returns 1 if EXP1<EXP2 , 0 otherwise. |
EXP1 and EXP2 |
Returns 1 if EXP1 and EXP2 are both not equal to 0, 0 otherwise. |
EXP1 or EXP2 |
Returns 1 if EXP1 or EXP2 is not equal to 0, 0 otherwise. |
EXP1 xor EXP2 |
Returns 1 if one of EXP1 and EXP2 is not equal to 0, 0 otherwise. |
EXP1·EXP2 |
Returns the bitwise and of EXP1 and EXP2 . This is a plot style token. |
EXP1ᕀEXP2 |
Returns the bitwise or of EXP1 and EXP2 . This is a plot style token. |
EXP1▫EXP2 |
Returns the bitwise xor of EXP1 and EXP2 . This is a plot style token. |
EXP→VAR |
Stores EXP into VAR . |
not(EXP) |
Returns the negation of EXP , so if EXP is nonzero, it returns 0, and 1 otherwise. |
remainder(EXP1,EXP2) |
Returns the remainder of EXP1/EXP2 . |
min(EXP1,EXP2) |
Returns the minimum of EXP1 and EXP2 . |
max(EXP1,EXP2) |
Returns the maximum of EXP1 and EXP2 . |
mean(EXP1,EXP2) |
Returns the mean of EXP1 and EXP2 . |
sqrt(EXP) |
Returns the square root of EXP . |
sin(EXP) |
Returns the sine root of EXP . One period is [0,255] and it returns a value in [-255,255] . |
cos(EXP) |
Returns the cosine root of EXP . One period is [0,255] and it returns a value in [-255,255] . |
Controls
Command | Description |
---|---|
If EXP:code:End |
If EXP is true, code will be executed. |
If EXP:code1:Else:code2:End |
If EXP is true, code1 will be executed, code2 otherwise |
Repeat EXP:code:End |
Repeats executing code until EXP is true. code always executes at least once. |
While EXP:code:End |
Executes code until EXP is false. EXP is checked first. |
For(VAR,EXP1,EXP2):code:End |
VAR is initialized with EXP1 . If VAR is greater than EXP2 , the loop ends. Otherwise, code is executed and VAR is incremented. |
For(VAR,EXP1,EXP2,EXP3):code:End |
VAR is initialized with EXP1 . If VAR is greater than EXP2 , the loop ends. Otherwise, code is executed and EXP3 is added to VAR . If EXP3 is a negative constant, it will loop until VAR is smaller than EXP1 . |
Labels
Command | Description |
---|---|
Labels are limited to 20 characters. | |
Lbl LABEL Preprocessor command |
Creates a label at the current position. |
Goto LABEL |
Jumps to a label. |
Call LABEL |
Calls a label. This label should have a Return , otherwise the program will very likely crash. |
Return |
Returns. If you called a label before, and Return is in that label, the program will jump back to the main program. Otherwise, you program will end. |
ReturnIf EXP |
Returns if EXP is true. If you called a label before, and ReturnIf is in that label, the program will jump back to the main program. Otherwise, you program will end. |
Graphics
Command | Name | Description | Returns |
---|---|---|---|
For all routines that uses coordinates, they are measured from the top left origin of the screen. | |||
det(0) |
Begin | Initializes the graphics library setup (8bpp, default palette, clear screen). | - |
det(1) |
End | Closes the graphics setup. Restores the LCD to 16bpp prefered by the OS and clears the screen. | - |
det(2,COLOR) |
SetColor | Sets the color index that drawing routines will use. This applies to lines, rectangles, circles, etc. | Previous set color index. |
det(3) |
SetDefaultPalette | Sets up the default palette where H=L (xLIBC palette). | - |
det(4,"DATA",SIZE,OFFSET) |
SetPalette | Sets entries in the palette. Each entry is 2 bytes, so SIZE should be the amount of entries you want to set times 2. |
- |
det(5,COLOR) |
FillScreen | Fills the screen with a given palette index. | - |
det(6,X,Y) |
SetPixel | Sets a pixel to the global color index. This is measured from the top left origin of the screen. Pixels are only clipped within the screen boundaries. | - |
det(7,X,Y) |
GetPixel | Gets a pixel's color index. This is measured from the top left origin of the screen. Pixels are only clipped within the screen boundaries. | Pixel color index. |
det(8) |
GetDraw | Gets current draw location. 0 = screen, 1 = buffer. | Current draw location. |
det(9,BUFFER) |
SetDraw | Forces all graphics routines draw location. 0 = draw at screen, 1 = draw at buffer. | - |
det(10) |
SwapDraw | Swaps the roles of the screen and drawing buffers. Does not wait for the old screen buffer to finish being displayed. Instead, the next invocation of a graphx drawing function will block, waiting for this event. To block and wait explicitly, use Wait .In practice, this function should be invoked immediately after finishing drawing a frame to the drawing buffer, and invocation of the first graphx drawing function for the next frame should be scheduled as late as possible relative to non-drawing logic. Non-drawing logic can execute during time when a drawing function may otherwise block. |
- |
det(11,BUFFER) |
Blit | Copies the input buffer to the opposite buffer. No clipping is performed; as it is a copy not a draw. 0 = copy screen to buffer, 1 = copy buffer to screen. | - |
det(12,BUFFER,Y,LINES) |
BlitLines | Copies lines from the input buffer to the opposite buffer. No clipping is performed; as it is a copy not a draw. 0 = copy screen to buffer, 1 = copy buffer to screen. | - |
det(13,BUFFER,X,Y,WIDTH,HEIGHT) |
BlitRectangle | Copies a rectangle from the input buffer to the opposite buffer. No clipping is performed; as it is a copy not a draw. 0 = copy screen to buffer, 1 = copy buffer to screen. | - |
det(14,CHAR) |
PrintChar | Outputs a character at the current cursor position. (Should be a number, you can find them here). | - |
det(15,EXP,CHARS) |
PrintInt | Prints a signed integer at the current cursor position using CHARS characters. By default, no text clipping is performed (configurable with SetTextConfig ). |
- |
det(16,EXP,CHARS) |
PrintUInt | Prints an unsigned integer at the current cursor position using CHARS characters. By default, no text clipping is performed (configurable with SetTextConfig ). |
- |
det(17,"STRING") |
PrintString | Prints a string at the current cursor position. By default, no text clipping is performed (configurable with SetTextConfig ). |
- |
det(18,"STRING",X,Y) |
PrintStringXY | Outputs a string at the supplied coordinates. Posistion is measured from top left origin of screen. By default, no text clipping is performed (configurable with SetTextConfig ). |
- |
det(19,X,Y) |
SetTextXY | Sets the text cursor XY position. | - |
det(20,COLOR) |
SetTextBGColor | Sets text background color. Default text background color index: 255. | Previous text background color index. |
det(21,COLOR) |
SetTextFGColor | Sets text foreground color. Default text foreground color index: 0. | Previous text foreground color index. |
det(22,COLOR) |
SetTextTransparentColor | Sets text transparency color. Default text transparency color index: 255. | Previous text transparency color index. |
det(23,"DATA") |
SetFontData | Sets the font's character data. Format of font data is 8 bytes horizontally aligned. | Pointer to previous font data |
det(24,"DATA") |
SetFontSpacing | Sets the font spacing. "DATA" can also be a pointer to the data. |
- |
det(25,SPACE) |
SetMonospaceFont | Sets monospaced font. To disable monospaced font, set to 0 | - |
det(26,"STRING") |
GetStringWidth | Gets the pixel width of the given string. Takes into account monospacing flag. | Width in pixels of string. |
det(27,CHAR) |
GetCharWidth | Gets the pixel width of the given character. Takes into account monospacing flag. | Width in pixels of character. |
det(28) |
GetTextX | Returns the current text cursor X position. | The current text cursor X position. |
det(29) |
GetTextY | Returns the current text cursor Y position. | The current text cursor Y position. |
det(30,X1,Y1,X2,Y2) |
Line | Draws a line. | - |
det(31,X,Y,LENGTH) |
HorizLine | Draws a horizontal line. Performs faster than using Line( . |
- |
det(32,X,Y,LENGTH) |
VertLine | Draws a vertical line. Performs faster than using Line( . |
- |
det(33,X,Y,RADIUS) |
Circle | Draws a circle outline. | - |
det(34,X,Y,RADIUS) |
FillCircle | Draws a filled circle. | - |
det(35,X,Y,WIDTH,HEIGHT) |
Rectangle | Draws a rectangle outline. | - |
det(36,X,Y,WIDTH,HEIGHT) |
FillRectangle | Draws a filled rectangle. | - |
det(37,X1,Y1,X2,Y2) |
Line_NoClip | Draws an unclipped line. | - |
det(38,X,Y,LENGTH) |
HorizLine_NoClip | Draws an unclipped horizontal line. Performs faster than using Line( . |
- |
det(39,X,Y,LENGTH) |
VertLine_NoClip | Draws an unclipped vertical line. Performs faster than using Line( . |
- |
det(40,X,Y,RADIUS) |
FillCircle_NoClip | Draws an unclipped filled circle. | - |
det(41,X,Y,WIDTH,HEIGHT) |
Rectangle_NoClip | Draws an unclipped rectangle outline. | - |
det(42,X,Y,WIDTH,HEIGHT) |
FillRectangle_NoClip | Draws an unclipped filled rectangle. | - |
det(43,XMIN,YMIN,XMAX,YMAX) |
SetClipRegion | Sets the clipping window. This window is used across all clipped routines. | - |
det(44,CLIP_REGION) |
GetClipRegion | Clips a region to fit within the window. 0 = offscreen, 1 = onscreen. | 0 if offscreen, 1 if onscreen. |
det(45,PIXELS) |
ShiftDown | Shifts the drawing window down. | - |
det(46,PIXELS) |
ShiftUp | Shifts the drawing window up. | - |
det(47,PIXELS) |
ShiftLeft | Shifts the drawing window left. | - |
det(48,PIXELS) |
ShiftRight | Shifts the drawing window right. | - |
det(49,VAR,X_OFFSET,Y_OFFSET) |
Tilemap | Draws a tilemap given an initialized tilemap structure. VAR should point to the tilemap structure, which you can get with DefineTilemap( . |
- |
det(50,VAR,X_OFFSET,Y_OFFSET) |
Tilemap_NoClip | Draws an unclipped tilemap given an initialized tilemap structure. VAR should point to the tilemap structure, which you can get with DefineTilemap( . |
- |
det(51,VAR,X_OFFSET,Y_OFFSET) |
TransparentTilemap | Draws a transparent tilemap given an initialized tilemap structure. VAR should point to the tilemap structure, which you can get with DefineTilemap( . |
- |
det(52,VAR,X_OFFSET,Y_OFFSET) |
TransparentTilemap_NoClip | Draws an unclipped transparent tilemap given an initialized tilemap structure. VAR should point to the tilemap structure, which you can get with DefineTilemap( . |
- |
det(53,VAR,X_OFFSET,Y_OFFSET) |
TilePtr | Gets a pointer to a particular tile given an initialized tilemap structure and pixel offsets. VAR should point to the tilemap structure, which you can get with DefineTilemap( . |
- |
det(54,VAR,ROW,COL) |
TilePtrMapped | Gets a pointer to a particular tile given an initialized tilemap structure and mapped offsets. VAR should point to the tilemap structure, which you can get with DefineTilemap( . |
- |
For all sprite commands: PTR should be a pointer to the sprite data done with DefineSprite( . Check sprites.txt how to define sprites. |
|||
det(57,PTR,X,Y) |
Sprite | Draws a sprite. | - |
det(58,PTR,X,Y) |
TransparentSprite | Draws a transparent sprite. | - |
det(59,PTR,X,Y) |
Sprite_NoClip | Draws an unclipped sprite. | - |
det(60,PTR,X,Y) |
TransparentSprite_NoClip | Draws an unclipped transparent sprite. | - |
det(61,PTR,X,Y) |
GetSprite | Grabs the background behind a sprite, and stores it to the memory pointed to by PTR . Note: you need to store the width and the height (both 1-byte values) to the memory first. |
- |
det(62,PTR,X,Y,WSCALE,HSCALE) |
ScaledSprite_NoClip | Scales an unclipped sprite. Scaling factors must be greater than or equal to 1, and an integer factor. | - |
det(63,PTR,X,Y,WSCALE,HSCALE) |
ScaledTransparentSprite_NoClip | Scales an unclipped transparent sprite. Scaling factors must be greater than or equal to 1, and an integer factor. | - |
det(64,PTR_IN,PTR_OUT) |
FlipSpriteY | Flips a sprite along the Y axis. Note: PTR_IN and PTR_OUT cannot be the same. |
PTR_OUT pointer. |
det(65,PTR_IN,PTR_OUT) |
FlipSpriteX | Flips a sprite along the X axis. Note: PTR_IN and PTR_OUT cannot be the same. |
PTR_OUT pointer. |
det(66,PTR_IN,PTR_OUT) |
RotateSpriteC | Rotates a sprite 90 degrees clockwise. Note: PTR_IN and PTR_OUT cannot be the same. |
PTR_OUT pointer. |
det(67,PTR_IN,PTR_OUT) |
RotateSpriteCC | Rotates a sprite 90 degrees counter clockwise. Note: PTR_IN and PTR_OUT cannot be the same. |
PTR_OUT pointer. |
det(68,PTR_IN,PTR_OUT) |
RotateSpriteHalf | Rotates a sprite 180 degrees. Note: PTR_IN and PTR_OUT cannot be the same. |
PTR_OUT pointer. |
det(69,PTS,NUM_PTS) |
Polygon | Draws a polygon outline with NUM_PTS points. PTS should point to a 3-byte list, with all the X- and Y-coordinates of the points, so {X1,Y1,X2,Y2,...} |
- |
det(70,PTS,NUM_PTS) |
Polygon_NoClip | Draws an unclipped polygon outline with NUM_PTS points. PTS should point to a 3-byte list, with all the X- and Y-coordinates of the points, so {X1,Y1,X2,Y2,...} |
- |
det(71,X1,Y1,X2,Y2,X3,Y3) |
FillTriangle | Draws a filled triangle. | - |
det(72,X1,Y1,X2,Y2,X3,Y3) |
FillTriangle_NoClip | Draws an unclipped, filled triangle. | - |
det(74,XSCALE,YSCALE) |
SetTextScale | Sets the scaling for text. Values in the range from 1-5 are preferred. | - |
det(75,COLOR) |
SetTransparentColor | Sets the transparent index that drawing routines will use. This currently applies to transparent sprites, both scaled and unscaled. | Previous transparent color index. |
det(76) |
ZeroScreen | Implements a faster version of gfx_FillScreen(0) . |
- |
det(77,CONFIG) |
SetTextConfig | Sets the configuration for the text routines. 1 = clipping, 2 = no clipping. | - |
det(78,CHAR) |
GetSpriteChar | Creates a temporary character sprite. This may be useful for performing rotations and other. | Pointer to temp sprite. |
det(79,COLOR,AMOUNT) |
Lighten | Lightens a given 1555 color; useful for palette color conversions. AMOUNT is the amount to lighten by. |
Lightened color. |
det(80,COLOR,AMOUNT) |
Darken | Darkens a given 1555 color; useful for palette color conversions. AMOUNT is the amount to darken by. |
Darkened color. |
det(81,HEIGHT) |
SetFontHeight | Sets the height in pixels of each character. | Previous height of font in pixels. |
det(82,PTR_IN,PTR_OUT) |
ScaleSprite | Resizes a sprite to new dimensions. | PTR_OUT pointer. |
det(83,X,Y,COLOR) |
FloodFill | Fills an area with a color. This routine performs clipping to stay within the window, but you must ensure it starts in the window. | - |
det(84,PTR,X,Y) |
RLETSprite | Draws a sprite with RLE transparency. | - |
det(85,PTR,X,Y) |
RLETSprite_NoClip | Draws an unclipped sprite with RLE transparency. | - |
det(86,PTR_IN,PTR_OUT) |
ConvertFromRLETSprite | Converts a sprite with RLE transpareny to a sprite with normal transparency. Width and height will be set in the converted sprite. The transparent color index in the converted sprite is controlled by SetTransparentColor . The output sprite must have been allocated with a large enough data field to hold the converted sprite data, which will be width * height bytes large. |
PTR_OUT pointer. |
det(87,PTR_IN,PTR_OUT) |
ConvertToRLETSprite | Converts a sprite with normal transpareny to a sprite with RLE transparency. Width and height will be set in the converted sprite. The transparent color index in the converted sprite is controlled by SetTransparentColor . The output sprite must have been allocated with a large enough data field to hold the converted sprite data. |
PTR_OUT pointer. |
det(89,PTR_IN,PTR_OUT,ANGLE,SCALE) |
RotateScaleSprite | Fixed Rotation with scaling factor for sprites. The output sprite is updated with the dimensions required for the implemented scaling factor. You must make sure that PTR_OUT has enough memory to store the needed output sprite. This can be found with the following formula: size = (max_scale / 64) * width * height + 2 . A scale factor of 64 represents 100% scaling. This routine only accepts square input sprites. |
PTR_OUT pointer. |
det(90,PTR,X,Y,ANGLE,SCALE) |
RotatedScaledTransparentSprite_NoClip | Fixed Rotation with scaling fator for sprites. A scale factor of 64 represents 100% scaling. This routine only accepts square input sprites. | The size of the sprite after scaling. |
det(91,PTR,X,Y,ANGLE,SCALE) |
RotatedScaledSprite_NoClip | Fixed Rotation with scaling fator for sprites without transparency. A scale factor of 64 represents 100% scaling. This routine only accepts square input sprites. | The size of the sprite after scaling. |
det(92,INDEX,"DATA") |
SetCharData | Sets the font data for a specific character. If using the default font, INDEX range from 0-127, custom font can have indexes 0-255. "DATA" should be 0 if you want to get the current character data. |
Pointer to current character data if "DATA" is 0, otherwise a pointer to next character data. |
det(93) |
Wait | Waits for the screen buffer to finish being displayed after SwapDraw . In practice, this function should not need to be invoked by user code. It should be invoked by custom drawing functions (as late as reasonably possible) before writing to the drawing buffer. |
- |
File I/O
Command | Name | Description |
---|---|---|
sum(0) |
CloseAll | Closes all open slots. Call this before you use any variable functions! |
sum(1,"NAME","MODE") |
Open | Opens an appvar with name "NAME" . Returns the slot number or 0 if failure. "MODE" options:- "r" - Opens a file for reading. The file must exist. Keeps file in archive if in archive.- "w" - Creates an empty file for writing. Overwrites file if already exists.- "a" - Appends to a file. Writing operations, append data at the end of the file. The file is created if it does not exist.- "r+" - Opens a file to update both reading and writing. The file must exist. Moves file from archive to RAM if in archive.- "w+" - Creates an empty file for both reading and writing. Overwrites file if already exists.- "a+" - Opens a file for reading and appending. Moves file from archive to RAM if in archive. Created if it does not exist. |
sum(2,"NAME","MODE",TYPE) |
OpenVar | Opens a variable with name "NAME" and type TYPE . See sum(1 for the "MODE" options. Returns the slot number or 0 if failure. TYPE options:- 0 - Real- 1 - Real list- 2 - Matrix- 3 - Equation- 4 - String- 5 - Program- 6 - Protected program- 12 - Complex- 13 - Complex list- 21 - Appvar- 22 - Temp program |
sum(3,SLOT) |
Close | Frees an open slot. |
sum(4,"DATA",SIZE,COUNT,SLOT) |
Write | Writes "DATA" at the offset of the variable in slot SLOT . Exactly COUNT times SIZE bytes are written, and this function returns SIZE or 0 in an error occured. SIZE *COUNT is added to the variable offset. |
sum(5,PTR,SIZE,COUNT,SLOT) |
Read | Reads COUNT times SIZE bytes from the variable in slot SLOT and copies everything to PTR . If everything went right, this function returns SIZE or 0 if on failure. SIZE *COUNT is added to the variable offset. |
sum(6,SLOT) |
GetChar | Gets a char from the variable in slot SLOT and increments the offset. |
sum(7,CHAR,SLOT) |
PutChar | Writes a char to the variable in slot SLOT and increments the offset. |
sum(8,"NAME") |
Delete | Delets an appvar. |
sum(9,"NAME",TYPE) |
DeleteVar | Delets a variable with type TYPE . See sum(2 for the types. |
sum(10,OFFSET,ORIGIN,SLOT) |
Seek | Seeks the variable in slot SLOT to an offset. ORIGIN options:- 0 - SEEK_SET - seek from beginning of file- 1 - SEEK_CUR - seek from current offset in file- 2 - SEEK_END - seek from end of file |
sum(11,SIZE,SLOT) |
Resize | Resizes the variable in slot SLOT . |
sum(12,SLOT) |
IsArchived | Returns 0 if the variable in slot SLOT is in RAM, and 1 if in archive. |
sum(13,ARCHIVED,SLOT) |
SetArchiveStatus | Sends the variable into either the archive or RAM if needed. ARCHIVED options:- 0 - Send to RAM- 1 - Send to archive |
sum(14,SLOT) |
Tell | Returns the offset in a slot. |
sum(15,SLOT) |
Rewind | Seeks to the start of the variable in slot SLOT . |
sum(16,SLOT) |
GetSize | Gets the size of the variable in slot SLOT . |
sum(17,°READ_PTR,°LEN_TOK,°LEN_STR) |
GetTokenString | Reads the token at READ_PTR and returns a pointer to the characters. Both variables LEN_TOK and LEN_STR gets overwritten with respectively the length of the token (1- or 2-byte token) and the length of the string (the amount of characters). |
sum(18,SLOT) |
GetDataPtr | Gets a pointer to the data located at the current position of the variable in slot SLOT . |
sum(19,°POS,"DATA") |
Detect | Finds the first appvar starting at POS which starts with the data "DATA" . If you want to search for all appvars, you can replace "DATA" with 0 . Returns the pointer to the filename. POS is updated each call, and should be 0 to start the search. Returns 0 if no more appvars found. |
sum(20,°POS,"DATA",TYPE) |
DetectVar | Finds the first variable with type TYPE starting at POS which starts with the data "DATA" . If you want to search for all variables with type TYPE , you can replace "DATA" with 0 . Returns the pointer to the filename. POS is updated each call, and should be 0 to start the search. Returns 0 if no more variables found. See sum(2 for the types. |
sum(29,°POS,"DATA",°TYPE) |
DetectAny | Finds the first variable starting at POS which starts with the data "DATA" . If you want to search for all variables, you can replace "DATA" with 0 . Returns the pointer to the filename. POS is updated each call, and should be 0 to start the search. TYPE is updated each call with the found filetype. Returns 0 if no more variables found. See sum(2 for the types. |
sum(30,SLOT) |
GetVATPtr | Gets the VAT location of the variable in slot SLOT . |
sum(31,PTR,SLOT) |
GetName | Gets the variable name of the variable in slot SLOT and writes it to PTR . |
sum(32,"OLD","NEW") |
Rename | Renames the appvar "OLD" to "NEW" . Returns 0 on success, 1 if the file already exists and 2 when any other error occurs. It is potentially hazardous to rename an open file. Be sure to close the open file before renaming! |
sum(33,"OLD","NEW",TYPE,) |
RenameVar | Renames the variable with type TYPE and name "OLD" to "NEW" . Returns 0 on success, 1 if the file already exists and 2 when any other error occurs. It is potentially hazardous to rename an open file. Be sure to close the open file before renaming! |
Memory
Command | Description |
---|---|
DefineSprite(WIDTH,HEIGHT) Preprocessor command |
Allocates WIDTH*HEIGHT+2 bytes for an empty sprite. This is recommend for duplicating, rotating or enlarging sprites. Returns a pointer to the allocated memory. |
DefineSprite(WIDTH,HEIGHT,"DATA") Preprocessor command |
Defines a sprite with data DATA , width WIDTH and height HEIGHT . Returns a pointer to the start of the sprite. |
DefineTilemap(TILE_HEIGHT,TILE_WIDTH,DRAW_HEIGHT,DRAW_WIDTH,TYPE_WIDTH,TYPE_HEIGHT,TILEMAP_HEIGHT,TILEMAP_WIDTH,Y,X,VAR,"MAP_DATA") Preprocessor command |
Defines a tilemap. VAR should be a variable, which holds a pointer to the table with pointers to the sprites, which returns from LoadData( . See tilemaps.docx how to get the map data. Returns a pointer to the tilemap struct, which can be used in det(50 . TYPE_HEIGHT , TYPE_WIDTH options:- 0 - Not a power of 2- 1 - Tile width/height of 2- 2 - Tile width/height of 4- 3 - Tile width/height of 8- 4 - Tile width/height of 16- 5 - Tile width/height of 32- 6 - Tile width/height of 64- 7 - Tile width/height of 128 |
Data(SIZE,CONST1,CONST2...) Preprocessor command |
Places constant data in program memory with each element size of SIZE bytes. Returns a pointer to the data. |
CopyData(DEST,SIZE,CONST1,CONST2...) |
Places constant data in program memory with each element size of SIZE bytes and copies it to DEST . Returns a pointer to the end of the data in the program data. |
Alloc(SIZE) |
Allocates SIZE bytes in safe RAM. An error will be displayed if you allocated too much memory. Returns a pointer to the memory. |
Copy(DEST,SRC,SIZE) |
Copies SIZE bytes from SRC to DEST . |
Copy(...,DEST,SRC,SIZE) |
Copies SIZE bytes from SRC to DEST backwards. The first argument can be anything you like. |
LoadData("APPVAR",OFFSET,SIZE) |
Returns a pointer to the table with pointers to the tiles from the tilemap in appvar "APPVAR" . This pointer should be used in DefineTilemap( . You can get these values from ConvPNG . See tilemaps.txt for more information. |
Compare(PTR1,PTR2) |
Compares the string pointed to by PTR1 with the string pointed to by PTR2 . Returns 0 if both strings (zero-terminated) are the same, -1 if the ASCII value of the first unmatched character is less than the second and 1 if the ASCII value of the first unmatched character is greater than the second. |
L₁...L₆ |
Returns the pointer to one of the OS lists as an integer. |
LIST(EXP) |
Same as {LIST+EXP} but easier to remember. |
*{EXP} |
Returns the single byte EXP points to. |
**{EXP} |
Returns the 2-byte value EXP points to. |
{EXP} |
Returns the word EXP points to. ***{EXP} is valid syntax as well. |
EXP1→*{EXP2} |
The single byte of EXP1 is stored where EXP2 points to. |
EXP1→**{EXP2} |
The 2-byte value EXP1 is stored where EXP2 points to. |
EXP1→{EXP2} |
The word EXP1 is stored where EXP2 points to. EXP1→***{EXP2} is valid syntax as well. |
Strings
Command | Description |
---|---|
"STRING" |
Adds a string to the program data and returns a pointer to it. |
STRING_VAR |
Returns a pointer to STRING_VAR . The 10 BASIC tokens are available for string variables, Str0-Str9 . |
"STRING1"+"STRING2" |
Concatenates two strings. String variables are valid as well. Returns a pointer to the data. |
"STRING"→STRING_VAR |
Stores "STRING" into one of the 10 available string variables, Str0-Str9 . Storing one string variable into another one is valid as well. |
sub("STRING",OFFSET,SIZE) |
Copies SIZE bytes starting at offset OFFSET from "STRING" to a temporary location and returns a pointer to it. String variables are valid as well. |
length("STRING") |
Returns the length of "STRING" . String variables are valid as well. |
inString("STR1","STR2") |
Finds the first occurence of "STR2" in "STR1" . Returns a pointer to the substring if the substring is found, or 0 otherwise. |
Text
Command | Description |
---|---|
Disp EXP1,EXP2,... |
Displays either an expression or a string at the cursor position. i puts the cursor at the start of a new line. |
Output(ROW,COLUMN) |
Puts the cursor at coordinates (ROW,COLUMN) . |
Output(ROW,COLUMN,EXP1) |
Displays either the outcome of an expression or a string at coordinates (ROW,COLUMN) . |
ClrHome |
Clears the homescreen full. It is recommend to call this function before using Disp . The cursor moves to the upper-left corner. |
Input VAR |
Asks for a user input, and stores the value in VAR . |
Input "STRING",VAR |
Asks for a user input while displaying "STRING" , and stores the value in VAR . |