Omnimaga

Omnimaga => News => Topic started by: Jim Bauwens on June 16, 2013, 04:34:09 pm

Title: C++ on the TI-Nspire
Post by: Jim Bauwens on June 16, 2013, 04:34:09 pm
ExtendeD is still working on Ndless, and has just solved technical issues that prevented C++ support from being implemented in Ndless.
Here you go for a brand new version of Ndless :)

The first C++ programs for Nspire have been coded by tangrs (http://blog.tangrs.id.au/?p=712) a while ago, but the issue was that elf2flt (http://docs.blackfin.uclinux.org/doku.php?id=toolchain:elf2flt) was not handling some relocations with recent GCC versions for ARM. This caused issues with hoffa's nSDL (http://hoffa.github.io/nSDL/), and was reducing the number of programs you could port for the Nspire.

Now that the issue has been identified, ExtendeD patched elf2flt and published :


Here's a preview of the new features of a direct port (with small changes to adapt to the platform itself, like keyboard, resolution...) showing what c++ with nSDL can provide, with a quick  port (http://www.unsads.com/projects/nsptools/downloader/download/file/58) of Advanced Tetris by GDO (http://www.gd-experience.eu/index.php?viewPost=50), by Extended :

(http://ndlessly.files.wordpress.com/2013/06/atetris.jpg)

Have fun with Ndless, even if TI tries to prevent us from opening the Nspire (http://tiplanet.org/forum/viewtopic.php?t=12359) - they have more to lose than we do :)




Source and downloads: http://ndlessly.wordpress.com/2013/06/15/cpp-for-the-ti-nspire/ & ExtendeD for tip

Cross posted from TI-Planet (http://tiplanet.org/forum/viewtopic.php?f=43&t=12396)
Title: Re: C++ on the TI-Nspire
Post by: lkj on June 16, 2013, 04:49:07 pm
Great! Thanks for your continued work on Ndless, ExtendeD! :)

So does the use of bFLT mean that the issues with global variables are now also solved?
Title: Re: C++ on the TI-Nspire
Post by: TIfanx1999 on June 16, 2013, 05:27:10 pm
That's fantastic news. I'm sure a lot of coders will be really happy! :D
Title: Re: C++ on the TI-Nspire
Post by: DJ Omnimaga on June 16, 2013, 05:47:57 pm
Thanks for cross posting :)

This is great news. I believe that some people used minimal C++ stuff before, but they couldn't use the entire language. It's good news since some people prefer it to C.
Title: Re: C++ on the TI-Nspire
Post by: ElementCoder on June 17, 2013, 02:21:19 am
Oh great, now you're making me doubt again wether I should learn C or C++ :P J/k, fatastic work!/me will just learn both
Title: Re: C++ on the TI-Nspire
Post by: Streetwalrus on June 17, 2013, 05:20:18 am
Oh great, now you're making me doubt again wether I should learn C or C++ :P J/k, fatastic work!/me will just learn both
Well, since they are so close in their cores, you could learn C first, then learn C++'s expansions.

And that's awesome by the way. :D
Title: Re: C++ on the TI-Nspire
Post by: ExtendeD on June 17, 2013, 07:21:52 am
So does the use of bFLT mean that the issues with global variables are now also solved?

Yes :) You can thank tangrs for this.
Title: Re: C++ on the TI-Nspire
Post by: Sorunome on June 17, 2013, 07:24:58 am
Ha, that's awesome, i love c++ :D
Title: Re: C++ on the TI-Nspire
Post by: Hayleia on June 17, 2013, 10:31:29 am
That is very great news !
Iirc, some emulators people wanted to see ported (Sega for example) couldn't be be ported from C (because no one coded them in C) but existed in C++, so maybe we could see those emulators coming now ?
Title: Re: C++ on the TI-Nspire
Post by: Streetwalrus on June 17, 2013, 11:08:10 am
Yeah what Hayleia said. :D
Title: Re: Re: C++ on the TI-Nspire
Post by: DJ Omnimaga on June 17, 2013, 02:06:12 pm
Just make sure that the emulator is properly coded in its current form before considering porting it to a weaker platform. I remember some NES emulators like JNES that could barely even run on a Pentium II 350 MHz (got like 8 FPS), yet Nesticle and FCEU would run at 60 FPS.
Title: Re: C++ on the TI-Nspire
Post by: Legimet on June 17, 2013, 03:25:51 pm
This is really awesome, because people can port a lot of SDL games and emulators written in C++. :D
Title: Re: C++ on the TI-Nspire
Post by: AlexisVieira on June 17, 2013, 04:00:22 pm
I think that we will see lots of new games on the next times :) I really want to see that SEGA emulator :) (working on the black/white nspires too)
by the way, it's now possible to make a GBA emulator compatible with the non-cx nspires?
Title: Re: C++ on the TI-Nspire
Post by: Streetwalrus on June 17, 2013, 04:02:58 pm
I think classics' hardware is too weak for GBA, else gpSP would have been realeased to it too. ;)
Title: Re: C++ on the TI-Nspire
Post by: AlexisVieira on June 17, 2013, 04:07:41 pm
I think classics' hardware is too weak for GBA, else gpSP would have been realeased to it too. ;)
that's great news :)
Title: Re: C++ on the TI-Nspire
Post by: Streetwalrus on June 17, 2013, 04:09:41 pm
Hmmm, I think you misunderstood me. The answer was no. :P/me runs
Sorry dude. :/
Title: Re: C++ on the TI-Nspire
Post by: sammyMaX on June 17, 2013, 04:34:59 pm
There are many advantages C++ has over C, but what makes me especially happy is that dealing with strings is no longer a PITA  ;D
Title: Re: C++ on the TI-Nspire
Post by: AlexisVieira on June 17, 2013, 05:49:56 pm
Hmmm, I think you misunderstood me. The answer was no. :P/me runs
Sorry dude. :/
oh :( sorry... my bad english again -.-
Title: Re: C++ on the TI-Nspire
Post by: tr1p1ea on June 17, 2013, 09:32:13 pm
Are there many ARM coders on Nspire?
Title: Re: C++ on the TI-Nspire
Post by: DJ Omnimaga on June 17, 2013, 09:55:16 pm
Sadly, not much. We had a few in the early days of the Nspire, but when we discovered we could use C, everyone switched to C. And Nspire programming almost completely died for a while after OS 3.0.2 came out and it took almost half a year before Ndless 3.x is possible. Now it's pretty much like the 68K scene back in 2007-09.
Title: Re: C++ on the TI-Nspire
Post by: Hooloovoo on June 17, 2013, 10:10:28 pm
There is one that I can think of now right off the top of my head, and that is jacobly with his calcemu, which is written completely in ARM asm. Also, Calc84 wrote gbc4nspire in assembly.
Title: Re: C++ on the TI-Nspire
Post by: DJ Omnimaga on June 18, 2013, 12:16:41 am
Oh I didn't know Jacobly used ARM ASM. I know ExtendeD did and calc84maniac too, but I thought calc84maniac switched to C after gbc4nspire.
Title: Re: C++ on the TI-Nspire
Post by: ajorians on June 18, 2013, 09:07:05 am
Hey Guys,

I'm very happy to see C++ support implemented in Ndless!  AFAIK with bFLT format handling it should be easier to create a game with external A.I. players.  Like a plugin.  So imagine playing Connect 4 (for example) and somebody creates a new A.I. player to play with and all you got to do is add the one new A.I. file.

ikj: I tested the "issues with global variables" and they are indeed solved!  See Test_Globals attachment.  C++ exceptions are disabled (see Test_Exceptions attachment); but we can create some amazing things without them!

Have a great day!
Title: Re: C++ on the TI-Nspire
Post by: Streetwalrus on June 18, 2013, 12:27:41 pm
Meh. Exceptions are for pussies, you should catch the thing before an exception is thrown. :P
Title: Re: C++ on the TI-Nspire
Post by: Legimet on June 18, 2013, 12:53:40 pm
I saw on tangrs blog that exceptions don't work because of some unimplemented functions. What are these functions??
Title: Re: C++ on the TI-Nspire
Post by: Lionel Debroux on June 18, 2013, 12:55:00 pm
Exceptions do indeed have drawbacks. AFAIK, most secure / embedded C++ coding conventions ban them.
Title: Re: C++ on the TI-Nspire
Post by: ajorians on June 18, 2013, 01:56:38 pm
Hey Guys,

Indeed!  I compiled the very simple Text_Exceptions and with the throw,try&catch commented out and there is a size difference (see below).  Personally I'm perfectly fine without exceptions; but I could see if somebody using Boost or something would need to write around their issue.

Thanks and have a wonderful day!
Title: Re: C++ on the TI-Nspire
Post by: ajorians on June 18, 2013, 02:04:10 pm
I saw on tangrs blog that exceptions don't work because of some unimplemented functions. What are these functions??

Sorry, second post :(

For sure std::terminate.  I am under the impression that when an unhandled exception is called it would call that function.  I'd have to look up to know more.

Thanks!
Title: Re: C++ on the TI-Nspire
Post by: Legimet on June 18, 2013, 02:33:27 pm
Also, std::unexpected, I guess.
Title: Re: C++ on the TI-Nspire
Post by: Hooloovoo on June 18, 2013, 03:03:48 pm
ajorians: you can use the 'modify' button on the top-right of your post to edit the post and avoid double-posting.
Title: Re: C++ on the TI-Nspire
Post by: Dapianokid on June 18, 2013, 05:03:43 pm
"And now, ladies and gentleman, Dapianokid would like to entertain you with his 'Ode to ExtendeD'"

I'm really impressed. Blown away, really. You just made so many people have a much easier time of porting programs to the Nspire.
Title: Re: C++ on the TI-Nspire
Post by: ExtendeD on June 19, 2013, 01:59:35 am
tangrs should be thank for this, he did most of the hard job.
Title: Re: C++ on the TI-Nspire
Post by: AlexisVieira on June 19, 2013, 04:16:26 pm
tangrs should be thank for this, he did most of the hard job.

thanks for your awnsome job Tangrs and ExtendeD :)