Omnimaga

Omnimaga => Completed => Our Projects => Nspire I/O => Topic started by: compu on March 03, 2011, 03:21:21 pm

Title: Nspire I/O
Post by: compu on March 03, 2011, 03:21:21 pm
Hi, here is a collection of text input/output functions for the TI-Nspire ;D

Demo program:
(http://nspforge.unsads.com/p/nspireio/raw-attachment/wiki/WikiStart/consoledemo.PNG)

Basically these functions are included:

Download and more information can be found at nspforge (here (http://nspforge.unsads.com/p/nspireio)).

So if you found any bugs, got suggestions or I did any mistakes with this please let me know, because I don't have much experience with Nspire programming... :)
Title: Re: Nspire I/O
Post by: DJ Omnimaga on March 03, 2011, 03:22:50 pm
Interesting. I wonder if there will be multiple font support? Is it gonna be mostly for game dev or mostly for command line development?
Title: Re: Nspire I/O
Post by: alberthrocks on March 03, 2011, 03:23:14 pm
Hehe, you're going to make one ExtendeD happy. ;)
He wants to make a small console for the Nspire and include it (??) with ndless. This could be that prgm. :D

(Of course, not a simple print/input prgm, but something like BASH)
Title: Re: Nspire I/O
Post by: Munchor on March 03, 2011, 03:23:42 pm
A cat program for the nspires! Nice :D

I agree with DJ, multiple fonts'
Title: Re: Nspire I/O
Post by: compu on March 03, 2011, 03:25:36 pm
Interesting. I wonder if there will be multiple font support? Is it gonna be mostly for game dev or mostly for command line development?
If you exchange the charmap and edit some of the defines it should work with every font size ;)

Hehe, you're going to make one ExtendeD happy. ;)
He wants to make a small console for the Nspire and include it (??) with ndless. This could be that prgm. :D

(Of course, not a simple print/input prgm, but something like BASH)
Hm, I think he could do it better than me, but thanks ;D

EDIT: oops, I read only the first part of your post DJ ::)
I don't know what I will use this for, but I thought it would be useful for me and other people  :)
Title: Re: Nspire I/O
Post by: DJ Omnimaga on March 03, 2011, 03:45:44 pm
I see, that's cool, then. :D
Title: Re: Nspire I/O
Post by: ExtendeD on March 04, 2011, 09:10:04 am
Nice :)

Hehe, you're going to make one ExtendeD happy. ;)
He wants to make a small console for the Nspire and include it (??) with ndless. This could be that prgm. :D
I have unfortunately already started working on it.
Title: Re: Nspire I/O
Post by: compu on March 25, 2012, 11:50:57 am
(Necro)update :P

- Ndless 3.1 compatibility
- Included functions for RS232 that work with disabled interrupts (no clock on the screen) - CX compatible
- Grayscale support
- Support for multiple consoles
- Lot of minor improvements.

CX compatibility has not been tested for on-screen I/O.

And 2 screenshots. The first shows grayscale support, the second using two consoles at once.
Link to source and download is in the first post.
Title: Re: Nspire I/O
Post by: DJ Omnimaga on March 25, 2012, 12:17:04 pm
Looks nice. :)

That reminds me, Calc84maniac was working on some sort of DOS/command prompt for the Nspire, but sadly he lost all his work in late 2010. :(
Title: Re: Nspire I/O
Post by: Jim Bauwens on March 25, 2012, 02:48:16 pm
Very nice :)
I'm definitely going to put it on my CX when it's done!

On a side note, can you change the baud speed of the rs232/uart (and other flags)? That would be very interesting, since you could then use your nspire to hack other devices (routers, nas, etc) if they have a serial port. I don't expect this to be included, but it's just an interesting idea :)
Title: Re: Nspire I/O
Post by: ExtendeD on March 31, 2012, 11:55:00 am
I have just looked into it, really nice, it needs more promotion :) This should be part of the toolkit of anyone beginning native programming on the TI-Nspire.
You should release it as an archive file. And I'm really expecting CX compatibility.
Title: Re: Nspire I/O
Post by: compu on April 13, 2012, 04:30:35 pm
A package including source code, binaries, demo application and documentation is now available at nspforge (http://nspforge.unsads.com/p/nspireio/downloader).

On a side note, can you change the baud speed of the rs232/uart (and other flags)? That would be very interesting, since you could then use your nspire to hack other devices (routers, nas, etc) if they have a serial port. I don't expect this to be included, but it's just an interesting idea :)
In theory this would be possible, but I haven't tried anything yet ;)
Title: Re: Nspire I/O
Post by: ExtendeD on April 13, 2012, 04:34:20 pm
To contribute to its promotion: nspireio is being used by OCD (On-Calc Debugger) (http://ndlessly.wordpress.com/2012/04/09/introducing-ocd-the-ti-nspire-on-calc-debugger/).
It's easy to use and really deserve trying it.
As compu told me just switch to grayscale mode for CX compatibility (if(has_colors) {clrscr(); lcd_ingray();}).
Title: Re: Nspire I/O
Post by: Jim Bauwens on April 13, 2012, 07:22:07 pm
Thanks for the answer compu :)

