// Common inheritance for PicasoGFX2 platforms #constant PICASO_GFX_FUNCTIONS #CONST //-------------------------------------------------------------------------- // compiler info //-------------------------------------------------------------------------- PICASO 1 __MAXPROG 14400 // user program space __MAXMEM 14400 // user memory bytes __PLATFORM PICASO //__DISPLAY_X_MAX 239 //__DISPLAY_Y_MAX 319 #END #CONST //-------------------------------------------------------------------------- // #MODE control bits //-------------------------------------------------------------------------- RUNFLASH 0x80 // bit 7, run user code directly from FLASH USER_INITIALIZED_DISPLAY 0x20 // bit 5, display is initialized in users code #END #CONST //-------------------------------------------------------------------------- // putch, putstr, putnum and print redirection constants //-------------------------------------------------------------------------- TEXT 0xF801 // legacy, not required GFX 0xF801 // legacy, not required DSK 0xF802 COM0 0xF804 COM1 0xF808 I2C 0xF820 MDA 0xF840 APPEND 0 #END #CONST //-------------------------------------------------------------------------- // string processing constants //-------------------------------------------------------------------------- STR 0x0080 // display as string CHR 0x0081 // display as single char //============================================================================ // number formatting bits //============================================================================ // bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 // | | | | \___ ___/ | \ / \_____ _____/ // | | | | V | V V // | | | | | | | | // | | | | digit count | | | // | | | | (nb 0 = 16) | | |____BASE (usually 2,10 or 16) // | | | | | | // | | | | | |___reserved (not used on Goldelox) // | | | | | // | | | | |____ string indicatior // | | | | 0x80 = [STR] // | | | | 0x81 = [CHR] // | | | |______ // | | | 1 = leading zeros included // | | | 0 = leading zeros suppressed // | | | // | | |_______ // | | 1 = leading zero blanking // | | // | |_____ sign bit (0 = signed, 1 = unsigned) // | // |______ 1 = space before unsigned number //======================================================= // general number formatting constants // for 'print' and 'putnum' //======================================================= // binary, no leading zeroes BIN 0x0002 // binary, 16 digits, no leading zeroes BIN1 0x0102 // binary, 1 digit, no leading zeroes BIN2 0x0202 // binary, 2 digits, no leading zeroes BIN3 0x0302 // binary, 3 digits, no leading zeroes BIN4 0x0402 // binary, 4 digits, no leading zeroes BIN5 0x0502 // binary, 5 digits, no leading zeroes BIN6 0x0602 // binary, 6 digits, no leading zeroes BIN7 0x0702 // binary, 7 digits, no leading zeroes BIN8 0x0802 // binary, 8 digits, no leading zeroes BIN9 0x0902 // binary, 9 digits, no leading zeroes BIN10 0x0A02 // binary, 10 digits, no leading zeroes BIN11 0x0B02 // binary, 11 digits, no leading zeroes BIN12 0x0C02 // binary, 12 digits, no leading zeroes BIN13 0x0D02 // binary, 13 digits, no leading zeroes BIN14 0x0E02 // binary, 14 digits, no leading zeroes BIN15 0x0F02 // binary, 15 digits, no leading zeroes BIN16 0x0002 // binary, 16 digits, no leading zeroes // binary, with leading zeroes BINZ 0x1002 // binary, 16 digits, leading zeroes BIN1Z 0x1102 // binary, 1 digit, leading zeroes BIN2Z 0x1202 // binary, 2 digits, leading zeroes BIN3Z 0x1302 // binary, 3 digits, leading zeroes BIN4Z 0x1402 // binary, 4 digits, leading zeroes BIN5Z 0x1502 // binary, 5 digits, leading zeroes BIN6Z 0x1602 // binary, 6 digits, leading zeroes BIN7Z 0x1702 // binary, 7 digits, leading zeroes BIN8Z 0x1802 // binary, 8 digits, leading zeroes BIN9Z 0x1902 // binary, 9 digits, leading zeroes BIN10Z 0x1A02 // binary, 10 digits, leading zeroes BIN11Z 0x1B02 // binary, 11 digits, leading zeroes BIN12Z 0x1C02 // binary, 12 digits, leading zeroes BIN13Z 0x1D02 // binary, 13 digits, leading zeroes BIN14Z 0x1E02 // binary, 14 digits, leading zeroes BIN15Z 0x1F02 // binary, 15 digits, leading zeroes BIN16Z 0x1002 // binary, 16 digits, leading zeroes // binary, with leading blanked BINZB 0x2002 // binary, 16 digits, leading blanks BIN1ZB 0x2102 // binary, 1 digit, leading blanks BIN2ZB 0x2202 // binary, 2 digits, leading blanks BIN3ZB 0x2302 // binary, 3 digits, leading blanks BIN4ZB 0x2402 // binary, 4 digits, leading blanks BIN5ZB 0x2502 // binary, 5 digits, leading blanks BIN6ZB 0x2602 // binary, 6 digits, leading blanks BIN7ZB 0x2702 // binary, 7 digits, leading blanks BIN8ZB 0x2802 // binary, 8 digits, leading blanks BIN9ZB 0x2902 // binary, 9 digits, leading blanks BIN10ZB 0x2A02 // binary, 10 digits, leading blanks BIN11ZB 0x2B02 // binary, 11 digits, leading blanks BIN12ZB 0x2C02 // binary, 12 digits, leading blanks BIN13ZB 0x2D02 // binary, 13 digits, leading blanks BIN14ZB 0x2E02 // binary, 14 digits, leading blanks BIN15ZB 0x2F02 // binary, 15 digits, leading blanks BIN16ZB 0x2002 // binary, 16 digits, leading blanks // signed decimal, no leading zeroes DEC 0x050A // signed decimal, 5 digits, no leading zeroes DEC1 0x010A // signed decimal, 1 digit, no leading zeroes DEC2 0x020A // signed decimal, 2 digits, no leading zeroes DEC3 0x030A // signed decimal, 3 digits, no leading zeroes DEC4 0x040A // signed decimal, 4 digits, no leading zeroes DEC5 0x050A // signed decimal, 5 digits, no leading zeroes // signed decimal, with leading zeroes DECZ 0x150A // signed decimal, 5 digits, leading zeroes DEC1Z 0x110A // signed decimal, 1 digit, leading zeroes DEC2Z 0x120A // signed decimal, 2 digits, leading zeroes DEC3Z 0x130A // signed decimal, 3 digits, leading zeroes DEC4Z 0x140A // signed decimal, 4 digits, leading zeroes DEC5Z 0x150A // signed decimal, 5 digits, leading zeroes // signed decimal, leading zeroes blanked DECZB 0x250A // signed decimal, 5 digits, leading blanks DEC1ZB 0x210A // signed decimal, 1 digit, leading blanks DEC2ZB 0x220A // signed decimal, 2 digits, leading blanks DEC3ZB 0x230A // signed decimal, 3 digits, leading blanks DEC4ZB 0x240A // signed decimal, 4 digits, leading blanks DEC5ZB 0x250A // signed decimal, 5 digits, leading blanks // unsigned decimal, no leading zeroes UDEC 0x450A // unsigned decimal, 5 digits, no leading zeroes UDEC1 0x410A // unsigned decimal, 1 digit, no leading zeroes UDEC2 0x420A // unsigned decimal, 2 digits, no leading zeroes UDEC3 0x430A // unsigned decimal, 3 digits, no leading zeroes UDEC4 0x440A // unsigned decimal, 4 digits, no leading zeroes UDEC5 0x450A // unsigned decimal, 5 digits, no leading zeroes // unsigned decimal, with leading zero's UDECZ 0x550A // unsigned decimal, 5 digits, leading zeroes UDEC1Z 0x510A // unsigned decimal, 1 digit, leading zeroes UDEC2Z 0x520A // unsigned decimal, 2 digits, leading zeroes UDEC3Z 0x530A // unsigned decimal, 3 digits, leading zeroes UDEC4Z 0x540A // unsigned decimal, 4 digits, leading zeroes UDEC5Z 0x550A // unsigned decimal, 5 digits, leading zeroes // unsigned decimal, leading zeroes blanked UDECZB 0x650A // unsigned decimal, 5 digits, leading blanks UDEC1ZB 0x610A // unsigned decimal, 1 digit, leading blanks UDEC2ZB 0x620A // unsigned decimal, 2 digits, leading blanks UDEC3ZB 0x630A // unsigned decimal, 3 digits, leading blanks UDEC4ZB 0x640A // unsigned decimal, 4 digits, leading blanks UDEC5ZB 0x650A // unsigned decimal, 5 digits, leading blanks // hex, with leading zero's HEX 0x1410 // hex, 4 digits, leading zeroes HEX1 0x1110 // hex, 1 digit, leading zeroes HEX2 0x1210 // hex, 2 digits, leading zeroes HEX3 0x1310 // hex, 3 digits, leading zeroes HEX4 0x1410 // hex, 4 digits, leading zeroes // hex, no leading zero's HEXZ 0x0410 // hex, 4 digits, no leading zeroes HEX1Z 0x0110 // hex, 1 digit, no leading zeroes HEX2Z 0x0210 // hex, 2 digits, no leading zeroes HEX3Z 0x0310 // hex, 3 digits, no leading zeroes HEX4Z 0x0410 // hex, 4 digits, no leading zeroes // hex, leading zero's blanked HEXZB 0x2410 // hex, 4 digits, leading blanks HEX1ZB 0x2110 // hex, 1 digit, leading blanks HEX2ZB 0x2210 // hex, 2 digits, leading blanks HEX3ZB 0x2310 // hex, 3 digits, leading blanks HEX4ZB 0x2410 // hex, 4 digits, leading blanks #END // baud divisor rates for setbaud(n); #CONST MIDI 9 BAUD_110 0 BAUD_300 1 BAUD_600 2 BAUD_1200 3 BAUD_2400 4 BAUD_4800 5 BAUD_9600 6 BAUD_14400 7 BAUD_19200 8 BAUD_31250 9 BAUD_38400 10 BAUD_56000 11 BAUD_57600 12 BAUD_115200 13 BAUD_128000 14 BAUD_256000 15 BAUD_300000 16 BAUD_375000 17 BAUD_500000 18 BAUD_600000 19 #END /* Inherited 4DGL Function Prototypes WARNING Do Not change the order */ //==============================================// // EVE bios functions // //==============================================// // func serin(), 1; // read a byte from COM0 // Syntax: serin(); // Usage : char := serin(); // Notes : Receives a character from the Serial Port COM0. The transmission format is: // : No Parity, 1 Stop Bit, 8 Data Bits (N,8,1). // : The default Baud Rate is 115,200 bits per second or 115,200 baud. The baud rate can be // : changed under program control by using the setbaud(...) or the com_SetBaud(...) function. // : Returns: -1 if no character is available // : Returns: -2 if a framing error or over-run has occurred (auto cleared) // : Returns: positive value 0 to 255 for a valid character received func putch("char"), 0; // write single char to current output device // Syntax: putch("char"); // Usage : putch("A"); // Notes : Transmits a single byte from the Serial Port COM0. The transmission format is: // : No Parity, 1 Stop Bit, 8 Data Bits (N,8,1). // : The default Baud Rate is 115,200 bits per second or 115,200 baud. The baud rate can be // : changed under program control by using the setbaud(...) or the com_SetBaud(...) function. // : The arguments can be a variable, array element, expression or constant func serout("char"), 0; // write a byte to COM0 // Syntax: serout1("char"); // Usage : serout1(ch); // Notes : send character to COM1 func setbaud("baudnum"), 0; // set baud rate of COM0 // Syntax: setbaud(baud_number); // Usage : setbaud(BAUD_128000); //Set baud rate to 128000bps // *Notes : argument specifies the baud rate using pre-defined constant. // : The pre-defined constant is a value of 0-19 , and internally // : this is used as a table pointer to get the baud rate divisor // : value for one of the 20 selected baud rates, control is then // : passed to com_SetBaud(COM0, baudlookup[baud_number]); // : The pre-defined constants equate to a value of 0-19. // : If a value other than 0-19 is used, a run time error (eror 25) // : will occur. func to("device"), 1; // output device redirection // Syntax: to(outstream); // Usage : to(APPEND); putstr("TWO "); // Notes : outstream: A variable or constant specifying destination for putch, putstr, putnum and print functions. // : // : to() sends the printed output to destinations other than the screen. Normally, print just // : sends its output to the display in TEXT mode which is the default, however, the output from // : print can be sent to COM0, and MDA (media) 'streams'. The to(...) function can also stream // : to a memory array . Note that once the to(...) function has taken effect, the stream reverts // : back to the default stream which is TEXT as soon as putch, putstr, putnum or print has // : completed its action. The APPEND argument is used to send the printed output to the same // : place as the previous redirection. This is most useful for building string arrays, or adding // : sequential data to a media stream. // : // : Predefined Name Constant putch(), putstr(), putnum(), print() redirection // : APPEND 0x0000 Output is directed to the same stream that was previously assigned. Output is // : appended to user memory if previous redirection was to an array. // : COM0 0xFF04 Output is redirected to the COM (serial) port. // : TEXT 0xFF08 Output is directed to the screen (default). // : MDA 0xFF10 Output is directed to the SD or FLASH media. // : I2C 0xF820 Output is directed to the I2C port. // : memory pointer Output is redirect to the memory pointer argument, eg to(myarray); print("HELLO"); func pause("milliseconds"), 0; // blocking delay // Syntax: pause(milliseconds); // Usage : pause(1000); //pause for 1 second // Notes : Pause for a number of milli second.Maximum delay could be 65535 milli seconds func putnum("arg1","arg2"), 1; // print number to current output device // Syntax: putnum(format, value); // Usage : var := putnum(HEX, val); // Notes : prints a 16bit number in various formats to the current output stream, usually the display. // : Format: A constant that specifies the number format // : Value : The number to be printed // : ( DECIMAL ) ( UNSIGNED DECIMAL ) ( HEX ) ( BINARY ) // : DEC DECZ DECZB UDEC UDECZ UDECZB HEX HEXZ HEXZB BIN BINZ BINZB // : DEC1 DEC1Z DEC1ZB UDEC1 UDEC1Z UDEC1ZB HEX1 HEX1Z HEX1ZB BIN1 BIN1Z BIN1ZB // : DEC2 DEC2Z DEC2ZB UDEC2 UDEC2Z UDEC2ZB HEX2 HEX2Z HEX1ZB BIN2 BIN2Z BIN2ZB // : DEC3 DEC3Z DEC3ZB UDEC3 UDEC3Z UDEC3ZB HEX3 HEX3Z HEX1ZB BIN3 BIN3Z BIN3ZB // : DEC4 DEC4Z DEC4ZB UDEC4 UDEC4Z UDEC4ZB HEX4 HEX4Z HEX1ZB BIN4 BIN4Z BIN4ZB // : DEC5 DEC5Z DEC5ZB UDEC5 UDEC5Z UDEC5ZB BIN5 BIN5Z BIN5ZB // : BIN6 BIN6Z BIN6ZB // : BIN7 BIN7Z BIN7ZB // : BIN8 BIN8Z BIN8ZB // : BIN9 BIN9Z BIN9ZB // : BIN10 BIN10Z BIN10ZB // : BIN11 BIN11Z BIN11ZB // : BIN12 BIN12Z BIN12ZB // : BIN13 BIN13Z BIN13ZB // : BIN14 BIN14Z BIN14ZB // : BIN15 BIN15Z BIN15ZB // : BIN16 BIN16Z BIN16ZB // : field: Returns the the default width of the numeric field (digit count), usually ignored. // : bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 // : | | | | \___ ___/ \__ __/ \_____ _____/ // : | | | | V V V // : | | | | | | | // : | | | | | | // : | | | | (nb 0 = 16) | |____BASE (usually 2,10 or 16) // : | | | | digit count | // : | | | | |___reserved (not used on GOLDELOX) // : | | | | // : | | | | // : | | | | // : | | | | // : | | | | // : | | | |______ 1 = leading zeros included // : | | | 0 = leading zeros suppressed // : | | | // : | | | // : | | |_______ 1 = leading zero blanking // : | | // : | |_____ sign bit (0 = signed, 1 = unsigned) // : | // : |______ 1 = space before unsigned number func translate("arg1","arg2","arg3","arg4"), 1; // list translator (internal use only, not usable) func putstr("string"), 1; // print string to current output device // Syntax: putstr(pointer); // Usage : putstr("HELLO\n"); // Notes : putstr prints a string to the current output stream, usually the display. The argument can be // : a string constant, a word aligned pointer to a string, a pointer to an array, or a pointer to // : a data statement. Note that string constants and data statement pointers are byte aligned. // : The output of putstr can be redirected to the communications port, the media, or memory // : using the to(...); function. // : A string constant is automatically terminated with a zero. // : A string in a data statement is not automatically terminated with a zero. // : All variables in 4DGL are 16bit, if an array is used for holding 8 bit characters, each array // : element packs 1 or 2 characters. func strlen("varAddress"), 1; // return length of a var packed string in character units // Syntax: strlen("varAddress); // Usage : strlen("HELLO\n"); // Notes : gives the length of a string that is packed into regular var array // : Use str_Length(ptr) for string pointer mode //==============================================// // Memory Access Function Prototypes // //==============================================// // func peekW("address"), 1; // read a word from system memory func pokeW("address", "wordvalue"), 0; // write a word to system memory // refer to address map of internal variables // //==============================================// // Math Functions // //==============================================// // func ABS("value"), 1; // return a positive number // Syntax: ABS(value); // Usage : var := ABS(arg); // Notes : Returns the absolute value of an argument func MIN("value1", "value2"), 1; // return the smaller of 2 numbers // Syntax: MIN(value1, value2); // Usage : var := MIN(arg1, arg2); // Notes : Returns the minimum of 2 arguments func MAX("value1", "value2"), 1; // return the larger of 2 numbers // Syntax: MAX(value1, value2); // Usage : var := MAX(arg1, arg2); // Notes : Returns the maximum of 2 arguments func SWAP("&var", "&var"), 0; // swap 2 variables, arguments must point to variables // Syntax: SWAP(&var1, &var2); // Usage : SWAP(&var1, &var2); // Notes : Swaps the contents of 2 variables or memory locations func SIN("angle"), 1; // return SIN of angle // Syntax: SIN(angle); // Usage : var := SIN(arg); // Notes : Returns the sine in radians of an argument in degrees // : the returned value range is from 127 to -127. The real // : cosine values vary from 1.0 to -1.0 so appropriate // : scaling must be done in user code. func COS("angle"), 1; // return COS of angle // Syntax: COS(angle); // Usage : var := COS(arg); // Notes : Returns the cosine in radians of an argument in degrees // : the returned value range is from 127 to -127. The real // : cosine values vary from 1.0 to -1.0 so appropriate // : scaling must be done in user code. func RAND(), 1; // return a pseudo random number // Syntax: RAND(); // Usage : var := RAND(); // Notes : Returns a random number between 0 and 0xFFFF. // : The random number generator must first be seeded // : by using the SEED(number) function. func SEED("number"), 0; // re-seed the pseudo random number generator // Syntax: SEED(number); // Usage : SEED(arg); // Notes : Seeds the random number generator. func OVF(), 1; // returns upper 16bits of 32bit results // Syntax: OVF(); // Usage : loWord := 0x2710 * 0x2710; // (10000 * 10000 in hex format) // : hiWord := OVF(); // Notes : This function returns the high order 16 bits from certain math and shift functions.. func SQRT("number"), 1; // return square root of a number // Syntax: SQRT(number); // Usage : SQRT(arg); // Notes : Returns the integer square root of a number. //------------------------------------------------------------------// // Text Related Function Prototypes //------------------------------------------------------------------// func txt_MoveCursor("line", "column"), 0; // Syntax: txt_SetCursor(line, column); // Usage : txt_SetCursor(arg1, arg2); // Notes : Moves the text Cursor to a new screen position set by // : line,column parameters. func txt_Set("mode", "value"), 0; // Syntax: txt_Set(mode, value); // Usage : txt_Set(arg1, arg2); // Returns : Original value before the change // Notes : Sets various text related parameters used by other functions // : This allows the features to be set programatically with a // : single function call.It is strongly recommended to use the // : pre-defined constants rather than the mode numbers. // : NB:- Although it is often required to be able to set text // : functions with a single function call for graphics engine // : related functions, there is a complete set of single parameter // : shortcut functions that have exactly the same function as // : each of the txt_Set modes and saves 1 parameter / uses less memory // : // : mode = TEXT_COLOUR (mode 0) // : txt_Set(TEXT_COLOUR, value); // : value = 0 to 0xFFFF, Black to White // : Sets the Text colour for the display // : Default = LIME. // : // : mode = TEXT_HIGHLIGHT (mode 1) // : txt_Set(TEXT_HIGHLIGHT, value); // : value = 0 to 0xFFFF, Black to White // : Sets the Text background colour for the display. Effective // : when text mode is Opaque. // : Default = BLACK. // : // : mode = FONT_ID (mode 2) // : txt_Set(FONT_ID, value); // : value = FONT1, FONT2 or FONT3 for internal fonts // : else this value is the name of a font included // : in a users program in a data statement. // : Default = FONT SIZE 3. // : // : mode = TEXT_WIDTH (mode 3) // : txt_Set(TEXT_WIDTH, value); // : value = 1 to 16 // : Sets the Text Width multiplier // : text will be printed magnified horizontally // : by this factor, Default = 1. // : // : mode = TEXT_HEIGHT (mode 4) // : txt_Set(TEXT_HEIGHT, value); // : value = 1 to 16 // : Sets the Text Height multiplier // : text will be printed magnified vertically // : by this factor, Default = 1. // : // : mode = TEXT_XGAP (mode 5) // : txt_Set(TEXT_XGAP, value); // : value = 1 to 32 // : Sets the horizontal gap between characters // : The gap is in pixel units, Default = 0 // : // : mode = TEXT_YGAP (mode 6) // : txt_Set(TEXT_YGAP, value); // : value = 1 to 32 // : Sets the vertical gap below characters // : The gap is in pixel units, Default = 0 // : // : mode = TEXT_PRINTDELAY (mode 7) DEPRECATED // : txt_Set(TEXT_PRINTDELAY, value); // : value = 0 to 255 // : Sets the delay time (in ms) during character // : printing to give a 'teletype' like effect. // : Often used to attract attention to a string // : being printed which can often be missed if // : just suddenly appearing or changing. // : Default = 0 ms. // : // : mode = TEXT_OPACITY (mode 8) // : txt_Set(TEXT_OPACITY, value); // : value = TRANSPARENT (0) = Text Trasparent // : value = OPAQUE (1) = Text Opaque // : Sets the Opacity/Transparency of the text // : Default = 0 or TRANSPARENT // : // : mode = TEXT_BOLD (mode 9) // : txt_Set(TEXT_BOLD, value); // : value = dont care // : Sets Bold Text mode for the next string or char // : The feature automatically resets after printing // : using putstr or print has completed // : // : mode = TEXT_ITALIC (mode 10) // : txt_Set(TEXT_ITALIC, value); // : value = dont care // : Sets Italic Text mode for the next string or char // : The feature automatically resets after printing // : using putstr or print has completed // : mode = TEXT_INVERSE (mode 11) // : txt_Set(TEXT_INVERSE, value); // : value = dont care // : Sets Inverse Text mode for the next string or char // : The feature automatically resets after printing // : using putstr or print has completed // : // : mode = TEXT_UNDERLINED (mode 12) // : txt_Set(TEXT_UNDERLINED, value); // : value = dont care // : Sets Underlined Text mode for the next string or char // : The feature automatically resets after printing // : using putstr or print has completed // : // : mode = TEXT_ATTRIBUTES (mode 13) // : txt_Set(TEXT_ATTRIBUTES, value); // : value = bits are defined as: // : BOLD 16 // TEXT_ATTRIBUTES bold text (auto reset) // : ITALIC 32 // TEXT_ATTRIBUTES italic text (auto reset) // : INVERSE 64 // TEXT_ATTRIBUTES inverse text (auto reset) // : UNDERLINED 128 // TEXT_ATTRIBUTES underlined text (auto reset) // : Allows a combination of text attributes to be defined together // : by 'or'ing the bits together. // : Example: txt_Set(TEXT_ATTRIBUTES, BOLD | INVERSE); // bold + inverse // : The feature automatically resets after printing // : using putstr or print has completed. // : Bits 0-3 and 8-15 are reserved for future attributes. // : // : mode = TEXT_WRAP (mode 14) // : txt_Set(TEXT_WRAP , value); // : Sets the position where text wrap will occur // : The feature automatically resets when screen // : mode is changed. If the value is set to 0, // : text wrap is turned off. // : of the current screen. Default value is 0 // Notes : The value is in pixel units. // : // : txt_Set mode 15 reserved for future use // : //=====================================================// // Single parameter short-cuts // // for the txt_Set functions // // These functions return the existing value before // // the change is made. // //=====================================================// func txt_FGcolour("colour"), 1; // 0 text foreground colour func txt_BGcolour("colour"), 1; // 1 text background colour func txt_FontID("id"), 1; // 2 text font ID (0 = system font) func txt_Width("multiplier"), 1; // 3 text width multiplier func txt_Height("multiplier"), 1; // 4 text height multiplier func txt_Xgap("pixelcount"), 1; // 5 text gap between characters func txt_Ygap("pixelcount"), 1; // 6 text gap between lines func txt_Delay("millisecs"), 1; // 7 text printing delay factor func txt_Opacity("mode"), 1; // 8 text OPAQUE or TRANSPARENT func txt_Bold("mode"), 1; // 9 text bold ON/OFF func txt_Italic("mode"), 1; // 10 text italic ON/OFF func txt_Inverse("mode"), 1; // 11 text inverse ON/OFF func txt_Underline("mode"), 1; // 12 text underline ON/OFF func txt_Attributes("value"), 1; // 13 text combined bold|italic|inverse|underline func txt_Wrap("value"), 1; // 14 text set text wrap position func _1F(), 0; // 15 text (reserved DO NOT REMOVE) //------------------------------------------------------------------// // Hardware Function Prototypes //------------------------------------------------------------------// // I/O Pin reference:- // // IO1_PIN is pin 2 of J1 // IO2_PIN is pin 1 of J1 // IO3_PIN is pin 3 of J1 // IO4_PIN is pin 5 of J1 (also used for BUS_RD) // IO5_PIN is pin 9 of J2 (also used for BUS_WR) // BUS_RD_PIN is pin 5 of J1 (alias IO4_PIN) // BUS_WR_PIN is pin 9 of J2 (alias IO5_PIN) // BUS_0 is pin 27 of J1 // BUS_1 is pin 25 of J1 // BUS_2 is pin 23 of J1 // BUS_3 is pin 21 of J1 // BUS_4 is pin 19 of J1 // BUS_5 is pin 17 of J1 // BUS_6 is pin 13 of J2 // BUS_7 is pin 11 of J2 // BACKLITE is backlite control pin // AUDIO_ENABLE is amplifier chip control pin func pin_Set("mode", "pin"), 1; // set pin to required mode // Syntax: pin_Set(mode, pin); // Usage : pin_Set(arg1, arg2); // Notes : Sets the appropriate pins to Inputs or Outputs // : returns true if the pin number is legal (usually ignored) // : // : mode = 0 : Set Pin to Output // : pin_Set(0, pin); // : pin_Set(OUTPUT, pin); // : pin = 1 : set IO1_PIN to output (pin 2 J1) // : pin = 2 : set IO2_PIN to output (pin 1 J1) // : pin = 3 : set IO3_PIN to output (pin 3 J1) // : pin = 4 : set IO4_PIN to output (pin 5 J1, also used for BUS_RD) // : pin = 5 : set IO5_PIN to output (pin 9 J2, also used for BUS_WR) // : (pin 6,7 are BACKLITE and AMP control and are permanemtly outputs which can't be altered) // : pin = 8 : set BUS_0 to output (pin 27 of J1) // : pin = 9 : set BUS_1 to output (pin 25 of J1) // : pin = 10 : set BUS_2 to output (pin 23 of J1) // : pin = 11 : set BUS_3 to output (pin 21 of J1) // : pin = 12 : set BUS_4 to output (pin 19 of J1) // : pin = 13 : set BUS_5 to output (pin 17 of J1) // : pin = 14 : set BUS_6 to output (pin 13 of J2) // : pin = 15 : set BUS_7 to output (pin 11 of J2) // : Sets the desired pin to be used as an Output. // : // : mode = 1 : Set Pin to Input // : pin_Set(1, pin); // : pin_Set(INPUT, pin); // : pin = 1 : set IO1_PIN to input (pin 2 J1) // : pin = 2 : set IO2_PIN to input (pin 1 J1) // : pin = 3 : set IO3_PIN to input (pin 3 J1) // : pin = 4 : set IO4_PIN to input (pin 5 J1, also used for BUS_RD) // : pin = 5 : set IO5_PIN to input (pin 9 J2, also used for BUS_WR) // : (pin 6,7 are BACKLITE and AMP control and are permanemtly outputs which can't be altered) // : pin = 8 : set BUS_0 to input (pin 27 of J1) // : pin = 9 : set BUS_1 to input (pin 25 of J1) // : pin = 10 : set BUS_2 to input (pin 23 of J1) // : pin = 11 : set BUS_3 to input (pin 21 of J1) // : pin = 12 : set BUS_4 to input (pin 19 of J1) // : pin = 13 : set BUS_5 to input (pin 17 of J1) // : pin = 14 : set BUS_6 to input (pin 13 of J2) // : pin = 15 : set BUS_7 to input (pin 11 of J2) // : Sets the desired pin to be used as an Input. func pin_HI("pin"), 1; // set pin to logic '1' // Syntax: pin_HI(pin); // Usage : pin_HI(arg); // Notes : Outputs a logic "High" (3.3V) on the appropriate // : pin that was previously selected as an Output. // : returns true if the pin number is legal (usually ignored) // : // : pin = 1 : set IO1_PIN to "High" level (pin 2 of J1) // : pin = 2 : set IO2_PIN to "High" level (pin 1 of J1) // : pin = 3 : set IO3_PIN to "High" level (pin 3 of J1) // : pin = 4 : set IO4_PIN to "High" level (pin 5 of J1, also used for BUS_RD) // : pin = 5 : set IO5_PIN to "High" level (pin 9 of J2, also used for BUS_WR) // : pin = 6 : set DCENB pin to "High" level (BACKLITE ON) // : pin = 7 : set AUDIO_ENABL pin to "High" level (AMP OFF) // : pin = 8 : set BUS_0 to "High" level (pin 27 of J1) // : pin = 9 : set BUS_1 to "High" level (pin 25 of J1) // : pin = 10 : set BUS_2 to "High" level (pin 23 of J1) // : pin = 11 : set BUS_3 to "High" level (pin 21 of J1) // : pin = 12 : set BUS_4 to "High" level (pin 19 of J1) // : pin = 13 : set BUS_5 to "High" level (pin 17 of J1) // : pin = 14 : set BUS_6 to "High" level (pin 13 of J2) // : pin = 15 : set BUS_7 to "High" level (pin 11 of J2) func pin_LO("pin"), 1; // set pin to logic '0' // Syntax: pin_LO(pin); // Usage : pin_LO(arg); // Notes : Outputs a logic "Low" (0V) on the appropriate // : pin that was previously selected as an Output. // : returns true if the pin number is legal (usually ignored) // : // : pin = 1 : set IO1_PIN to "Low" level (pin 2 of J1) // : pin = 2 : set IO2_PIN to "Low" level (pin 1 of J1) // : pin = 3 : set IO3_PIN to "Low" level (pin 3 of J1) // : pin = 4 : set IO4_PIN to "Low" level (pin 5 of J1, also used for BUS_RD) // : pin = 5 : set IO5_PIN to "Low" level (pin 9 of J2, also used for BUS_WR) // : pin = 6 : set DCENB pin to "Low" level (BACKLITE) // : pin = 7 : set AUDIO_ENABL pin to "Low" level (AMP ON) // : pin = 8 : set BUS_0 to "Low" level (pin 27 of J1) // : pin = 9 : set BUS_1 to "Low" level (pin 25 of J1) // : pin = 10 : set BUS_2 to "Low" level (pin 23 of J1) // : pin = 11 : set BUS_3 to "Low" level (pin 21 of J1) // : pin = 12 : set BUS_4 to "Low" level (pin 19 of J1) // : pin = 13 : set BUS_5 to "Low" level (pin 17 of J1) // : pin = 14 : set BUS_6 to "Low" level (pin 13 of J2) // : pin = 15 : set BUS_7 to "Low" level (pin 11 of J2) func pin_Read("pin"), 1; // read pin, logic or analogue // Syntax: pin_Read(pin); // Usage : arg1 := pin_Read(arg2); // Notes : Reads the logic state of the appropriate // : pin that was previously selected as an Input. // : // : pin = 1 : Read the state of IO1_PIN (pin 2 of J1) // : pin = 2 : Read the state of IO2_PIN (pin 1 of J1) // : pin = 3 : Read the state of IO3_PIN (pin 3 of J1) // : pin = 4 : Read the state of IO4_PIN (pin 5 of J1, also used for BUS_RD) // : pin = 5 : Read the state of IO5_PIN (pin 9 of J2, also used for BUS_WR) // : pin = 6 : Read the state of DCENB pin to "Low" level (BACKLITE) // : pin = 7 : Read the state of AUDIO_ENABL pin to "Low" level (AMP ON) // : pin = 8 : Read the state of BUS_0 (pin 27 of J1) // : pin = 9 : Read the state of BUS_1 (pin 25 of J1) // : pin = 10 : Read the state of BUS_2 (pin 23 of J1) // : pin = 11 : Read the state of BUS_3 (pin 21 of J1) // : pin = 12 : Read the state of BUS_4 (pin 19 of J1) // : pin = 13 : Read the state of BUS_5 (pin 17 of J1) // : pin = 14 : Read the state of BUS_6 (pin 13 of J2) // : pin = 15 : Read the state of BUS_7 (pin 11 of J2) // : Returns a 0 (logic low) or 1 (logic high). //------------------------------------------------------------------// // P1 module BUS I/O control //------------------------------------------------------------------// func bus_In(), 1; // Syntax: bus_In(); // Usage : arg1 := bus_In(); // Notes : Read the 8bit wide bus into the lower 8 bits of arg1. // : The upper 8 bits of arg1 are set to 0. // : the BUS_RD and BUS_WR pins are not affected. // : // : BUS_0 is pin 27 of J1 // : BUS_1 is pin 25 of J1 // : BUS_2 is pin 23 of J1 // : BUS_3 is pin 21 of J1 // : BUS_4 is pin 19 of J1 // : BUS_5 is pin 17 of J1 // : BUS_6 is pin 13 of J2 // : BUS_7 is pin 11 of J2 func bus_Out("var"), 0; // Syntax: bus_Out(var); // Usage : bus_Out(arg1); // Notes : The lower 8 bits of arg1 are placed on the 8bit wide bus. // : The upper 8 bits of arg1 are ignored. // : the BUS_RD and BUS_WR pins are not affected. // : NB:- any BUS pins that are set to inputs are not affected. // : // : BUS_0 is pin 27 of J1 // : BUS_1 is pin 25 of J1 // : BUS_2 is pin 23 of J1 // : BUS_3 is pin 21 of J1 // : BUS_4 is pin 19 of J1 // : BUS_5 is pin 17 of J1 // : BUS_6 is pin 13 of J2 // : BUS_7 is pin 11 of J2 func bus_Set("var"), 0; // Syntax: bus_Set(var); // Usage : bus_Set(arg1); // Notes : The lower 8 bits of arg1 are placed in the BUS direction register. // : a '1' sets a pin to be an input, a '0' sets a pin to be output. // : The upper 8 bits of arg1 are ignored. // : the BUS_RD and BUS_WR pins are not affected. // : // : BUS_0 is pin 27 of J1 // : BUS_1 is pin 25 of J1 // : BUS_2 is pin 23 of J1 // : BUS_3 is pin 21 of J1 // : BUS_4 is pin 19 of J1 // : BUS_5 is pin 17 of J1 // : BUS_6 is pin 13 of J2 // : BUS_7 is pin 11 of J2 func bus_Write("var"), 0; // Syntax: bus_Write(var); // Usage : bus_Write(arg1); // Notes : The lower 8 bits of arg1 are placed on the BUS, then, after // : a settling delay of approx 50nsec, the BUS_WR pin is strobed // : LO for approx 50nsec then set back HI. // : The upper 8 bits of arg1 are ignored. // : NB:- the BUS_WR pin is automatically pre-set to an output to // : ensure BUS write integrity. // : // : BUS_0 is pin 27 of J1 // : BUS_1 is pin 25 of J1 // : BUS_2 is pin 23 of J1 // : BUS_3 is pin 21 of J1 // : BUS_4 is pin 19 of J1 // : BUS_5 is pin 17 of J1 // : BUS_6 is pin 13 of J2 // : BUS_7 is pin 11 of J2 func bus_Read(), 1; // Syntax: bus_Read(); // Usage : arg1 := bus_Read(); // Notes : The BUS_RD pin set to LO, then, after a settling delay // : of approx 50nsec, the BUS is read into the lower 8 bits of arg // : (the upper 8 bits being set to 0) // : the BUS_RD pin is then set back to a HI level. // : NB:- the BUS_RD pin is automatically pre-set to an output to // : ensure BUS write integrity. // : // : BUS_0 is pin 27 of J1 // : BUS_1 is pin 25 of J1 // : BUS_2 is pin 23 of J1 // : BUS_3 is pin 21 of J1 // : BUS_4 is pin 19 of J1 // : BUS_5 is pin 17 of J1 // : BUS_6 is pin 13 of J2 // : BUS_7 is pin 11 of J2 //------------------------------------------------------------------// // Graphics Functions //------------------------------------------------------------------// func gfx_Set("mode", "value"), 0; // set various graphics functions // Syntax: gfx_Set(mode, value); // Usage : gfx_Set(arg1, arg2); // Notes : Sets various graphics parameters used by other functions // : This allows the features to be set programatically with a // : single function call.It is strongly recommended to use the // : pre-defined constants rather than the mode numbers. // : NB:- Although it is often required to be able to set graphics // : functions with a single function call for graphics engine // : related functions, there is a complete set of single parameter // : shortcut functions that have exactly the same function as // : each of the gfx_Set modes and saves 1 parameter / uses less memory // : // : mode = PEN_SIZE (mode 16) // : gfx_Set(PEN_SIZE, value); // : value = SOLID (value 0) rectangle and circle objects are solid // : value = OUTLINE (value 1) rectangle and circle objects are outlines // : Sets the mode of the Pen used by most graphics objects // : // : mode = BACKGROUND_COLOUR (mode 17) // : gfx_Set(BACKGROUND_COLOUR, value); // : value = 0 to 0xFFFF, Black to White // : Sets the Background colour of the screen // : // : mode = OBJECT_COLOUR (mode 18) // : gfx_Set(OBJECT_COLOUR, value); // : value = 0 to 0xFFFF, Black to White // : Sets the Object colour used in various functions // : LineTo(,,); LineRel(,,); BoxTo(,,); Dot(); etc. // : // : mode = CLIPPING (mode 19) // : gfx_Set(CLIPPING, value); // : value = OFF (value 0) Clipping disabled // : value = ON (value 1) Clipping enabled // : Enables/Disables the Clipping feature // : // : mode = TRANSPARENT_COLOUR (mode 20) : Image or Animation Transparency Colour. // : gfx_Set(TRANSPARENT_COLOUR, value); // : value = 0 to 0xFFFF Black to White // : Sets Bitmap, Image or Animation Transparency Colour. // : NB not implemented // : // : mode = TRANSPARENCY (mode 21) : Bitmap/Image/Animation Transparency // : gfx_Set(5, value); // : value = OFF (value 0) Transparency disabled // : value = ON (value 1) Transparency enabled // : Enables/Disables the Transparency feature // : NB not implemented // : // : mode = FRAME_DELAY (mode 22) : Inter-Frame Delay // : gfx_Set(FRAME_DELAY, value); // : value = 0 to 65535 ms // : Sets the Video/Animation clip inter-frame delay. This setting will // : over-ride the embedded frame delay of the clip. After the event, // : the setting will auto disable and if further inter-frame delays need // : overriding the setting must be re-issued. // : // : mode = SCREEN_MODE (mode 23) : Set required screen behaviour // : gfx_Set(SCREEN_MODE, value); // : value = LANDSCAPE (value 0) // : value = LANDSCAPE_R (value 1) // : value = PORTRAIT (value 2) // : value = PORTRAIT_R (value 3) // : // : mode = OUTLINE_COLOUR (mode 24) : Outline Colour // : gfx_Set(OUTLINE_COLOUR, value); // : value = 1 to 0xFFFF, if 0, featre is OFF // : Sets the filled Rectangle or Circle objects outline colour // : If outline colour, is 0, OUTLINE_COLOUR feature is disabled // : gfx_Set(OUTLINE_COLOUR, OFF); may be used for this // : // : Only supports variable contrast for uOLED Modules // : mode = CONTRAST (mode 25) : Contrast // : gfx_Set(CONTRAST, value); // : value = 0 to 9, 0=off, 1=lowest, 8=highest contrast // : when contrast=0, display is placed in low power mode. // : This function should be called with contrast=0 when // : powering down the module. // : // : mode = LINE_PATTERN (mode 26) : Line Pattern // : gfx_Set(LINE_PATTERN, value); // : gfx_Set(LINE_PATTERN, 0b1111000011110000); // draw dotted line // : gfx_Set(LINE_PATTERN, OFF); // line patterning OFF // : a value of 0 turns the feature off // : // : mode = COLOUR_MODE (mode 27) : 8/16 bit colour mode // : gfx_Set(COLOUR_MODE , COLOUR16); // set 16bit colour mode // : gfx_Set(COLOUR_MODE , COLOUR8); // set 8bit colour mode // : NB not implemented, default is COLOUR16 // : // : mode = BEVEL_WIDTH (mode 28) : set button and slider bevel width // : gfx_Set(BEVEL_WIDTH , 5); // set bevel lines to 5 pixels wide // : sets the button and slider objects bevel width // : // : mode = BEVEL_SHADOW (mode 29) : set bevel shadowing depth for buttons and sliders // : gfx_Set(BEVEL_SHADOW , 5); // : sets the button and slider objects darken and lighten depth for the bevel colour // : // : mode = X_ORIGIN (mode 29) : set x offset for screen // : gfx_Set(X_ORIGIN , 25); // object are offset 25 pixels from LHS // : sets the origin of drawn objects to a position other than 0,0 // : // : mode = Y_ORIGIN (mode 29) : set y offset for screen // : gfx_Set(Y_ORIGIN , 30); // object are offset 30 pixels from TOP // : sets the origin of drawn objects to a position other than 0,0 func gfx_Cls(), 0; // clear the screen // Syntax: gfx_Cls(); // Usage : gfx_Cls(); // Notes : Clears the screen with current background colour func gfx_MoveTo("x", "y"), 0; // set glb_X1 and glb_Y1 to required co-ordinate // Syntax: gfx_MoveTo(x, y); // Usage : gfx_MoveTo(arg1, arg2); // Notes : Moves the origin to a new x,y position func gfx_MoveRel("x", "y"), 0; // set glb_X1 and glb_Y1 to new relative offset // Syntax: gfx_MoveRel(x, y); // Usage : gfx_MoveRel(arg1, arg2); // Notes : Moves the origin to a new x,y position // : relative to the current origing func gfx_LineTo("x1", "y1"), 0; // draw line from current origin to new point // Syntax: gfx_LineTo(x1, y1); // Usage : gfx_LineTo(arg1, arg2); // Notes : Draws a Line from the origin x,y to x1,y1. // : The new origin is then set to x1, y1. Line colour needs // : to be preset with "Set Object colour" using gfx_Set(mode=2, colour); func gfx_LineRel("x1", "y1"), 0; // draw line from current origin to new relative offset // Syntax: gfx_LineRel(x1, y1); // Usage : gfx_LineRel(arg1, arg2); // Notes : Draws a Line from the origin x,y to x1,y1. // : Unlike gfx_MoveTo() the origin is not updated with x1, y1. Line colour needs // : to be preset with "Set Object colour" using gfx_Set(OBJECT_COLOUR, colour); func gfx_Line("x1", "y1", "x2", "y2", "colr"), 0; // draw line, can be patterned // Syntax: gfx_Line(x1, x2, y2, colr); // Usage : gfx_Line(arg1, arg2, arg3, arg4, arg5); // Notes : Plots a coloured Line from x1,y1 to x2,y2 on the screen func gfx_Hline("y", "x1", "x2", "colr"), 1; // draw Hline, can be patterned // Syntax: gfx_Line(x1, x2, y, colr); // Usage : gfx_Line(arg1, arg2, arg3, arg4); // Notes : Plots a coloured Horizontal line from x1,y to x2,y on the screen func gfx_Vline("x", "y1", "y2", "colr"), 1; // draw Vline, can be patterned // Syntax: gfx_Line(y1, y2, x, colr); // Usage : gfx_Line(arg1, arg2, arg3, arg4); // Notes : Plots a coloured Vertical line from x,y1 to x,y2 on the screen func gfx_Rectangle("x1" ,"y1", "x2", "y2", "colr"), 0; // draw open rectangle,line can be patterned // Syntax: gfx_Rectangle(x1, y1, x2, y2, colr); // Usage : gfx_Rectangle(arg1, arg2, arg3, arg4, arg5); // Notes : Plots a coloured Outline Rectangle from top corner (x1,y1) to // : bottom corner (x2,y2) on the screen. func gfx_RectangleFilled("x1","y1","x2","y2","colr"), 0; // draw filled rectangle // Syntax: gfx_Rectangle(x1, y1, x2, y2, colour); // Usage : gfx_Rectangle(arg1, arg2, arg3, arg4, arg5); // Notes : Plots a coloured Solid Rectangle from top corner (x1,y1) to // : bottom corner (x2,y2) on the screen. func gfx_Circle("x", "y", "rad", "colr"), 0; // draw open circle // Syntax: gfx_Circle(x, y, rad, colr); // Usage : gfx_Circle(arg1, arg2, arg3, arg4); // Notes : Plots a coloured outline Circle on the screen at centre x,y with radius = rad func gfx_CircleFilled("x", "y", "rad", "colr"), 0; // draw filled circle // Syntax: gfx_Circle(x, y, rad, colr); // Usage : gfx_Circle(arg1, arg2, arg3, arg4); // Notes : Plots a coloured Solid Circle on the screen at centre x,y with radius = rad func gfx_PutPixel("x", "y", "colr"), 0; // set point at x y // Syntax: gfx_PutPixel(x, y, colr); // Usage : gfx_PutPixel(arg1, arg2, arg3); // Notes : Plots a coloured pixel on the screen at x,y location func gfx_GetPixel("x", "y"), 1; // read colour at point x y // Syntax: gfx_GetPixel(x, y); // Usage : var := gfx_GetPixel(arg1, arg2); // Notes : Reads and returns the colour value of a pixel at location x,y func gfx_Triangle("x1","y1","x2","y2","x3","y3","colr"), 0; // draw an open triangle // Syntax: gfx_Triangle(x1, y1, x2, y2, x3, y3, colr); // Usage : gfx_Triangle(arg1, arg2, arg3, arg4, arg5, arg6, arg7); // Notes : Plots a coloured outline Triangle from between 3 vertices: x1,y1 x2,y2 x3,y3 // : Vertices must be specified in an anti-clockwise fashion func gfx_OrbitInit("&x_orb", "&y_orb"), 0; // set result holders for orbit command // Syntax: gfx_OrbitInit(&x_orb, &y_orb); // Usage : gfx_OrbitInit(&arg1, &arg2); // Notes : Sets up the Orbit function parameters. // : &x_orb, &y_orb: calcualted Orbit coordiantes. These are pointers to local // : variables that get updated after calling gfx_Orbit(,,) function. // : The coordiantaes are calculated relative to the origin // : obtained by using the gfx_MoveTo(x, y) function. func gfx_Orbit("angle", "distance"), 0; // calculate point at angle, distance // Syntax: gfx_Orbit(angle, distance); // Usage : gfx_Orbit(arg1, arg2); // Notes : The Orbit function calcualtes the x, y coordinates of a distant point whose // : only known parameters are the angle and the distance from the current origin. func gfx_Polyline("n", "&vx", "&vy", "colr"), 0; // draw a polyline from a table of vertices // Syntax: gfx_Polyline(numbVertices, &vertices_x, &vertices_y, colour); // Usage : gfx_Polyline(arg1, x[array], y[array], arg2); // Notes : This function is very similar to the Ploygon function // : with the exception of the 1st and the last vertices not joined. func gfx_Polygon("n", "&vx", "&vy", "colr"), 0; // draw a polygon from a table of vertices // Syntax: gfx_Polygon(numbVertices, &vx, &y, colour); // Usage : gfx_Polygon(arg1, x[array], y[array], arg2); // Notes : Plots a coloured outline Polygon between specified vertices: x1,y1 x2,y2 .. xn,yn // : Vertices must be minimum of 3 and can be specified in any fashion func gfx_Dot(), 0; // set point at glb_X glb_Y, default colour // Syntax: gfx_Dot(); // Usage : gfx_Dot(); // Notes : Places a coloured dot at the origin func gfx_Bullet("r"), 0; // draw circle at glb_X glb_Y, default colour // Syntax: gfx_Bullet(); // Usage : gfx_Bullet(); // Notes : Places a coloured circle at the origin // : filled or unfilled state is controlled by PenSize func gfx_IncX(), 1; // increment global origin glb_X, returning new value // Syntax: gfx_IncX(); // Usage : var := gfx_IncX(); // Notes : Increments the x coordinate of the origin func gfx_IncY(), 1; // increment global origin glb_Y, returning new value // Syntax: gfx_IncY(); // Usage : var := gfx_IncY(); // Notes : Increments the y coordinate of the origin func gfx_BoxTo("x1", "y1"), 0; // draw rectangle from current origin to x1 y1 // Syntax: gfx_BoxTo(x1, y1); // Usage : gfx_BoxTo(arg1, arg2); // Notes : Draws a Rectangle from the origin x,y to x1,y1. // : The new origin is then set to x1,y1. Rectangle colour needs // : to be preset with "Set Object colour" using gfx_Set(mode=2, colour); // : and the PenSize setting determines if Box is solid or outline. func gfx_ClipWindow("x1" ,"y1", "x2", "y2"), 0; // set the cipping area // Syntax: gfx_ClipWindow(x1, y1, x2, y2); // Usage : gfx_ClipWindow(arg1, arg2, arg3, arg4); // Notes : Specifies a clipping window region on the screen such that any objects // : and text placed onto the screen will be clipped and displayed only // : within that region. For the clipping window to take effect, "Clipping" // : must be enabled seperately using the gfx_Set(CLIPPING, ON) command. func gfx_ChangeColour("oldcolr", "newcolr"), 0; // change pixel colour in clipping area // Syntax: gfx_ChangeColour(oldcolr, newcolr); // Usage : gfx_ChangeColour(0xFF00, 0XFFFF); // *Notes: func gfx_SetClipRegion(), 0; // set clipping area to the most recent extents // Syntax: gfx_SetClipRegion(); // Usage : var := gfx_SetClipRegion(); // *Notes: func gfx_Ellipse("x", "y", "xrad", "yrad", "colour"), 0; // Syntax: gfx_Ellipse(x, y, xrad, yrad, colour); // Usage : gfx_Ellipse(arg1, arg2, arg3, arg4, arg5); // Notes : Plots a coloured Ellipse on the screen at centre x,y // : with xradius = xrad and yradius = yrad. // : if PenSize = 0 Ellipse is Solid // : if PenSize = 1 Ellipse is Outline func gfx_EllipseFilled("x", "y", "xrad", "yrad", "colour"), 0; // Syntax: gfx_EllipseFilled(x, y, xrad, yrad, colour); // Usage : gfx_EllipseFilled(arg1, arg2, arg3, arg4, arg5); // Notes : Plots a coloured Ellipse on the screen at centre x,y // : with xradius = xrad and yradius = yrad. func gfx_Button("state", "x", "y", "buttonColour", "textColour", "font", "textWidth", "textHeight", "text"), 0; // Syntax: gfx_Button(mode, x, y, buttonColour, textColour, font, textWidth, textHeight, text); // Usage : gfx_Button(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); // Notes : Draws a 3 dimensional Text Button at screen location defined by // : x,y arguments (top left corner). The size of the button depends on // : the font, width, height and length of the text. // : The button appearance will depend on the state parameter setting: // : state = 0 : Button Pressed // : state = 1 : Button Raised func gfx_Panel("state", "x", "y", "width", "height", "colour"), 0; // Syntax: gfx_Panel("style", "x", "y", "width", "height", "colour"), 0; // Usage : gfx_Panel(PANEL_RAISED, x, y, w, h, GRAY); // Notes : Draws a panel (groupbox) at screen location defined by // : x, y, width and height with colour "colour". // : state = 0 : recessed // : state = 1 : raised func gfx_Slider("mode", "x1", "y1", "x2", "y2", "colour", "scale", "value"), 1; // Syntax: gfx_Slider(mode, x1, y1, x2, y2, colour, scale, value); // Usage : gfx_Slider(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); // Notes : Draws a 3 dimensional Slider Bar on the screen. // : Slider parameters are as follows: // : mode = 0 : Slider recessed // : mode = 1 : Slider raised // : x1, y1 = top left corner // : x2, y2 = bottom right corner // : scale = n : sets the full scale range from 0 to n // : value = m : sets the relative position of the thumb 0 <= m <= n // : returns:- func gfx_ScreenCopyPaste("xs", "ys", "xd", "yd", "width", "height"), 0; // Syntax: gfx_ScreenCopyPaste(xs, ys, xd, yd, width, height); // Usage : gfx_ScreenCopyPaste(arg1, arg2, arg3, arg4, arg5, arg6); // Notes : Copies an area of a screen from xs,ys of size given by width and height // : and pastes it to another location determined by xd, yd. func gfx_RGBto565("RED", "GREEN", "BLUE"), 1; // Syntax: gfx_RGBto565(red, green, blue); // Usage : gfx_RGBto565(arg1, arg2, arg3); // Notes : Returns the 16bit (565 format) colour value of a 24bit (R,G,B format) colour func gfx_332to565("COLOUR8BIT"), 1; // Syntax: gfx_332to565(colour); // Usage : gfx_332to565(arg); // Notes : Returns the 16bit (565 format) colour value of an 8 bit (332 format) colour func gfx_Selection("index", "backcolor", "textcolor"), 0; // Syntax: gfx_Selection("index", "backcolor", "textcolor"), 0; // Usage : gfx_Selection(1, RED, YELLOW); // Notes : Called prior to drawing a button, this function // : hilites the required text line on a multiline button. func gfx_TriangleFilled("x1","y1","x2","y2","x3","y3","colr"), 0; // draw a filled triangle // Syntax: gfx_TriangleFilled(x1, y1, x2, y2, x3, y3, colr); // Usage : gfx_TriangleFilled(arg1, arg2, arg3, arg4, arg5, arg6, arg7); // Notes : Plots a coloured Solid Triangle from between 3 vertices: x1,y1 x2,y2 x3,y3 // : Vertices must be specified in an anti-clockwise fashion func gfx_PolygonFilled("n", "&vx", "&vy", "colr"), 0; // draw a filled polygon from a table of vertices // Syntax: gfx_PolygonFilled(numbVertices, &vx, &y, colour); // Usage : gfx_PolygonFilled(arg1, x[array], y[array], arg2); // Notes : Plots a solid Polygon between specified vertices: x1,y1 x2,y2 .. xn,yn // : Vertices must be minimum of 3 and can be specified in any fashion func gfx_Origin("x", "y"), 0; // set relative screen offset for graphics objects // Syntax: gfx_Offset(x, y); // Usage : gfx_Offset(arg1, arg2); // Notes : Set the screen offset func gfx_Get("mode"), 1; // Syntax: gfx_Get(mode); // Usage : arg1 := gfx_Get(arg); // Notes : Returns various parameters to caller // : // : mode = X_MAX (mode 0) : current orientations maximum X value // : var := gfx_Get(X_MAX); // : Returns the maximum horizontal value of the display // : // : mode = Y_MAX (mode 1) : Vcurrent orientations maximum Y value // : var := gfx_Get(Y_MAX); // : Returns the maximum vertical value of the display // : // : mode = LEFT_POS (mode 2) : Left location of last Object // : var := gfx_Get(LEFT_POS); // : Returns the left location of the last drawn object // : such as a slider or button or an image/video // : // : mode = TOP_POS (mode 3) : Top location of Object // : var := gfx_Get(TOP_POS); // : Returns the top location of the last drawn object // : such as a slider or button or an image/video // : // : mode = RIGHT_POS (mode 4) : Right location of last Object // : var := gfx_Get(RIGHT_POS); // : Returns the right location of the last drawn object // : such as a slider or button or an image/video // : // : mode = BOTTOM_POS (mode 5) : Bottom location of Object // : var := gfx_Get(BOTTOM_POS ); // : Returns the bottom location of the last drawn object // : such as a slider or button or an image/video // : //==================================================// // Single parameter short-cuts // // for the gfx_Set functions // // These functions return the existing value before // // the change is made. // //==================================================// func gfx_PenSize("mode"), 1; // 0 graphics pen size, SOLD or OUTLINE func gfx_BGcolour("colour"), 1; // 1 graphics background colour func gfx_ObjectColour("colour"), 1; // 2 graphics object colour func gfx_Clipping("mode"), 0; // 3 graphics clipping ON/OFF func gfx_TransparentColour("colour"), 1; // 4 graphics image transparent mask colour func gfx_Transparency("mode"), 1; // 5 graphics image transparent mode ON/OFF func gfx_FrameDelay("milliseconds"), 1; // 6 graphics animation frame delay func gfx_ScreenMode("mode"), 1; // 7 graphics orientation LANDSCAPE, LANDSCAPE_R, PORTRAIT, PORTRAIT_R func gfx_OutlineColour("colour"), 1; // 8 graphics rectangle/circle outline colour func gfx_Contrast("value"), 1; // 9 graphics hardware value 0 to 9, 0=off, 1=lowest, 8=highest (only for AMOLED devices) func gfx_LinePattern("value"), 1; // 10 graphics line draw tesselation pattern (16 linear bits, 1=pixel off) func gfx_ColourMode("mode"), 1; // 11 graphics colour mode COLOUR8 or COLOUR16 (default colour 16) func gfx_BevelWidth("mode"), 1; // 12 graphics button bevel width func gfx_BevelShadow("value"), 1; // 13 graphics button bevel shadow depth func gfx_Xorigin("offset"), 1; // 14 graphics X origin func gfx_Yorigin("offset"), 1; // 15 graphics Y origin //==================================================// // uSD/FLASH Function Prototypes // //==================================================// func media_Video("x", "y"), 0; // display movie at position x y // Syntax: media_Video(x, y); // Usage : media_Video(arg1, arg2); // Notes : Play a Video/Animation clip from the uSD card at screen location // : specified by x,y (top left corner). The location of the clip in the // : uSD card must be specified by media_setSector(Video_Sector_Add) function. func media_VideoFrame("x", "y","framenumber"), 0; // display required frame from a movie at x y // Syntax: media_VideoFrame(Frame_number); // Usage : arg1 := media_VideoFrame(); // Notes : After a pointer to a valid video has been set with media_SetSector, // : calling this function shows each fram sequentially, returning // : the number of frames remaining. The position of the image is // : at the current origin as set with gfx_MoveTo(...); func media_SetAdd("HiWord", "LoWord"), 0; // set stream byte address // Syntax: media_SetAdd(AddHiWord, AddLoWord); // Usage : media_SetAdd(arg1, arg2); // Notes : Set uSD internal Address pointer for bytewise access func media_SetSector("HiWord", "LoWord"), 0; // set stream sector address // Syntax: media_SetSector(SectHiWord, SectLoWord); // Usage : media_SetSector(arg1, arg2); // Notes : Set uSD internal Sector pointer for sector block access func media_RdSector("*destination"), 1; // Syntax: media_RdSector(*destination); // Usage : media_RdSector(rdblock); // Notes : Reads and Returns 512 bytes (256 words) into a destination // : block (eg rdblock[256]) pointed to by the internal Sector pointer. // : After the read the Sector pointer is automatically incremented by 1. // : Returns TRUE if uSD response was TRUE func media_WrSector("*source"), 1; // Syntax: media_WrSector(*source); // Usage : media_WrSector(wrblock); // Notes : Writes 512 bytes (256 words) from a source memory block // : (eg wrblock[256]) into the uSD card. After the write the Sector // : pointer is automatically incremented by 1. // : Returns TRUE if uSD response was TRUE func media_ReadByte(), 1; // read a byte at the current stream position // Syntax: media_RdByte(); // Usage : var := media_RdByte(); // Notes : Reads and Returns a single byte of data from the // : uSD card pointed to by the internal Address pointer. // : After the read the Address pointer is automatically // : incremented by 1. func media_ReadWord(), 1; // read a word at the current stream position // Syntax: media_ReadWord(); // Usage : var := media_ReadWord(); // *Notes : Reads and Returns a single word of data from the // : uSD card pointed to by the internal Address pointer. // : After the read the Address pointer is automatically // : incremented by 2. func media_WriteByte("byte"), 1; // write a byte to the current stream position // Syntax: media_WriteByte(arg1); // Usage : var := media_WriteByte(arg1); // *Notes : Writes and Returns xxxxx // : After the write the Address pointer is automatically // : incremented by 1. func media_WriteWord("word"), 1; // write a word to the current stream position // Syntax: media_WriteWord(arg1); // Usage : var := media_WriteWord(arg1); // *Notes : Writes and Returns xxxxx // : After the write the Address pointer is automatically // : incremented by 2. func media_Image("x", "y"), 0; // display image at position x y // Syntax: media_Image(x, y); // Usage : media_Image(arg1, arg2); // Notes : Display an image from the uSD card at screen location // : specified by x,y (top left corner). The location of the // : Image in the uSD card must be specified by // : media_setSector(Image_Sector_Add) function. func media_Flush(), 1; // after writing to media, flush the sector and write // Syntax: media_Flush(); // Usage : var := media_Flush(); // *Notes : After writing any data to a sector, media_Flush() should be called to ensure that the current sector that // : is being written is correctly stored back to the media else write operations may be unpredictable. func media_Init(), 1; // initialize uSD card // Usage : media_Init(); // Notes : Initialise uSD CARD // : Response: 0 = No Card // : 1 = Card Initialised //==============================================// // Communications Function Prototypes // //==============================================// func com_Init("buf","bufsize","qualifier"), 0; // set up a interrupt driven ring buffer for comms // Syntax: com_Init(buffer, bufsize, qualifier); // Usage1: com_Init(mybuf, 20, 0); // Usage2: com_Init(mybuf, 20, ':'); // Notes : initialize a serial capture buffer for the comms input // : The program must declare a var array as a circular buffer. // : Usage1 declares a circular buffer which will continually // : buffer characters. // : Usage2 must receive ':' before any characters will // : accumulate in the buffer. func com_Reset(), 0; // reset the comms receiver // Syntax: com_Reset(); // Usage : com_Reset(); // Notes : reset comms to default polled mode func com_Count(), 1; // return count of characters in receive buffer // Syntax: com_Count(); // Usage : arg := com_Count(); // Notes : return count of buffered characters in buffer attachment func com_Full(), 1; // return TRUE if receiver buffer filled to capcity // Syntax: com_Full(); // Usage : if (com_Full() ,,,, go read buffer; // Notes : return true if buffer full (not necessarily an error if // : buffer is sized to a packet size) func com_Error(), 1; // return comms errors comms error occurred // Syntax: com_Error(); // Usage : if (com_Error() ) ...... take recovery action; // Notes : return non zero if any errors low level comms errors occured // returns : // bit0 = Receiver Overflow Error // bit1 = Receiver Framing Error // bit2 = Transmit Buffer Overflow func com_Sync(), 1; // returns TRUE if qualifier has been received // Syntax: com_Sync(); // Usage : com_Sync(); // return true if sync character has been received in com_Init("...") mode func com_TXbuffer("buf", "bufsize", "pin"), 0; // sets the buffer location for buffered transmission // Syntax: com_TXbuffer("buf", "bufsize", "pin"); // Usage : com_TXbuffer(mybuf, 1024, IO1_PIN); // set the TX buffer, usin IO1_PIN for turnaround // Usage : com_TXbuffer(0, 0, 0); // revert to non buffered service // Notes : initialize a serial buffer for the COM0 output. // : The program must declare a var array as a circular buffer. // : When a TX buffer is declared for comms, the transmission // : of characters becomes non blocking. The only time // : blocking will occur is if the buffer has insufficient space // : to accept the next character, in which case the function // : will wait for buffer space to become available. If the // : TX buffer is no longer required, just set the buffer pointer // : to zero, the size in this case doesnt matter and is ignored. // : The function can resize or reallocated to another buffer at // : any time. The buffer is flushed before any changes are made. // : "pin" designates an IO pin to control a bi-directional // : control device for half duplex mode. "pin" will go HI at the // : start of a transmission, and will return low after the final // : byte is transmitted. If not required, just set "pin" to zero. func com_TXcount(), 1; // return count of characters in COM0 TX buffer // Syntax: com_TXcount(); // Usage : arg := com_Count(); // Notes : return count of characters remaining in COM0 transmit buffer // : that was previously allocated with com_TXbuffer(...); func com_TXemptyEvent("function"), 1; // sets a function to be called when COM0 TX buffer empty // Syntax: com_TXemptyEvent(function); // Usage : arg := com_TXemptyEvent(); // Notes : If a comms TX buffer that was previously allocated with // : com_TXbuffer(...);, this function can be used to set up // : a function to be called when the COM0 TX buffer is empty. // : This is useful for either reloading the TX buffer, setting // : or clearing a pin to change the direction of eg a RS485 // : line driver, or any other form of traffic control. // : The event function must not have any parameters. // : To disable the event, simply call com_TXemptyEvent(0). // : com_TXbuffer(...); also resets any active event. // : com_TXemptyEvent returns any previous event function // : address, or zero if there was no previous function. func com_TXbufferHold("state"), 1; // hold or release a com_TXbuffer // Usage : arg := com_TXbufferHold(ON); // hold the buffer while we fill it // Usage : arg := com_TXbufferHold(OFF); // start sending the buffer // Notes : Expecting that a comms TX buffer that was previously allocated with // : com_TXbuffer(...);, com_TXbufferHold(ON) can be used to stop // : the buffer being sent wile it is being loaded. Mormally, when // : using buffered comms, the transmit process will begin // : immediately. This is often undesirable for 2 reasons, // : 1] you may wish to build a packet then send it later // : 2] when using com_TXemptyEvent erroneous empty events will occur // : as the FIFO buffer is constantly trying to empty while // : you are busy tring to fill it. // return -1 if function is called illegally when TX comms is not buffered. // return buffer count when called with argument of 1, eg com_TXbufferHold(ON) // return 0 when argument is zero, eg com_TXbufferHold(OFF) //=============================================================// // Auxilliary Communications Function Prototypes //=============================================================// func com1_Init("buffer", "bufsize", "qualifier"), 0; // Syntax: com_Init(buffer, bufsize, qualifier); // Usage1: com_Init(mybuf, 20, 0); // Usage2: com_Init(mybuf, 20, ':'); // Notes : initialize a serial capture buffer for the comms input // : The program must declare a var array as a circular buffer. // : Usage1 declares a circular buffer which will continually // : buffer characters. // : Usage2 must receive ':' before any characters will // : accumulate in the buffer. func com1_Reset(), 0; // Syntax: com_Reset(); // Usage : com_Reset(); // Notes : reset comms receiver to default polled mode func com1_Count(), 1; // Syntax: com_Count(); // Usage : arg := com_Count(); // Notes : return count of characters in receive buffer func com1_Full(), 1; // Syntax: com_Full(); // Usage : if (com_Full() ,,,, go read buffer; // Notes : return true if receive buffer full func com1_Error(), 1; // Syntax: com_Error(); // Usage : if (com_Error() ) ...... take recovery action; // Notes : return non zero if any level comms errors occured // returns : // bit0 = Receiver Overflow Error // bit1 = Receiver Framing Error // bit2 = Transmit Buffer Overflow func com1_Sync(), 1; // Syntax: com_Sync(); // Usage : com_Sync(); // Notes : return true if sync character has been received in com_Init("...") mode func com1_TXbuffer("buf", "bufsize", "pin"), 0; // sets the buffer location for buffered transmission // Syntax: com1_TXbuffer("buf", "bufsize", "pin"); // Usage : com1_TXbuffer(mybuf, 1024, IO1_PIN); // set the TX buffer, usin IO1_PIN for turnaround // Usage : com1_TXbuffer(0, 0, 0); // revert to non buffered service // Notes : initialize a serial buffer for the COM1 output. // : The program must declare a var array as a circular buffer. // : When a TX buffer is declared for comms, the transmission // : of characters becomes non blocking. The only time // : blocking will occur is if the buffer has insufficient space // : to accept the next character, in which case the function // : will wait for buffer space to become available. If the // : TX buffer is no longer required, just set the buffer pointer // : to zero, the size in this case doesnt matter and is ignored. // : The function can resize or reallocated to another buffer at // : any time. The buffer is flushed before any changes are made. // : "pin" designates an IO pin to control a bi-directional // : control device for half duplex mode. "pin" will go HI at the // : start of a transmission, and will return low after the final // : byte is transmitted. If not required, just set "pin" to zero. func com1_TXcount(), 1; // return count of characters in COM1 TX buffer // Syntax: com1_TXcount(); // Usage : arg := com1_Count(); // Notes : return count of characters remaining in COM1 transmit buffer // : that was previously allocated with com1_TXbuffer(...); func com1_TXemptyEvent("function"), 1; // sets a function to be called when COM1 TX buffer empty // Syntax: com1_TXemptyEvent(function); // Usage : arg := com1_TXemptyEvent(); // Notes : If a comms TX buffer that was previously allocated with // : com1_TXbuffer(...);, this function can be used to set up // : a function to be called when the COM1 TX buffer is empty. // : This is useful for either reloading the TX buffer, setting // : or clearing a pin to change the direction of eg a RS485 // : line driver, or any other form of traffic control. // : The event function must not have any parameters. // : To disable the event, simply call com1_TXemptyEvent(0). // : com1_TXbuffer(...); also resets any active event. // : com1_TXemptyEvent returns any previous event function // : address, or zero if there was no previous function. func com1_TXbufferHold("state"), 1; // hold or release a com1_TXbuffer // Usage : arg := com1_TXbufferHold(ON); // hold the buffer while we fill it // Usage : arg := com1_TXbufferHold(OFF); // start sending the buffer // Notes : Expecting that a comms TX buffer that was previously allocated with // : com1_TXbuffer(...);, com1_TXbufferHold(ON) can be used to stop // : the buffer being sent wile it is being loaded. Mormally, when // : using buffered comms, the transmit process will begin // : immediately. This is often undesirable for 2 reasons, // : 1] you may wish to build a packet then send it later // : 2] when using com_TXemptyEvent erroneous empty events will occur // : as the FIFO buffer is constantly trying to empty while // : you are busy tring to fill it. // return -1 if function is called illegally when TX comms is not buffered. // return buffer count when called with argument of 1, eg com1_TXbufferHold(ON) // return 0 when argument is zero, eg com1_TXbufferHold(OFF) func serin1(), 1; // Syntax: serin1(); // Usage : char := serin1(); // Notes : return the next available character from COM1 func serout1("char"), 0; // Syntax: serout1("char"); // Usage : serout1(ch); // Notes : send character to COM1 func com_SetBaud("comport","baudrate/10"), 1; // Syntax: com_SetBaud("comport","baudrate/10"); // Usage : com_SetBaud(COM1, 960); // set COM1 to 9600 baud // Notes : sets to any viable baud rate from 160 to 655350 // return true if baud rate was acceptable //==============================================// // Display Access // //==============================================// func disp_Init("INIT_table", "GRAM_code"), 0; // initialize display with required tables // NB not available on current Picaso GFX2 func disp_SetReg("register", "data"), 0; // Syntax: display_SetReg(register, data); // Usage : display_SetReg(arg1, arg2); // Notes : Sets uLCD specific display driver registers. Refer // : to appropriate display driver data sheet. func disp_setGRAM("x1","y1","x2","y2"), 0; // set GRAM window // Syntax: disp_setGRAM(x1, y1, x2, y2); // Usage : disp_setGRAM(arg1, arg2, arg3, arg4); // Notes : Prepares the GRAM area for user access. // : Data can now be written with disp_GRAM. // : GRAM will be set accordingly for the correct screen mode. // : the LO word of the 32 bit pixel count is returned. This is // : usually all that is needed unlse GRAM area exceeds 256^2 // : A copy of the 32bit value can be found in // : GRAM_PIXEL_COUNT_LO and GRAM_PIXEL_COUNT_HI func disp_WrGRAM("colour"), 0; // Syntax: display_WrGRAM(colour); // Usage : display_WrGRAM(arg); // Notes : Data can be written to the GRAM consecutively using // : this function once the GRAM access window has been setup. func disp_WriteControl("value"), 0; // write a control byte to the display func disp_WriteWord("value"), 0; // write a word to the display func disp_ReadWord(), 1; // read a word from the display // Syntax: disp_ReadWord(); // Usage : x:=disp_ReadWord(); // Notes : Read a word from the controller // Eg: : disp_WriteControl(0); // select Ilitek ID register // : print(disp_ReadWord()); // print ID // : (Many displays are write only) // //==============================================// // unadorned SPI functions // //==============================================// func spi_Init("speed","ip_mode","op_mode"), 0; // set the SPI port, not used if uSD active func spi_Read(), 1; // read a raw byte from SPI (lowers CS) func spi_Write("byte"), 0; // write a raw byte to SPI (lowers CS) func spi_Disable(), 0; // disable SPI reading or writing (raise CS) // //==============================================// // flash device specific functions // //==============================================// func flash_SIG(), 1; // read Jedecsignature from SPI Flash device func flash_ID(), 1; // read ID code from FLASH device func flash_BulkErase(), 0; // erase the entire FLASH device func flash_BlockErase("block"), 1; // erase the required 64k flash block // // //==============================================// // string and character size function // //==============================================// func charwidth("char"), 1; // return width of a character in pixel units func charheight("char"), 1; // return height of a character in pixel units func strwidth("pointer"), 1; // return width of a string in pixel units func strheight(), 1; // return height of a string in pixel units //------------------------------------------------------------------// // I2C Function Prototypes //------------------------------------------------------------------// func I2C_Open("speed"), 0; // Syntax: I2C_Open(speed), // Usage : I2C_Open(I2C_MED); // Notes : configures the I2C module // : speed can be I2C_SLOW, I2C_MED, I2C_FAST (100khz, 400khz, 1mhz) func I2C_Close(), 0; // Syntax: I2C_Close(); // Usage : I2C_Close(); // Notes : disables the I2C1 module. func I2C_Start(), 1; // Syntax: I2C_Start(); // Usage : I2C_Start(); // Notes : generates a Start condition. // : returns true if successful (usually ignored) func I2C_Stop(), 1; // Syntax: I2C_Stop(); // Usage : I2C_Stop(); // Notes : generates a Stop condition. // : returns true if successful (usually ignored) func I2C_Restart(), 1; // Syntax: I2C_Restart(); // Usage : I2C_Restart(); // Notes : generates a Restart condition. // : returns true if successful (usually ignored) func I2C_Read(), 1; // Syntax: I2C_Read(); // Usage : ch := I2C_Read(); // Notes : reads a single byte from the I2C Bus. func I2C_Write("byte"), 1; // Syntax: I2C_Write(byte); // Usage : r := I2C_Write(ch); // Notes : is used to write a byte to the I2C bus. // : Returns 0 if failed, 1 if no ack, 2 if ack func I2C_Ack(), 0; // Syntax: I2C_Ack(); // Usage : I2C_Ack(); // Notes : generates the acknowledge condition. func I2C_Nack(), 0; // Syntax: I2C_Nack(); // Usage : I2C_Nack(); // Notes : generates the negative acknowledge condition. func I2C_AckStatus(), 0; // Syntax: I2C_AckStatus(); // Usage : r := I2C_AckStatus(); // Notes : returns the ACK status from the device. func I2C_AckPoll("control"), 1; // Syntax: I2C_AckPoll(); // Usage : r := I2C_AckPoll(0xA0); // Notes : waits for a device to return from ACK polling. func I2C_Idle(), 0; // Syntax: I2C_Idle(); // Usage : I2C_Idle(); // Notes : waits until the I2C Bus is Inactive. func I2C_Gets("buffer", "size"), 1; // Syntax: I2C_Gets("buffer", "size"); // Usage : r := I2C_Gets(mybuf, 16); // Notes : only reads up to "size" characters into "buffer" // : Reads up to asciiz terminator including terminator func I2C_Getn("buffer", "size"), 1; // Syntax: I2C_Gets("buffer", "size"); // Usage : r := I2C_Gets(mybuf, 16); // Notes : reads "size" bytes into "buffer" // : func I2C_Puts("buffer"), 1; // Syntax: I2C_Puts("buffer"); // Usage : r := I2C_Puts(mybuf); // Notes : writes an asciiz string to the I2C device // : returns count of characters written func I2C_Putn("buffer", "count"), 1; // Syntax: I2C_Putn("buffer","count"); // Usage : r := I2C_Puts(mybuf,10); // Notes : writes up to "size" bytes to the I2C device // : returns number of bytes written //------------------------------------------------------------------// // Image Control Function Prototypes //------------------------------------------------------------------// func img_SetPosition("handle", "index", "xpos", "ypos"), 1; // Syntax: img_SetPosition(handle, index, xpos, ypos); // Usage : r := img_SetPosition(hImageList, imagenum, x, y); // Notes : set the position where the image will be displayed // : returns true if index was ok and function was successful. // : you may turn off an image so when img_Refresh is called, // : the image will not be shown func img_Enable("handle", "index"), 1; // Syntax: img_Enable(handle, index); // Usage : r := img_Enable(hImageList, imagenum); // Notes : enable image in a image list // : returns true if index was ok and function was successful. // : this is the default state so when img_Refresh is called, // : all the images in the list will be shown // : if index is set to -1, all of the images are enabled func img_Disable("handle", "index"), 1; // Syntax: img_Disable(handle, index); // Usage : r := img_Disable(hImageList, imagenum); // Notes : disable image in a image list // : returns true if index was ok and function was successful. // : you must turn off an image so when img_Refresh is called, // : the image will not be shown. // : if index is set to -1, all of the images are disabled func img_Darken("handle", "index"), 1; // Syntax: img_Darken(handle, index); // Usage : r := img_Darken(hImageList, imagenum); // Notes : darken image in a image list // : returns true if index was ok and function was successful. // : if index is set to -1, all of the images are darkened // : NB:- this feature will only work for the next refresh, then // : the image reverts back to normal when displayed again. func img_Lighten("handle", "index"), 1; // Syntax: img_Lighten(handle, index); // Usage : r := img_Lighten(hImageList, imagenum); // Notes : lighten image in a image list // : returns true if index was ok and function was successful. // : if index is set to -1, all of the images are lightened // : NB:- this feature will only work for the next refresh, then // : the image reverts back to normal when displayed again. func img_SetWord("handle", "index", "offset", "word"), 1; // Syntax: img_SetWord(handle, index, offset, word); // Usage : img_SetWord(hndl, 5, IMAGE_XPOS, 10); // Notes : set specified word (0-7) in a image entry // : returns TRUE if successful, return value usually ignored. func img_GetWord("handle", "index", "offset"), 1; // Syntax: myvar := img_GetWord("handle", "index", "offset"); // Usage : myvar := img_GetWord(hndl, 5, IMAGE_YPOS); // Notes : returns specified word (0-14) from an image entry // : refer to image control entry offsets. func img_Show("handle", "index"), 1; // Syntax: img_Show(handle, index); // Usage : display image entry (regardless of enable/disable) // : returns TRUE if successful, return value usually ignored. func img_SetAttributes("handle", "index","value"), 1; // Syntax: img_SetAttributes("handle", "index","offset"); // Usage : img_SetAttributes(hndl, 5, I_TOPMOST); // Notes : This function SETS one or more bits in the IMAGE_FLAGS field // : of an image control entry. "value" refers to various bits in // : the image control entry (see image attribute flags). // : A '1' bit in the "value" field SETS the respective bit // : in the IMAGE_FLAGS field of the image control entry. // : returns TRUE if successful, return value usually ignored. func img_ClearAttributes("handle", "index","value"), 1; // Syntax: img_ClearAttributes("handle", "index","offset"); // Usage : img_ClearAttributes(hndl, 5, I_TOPMOST); // Notes : This function CLEARS one or more bits in the IMAGE_FLAGS field // : of an image control entry. "value" refers to various bits in // : the image control entry (see image attribute flags) // : a '1' bit in the "value" field CLEARS the respective bit // : in the IMAGE_FLAGS field of the image control entry. // : returns TRUE if successful, return value usually ignored. func img_Touched("handle", "index"), 1; // Syntax: r := img_Touched(handle, index); // Usage : img_Touched(hndl, 17); // : returns -1 if image not touched, or returns index // Notes : if index is passed as -1, function tests all images, // : and returns -1 if image not touched, or returns index. //------------------------------------------------------------------// // Timer Function Prototypes //------------------------------------------------------------------// func sys_T(), 1; // Syntax: sys_T(); // Usage : t := sys_T(); // Notes : return the current value of the rolling system timer (1msec) LO word func sys_T_HI(), 1; // Syntax: sys_T_HI(); // Usage : t := sys_T_HI(); // Notes : return the current value of the rolling system timer (1msec) HI word func sys_SetTimer("timernum","value"), 0; // Syntax: sys_SetTimer("timernum", "value"); // Usage : sys_SetTimer(TIMER5, 10000); // Notes : set a countdown on the selected timer, or 'top up' if required. // : There ar 8 timers TIMER0 to TIMER7 which stop at the count of 0 // : Maximum timeout period is 65.535 seconds // : A timer can be read with the sys_GetTimer("timernum") function func sys_GetTimer("timernum"), 1; // Syntax: t := sys_GetTimer("timernum"); // Usage : t := sys_GetTimer(TIMER3); // Notes : returns 0 if timer has expired, or the current countdown value. // : There ar 8 timers TIMER0 to TIMER7 which stop at the count of 0 // : Maximum timeout period is 65.535 seconds // : A timer must be set with the sys_SetTimer("timernum","value") function func sys_SetTimerEvent("timernum","function"), 1; // Syntax: sys_SetTimerFunction("timernum", "function"); // Usage : sys_SetTimer(TIMER5, myfunc); // Notes : set a function to be called for selected timer. // : When the timer reaches zero, the function is called. // : The called function must not have any parameters // : sys_SetTimerEvent returns any previous event function // : address, or zero if there was no previous function. func sys_EventQueue(), 1; // Syntax: sys_EventQueue(); // Usage : tasks := sys_EventQueue(); // Notes : returns the max number of events that were pending // : in the timer queue since the last call to this function. // : This can be used to assess timer event overhead burden, // : especially after or during a sys_EventsPostpone action. func sys_EventsPostpone(), 0; // Syntax: sys_EventPostpone(); // Usage : sys_EventPostpone(); // postpone the event queue // Notes : postpone any events until the sys_EventResume function is executed // : The timer event queue will continue to queue events, but no action // : will take place untill a sys_EventResume function is encountered. // : The queue will continue to receive up to 32 events before discarding // : any further events. This function is required to allow a sequence of // : instructions or functions to occur that would otherwise be corrupted // : by an event occuring during the sequence of instructions or functions. // : A good example of this is when you set a position to print, if there // : was no way of locking the current sequence, an event may occur which // : does a similar thing, and a contention would occur - printing to // : the wrong position. This function should be used wisely, if any action // : that is required would take considerable time, it is better to disable // : any conflicting event functions with a bypass flag, then restart the // : conflicting event by re-issuing a timer value. func sys_EventsResume(), 0; // Syntax: sys_EventsResume(); // Usage : sys_EventsResume(); // resume the event queue // Notes : resume any postponed events. The queue will try to execute any timer // : events that were incurred during the postponed period. func sys_Sleep("units"), 1; // Syntax: t := sys_Sleep("units"); // Usage : t := sys_Sleep(10); // Notes : sets the display into low power mode for a period of time. // : Touching the touch screen will also wake from sleep. // : Returns remaining sleep units. func iterator("offset"), 0; // Syntax: t := iterator("offset"); // Usage : t := iterator(10); // Notes : set the iterator size for ++/-- // : The next postinc,postdec,preinc of predec will alter // : by the specified value. // : The offset will return to 1 after the next operation. //------------------------------------------------------------------// // Touch Screen Function Prototypes //------------------------------------------------------------------// func touch_DetectRegion("x1" ,"y1", "x2", "y2"), 0; // Syntax: touch_DetectRegion(x1, y1, x2, y2); // Usage : touch_DetectRegion(arg1, arg2, arg3, arg4); // Notes : Specifies a new touch detect region on the screen // : such that only touch activity in that region will // : be reported by the status poll touch_Get(TOUCH_STATUS); func touch_Set("mode"), 0; // Syntax: touch_Set(mode); // Usage : touch_Set(arg); // Notes : Sets various Touch Screen related parameters // : // : mode = TOUCH_ENABLE (mode 0) Enable Touch Screen // : touch_Set(TOUCH_ENABLE); // : Enables and initialises Touch Screen hardware // : // : mode = TOUCH_DISABLE (mode 1) Disable Touch Screen // : touch_Set(TOUCH_DISABLE ); // : Disables the Touch Screen // : Note: Touch Screen runs in the background and disabling // : it when not in use will free up extra resources // : such as 4DVM CPU cycles. // : // : mode = TOUCH_REGIONDEFAULT (mode 2) Default Touch Region // : touch_Set(TOUCH_REGIONDEFAULT); // : This will reset the current active region to default // : to the full screen without the application having to // : set a new active region for the full screen. // : (NB for 'no touch' devices - like uVGAII or OLED's/LCD's // : that requre to be interfaced with an external pointing // : device, values that are poked into TOUCH_DRIVE will be // : read with the touch_Get() function) func touch_Get("mode"), 1; // Syntax: touch_Get(mode); // Usage : arg1 := touch_Get(arg); // Notes : Returns various Touch Screen parameters to caller // : // : mode = TOUCH_STATUS (mode 0) // : var := touch_Get(TOUCH_STATUS); // : Returns the various states of the touch screen // : 0 = NOTOUCH // : 1 = TOUCH_PRESSED // : 2 = TOUCH_RELEASED // : 3 = TOUCH_MOVING // : // : mode = TOUCH_GETX (mode 1) // : var := touch_Get(TOUCH_GETX); // : Returns the X coordinates of the touch // : // : mode = TOUCH_GETY (mode 2) // : var := touch_Get(TOUCH_GETY); // : Returns the Y coordinates of the touch //------------------------------------------------------------------// // CTYPE Function Prototypes //------------------------------------------------------------------// func isdigit("char"), 1; //Returns a 1 if the character is an ascii digit else returns a 0 // Syntax: isdigit("char"); // Usage : Var := isdigit(ch); // Notes : char specifies the ascii character for the test // : 0 : char is not an ascii digit. // : 1 : char is an ascii digit.. // : Valid range is "0123456789" func isxdigit("char"), 1; //Returns a 1 if the character is an ascii hexadecimal digit else returns a 0 // Syntax: isxdigit("char"); // Usage : Var := isxdigit(ch); // Notes : char specifies the ascii character for the test // : 0 : char is not an ascii hexadecimal digit. // : 1 : char is an ascii hexadecimal digit.. // : Valid range is "0123456789ABCDEF" func isupper("char"), 1; //Returns a 1 if the character is an ascii upper case letter else returns a 0 // Syntax: isupper("char"); // Usage : Var := isupper(ch); // Notes : char specifies the ascii character for the test // : 0 : char is not an ascii upper-case letter. // : 1 : char is an ascii upper-case letter. // : Valid range is "ABCD....WXYZ" func islower("char"), 1; //Returns a 1 if the character is an ascii lower case letter else returns a 0 // Syntax: islower("char"); // Usage : Var := islower(ch); // Notes : char specifies the ascii character for the test // : 0 : char is not an ascii lower-case letter. // : 1 : char is an ascii lower-case letter. // : Valid range is "abcd....wxyz" func isalpha("char"), 1; //Returns a 1 if the character is an ascii lower or upper case letter else returns a 0 // Syntax: isalpha("char"); // Usage : Var := isalpha(ch); // Notes : char specifies the ascii character for the test // : 0 : char is not an ascii lower or upper case letter. // : 1 : char is an ascii lower or upper case letter. // : Valid range is "ABCD...XYZ", "abcd....wxyz" func isalnum("char"), 1; //Returns a 1 if the character is an ascii alpha numeric else returns a 0 // Syntax: isalnum("char"); // Usage : Var := isalnum(ch); // Notes : char specifies the ascii character for the test // : 0 : char is not an ascii alphanumeric character. // : 1 : char is an ascii alphanumeric character. // : Valid range is "ABCD...XYZ", "abcd....wxyz", "0123456789" func isprint("char"), 1; //Returns a 1 if the character is a printible ascii char else returns a 0 // Syntax: isprint("char"); // Usage : Var := isprint(ch); // Notes : char specifies the ascii character for the test // : 0 : char is not a printable ascii character. // : 1 : char is a printable ascii character. // : Valid range is "0x20...0x7F" func isspace("char"), 1; //Returns a 1 if the character is any one of the space type chars else returns a 0 // Syntax: isspace("char"); // Usage : Var := isspace(ch); // Notes : char specifies the ascii character for the test // : 0 : char is not a space type character. // : 1 : char is a space type character. // : Valid range is space, formfeed, newline, carriage return, tab, vertical tab //unformatted func iswhite("char"), 1; // // Syntax: iswhite("char"); // Usage : Var := iswhite(ch); // Notes : char specifies the ascii character for the test // : 0 : char is not a space or tab character. // : 1 : char is not a space or tab character. // : Valid range is space or tab func toupper("char"), 1; //if character is lower case it returns the upper case equivalent else returns the passed char // Syntax: toupper("char"); // Usage : Var := toupper(ch); // Notes : char specifies the ascii character for the test // : "ABCD....XYZ" : if character is a lower case letter. // : char : if character is not a lower case letter. // : Valid range is "abcd....wxyz" func tolower("char"), 1; //if character is upper case it returns the lower case equivalent else returns the passed char // Syntax: tolower("char"); // Usage : Var := tolower(ch); // Notes : char specifies the ascii character for the test // : "abcd....xyz" : if character is an upper case letter. // : char : if character is not an upper case letter. // : Valid range is "ABCD....WXYZ" func LObyte("var"), 1; //Returns the lower byte (lower 8 bits) of a 16 bit variable. // Syntax: LObyte(var); // Usage : myVar := LObyte(myvar2); // Notes : var specifies the user variable // : Returns the lower byte (lower 8 bits) of a 16 bit variable func HIbyte("var"), 1; //Returns the High byte (upper 8 bits) of a 16 bit variable. // Syntax: HIbyte(var); // Usage : myVar := HIbyte(myvar2); // Notes : var specifies the user variable // : Returns the high byte (upper 8 bits) of a 16 bit variable func ByteSwap("var"), 1; //Returns the swapped upper and lower bytes of a 16 bit variable. // Syntax: ByteSwap(var); // Usage : myVar := ByteSwap(myvar2); // Notes : var specifies the user variable // : Returns the endian swapped value of a 16 bit variable //------------------------------------------------------------------// // Memory Allocation Function Prototypes //------------------------------------------------------------------// func mem_Alloc("size"), 1; // Syntax: mem_Alloc(bytesize); // Usage : myvar := mem_Alloc(100); // Notes : Allocate a block of memory to pointer myvar // : The allocated memory contains garbage but is a fast allocation. // : The block must later be released with mem_Free(); // : returns 0 if function fails func mem_AllocV("size"), 1; // Syntax: mem_AllocV(bytesize); // Usage : myvar := mem_AllocV(100); // Notes : Allocate a block of memory to pointer myvar // : The block of memory is filled with signature values // : the block starts with A5,5A then fills with incrementing // : number eg:- A5,5A,00,01,02,03...FF,00,11.... // : This can be helpful when debugging // : The block must later be released with mem_Free(); // : returns 0 if function fails func mem_AllocZ("size"), 1; // Syntax: mem_AllocZ(bytesize); // Usage : myvar := mem_AllocC(100); // Notes : Allocate a zeroed block of memory to pointer myvar // : The block of memory is filled with zeroes // : The block must later be released with mem_Free(); // : returns 0 if function fails func mem_Realloc("ptr", "size"), 1; // Syntax: myvar := mem_Realloc("ptr", "size"); // Usage : myvar := mem_Realloc(ptr, size); // Notes : The function may move the memory block to a new location, // : in which case the new location is returned. // : The content of the memory block is preserved up to the lesser // : of the new and old sizes, even if the block is moved. // : If the new size is larger, the value of the newly allocated // : portion is indeterminate. In case that ptr is NULL, // : the function behaves exactly as mem_Alloc, assigning a new block // : of size bytes and returning a pointer to the beginning of it. // : In case that the size is 0, the memory previously allocated in // : ptr is deallocated as if a call to mem_Free()was made, and a NULL // : pointer is returned. func mem_Free("allocation"), 1; // Syntax: myvar := mem_Free(allocation); // Usage : myvar := mem_Free(myvar); // Notes : De-allocate a block of memory previously created with // : mem_Alloc(...), mem_AllocV(...); or mem_AllocZ(...); // : returns 0 if function fails func mem_Heap(), 1; // Syntax: myvar := mem_Heap(); // Usage : myvar := mem_Heap(); // Notes : returns bytecount available in heap // : func mem_Set("ptr","char","size"), 1; // Syntax: mem_Set(ptr,char,bytesize); // Usage : mem_Set(p, 'A', 100); // Notes : fill a block of memory with a byte value // : returns ptr func mem_Copy("src", "dest", "bytecount"), 1; // Syntax: myvar := mem_Copy(src, dest, bytesize); // Usage : myvar := mem_Copy(p1, p2, 100); // Notes : copy a word aligned block of memory from src to dest // : Note that count is a byte count, this facilitates // : copying word aligned byte arrays when using word // : aliggned packed strings. // : returns src func mem_Compare("ptr1","ptr2","count"), 1; // Syntax: myvar := mem_Compare(ptr1,ptr2,bytesize); // Usage : myvar := mem_Compare(p1, p2, 100); // Notes : compare blocks of memory at src, dest // : returns 0 if we have a match //------------------------------------------------------------------// // FAT16 Function Prototypes //------------------------------------------------------------------// func file_Error(), 1; // Syntax: myvar := file_Error(); // Usage : e := file_Error(); // Notes : return the most recent file error. // : func file_Count("filename"), 1; // Syntax: count := file_Count("filename"); // Usage : count := file_Count("*.4dg"); // Notes : returns number of files found that match the criteria func file_Dir("filename"), 1; // Syntax: count := file_Dir("filename"); // Usage : count := file_Dir("*.4dg"); // Notes : streams a string of filenames that agree with the search key // : returns number of files found that match the criteria func file_FindFirst("fname"), 1; // Syntax: res := file_FindFirst("fname"); // Usage : if (file_FindFirst("*.4xe") .... // Notes : returns true if at least 1 file exists // : that satisfies the file argument. // : Wildcards are usually used so if // : file_FindFirst returns true, further // : tests can be made using file_FindNext(); // : to find all the files that match the // : wildcard class. Note that the stream behaviour // : is the same as file_Dir. // : func file_FindNext(), 1; // Syntax: res := file_FindNext(); // Usage : while ((file_FindNext()) .... // Notes : returns true if more file exists // : that satisfies the file argument // : that was given for file_FindFirst. // : Wildcards must be used for // : file_FindFirst, else this function will // : always return zero as the only occurence // : will have already been found. // : Note that the stream behaviour // : is the same as file_Dir. // : func file_Exists("fname"), 1; // Syntax: res := file_Exists("fname"), // Usage : if(file_Exists("myfile") .... // Notes : returns true if file exists // : func file_Open("fname", "mode"), 1; // Syntax: handle := file_Open("fname","mode"), // Usage : handle := file_Open("myfile.txt", 'r'); // Notes : returns handle if file exists // : func file_Close("handle"), 1; // Syntax: res := file_Close("handle"); // Usage : res := file_Close(hnd1); // Notes : returns true if file closed ok // : func file_Read("*dest", "size", "handle"), 1; // Syntax: res := file_Read("*dest", "size", "handle"), // Usage : res := file_Read(memblock,20,hnd1); // Notes : returns number of characters read // : if "dest" is zero, data is read direct to GRAM window // : func file_Seek("handle", "HiWord", "LoWord"), 1; // Syntax: res := file_Seek("handle", "HiWord", "LoWord") // Usage : res := file_Seek(hSource, 0, 0x1234); // Notes : set file position to 0x00001234 (byte position 4660) // : for the file handle so subsequent data may be read // : from that position onwards with file_GetC(...), // : file_GetW(...) or file_GetS(...), or an image // : can be displayed with file_Image(...) // Notes : returns true if ok, usually ignored func file_Index("handle", "HiSize", "LoSize","recordnum"), 1; // Syntax: file_Index("handle", "HiSize", "LoSize","recordnum"), 1; // Usage : res := file_Index(hsource, 0, 1000, 123), 1; // Notes : set file seek position to 123000 // : for the file handle so subsequent data may be read // : from that record position onwards with file_GetC(...), // : file_GetW(...) or file_GetS(...), or an image // : can be displayed with file_Image(...) // Notes : returns true if ok, usually ignored func file_Tell("handle", "&HiWord", "&LoWord"), 1; // Syntax: file_Tell("handle", &HiWord, &LoWord); // Usage : file_Tell(fhndl, &SizeHi, &SizeLo); // Notes : Reads the 32 bit file pointer and stores it into 2 variables. // : returns true if function succeeded func file_Write("*source", "size", "handle"), 1; // Syntax: res := fwrite("*source", "size", "handle"), // Usage : res := fwrite(memblock, 20, hnd1); // Notes : returns number of bytes written // : func file_Size("handle", "&HiWord", "&LoWord"), 1; // Syntax: file_Size("handle", &HiWord, &LoWord); // Usage : file_Size(fhndl, &SizeHi, &SizeLo); // Notes : Reads the 32 bit file size and stores it into 2 variables. // : returns true if function succeeded func file_Image("x", "y", "handle"), 1; // Syntax: file_Image(x, y, handle); // Usage : file_Image(10, 10, hnd1); // Notes : Display an image from a file at the current file position. // : The image is displayed at x,y (with respect to top left corner). // : If there is more than 1 image in the file, it can be // : accessed with file_Seek(...) func file_ScreenCapture("x", "y", "width", "height", "handle"), 1; // Syntax: file_ScreenCapture(x, y, w, h, handle); // Usage : file_ScreenCapture(10, 10, 50,50, hnd1); // Notes : Save a image from screen to file at the current file position. // : The image can later be displayed with file_Image(...); // : The file may be opened in append mode to accumulate multiple // : images. Later, the images can be accessed with file_Seek(...); // : Note that the image will be sector aligned. // : All image headers must start on a sector boundary. // : The image is saved from x, y (with respect to top left corner) // : and the capture area is determined by "width" and "height". // : returns 0 if function succeeded func file_PutC("char","handle"), 1; // Syntax: file_PutC("char", "handle"); // Usage : file_PutC('x', hndl); // Notes : returns true if function succeeded func file_GetC("handle"), 1; // Syntax: file_GetC("handle"); // Usage : mychar := fgetC("handle"); // Notes : returns next char from file func file_PutW("word","handle"), 1; // Syntax: file_PutW("word","handle"); // Usage : file_PutW(0x1234, hndl); // Notes : returns true if function succeeded func file_GetW("handle"), 1; // Syntax: file_GetW("handle"); // Usage : myword := fgetW("handle"); // Notes : returns next word in file func file_PutS("*source", "handle"), 1; // Syntax: res := file_Puts("*source", "handle"), // Usage : res := file_Puts(mystring, hnd1); // Notes : returns number of characters written // : func file_GetS("*string", "size", "handle"), 1; // Syntax: res := file_Gets("*string", "size", "handle"); // Usage : res := file_Gets(mystr , 81, hnd1); // read up to 80 chars // Notes : get a string from a file // : returns pointer to string or null if failed. // : file_GetS(...) automatically appends a null-terminator to the data read. // : NB:- only reads up to "size-1" characters into "string" // : file_GetS(...) will stop reading when any of the following conditions are true: // : A] It has read n-1 bytes (one character is reserved for the null-terminator) // : B] It encounters a newline character (a line-feed in the compilers tested here), or // : C] It reaches the end of file // : D] A read error occurs. func file_Erase("fname"), 1; // Syntax: res := file_Erase("fname"); // Usage : res := file_Erase("myfile.txt"); // Notes : returns true if successful // : func file_Rewind("handle"), 1; // Syntax: res := file_Rewind("handle"); // Usage : res := file_Rewind(hnd1); // Notes : returns true if file rewound ok (usually ignored) // : resets the file pointer the the beginning of the open file. func file_LoadFunction("fname.4xe"), 1; // Syntax: res := file_LoadFunction("fname.4fn"); // Usage : myfunc := file_LoadFunction(myfuncname); // Notes : Load a function or program from disk and // : return a function pointer to the allocation. // : The function can then be invoked just like any other // : function would be called via a function pointer. // : Parameters may be passed to it in a conventional way. // : The function may be discarded at any time when no // : longer required, thus freeing its memory resources. // : The loaded function can be discarded with mem_Free(..) // : eg: // : popupWindow := file_LoadFunction("popupWindow1.4fn"); // : if(!popupWindow) goto LoadFunctionFailed; // could not load the function !!! // : then elsewhere in your program:- // : res := popupWindow(MYMODE,"My Title","My Popup Text"); // : if(res == QUIT_APPLICATION) goto exitApp; // : Later in your program, when popupWindow is no longer // : required for the application:- // : res := mem_Free(popupWindow); // : if(!res) goto FreeFunctionFailed; // should never happen if memory not corrupted // : The callers stack is shared by the loaded function, // : however any global variables in the loaded function // : are private to that function. // func file_Run("fname.4xe", "arglistptr"), 1; // Syntax: res := file_Run("fname.4xe","arglistptr"); // Usage : res := file_Run(fname, argptr); // Notes : current program releases any allocated memory but // : retains the stack and global memory. // : If arglistptr is 0, no arguments are passed, else // : arglist points to an array, the first element being // : the number of elements in the array. // : func 'main' in the called program accepts // : the arguments, if any. THe arguments can only // : be passed by value, no pointers or references can be // : used as all memory is cleared before the file // : is loaded. Refer to file_Exec and file_LoadFunction // : for functions that can pass by reference. func file_Exec("fname.4xe", "arglistptr"), 1; // Syntax: res := file_Exec("fname.4xe","arglistptr"); // Usage : res := file_Exec("fname.4xe","arglistptr"); // Notes : returns like a function, current program // : calling program is kept active and control returns to it. // : If arglistptr is 0, no arguments are passed, else // : arglist points to an array, the first element being // : the number of elements in the array. // : func 'main' in the called program accepts the arguments. // : This function is similar to file_LoadFunction(...), however, // : the function argument list is passed by pointer, and // : the memory consumed by the function is released as // : soon as the function completes. func file_LoadImageControl("fname1", "fname2", "mode"), 1; // Syntax: hImagelist := file_LoadImageControl ("controlfile", "imagefile", "mode"), // Usage : hImagelist := file_LoadImageControl ("resource.dat", "resource.gci", 0); // Notes : Reads a control file to create an image list. // : Returns NULL if function fails. // : Returns a handle (pointer to the memory allocation) to the // : image control list that has been created. // : "fname1" is the control list filename "*.dat" // : "fname2" is the image filename "*.gci" // Notes : This function Calculates the size of a chunk of memory required for // : a image list and populates it from the image control file ("*.dat") // : therefore, when imagelist is no longer required, you must de-allocate // : the image list memory by using eg:- mem_Free(hImagelist); // : to restore the heap. // : // : mode 0:- it is assumed that there is a graphics file with the // : file extension "fname2.gci". In this case, the images have been stored // : in a FAT16 file concurrently, and the offsets that ar derived from the // : "fname1.dat" file are saved in the image control so that the image control // : can open the file (*.gci) and us file_Seek to get to the position of the // : image which can then automatically be displayed using file_Image(xpos, ypos, hSource); // : mode 0 builds the image control quickly as it only scans the *.dat file // : for the file offsets and save them in the relevant entries in the image control. // : The penalty is that images take longer to find when displayed due to file_Seek // : overheads. // // : mode 1:- it is assumed that there is a graphics file with the // : file extension "fname2.gci". In this case, the images have been stored // : in a FAT16 file concurrently, and the offset of the images are saved // : in the image control so that image file (*.gci) can be mapped to directly. // : The absolute cluster/sector is mapped so file seek does not need to be called // : internally. This means that there is no seek time penalty, however, the // : image list takes a lot longer to build, as all the seeking is done at control // : build time. // : mode 2:- the graphics file with the is placed in a partitioned area // : In this case, the images have been stored in a in a known raw area of the FAT16 // : disk, and the absolute address of the images are saved in the DAT file // : This is the fastest operation of the image control as there is no seeking // : or other disk activity taking place. func file_Mount(), 1; // Syntax: r := file_Mount(); // Usage : r := file_Mount(); // Notes : Create a control block for FAT16 and mount the File System func file_Unmount(), 0; // Syntax: file_Unmount(); // Usage : file_Unmount(); // Notes : release any control block and buffers for FAT16 // : and unmount the File System func file_PlayWAV("fname1"), 1; // Syntax: file_PlayWAV("fname1"); // Usage : file_PlayWAV("ding.wav"); // Notes : Play a wave file with filename "fname1" // : This function automatically grabs a chunk // : of memory for a file buffer, and a wave // : buffer. The minimum memory requirement is // : about 580 bytes for the disk io service and // : a minimum wave buffer size of 1024. The siz // : of the wave buffer allocation // : can be increased by the snd_BufSize function. // : The default size 1024 bytes. // : NB the memory is only required during the // : duration of play, and is automatically // : released while not in use. // : See the Sound Class services for other associated controls. // : If there are no errors, returns number of blocks to play (1 to 32767) // : If errors occured, the folling is returned // : -6 : cant play this rate // : -5 : no data chunk found in first rsector // : -4 : no format data // : -3 : no wave chunk signature // : -2 : bad wave file format // : -1 : file not found //------------------------------------------------------------------// // Sound Class Services //------------------------------------------------------------------// func snd_Volume("var"), 0; // Syntax: snd_Volume("var"); // Usage : snd_Volume(30); // Notes : set sound playback volume. Var must // : be in the range from 8 (min volume) // : to 127 (max volume). If var is less // : than 8 volume is set to 8, and if // : var > 127 it is set to 127. func snd_Pitch("pitch"), 1; // func snd_Pitch("freq"), 1; // func snd_Pitch(7000), 1; // play the wave file with a sample frequency of 7khz // Notes : sets the samples playback rate to a different frequency // : The minimum value is 4khz // : Setting the pitch to zero restores the original sample rate // : Return value is the samples original sample rate. func snd_BufSize("var"), 0; // Syntax: snd_BufSize("var"); // Usage : snd_BufSize(2); // Notes : specify the a memory chunk size for the wavefile buffer. // : default size 1024 bytes. // : 0 = 1024 bytes (default) // : 1 = 2048 bytes // : 2 = 4096 bytes // : 3 = 8192 bytes func snd_Stop(), 0; // Syntax: snd_Stop(); // Usage : snd_Stop(); // Notes : stop any sound that is playing, releasing // : buffers and closes any open wav file. func snd_Pause(), 0; // Syntax: snd_Pause(); // Usage : snd_Pause(); // Notes : pauses any sound that is playing, does nothing // : until sound is resumed with snd_Continue(). // : The sample cam be terminated with snd_Stop. // : buffers and closes any open wav file. func snd_Continue(), 0; // Syntax: snd_Continue(); // Usage : snd_Continue(); // Notes : resume any sound that is paused by snd_Pause. func snd_Playing(), 1; // Syntax: snd_Playing(); // Usage : r := snd_Playing(); // Notes : returns 0 if sound has finished playing, // : else return number of 512 byte blocks to go. //------------------------------------------------------------------// // String Class Services //------------------------------------------------------------------// func str_Ptr("&var"), 1; // Syntax: str_Ptr(&var); // Usage : p := str_Ptr(&var); // Notes : return a byte pointer to a word region func str_GetD("&ptr", "&var"), 1; // Syntax: str_GetD(&ptr, &var); // Usage : ok := str_GetD(&ptr, &var); // Notes : convert number in a string to DWORD ( myvar[2] ) // : returns true if function succeeds, advancing ptr func str_GetW("&ptr", "&var"), 1; // Syntax: str_GetW(&ptr, &var); // Usage : ok := str_GetW(&ptr, &var); // Notes : convert number in a string to WORD ( myvar ) // : returns true if function succeeds, advancing ptr func str_GetHexW("&ptr", "&var"), 1; // Syntax: str_GetHexW(&ptr, &var); // Usage : ok := str_GetHexW(&ptr, &var); // Notes : convert HEX number in a string to WORD ( myvar ) // : returns true if function succeeds, advancing ptr func str_GetC("&ptr", "&var"), 1; // Syntax: str_GetC(&ptr, &var); // Usage : ok := str_GetC(&ptr, &var); // Notes : get a valid ascii char in a string to WORD ( myvar ) // : returns true if function succeeds, advancing ptr func str_GetByte("ptr"), 1; // Syntax: str_GetByte(ptr); // Usage : myvar := str_GetByte(ptr); // Notes : get a byte to myvar // : returns value func str_GetWord("ptr"), 1; // Syntax: GetWord(ptr); // Usage : GetWord(ptr); // Notes : get a word to myvar // : returns value func str_PutByte("ptr","val"), 0; // Syntax: str_PutByte(ptr); // Usage : myvar := str_PutByte(ptr); // Notes : put a byte at ptr // : returns value func str_PutWord("ptr","val"), 0; // Syntax: str_PutWord("ptr","val"); // Usage : str_PutWord(p,100); // Notes : put word 100 at current pointer location // : returns value func str_Match("&ptr", "*str"), 1; // Syntax: str_Match(&ptr, *str); // Usage : r := str_Match(&p, "hello"); // Notes : Case sensitive match // : returns true if function succeded, andvancing pointer to position past // : the matched item. Note that any whitespace characters are skipped // : in the source string prior to the test. func str_MatchI("&ptr", "*str"), 1; // Syntax: str_MatchI(&ptr, *str); // Usage : r := str_MatchI(&p, "hello"); // Notes : Case insensitive match // : returns true if function succeded, andvancing pointer to position past // : the matched item. Note that any whitespace characters are skipped // : in the source string prior to the test. func str_Find("&ptr", "*str"), 1; // Syntax: str_Find(&ptr, *str); // Usage : n := str_Find(&p, "hello"); // Notes : given the address of a pointer to a source string as the // : first argument, and a pointer to a test string as the second // : argument, attempt to find the position of the matching string // : in the source string. The test is performed with case sensitivity. // : return 0 if not found, else returns the address of the first // : character of the match. NB:- The source pointer is not altered. func str_FindI("&ptr", "*str"), 1; // Syntax: str_Find(&ptr, *str); // Usage : n := str_Find(&p, "hello"); // Notes : given the address of a pointer to a source string as the // : first argument, and a pointer to a test string as the second // : argument, attempt to find the position of the matching string // : in the source string. The test is performed with no case // : sensitivity, eg upper and lower case chars are accepted. // : return 0 if not found, else returns the address of the first // : character of the match. NB:- The source pointer is not altered. func str_Length("ptr"), 1; // Syntax: str_Length(ptr); // Usage : len := str_Ptr(mystring); // Notes : return the length of a byte aligned string excluding terminator func str_Printf("&ptr", "*format"), 1; // Syntax: str_Printf("&ptr", "*format"); // Usage : r := str_Printf(&p, "hello"); // Notes : refer to documentation // : func str_Cat("dest","src"), 1; // Syntax: str_Append("&dest","&src"); // Usage : str_Append(&buf,"Hello"); // Notes : Appends a copy of the source string to the destination string. // : The terminating null character in destination is overwritten by // : the first character of source, and a new null-character is appended // : at the end of the new string formed by the concatenation of both in destination. // : returns destination. func str_CatN("dest","src","count"), 1; // Syntax: str_Append("&dest","&src","count"); // Usage : str_Append(&buf,"Monday",3); // Notes : Appends a copy of the source string to the destination string. // : The number of characters copied is limited by "count". // : The terminating null character in destination is overwritten by // : the first character of source, and a new null-character is appended // : at the end of the new string formed by the concatenation of both in destination. // : returns destination. func sys_StoreTouchCalibration(), 1; // Syntax: sys_StoreTouchCalibration(); // Usage : r := sys_StoreTouchCalibration(); // Notes : Store the touch calibration values in non-volatile memory. // : Returns true if the values have been accepted and stored, // : else returns false if write could not be performed, or // : touch calibration values are improbable. // : The values that are stored are obtained from:- // : TOUCH_XMINCAL 78 // touch calibration value // : TOUCH_YMINCAL 79 // touch calibration value // : TOUCH_XMAXCAL 80 // touch calibration value // : TOUCH_YMAXCAL 81 // touch calibration value // : refer to the 4DGL example touchCalibrate.4DG for further information. // : This function is not supported on uVGA, Capicitive touch // : and 4.3" resistive touch modules. func unicode_page("charbeg","charend","charoffset"), 1; // Syntax: unicode_page("charbeg","charend","charoffset"); // Usage : eg: F_Traditional_0x20_0xFF // Notes : After selecting a unicode image control with txt_FontID, // : this function is called to set the required font within the // : unicode set. The file "Unicode.inc" contains wrappers for // : this function, and it is not normally called directly. // : Returns count of characters in the set. // : Refer to "Unicode.inc" for further information. func EVE_SP(), 1; // Syntax: EVE_SP(); // Usage : eg: print(EVE_SP()); // Notes : Used for debugging to assess the current stack level, // : mainly for checking stack leaks func EVE_SSIZE(), 1; // Syntax: EVE_SSIZE(); // Usage : eg: print(EVE_SSIZE()); // Notes : Used to get the stack size, // : mainly for debugging purposes // uVGAII extended functions func disp_Sync("line"), 0; // (uVGA only) wait till scanline reaches "line" // Syntax: disp_Sync(line); // Usage : disp_Sync(480); // Notes : Waits till the hardware gets to a certain line. // : Allows the program to synchronise writing to the hardware for flicker free operation. // : Some experimentation may be needed to find an optimum line for disp_Sync // : depending on the graphics operation. The higher the value, the slower // : the throughput. A cetain point will be reached (number of scanlines + blanking lines // : within the vertical retrace period) where it will just 'hang up' stopping the // : entire process. Eg, in 640x480 mode, if the 'lines' value is 507, operation will // : be slowest (as its actually right at the end of the blanking period) and 508 // : will cause a hangup situation as it is above the highes scanline value. // : Currently, this function is only supported on displays with SSD1963 driver. // New functions added to PmmC v2.8 //================================================================ func CY(), 1; // Syntax: CY(); // Usage : myvar := 0xFFF8 + 9; // result = 1 // : print(myvar," "CY(),"\n"); // carry = 1 // Notes : This function returns the carry status of an // unsigned overflow from any 16 or 32bit additions or sutractions. //================================================================ //================================================================ func str_ByteMove("src", "dest", "count"), 1; // func str_ByteMove("src", "dest", "count"), 1; // Syntax : str_ByteMove(src, dest, bytecount); // Input : STR *source points to byte aligned source. // : STR *dest points to byte aligned destination. // : VAR count number of bytes to transfer. // Usage : nextpos := str_ByteMove(s, d, 100); // Notes : copy bytes from "src" to "dest", stopping only // : when "count" is exhausted. // : No terminator is appended, it is purely a // : byte copy, and any zeroes encountered will // : also be copied. // Returns : returns a pointer to the end of the destination // : (which is "dest" + "count") //================================================================ //================================================================ func str_Copy("dest", "src"), 1; // Syntax : str_Copy(dest, src); // Input : STR *dest points to byte aligned destination. // : STR *source points to byte aligned source. // Usage : nextplace := str_Copy(d, s); // Notes : copy a string from "src" to "dest", stopping only // : when the end of source string "src" is encountered // : (0x00 terminator). // : The terminator is always appended, even if "src" is // : an empty string. // Returns : returns a pointer to the 0x00 string terminator at // : end of "dest" (which is "dest" + str_Length(src); ) //================================================================ //================================================================ func str_CopyN("dest", "src", "count"), 1; // Syntax : str_CopyN(dest, src, bytecount); // Input : STR *dest points to byte aligned destination. // : STR *source points to byte aligned source. // : VAR count max number of chars to copy. // Usage : nextplace := str_CopyN(d, s, 100); // Notes : copy a string from "src" to "dest", stopping only // : when "count" is exhausted, or end of source // : string "str" is encountered (0x00 string terminator). // : The terminator is always appended, even if // : "count" is zero, or "src" is a null string. // Returns : returns a pointer to the 0x00 string terminator // : (which is "dest" + whatever was copied) //================================================================ //================================================================ func umul_1616("&res32", "val1", "val2"), 1; // Syntax : umul_1616(&res32, varA, varB); // Input : DWORD *result points to 32bit result register. // : VAR val1 16bit register or constant // : VAR val2 16bit register or constant // Usage : var res32[2]; // : umul_1616(&res32, myvar, 50000); // Notes : performs an unsigned multiply of 2 x 16bit values // : placing the 32bit result in a 2 word array. // Returns : the pointer to the 32bit result. // : carry and overflow are not affected. //================================================================ //================================================================ func uadd_3232("&res32", "&val1", "&val2"), 1; // Syntax : cmp_3232(&res32, &varA, &varB); // Input : DWORD *res32 points to optional result (or zero for compare) // : DWORD *val1 points to 32bit augend // : DWORD *val2 points to 32bit addend // Usage : var res32[2]; // : res := cmp_3232(res32, val1, val2); // Notes : performs an unsigned addition of 2 x 32bit values // : placing the 32bit result in a 2 word array. // Returns : returns 1 on 32bit unsigned overflow (carry). // ; carry flag is also set on 32bit unsigned overflow // ; and can be read with the CY() function. //================================================================ //================================================================ func usub_3232("&res32", "&val1", "&val2"), 1; // Syntax : cmp_3232(&res32, &varA, &varB); // Input : DWORD *res32 points to optional result (or zero for compare) // : DWORD *val1 points to first 32bit minuend // : DWORD *val2 points to 32bit subtrahend // Usage : var res32[2]; // : res := cmp_3232(res32, val1, val2); // Notes : performs an unsigned subtraction of 2 x 32bit values // : placing the 32bit result in a 2 word array. // Returns : returns 1 on 32bit unsigned overflow (borrow). // ; carry flag is also set on 32bit unsigned underflow // ; and can be read with the CY() function. //================================================================ //================================================================ func ucmp_3232("&val1", "&val2"), 1; // Syntax : cmp_3232(&varA, &varB); // Input : DWORD *val1 points to 32bit minuend // : DWORD *val2 points to 32bit sutrahend // Usage : res := cmp_3232(val1, val2); // Notes : performs an unsigned comparison of 2 x 32bit values. // : The result of the subtraction is returned. // Returns : 0 if equal // : 1 if val1 > val2 // : -1 if val1 < val2 // : This function does not affect the carry flag. //================================================================ //------------------------------------------------------------------// // CONSTANTS //------------------------------------------------------------------// // generic constants #CONST ENABLE 1 DISABLE 0 HI 1 LO 0 INPUT 1 OUTPUT 0 ON 1 OFF 0 #END //------------------------------------------------------------------------------ // Pin related constants //------------------------------------------------------------------------------ #CONST IO1_PIN 1 // pin 2 J1 IO2_PIN 2 // pin 1 J1 IO3_PIN 3 // pin 3 J1 IO4_PIN 4 // pin 5 J1 (also used for BUS_RD) IO5_PIN 5 // pin 9 J2 (also used for BUS_WR) BUS_RD_PIN 4 // pin 5 J1 (alias IO4_PIN) BUS_WR_PIN 5 // pin 9 J2 (alias IO5_PIN) BACKLITE 6 // backlite control pin AUDIO_ENABLE 7 // amplifier chip control pin BUS_0 8 // pin 27 of J1 BUS_1 9 // pin 25 of J1 BUS_2 10 // pin 23 of J1 BUS_3 11 // pin 21 of J1 BUS_4 12 // pin 19 of J1 BUS_5 13 // pin 17 of J1 BUS_6 14 // pin 13 of J2 BUS_7 15 // pin 11 of J2 #END //------------------------------------------------------------------------------ //gfx_Set() related constants //------------------------------------------------------------------------------ #CONST PEN_SIZE 16 // not necessary to use (legacy mode) BACKGROUND_COLOUR 17 OBJECT_COLOUR 18 // line / circle / rectangle generic colour CLIPPING 19 // clipping ON / OFF TRANSPARENT_COLOUR 20 // (only on displays with specific hware feature) TRANSPARENCY 21 // 0 = OFF, 1 = ON (only on displays with specific hware feature) FRAME_DELAY 22 // legacy mode, see pokeB(IMAGE_DELAY, n); SCREEN_MODE 23 // LANDSCAPE, LANDSCAPE_R, PORTRAIT, PORTRAIT_R OUTLINE_COLOUR 24 // if not BLACK (0) , used for outline around circles,rectangles and filled polygons CONTRAST 25 // for OLED,cahnge contrast, for LCD on or off only LINE_PATTERN 26 // used for patterned lines, 16bit value (0 = no pattern, '1's = pattern) COLOUR_MODE 27 // select 8 or 16 bit colour mode BEVEL_WIDTH 28 // button bevel width BEVEL_SHADOW 29 // button bevel shadow depth X_ORIGIN 30 // display position X offset Y_ORIGIN 31 // display position X offset #END //gfx_Get() related constants #CONST X_MAX 0 // current orientations screen maximum X co-ordinate Y_MAX 1 // current orientations screen maximum Y co-ordinate LEFT_POS 2 // last objects left co-ord TOP_POS 3 // last objects top co-ord RIGHT_POS 4 // last objects right co-ord BOTTOM_POS 5 // last objects bottom co-ord X_ORG 6 // display position X offset Y_ORG 7 // display position X offset #END #CONST SOLID 0 // PEN_SIZE OUTLINE 1 // PEN_SIZE STYLE1 2 STYLE2 3 LANDSCAPE 0 // SCREEN_MODE (north) LANDSCAPE_R 1 // SCREEN_MODE (south) PORTRAIT 2 // SCREEN_MODE (west) PORTRAIT_R 3 // SCREEN_MODE (east) COLOUR8 1 // COLOUR_MODE 8 bit colour mode (not supported) COLOUR16 0 // COLOUR_MODE 16 bit colour mode #END #CONST DOWN 0 UP 1 HIDE 2 SELECT 3 SELECT_MULTIPLE 4 BUTTON_DOWN 0 BUTTON_UP 1 SLIDER_SUNKEN 0 SLIDER_RAISED 1 SLIDER_HIDE 2 PROGRESSBAR_RAISED 0xFFFF PROGRESSBAR_SUNKEN 0xFFFE PROGRESSBAR_HIDE 2 PANEL_SUNKEN 0 PANEL_RAISED 1 PANEL_HIDE 2 #END //------------------------------------------------------------------------------ //txt_Set() related constants //------------------------------------------------------------------------------ #CONST TEXT_COLOUR 0 // text foreground colr TEXT_BACKGROUND 1 // text background colr TEXT_HIGHLIGHT 1 // text background colr FONT_ID 2 // default 0, else points to data statement font FONT_SIZE 2 // compatibility TEXT_WIDTH 3 // text width multiplier TEXT_HEIGHT 4 // text height multiplier TEXT_XGAP 5 // horizontal text gap (default 1) TEXT_YGAP 6 // vertical text gap (default 1) TEXT_PRINTDELAY 7 // for 'teletype' like effect when printing TEXT_OPACITY 8 // text mode flag, TRANSPARENT or OPAQUE TEXT_BOLD 9 // embolden text (auto reset) TEXT_ITALIC 10 // italicize text (auto reset) TEXT_INVERSE 11 // invert text (auto reset) TEXT_UNDERLINED 12 // underline text (auto reset) TEXT_ATTRIBUTES 13 // controls BOLD/ITALIC/INVERSE/UNDERLINE simultaneously TEXT_WRAP 14 // Sets the pixel position where text wrap will occur at RHS #END //------------------------------------------------------------------------------ //txt_Set() related arguments // NB:- FONT4 must be inherited if required, // eg #inherit "FONT4.fnt" //------------------------------------------------------------------------------ #CONST FONT1 0 // (same as system font) FONT2 1 FONT3 2 TRANSPARENT 0 // TEXT_OPACITY transparent text OPAQUE 1 // TEXT_OPACITY opaque text BOLD 16 // TEXT_ATTRIBUTES bold text ITALIC 32 // TEXT_ATTRIBUTES italic text INVERSE 64 // TEXT_ATTRIBUTES inverse text UNDERLINED 128 // TEXT_ATTRIBUTES underlined #END //touch_Set() related constants #CONST TOUCH_ENABLE 0 TOUCH_DISABLE 1 TOUCH_REGIONDEFAULT 2 #END //touch_Get() related constants #CONST TOUCH_STATUS 0 TOUCH_GETX 1 TOUCH_GETY 2 NOTOUCH 0 TOUCH_PRESSED 1 TOUCH_RELEASED 2 TOUCH_MOVING 3 #END // image control offset related constants #CONST IMG_COUNT 0 IMG_ENTRYLEN 1 IMG_MODE 2 IMG_GCI_FILENAME 3 IMG_DAT_FILENAME 4 IMG_GCIFILE_HANDLE 5 #END // image attribute flags // for img_SetAttributes(...) and img_ClearAttributes(...) #CONST I_ENABLED 0x8000 // bit 15, set for image enabled I_DARKEN 0x4000 // bit 14, display dimmed I_LIGHTEN 0x2000 // bit 13, display bright I_TOUCHED 0x1000 // bit 12, touch test result I_Y_LOCK 0x0800 // bit 11, stop Y movement I_X_LOCK 0x0400 // bit 10, stop X movement I_TOPMOST 0x0200 // bit 9, draw on top of other images next update (auto reset) I_STAYONTOP 0x0100 // bit 8, draw on top of other images always I_MOVIE 0x0080 // bit 7, image is a movie I_NOGROUP 0x0040 // bit 6, set to exclude image refresh when using img_Show(hndl, ALL); I_TOUCH_DISABLE 0x0020 // bit 5, set to disable touch for this image, default=1 for movie, 0 for image I_COLOUR16 0x0010 // bit 4, indicates 16 bit colour mode // bits 0-3 reserved #END #constant ALL 0xFFFF // argument for img_xxx functions to update all images // image control entry offsets #CONST IMAGE_LOWORD 0 // WORD image address LO IMAGE_HIWORD 1 // WORD image address HI IMAGE_XPOS 2 // WORD image location X IMAGE_YPOS 3 // WORD image location Y IMAGE_WIDTH 4 // WORD image width IMAGE_HEIGHT 5 // WORD image height IMAGE_FLAGS 6 // WORD image flags IMAGE_DELAY 7 // WORD inter frame delay IMAGE_FRAMES 8 // WORD number of frames IMAGE_INDEX 9 // WORD current frame IMAGE_CLUSTER 10 // WORD image start cluster pos (for FAT16 only) IMAGE_SECTOR 11 // WORD image start sector in cluster pos (for FAT16 only) IMAGE_TAG 12 // WORD user variable #1 IMAGE_TAG2 13 // WORD user variable #2 #END #CONST // DISK struct offsets DISK_FIRST_SECT_LO 0 // DWORD address of the first sector of the FAT partition (LO word) DISK_FIRST_SECT_HI 1 // address of the first sector of the FAT partition (HI word) DISK_FAT_LO 2 // DWORD address of FAT (LO word) DISK_FAT_HI 3 // address of FAT (HI word) DISK_ROOT_LO 4 // DWORD address of root directory (LO word) DISK_ROOT_HI 5 // address of root directory (HI word) DISK_DATA_LO 6 // DWORD address of data area (LO word) DISK_DATA_HI 7 // address of data area (HI word) DISK_MAXCLUS_LO 8 // DWORD max number of clusters in partition (LO word) DISK_MAXCLUS_HI 9 // max number of clusters in partition (HI word) DISK_MAXROOT 10 // WORD max entries in root directory DISK_FATSIZE 11 // WORD number of sectors in FAT DISK_FATCOPIES 12 // WORD number of fat copies DISK_SECT_PER_CLUS 13 // WORD number of sectors per cluster DISK_TYPE 14 // WORD type of fat DISK_BUF 15 // WORD pointer to 512 byte info buffer #END #CONST // FILE struct offsets FILE_FIRST_CLUSTER 0 // WORD first cluster FILE_CURR_CLUSTER 1 // WORD current cluster in file FILE_CURR_SECTOR 2 // WORD sector in current cluster FILE_CURR_SECTOR_POS 3 // WORD position in current sector FILE_CURR_SECTOR_TOP 4 // WORD number bytes in current sector buffer FILE_SEEK_POS_LO 5 // DWORD position in the file (LO word) FILE_SEEK_POS_HI 6 // position in the file (HI word) FILE_SIZE_LO 7 // DWORD file size (LO word) FILE_SIZE_HI 8 // file size (HI word) FILE_TIME 9 // WORD last update time FILE_DATE 10 // WORD last update date FILE_NAME 11 // WORD 12 byte buffer for filename FILE_MODE 17 // WORD file mode 'r', 'w', 'a' FILE_ATTRIBUTES 18 // WORD files attributes FILE_PAGEFLAG 19 // WORD cache check flag FILE_ENTRY 20 // WORD entry position in cur directory FILE_DISK 21 // WORD* pointer to DISK mount media structure FILE_BUFFER 22 // WORD* sector buffer #END // timer control related constants #CONST TIMER0 0 TIMER1 1 TIMER2 2 TIMER3 3 TIMER4 4 TIMER5 5 TIMER6 6 TIMER7 7 #END // I2C timing related constants #CONST I2C_SLOW 0 I2C_MED 1 I2C_FAST 2 #END // spi_Init(...) mode arguments #CONST SPI_SLOW 2 // 750khz SPI_MED 1 // 3mhz SPI_FAST 0 // 12mhz RXMODE_0 0 // receive sample pos RXMODE_1 1 // receive sample pos CKMODE_0 0 // transmit sample pos CKMODE_1 1 // transmit sample pos CKMODE_2 2 // transmit sample pos CKMODE_3 3 // transmit sample pos #END //------------------------------------------------------------------------------ // system WORD variables accesible with peekW and pokeW or pointer access // Note that the txt_Set variables (0-15) and gfx_set variables (16-31) // can also be accessed with peekW and pokeW //------------------------------------------------------------------------------ #CONST RANDOM_LO 32 // random number generator LO word RANDOM_HI 33 // random number generator LO word SYSTEM_TIMER_LO 34 // 1msec 32 bit free running timer LO word SYSTEM_TIMER_HI 35 // 1msec 32 bit free running timer HI word TMR0 36 // user timer0 TMR1 37 // user timer1 TMR2 38 // user timer2 TMR3 39 // user timer3 (10msec resolution) TMR4 40 // user timer0 TMR5 41 // user timer1 TMR6 42 // user timer2 TMR7 43 // user timer3 (10msec resolution) SYS_X_MAX 44 // display hardware X res-1 SYS_Y_MAX 45 // display hardware Y res-1 GFX_XMAX 46 // current display width-1 determined by portrait / landscape swapping GFX_YMAX 47 // current display width-1 determined by portrait / landscape swapping GFX_LEFT 48 // virtual left point for most recent object GFX_TOP 49 // virtual top point for most recent object GFX_RIGHT 50 // virtual right point for most recent object GFX_BOTTOM 51 // virtual bottom point for most recent object GFX_X1 52 // clipped left point for current object GFX_Y1 53 // clipped top point for current object GFX_X2 54 // clipped right point for current object GFX_Y2 55 // clipped bottom point for current object GFX_X_ORG 56 // current X origin GFX_Y_ORG 57 // current Y origin GFX_HILITE_LINE 58 // current multi line button hilite line GFX_LINE_COUNT 59 // count of lines in multiline button GFX_LAST_SELECTION 60 // last selected line GFX_HILIGHT_BACKGROUND 61 // multi button hilite background colour GFX_HILIGHT_FOREGROUND 62 // multi button hilite background colour GFX_BUTTON_FOREGROUND 63 // store default text colour for hilite line tracker GFX_BUTTON_BACKGROUND 64 // store default button colour for hilite line tracker GFX_BUTTON_MODE 65 // store current buttons mode GFX_TOOLBAR_HEIGHT 66 // height above GFX_STATUSBAR_HEIGHT 67 // height below GFX_LEFT_GUTTER_WIDTH 68 // width to left GFX_RIGHT_GUTTER_WIDTH 69 // width to right GFX_PIXEL_SHIFT 70 // pixel shift for button depress illusion (default 1) GFX_RECT_X1 71 // gp rect, used by multiline button to hilite required line GFX_RECT_Y1 72 GFX_RECT_X2 73 GFX_RECT_Y2 74 GFX_THUMB_PERCENT 75 // size of slider thumb as percentage GFX_THUMB_BORDER_DARK 76 // darker shadow of thumb GFX_THUMB_BORDER_LIGHT 77 // lighter shadow of thumb TOUCH_XMINCAL 78 // touch calibration value TOUCH_YMINCAL 79 // touch calibration value TOUCH_XMAXCAL 80 // touch calibration value TOUCH_YMAXCAL 81 // touch calibration value IMG_WIDTH 82 // width of currently loaded image IMG_HEIGHT 83 // height of currently loaded image IMG_FRAME_DELAY 84 // 0 if image, else inter frame delay for movie IMG_FLAGS 85 // bit 4 determines colour mode, other bits reserved IMG_FRAME_COUNT 86 // count of frames in a movie IMG_PIXEL_COUNT_LO 87 // count of pixels in the current frame IMG_PIXEL_COUNT_HI 88 // count of pixels in the current frame IMG_CURRENT_FRAME 89 // last frame shown MEDIA_ADDRESS_LO 90 // uSD byte address LO MEDIA_ADDRESS_HI 91 // uSD byte address HI MEDIA_SECTOR_LO 92 // uSD sector address LO MEDIA_SECTOR_HI 93 // uSD sector address HI MEDIA_SECTOR_COUNT 94 // uSD number of bytes remaining in sector TEXT_XPOS 95 // text current x pixel position TEXT_YPOS 96 // text current y pixel position TEXT_MARGIN 97 // text left pixel pos for carriage return TXT_FONT_ID 98 // font type, 0 = system font, else pointer to user font TXT_FONT_MAX 99 // max number of chars in font TXT_FONT_OFFSET 100 // starting offset (normally 0x20) TXT_FONT_WIDTH 101 // current font width TXT_FONT_HEIGHT 102 // current font height GFX_TOUCH_REGION_X1 103 // touch capture region GFX_TOUCH_REGION_Y1 104 GFX_TOUCH_REGION_X2 105 GFX_TOUCH_REGION_Y2 106 GFX_CLIP_LEFT_VAL 107 // left clipping point (set with gfx_ClipWindow(...) GFX_CLIP_TOP_VAL 108 // top clipping point (set with gfx_ClipWindow(...) GFX_CLIP_RIGHT_VAL 109 // right clipping point (set with gfx_ClipWindow(...) GFX_CLIP_BOTTOM_VAL 110 // bottom clipping point (set with gfx_ClipWindow(...) GFX_CLIP_LEFT 111 // current clip value (reads full size if clipping turned off) GFX_CLIP_TOP 112 // current clip value (reads full size if clipping turned off) GFX_CLIP_RIGHT 113 // current clip value (reads full size if clipping turned off) GFX_CLIP_BOTTOM 114 // current clip value (reads full size if clipping turned off) GRAM_PIXEL_COUNT_LO 115 // LO word of count of pixels in the set GRAM area GRAM_PIXEL_COUNT_HI 116 // HI word of count of pixels in the set GRAM area TOUCH_RAW_X 117 // 12 bit raw A2D X value from touch screen TOUCH_RAW_Y 118 // 12 bit raw A2D Y value from touch screen GFX_LAST_CHAR_WIDTH 119 // calculated char width from last call to charWidth function GFX_LAST_CHAR_HEIGHT 120 // calculated height from last call to charHeight function GFX_LAST_STR_WIDTH 121 // calculated width from last call to strWidth function GFX_LAST_STR_HEIGHT 122 // calculated height from last call to strHeight function #END //------------------------------------------------------------------------------ // FILEIO Error Code Constants //------------------------------------------------------------------------------ #CONST FE_OK 0 // IDE function succeeded FE_IDE_ERROR 1 // IDE command execution error FE_NOT_PRESENT 2 // CARD not present FE_PARTITION_TYPE 3 // WRONG partition type, not FAT16 FE_INVALID_MBR 4 // MBR sector invalid signature FE_INVALID_BR 5 // Boot Record invalid signature FE_DISK_NOT_MNTD 6 // Media not mounted FE_FILE_NOT_FOUND 7 // File not found in open for read FE_INVALID_FILE 8 // File not open FE_FAT_EOF 9 // Fat attempt to read beyond EOF FE_EOF 10 // Reached the end of file FE_INVALID_CLUSTER 11 // Invalid cluster value > maxcls FE_DIR_FULL 12 // All root dir entry are taken FE_DISK_FULL 13 // All clusters in partition are taken FE_FILE_OVERWRITE 14 // A file with same name exist already FE_CANNOT_INIT 15 // Cannot init the CARD FE_CANNOT_READ_MBR 16 // Cannot read the MBR FE_MALLOC_FAILED 17 // Malloc could not allocate the FILE struct FE_INVALID_MODE 18 // Mode was not r.w. FE_FIND_ERROR 19 // Failure during FILE search FE_INVALID_FNAME 20 // bad filename FE_INVALID_MEDIA 21 // bad media FE_SECTOR_READ_FAIL 22 // sector read failed FE_SECTOR_WRITE_FAIL 23 // sector write failed #END //==================================================================================================