Libndls and Main Page: Difference between pages

From Hackspire
(Difference between pages)
Jump to navigation Jump to search
m (nspire-ld to nspire-gcc)
 
No edit summary
 
Line 1: Line 1:
''libndls'' is a set of macros and functions available as a [http://en.wikipedia.org/wiki/Static_library static library] when building with Ndless. The library is automatically linked by <tt>nspire-gcc</tt> without "-nostdlib".
Welcome to you on Hackspire, the TI-Nspire Hacking wiki.
The goal of this wiki is to federate all research efforts about the Texas Instruments's TI-Nspire calculator series.


These definitions are available in Ndless 3.1 and above. Definitions marked with (asm) are only available in assembly.
Feel free to add your contribution, the more details we get, the better software the community can create.
TI Software is great for mathematics, physics, ... but independent developers are needed for all the rest, because TI does not have time for it!
__NOTOC__
== Alerts ==
<b>Some pages might show outdated content, these will be updated in the course of the following days.</b>


==Platform==
== Site news ==
*<tt>_TINSPIRE</tt>: since v3.1. Use <tt>#ifdef _TINSPIRE</tt> to check whether you are building with nspire-gcc (i.e. for the TI-Nspire platform).
*<tt>void assert_ndless_rev(unsigned required_rev)</tt>: Since v3.1 r617. Displays a popup asking to update Ndless if the Ndless revision on the calculator is less than ''required_rev'', and exits the program. Does nothing if the revision is greater or equal than ''required_rev''. You should call this function at the beginning of your program if it is using syscalls recently added to Ndless, or libndls functions which depend on recent syscalls. See [[Ndless_features_and_limitations#Checking Ndless's version|Checking Ndless version]] for more info. Note that this function works without v3.1 r617 or higher.


==Ndless==
* '''June 21, 2019 - ([[User:Jim Bauwens|Jim Bauwens]]):''' The Hackspire wiki is back online after a downtime of over a month due to a server failure
*<tt>const char *NDLESS_DIR</tt>: (since v3.1 r797) full path to the "ndless" directory in the documents folder ("/documents/ndless")
* '''July 2, 2017 - ([[User:Jim Bauwens|Jim Bauwens]]):''' The Hackspire wiki is 10 years old today! Many thanks to all the contributors for making Hackspire what it is today!
* '''June 15, 2016 - ([[User:Jim Bauwens|Jim Bauwens]]):''' hackspire.org is now the main domain name
* '''March 10, 2016 - ([[User:Jim Bauwens|Jim Bauwens]]):''' hosting on new server


==Common types==
== Pages ==
*<tt>typedef enum bool {FALSE = 0, TRUE = 1} BOOL;</tt>


==Screen==
<div style="overflow-x:auto">
*<tt>SCREEN_BASE_ADDRESS</tt>: address of the screen buffer. Read from the LCD controller, caching it is recommended.
{| style="min-width: 700px; width: 100%; line-height:1.5em; border-spacing:20px 0px; margin-top: 1em;"
*<tt>SCREEN_BYTES_SIZE</tt>: size of the screen buffer. Calculated depending on the color mode advertised by the LCD controller, caching it is recommended as long as the mode isn't changed.
|- style="text-align:left; background-color:#EEEEFF;"
*<tt>SCREEN_WIDTH</tt>: screen width in pixels
! style="width:20%; padding:0 1em;"|Projects, programs and tools
*<tt>SCREEN_HEIGHT</tt>: screen height in pixels
! style="width:20%; padding:0 1em;"|Ndless
*<tt>void clrscr(void)</tt>: clear the screen
! style="width:20%; padding:0 1em;"|Development resources
*<tt>BOOL lcd_isincolor(void)</tt>: since v3.1. Check the current LCD mode.
! style="width:20%; padding:0 1em;"|OS information
*<tt>void lcd_incolor(void)</tt>: since v3.1. Switch to color LCD mode.
! style="width:20%; padding:0 1em;"|Miscellaneous
*<tt>void lcd_ingray(void)</tt>: since v3.1. Switch to grayscale LCD mode.
|- style="color:black; vertical-align:top;"
|
*[[Emulators]]
*[[Lua Programs]]
*[[Linux]]
|
*[[Ndless]]
*[[Ndless features and limitations]]
*[[C and assembly development introduction]]
*[[libndls|libndls - TI-Nspire-specific library]]
*[[Syscalls|Syscalls and standard libraries]]
*[[Zehn]]
*[[CAS Programming]]
*[[Debugging programs]]
|
*[[Lua Programming]]
*[[Memory-mapped I/O ports]]
*[[Virtual Memory]]
*[[Clock speed]]
*[[Keypads]]
*[[Interrupts]]
*[[Hardware]]
*[[Jazelle]]
|
*[[Operating System]]
*[[OS upgrade files]]
*[[TNS File Format]]
*[[Document management]]
*[[TI-84 Plus Emulation]]
*[[Internal Filesystem]]
*[[NAND Memory Layout]]
*[[USB Protocol]]
|
*[[Site History]]
*[[Miscellaneous Information]]
*[[TI-Nspire CAS Software]]
*[[Links]]
|}
</div>


==UI==
== Registering / Contacting the Hackspire administration ==
*<tt>void show_msgbox(const char *title, const char *msg)</tt>: show a message box, with a single button OK"
*<tt>unsigned int show_msgbox_2b(const char *title, const char *msg, const char *button1, const char *button2)</tt>: since v3.1. show a message box with two buttons with custom labels. Return the number of the button pressed (1 for the first button).
*<tt>unsigned int show_msgbox_3b(const char *title, const char *msg, const char *button1, const char *button2, const char *button3)</tt>: since v3.1. show a message box with three buttons with custom labels. Return the number of the button pressed (1 for the first button).
*<tt>int show_msg_user_input(const char * title, const char * msg, char * defaultvalue, char ** value_ref)</tt>: since v3.1 r607. Request popup. Usage: <tt>char * value; show_msg_user_input("title", "msg", "default", &value)</tt>. <tt>value</tt> must be freed with <tt>free()</tt> once used. Returns the length of the value, or -1 if an empty text was entered or escape was pressed. Some issues fixed in r634 with the new String API.
*<tt>int show_1numeric_input(const char * title, const char * subtitle, const char * msg, int * value_ref, int min_value, int max_value)</tt>: since v3.1 r607. Request popup for one numeric input. Caution, values like -1 or 0 for ''min_value'' will cancel the popup. Returns 1 if OK, 0 if cancelled.
*<tt>int show_2numeric_input(const char * title, const char * subtitle, const char * msg1, int * value1_ref, int min_value1, int max_value1, const char * msg2, int * value2_ref, int min_value2, int max_value2)</tt>: since v3.1 r607. Request popup for two numeric inputs. Caution, values like -1 or 0 for ''min_value'' will cancel the popup. Returns 1 if OK, 0 if cancelled.
*<tt>void refresh_osscr(void)</tt>: since v3.1. Must be called at the end of a program that creates or deletes files, to update the OS document browser.


==Keyboard==
If you would like to register on Hackspire or contact the administration team you can do so by sending a mail to 'admin' on hackspire.org.  
*<tt>BOOL any_key_pressed(void)</tt>: non-blocking key press test. Return <tt>TRUE</tt> if one or more keys are being pressed.
*<tt>BOOL isKeyPressed(key)</tt>: non-blocking key press test. <tt>key</tt> must be one of the <tt>KEY_NSPIRE_*</tt> constants defined in keys.h.
*<tt>BOOL on_key_pressed(void)</tt>: since v3.1. Non-blocking ON key press test. Caution, key scanning is time consuming and may hurt the performance of programs which needs high reactivity. You should skip key scanning regularly in the main loop of a game.
*<tt>void wait_key_pressed(void)</tt>: block until a key is pressed. Changing the timer frequency have effects on the latency of this function.
*<tt>void wait_no_key_pressed(void)</tt>: block until all the keys are released. Changing the timer frequency have effects on the latency of this function.
*<tt>touchpad_info_t *touchpad_getinfo(void)</tt>: return information on the Touchpad area such as its dimension. Return <tt>NULL</tt> if not a TI-Nspire Touchpad. See <tt>include/libndls.h</tt> for the definition of <tt>touchpad_info_t</tt>.
*<tt>int touchpad_scan(touchpad_report_t *report)</tt>: check user interactions with the Touchpad area and writes to <tt>report</tt>. See <tt>include/libndls.h</tt> for the definition of <tt>touchpad_report_t</tt>. <tt>report->contact</tt> and <tt>report->pressed</tt> are always <tt>FALSE</tt> on TI-Nspire Clickpad. See <tt>src/arm/tests/ndless_tpad.c</tt> for an example of use.
*<tt>int get_event(struct s_ns_event*)</tt>: since r721. Poll for an OS event. See <tt>struct s_ns_event</tt> in nucleus.h.
*<tt>void send_key_event(struct s_ns_event* eventbuf, unsigned short keycode_asciicode, BOOL is_key_up, BOOL unknown)</tt>: since r721. Simulate a key event.
*<tt>void send_click_event(struct s_ns_event* eventbuf, unsigned short keycode_asciicode, BOOL is_key_up, BOOL unknown)</tt>: since r750. Simulate a click event. keycode_asciicode=0xFB00: single click, keycode_asciicode=0xAC00: drag.
*<tt>void send_pad_event(struct s_ns_event* eventbuf, unsigned short keycode_asciicode, BOOL is_key_up, BOOL unknown)</tt>: since r750. Simulate a cursor move. Set the cursor coordinates in eventbuf, and keycode_asciicode to 0x7F00.


==Filesystem==
Don't forget to '''add''' the name of this wiki in your message '''subject''', and clearly mention what your request is and why, otherwise your e-mail will be ignored.
<tt>int enable_relative_paths(char **argv)</tt>: since r820. Call before using <tt>fopen()</tt> and other file-related functions with paths relative to the current program. <tt>argv</tt> should be the <tt>argv</tt> parameter of the <tt>main()</tt> function. Returns -1 on error, 0 if success.


==CPU==
== Other TI-Nspire developer communities ==
*<tt>void clear_cache(void)</tt>: flush the data cache and invalidate the instruction and data caches of the processor. Should be called before loading code dynamically, after a code patch or with self-modifying code.
===Forums and News sites===
*(CX compatibility to come - temporarily removed) <del><tt>unsigned set_cpu_speed(unsigned speed)</tt>: since v3.1. ''speed'' is one of <tt>CPU_SPEED_150MHZ</tt>, <tt>CPU_SPEED_120MHZ</tt>, <tt>CPU_SPEED_90MHZ</tt>. Returns the previous speed. You must restore the original speed before the program exits.</del>
Although not specific to the TI-Nspire, these web sites are visited by many TI-Nspire hackers and developers.


==Hardware==
[https://codewalr.us CodeWalrus] ([https://codewalr.us/index.php?action=forum forum]) (English spoken)
*<tt>BOOL is_classic</tt>: since v3.1. <tt>TRUE</tt> on classic TI-Nspire. This is the preferred way to check CX/CM-specific features: ''if (is_classic) classic_code; else cx_code;''
*<tt>BOOL is_cm</tt>: since v3.1 r863. <tt>TRUE</tt> on TI-Nspire CM/CM-C.
*<tt>BOOL has_colors</tt>: since v3.1. <tt>TRUE</tt> if the device has a screen in color.
*<tt>BOOL is_touchpad</tt>: <tt>TRUE</tt> on a TI-Nspire Touchpad or on a TI-Nspire CX.
*<tt>unsigned hwtype()</tt>: 0 on classic TI-Nspire, 1 on TI-Nspire CX.
*<tt>IO()</tt>: select an I/O port whose mapping depends on the hardware type. Fo example <tt>IO(0xDC00000C, 0xDC0000010)</tt> will return 0xDC00000C on classic TI-Nspire, 0xDC0000010 on CX. Returns a ''volatile unsigned*''.
*<tt>volatile unsigned *IO_LCD_CONTROL</tt>: since v3.1. LCD control register of the LCD controller


==Time==
[https://tiplanet.org TI-Planet] ([https://tiplanet.org/forum/index.php forum]) (French spoken)
*<tt>void idle(void)</tt>: switch to low-power state until the next interrupt occurs. The use of this function is encouraged when waiting in loops for an event to save the batteries. Changing the timer frequency have effects on the latency of this function.
*<tt>void sleep(unsigned m)</tt>: delay for a specified amount of time in ms. The CPU is regularly switched to low-power state while blocking.


==Configuration==
[https://www.omnimaga.org Omnimaga] ([https://www.omnimaga.org/index.php?action=forum forum]) (least active - English spoken)
*<tt>void cfg_register_fileext(const char *ext, const char *prgm)</tt>: (since v3.1 r797) associate for Ndless the file extension <tt>ext</tt> (without leading '.') to the program name <tt>prgm</tt>. Does nothing if the extension is already registered.


==Debugging==
===Independent TI-Nspire Developers IRC channels===
*<tt>void bkpt()</tt>: software breakpoint. Make the emulator halt and open the debugger. Remove before transferring to a calculator, as it will crash if executed.
General discussion: <code>#inspired at efnet.xs4all.nl:6667</code> (SSL on port 6697), or another server listed on http://www.efnet.org/?module=servers .
 
More specifically aimed at Lua programming: <code>#nspire-lua at efnet.xs4all.nl:6667</code> (SSL on port 6697), or another server listed on http://www.efnet.org/?module=servers .
 
==Disclaimer==
Hackspire is in no way affiliated with Texas Instruments Inc., or any of its subsidiaries. All data included in or accessible from the wiki is provided "as is" and without warranties of any kind. We do not guarantee the accuracy of it and any use is at own risk.

Revision as of 09:06, 22 June 2019

Welcome to you on Hackspire, the TI-Nspire Hacking wiki. The goal of this wiki is to federate all research efforts about the Texas Instruments's TI-Nspire calculator series.

Feel free to add your contribution, the more details we get, the better software the community can create. TI Software is great for mathematics, physics, ... but independent developers are needed for all the rest, because TI does not have time for it!

Alerts

Some pages might show outdated content, these will be updated in the course of the following days.

Site news

  • June 21, 2019 - (Jim Bauwens): The Hackspire wiki is back online after a downtime of over a month due to a server failure
  • July 2, 2017 - (Jim Bauwens): The Hackspire wiki is 10 years old today! Many thanks to all the contributors for making Hackspire what it is today!
  • June 15, 2016 - (Jim Bauwens): hackspire.org is now the main domain name
  • March 10, 2016 - (Jim Bauwens): hosting on new server

Pages

Projects, programs and tools Ndless Development resources OS information Miscellaneous

Registering / Contacting the Hackspire administration

If you would like to register on Hackspire or contact the administration team you can do so by sending a mail to 'admin' on hackspire.org.

Don't forget to add the name of this wiki in your message subject, and clearly mention what your request is and why, otherwise your e-mail will be ignored.

Other TI-Nspire developer communities

Forums and News sites

Although not specific to the TI-Nspire, these web sites are visited by many TI-Nspire hackers and developers.

CodeWalrus (forum) (English spoken)

TI-Planet (forum) (French spoken)

Omnimaga (forum) (least active - English spoken)

Independent TI-Nspire Developers IRC channels

General discussion: #inspired at efnet.xs4all.nl:6667 (SSL on port 6697), or another server listed on http://www.efnet.org/?module=servers .

More specifically aimed at Lua programming: #nspire-lua at efnet.xs4all.nl:6667 (SSL on port 6697), or another server listed on http://www.efnet.org/?module=servers .

Disclaimer

Hackspire is in no way affiliated with Texas Instruments Inc., or any of its subsidiaries. All data included in or accessible from the wiki is provided "as is" and without warranties of any kind. We do not guarantee the accuracy of it and any use is at own risk.