ExtendeD, maybe nspireio could be eventually be integrated into Ndless?
Then it would come closer to TIGCC, as their lib includes something like this.
Title: Re: Nspire I/O
Post by: ExtendeD on April 14, 2012, 09:33:05 am
Maintenance is easier with autonomous owners and components with their own lifecycle.
And using static libraries (http://hackspire.unsads.com/wiki/index.php/Ndless_features_and_limitations#Using_static_libraries) is just a matter of dropping files in directories and adding an -l switch to the Makefile.
So I prefer the way it is today :)
Title: Re: Nspire I/O
Post by: Jim Bauwens on April 14, 2012, 12:54:32 pm
Ah, I see :)
Title: Re: Nspire I/O
Post by: alberthrocks on September 11, 2012, 08:11:54 pm
BUM BUM BUM BUMP!

I'm a rabid fan of NspireIO who is using this for a secret project (that isn't terribly secret after telling 3-5 people about it :P). However, it lacks a cursor, and the dev (compu) seemed inactive at the time, so I decided to implement it. (He seems to be active now - he has added lots of interesting features in SVN trunk!) Juju also has a need to implement it since KermMartian is using it for his LuaZM via the Prizm port of NspireIO, PrizmIO! After telling Juju that I would implement it (for his ease of porting), it's finally here... after quite a few feature additions so that NspireIO's cursor isn't "just any cursor!" ;)

Screenshot demo:
(https://dl.dropbox.com/u/1016340/PublicPictures/NSPIREIO21.GIF)

New features:

It's very likely that very few, if any at all, will use those extra cursor options, but it was fun developing it anyway. :)
And voila, an needed update to NspireIO! :) (Version 2.1)

(If I seem to be making a big deal about this, excuse me - I'm just excited because this is probably my first serious release!)

Downloads:
Downloads are attached in ZIP and GZIP tar archives.
Mirror:
https://dl.dropbox.com/u/1016340/NspireIO/nspireio-2.1.tar.gz
https://dl.dropbox.com/u/1016340/NspireIO/nspireio-2.1.zip

(To compu: I've made a change to the Makefile to make it more "compliant" - hopefully you won't mind :) This is based off of r37, so if you want to merge, merge from that point. Also, the code is under LGPL 2.1, like the SVN, so no worries there. :))

EDIT: As always, the API is located in the header file, nspireio2.h. New binaries need to be built, I'll update within an hour.

EDIT 2: Dropbox mirror releases are updated. Attachment archives will be fixed soon.

EDIT 3: Attachments updated. Read README.txt for installation instructions. Also a few clarifications: 1) This is MY update, not compu's. Consider it unofficial, despite the version bump. 2) You may encounter issues when linking for certain compilers. You may need to delete the Ndless SDK's version of the NspireIO header and library before things will work. The cursor is enabled automatically, so seeing it in your program after the update is a definite way of telling whether you are linking/using the new version or not.
Title: Re: Nspire I/O
Post by: blfngl on September 11, 2012, 08:30:29 pm
Little confused, but what exactly does this do? I don't get it :P
Title: Re: Nspire I/O
Post by: TheNlightenedOne on September 11, 2012, 08:32:34 pm
Do you mean alberthrocks's update or Nspire I/O itself?
Title: Re: Nspire I/O
Post by: alberthrocks on September 11, 2012, 08:36:48 pm
Little confused, but what exactly does this do? I don't get it :P
This is a library for a virtual console on the Nspire. Most people won't need it, unless they are developing a console based game of app.

Do you mean alberthrocks's update or Nspire I/O itself?
This is my update :)
Title: Re: Nspire I/O
Post by: blfngl on September 11, 2012, 08:39:12 pm
So if I were to be making the impossible game for nspire, for example, I should use this?
Title: Re: Nspire I/O
Post by: Juju on September 11, 2012, 08:41:08 pm
Yay. I'll merge your changes with my copy of PrizmIO as soon as possible.
Title: Re: Nspire I/O
Post by: alberthrocks on September 11, 2012, 08:43:08 pm
So if I were to be making the impossible game for example, I should use this?
Absolutely not... unless you want to use ASCII squares for the game. :P I suggest using nRGBLib (https://bitbucket.org/totorigolo/nrgblib) instead.

Yay. I'll merge your changes with my copy of PrizmIO as soon as possible.
Yippee!! And I'll take a nice long break.... :P
Title: Re: Nspire I/O
Post by: blfngl on September 11, 2012, 08:44:15 pm
Absolutely not... unless you want to use ASCII squares for the game. :P I suggest using nRGBLib (https://bitbucket.org/totorigolo/nrgblib) instead.
Thanks :D
Title: Re: Nspire I/O
Post by: compu on September 12, 2012, 02:07:28 am
Hi Albert, thanks for this nice feature :)
Yes, I didn't work on Nspire I/O for a longer time but I was always around in the forums - If you would've sent me a PM I would've integrated your changes into the trunk directly - but no problem, I'll do it this afternoon when I have time :)

And by the way, I made a lot of syntax changes a week ago:

The functions have completely changed and have the same syntax as
their stdio-counterparts now:
(with nio_-prefix)
fflush
fgetc
fgets
fprintf
fputc
fputs
getc
getchar
gets
perror
printf
putc
putchar
puts

All functions that don't have a FILE* stream / nio_console* c
argument, use a default console specified by nio_set_default().

Using the old syntax is possible by defining NIO_KEEP_COMPATIBILITY.

It is possible to replace the stdio-functions putchar, puts, getchar,
gets, printf, perror with nspireio functions by defining
NIO_REPLACE_STDIO, so you can use nspireio as stdin/stdout (just call
nio_use_stdio() at the beginning and nio_free_stdio() at the end of
the program).

Example:
Code: [Select]
#include <os.h>
#define NIO_REPLACE_STDIO
#include <nspireio2.h>

int main(void)
{
    nio_use_stdio();
    puts("Hello World!");
    nio_free_stdio();
   
    wait_key_pressed();
    return 0;
}

The same is possible with the UART functions (that work with disabled
interrupts) by defining UART_REPLACE_STDIO.

So, I'll merge your changes with r44 and probably release it as 3.0.
Title: Re: Nspire I/O
Post by: ExtendeD on September 16, 2012, 05:29:25 am
compu, so I'm waiting these changes to be merged before integrating it to the Ndless SDK, please tell me when it's OK for you.
Title: Re: Nspire I/O
Post by: Eiyeron on September 16, 2012, 07:33:55 am
Added to nSDK? WHy not? THat would be genious!
Title: Re: Nspire I/O
Post by: compu on October 06, 2012, 03:58:57 pm
Update:

- Color support (256 colors, with 16 predefined colors like NIO_COLOR_RED)
- The cursor shows if shift/ctrl/caps is activated

More information: http://nspforge.unsads.com/p/nspireio/wiki
Source code (direct download): http://nspforge.unsads.com/p/nspireio/changeset/62/trunk?old_path=%2F&format=zip
Title: Re: Nspire I/O
Post by: DJ Omnimaga on October 06, 2012, 05:10:26 pm
Glad to see this is still updated. I thought a while ago that you left the community in response to the PTTKiller incident and I'm glad you stayed around. Looks nice btw. :)
Title: Re: Nspire I/O
Post by: Juju on October 06, 2012, 05:32:01 pm
Yup, lots of new features got added lately thanks to compu, Alberthrocks (cursor support) and myself (color support).

Also I now have write access to the Nspire I/O repos (hint about the next update!) :D
Title: Re: Nspire I/O
Post by: ElementCoder on October 08, 2012, 01:16:10 pm
Nice work, glad to see this is still continued :) How do you record that animation btw?
Title: Re: Nspire I/O
Post by: compu on October 08, 2012, 03:33:27 pm
With a program called CalcCapture ;)
Title: Re: Nspire I/O
Post by: Juju on October 09, 2012, 10:57:17 pm
UPDATE:

- Prizm support complete! (Not done yet I think, still have to test some more, especially the keyboard part that might or might not work...) Type "make ARCH=prizm" to compile.
- [PRIZM] New keyboard layout! (Same as MPoupe's FXTERM)
Title: Re: Nspire I/O
Post by: compu on November 01, 2012, 10:47:59 am
UPDATE:

- Added nio_get_default()
- Replacing stdin & stdout with nio_get_default() when NIO_REPLACE_STDIO is set
- nio_fgets should be ANSI C compliant now
- nio_getchar should be ANSI C compliant now
- added nio__getch() and nio__getche()
Title: Re: Nspire I/O
Post by: excale on November 02, 2012, 05:47:48 pm
I tried to download the latest version, but I seems NspireIO is not up-to-date on nspforge.
Title: Re: Nspire I/O
Post by: lkj on November 02, 2012, 05:54:39 pm
Why do you think it's not up-to-date? It says modified 31 hours ago...
Title: Re: Nspire I/O
Post by: excale on November 02, 2012, 06:03:23 pm
I used the link in his signature, and then clicked on "downloader" ( http://nspforge.unsads.com/p/nspireio/downloader ), which says it was last updated on 16/09.

Am I on the wrong link?
Title: Re: Nspire I/O
Post by: compu on November 02, 2012, 06:04:02 pm
The downloader only has packages with pre-built libraries, demos and docs. You can download the latest source from the small link at the bottom of "Browse Source" or use this link: http://nspforge.unsads.com/p/nspireio/changeset/65/trunk?old_path=%2F&format=zip
Title: Re: Nspire I/O
Post by: Adriweb on November 02, 2012, 06:04:47 pm
To be precise, the trunk has been updated 31 hours ago (at the time of this post) :
http://nspforge.unsads.com/p/nspireio/browser/trunk

However, not the downloads :
http://nspforge.unsads.com/p/nspireio/downloader


Edit : ah well, compu was faster :P
Title: Re: Nspire I/O
Post by: excale on November 02, 2012, 06:05:28 pm
Ok. Thanks all :).
Title: Re: Nspire I/O
Post by: epic7 on December 11, 2012, 11:56:17 am
How do I input integers, if that's possible?
Title: Re: Nspire I/O
Post by: compu on December 11, 2012, 12:57:28 pm
Use nio_gets or nio_fgets and pass the string to atoi (http://www.cplusplus.com/reference/cstdlib/atoi/) ;)
Title: Re: Nspire I/O
Post by: Lionel Debroux on December 11, 2012, 01:00:25 pm
And FWIW, strtol & strtoul are better than atoi for error handling :)
Title: Re: Nspire I/O
Post by: epic7 on January 12, 2013, 05:39:41 pm
Does this support scrolling?
It just reaches the bottom and then crashes for me.
Title: Re: Nspire I/O
Post by: compu on January 12, 2013, 06:09:12 pm
Are you using the latest version? The "tests" demo with Nspire I/O 3.1 works fine for me.
You can download the latest version here: http://nspforge.unsads.com/p/nspireio/downloader
Title: Re: Nspire I/O
Post by: compu on March 18, 2013, 12:03:49 pm
Small update:

- Added double buffering (nio_scrbuf_* functions in nspireio-platform-nspire.h)
- Fixed a grayscale display issue (white was shown as gray)
Title: Re: Nspire I/O
Post by: Lionel Debroux on September 28, 2013, 12:00:03 pm
Feature request derived from http://ourl.ca/19674/362209 , assuming it doesn't exist yet: add nio_getsn() and add a compiler warning upon usage of nio_gets(). gets() is insecure and was removed from the C11 standard :)

When arg is a fixed-size char array, nio_gets can be expressed in terms of nio_getsn:
#define nio_gets(arg) nio_getsn(arg, sizeof(arg))
When arg is a pointer for an allocated array, that does not work...
Title: Re: Nspire I/O
Post by: Legimet on September 28, 2013, 10:33:28 pm
Actually, nio_gets() just calls nio_fgets() with a size argument of 100, so it's not insecure if you have a buffer of at least 100 chars, but it doesn't work like the gets function in older C standards.
If your buffer is smaller than 100 chars, you must use nio_fgets unless you want buffer overflows.

Another feature request: add nio_scanf() and nio_fscanf(). (Unfortunately, these will have to be implemented as macros, because there is no vsscanf syscall, only sscanf.)
Title: Re: Nspire I/O
Post by: compu on September 29, 2013, 10:59:00 am
I have added nio_scanf and nio_fscanf ;)

add nio_getsn() and add a compiler warning upon usage of nio_gets(). gets() is insecure and was removed from the C11 standard :)
Since we have fgets with a size argument, I don't think we need getsn.
Title: Re: Nspire I/O
Post by: Legimet on September 29, 2013, 12:47:36 pm
Thanks. And do you have any idea of when the next version will be released?
Title: Re: Nspire I/O
Post by: compu on September 29, 2013, 01:57:38 pm
Probably when I continue working on the C++ support (https://github.com/compujuckel/nspire-io/tree/cpp-support/niostream) (holidays start in some days, so maybe I'll stop being lazy and work on some Nspire stuff again :P ).
Title: Re: Nspire I/O
Post by: ivelegacy on September 22, 2016, 06:23:36 am
I can't access the repository, it seems expired  :o
Title: Re: Nspire I/O
Post by: Eeems on September 22, 2016, 11:26:04 am
I can't access the repository, it seems expired  :o
From what I can see on the network graph, it was merged into master here: https://github.com/compujuckel/nspire-io/commit/43d991c2ce0bf6384cc5b24614e317f26467a2d2
Title: Re: Nspire I/O
Post by: ivelegacy on September 25, 2016, 09:51:20 am
thanks, I will check it