Author Topic: C# for the nspire  (Read 12107 times)

0 Members and 1 Guest are viewing this topic.

Offline qazz42

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1130
  • Rating: +30/-12
  • hiiiiiiiii
    • View Profile
Re: C# for the nspire
« Reply #15 on: September 07, 2010, 03:00:05 pm »
I know that C++ should be first, but I still want to try and expand the idea of C# on the nspire if it is humanly possible

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: C# for the nspire
« Reply #16 on: September 07, 2010, 05:02:52 pm »
It is certainly possible; however, its uses probably will be limited by the overhead of the interpreter.
It is *much* harder than C++. We already have a C++ cross-compiler, but there isn't a complete C# interpreter for ARM devices yet.

Offline qazz42

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1130
  • Rating: +30/-12
  • hiiiiiiiii
    • View Profile
Re: C# for the nspire
« Reply #17 on: September 07, 2010, 05:48:04 pm »
Bwang, good point, perhaps I could work with someone to port C# to the nspire....

out of curiosity, what would it take to build your own interpreter?

_player1537

  • Guest
Re: C# for the nspire
« Reply #18 on: September 07, 2010, 05:50:59 pm »
Not much, (imo).  In TI-Basic, an interpreter is as easy as:
Code: [Select]
"sub(str1,A,1->v
For(A,1,Length(str1
If v="command
Do stuff
If v="other command
Do other stuff
End

It would be about the same thing in C, might be fun to write if I knew how to access files on the calc.  I'd be happy to help you :)  (although other people would probably be better suited to the job)

Offline qazz42

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1130
  • Rating: +30/-12
  • hiiiiiiiii
    • View Profile
Re: C# for the nspire
« Reply #19 on: September 07, 2010, 05:53:19 pm »
of cousre, I wish TI-Basic had a To.Upper method :P

and thats interesting player, if we get further on this, I would love to work with you
« Last Edit: September 07, 2010, 06:01:18 pm by qazz42 »

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: C# for the nspire
« Reply #20 on: September 07, 2010, 05:55:29 pm »
I've been thinking about doing this, although it would probably be easier to port one.
_player1537, you access files by using filesize() (in the utils.h in skeleton.zip attached to the first post on the Routines thread) to get the size, the fread to read it into an array, like so:
Code: [Select]
FILE* f;
int fsize;
char* buf;
f = fread("/documents/Examples/thegame.tns");
fsize = filesize(f);
buf = (char*) malloc(fsize);
fread(buf, 1, fsize, f);
close(f);

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: C# for the nspire
« Reply #21 on: September 12, 2010, 04:24:55 am »
Quote
Isn't c++ backwrds compatible with C code?
C++ is partially backwards-compatible with C (in various situations, e.g. some forms of typecasts, a C++ compiler will refuse code that is valid in C), and it is interoperable with C (within a given ABI scheme, that is) through "extern C { }" blocks.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: C# for the nspire
« Reply #22 on: September 12, 2010, 09:09:54 am »
I've been thinking about doing this, although it would probably be easier to port one.
_player1537, you access files by using filesize() (in the utils.h in skeleton.zip attached to the first post on the Routines thread) to get the size, the fread to read it into an array, like so:
Code: [Select]
...
f = fread("/documents/Examples/thegame.tns");
...
close(f);
I'm sure these were typos, but those should be fopen and fclose. Just so nobody gets confused :)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

SirCmpwn

  • Guest
Re: C# for the nspire
« Reply #23 on: September 14, 2010, 08:47:57 am »
*facepalm* C# isn't interpreted...
At compile-time, it is compiled almost all the way.  Then, at run-time, it is JIT compiled (Just-In-Time) the rest of the way.  You can do the second step whenever you like and save the binary, thus making it not interpreted.
I have been planning for a while to make a .NET Framework-like thing and object oriented C# based language for the TI-83+/84+ (SE).

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: C# for the nspire
« Reply #24 on: September 14, 2010, 12:12:27 pm »
I assume that would be for KnightOS?

I wonder how easy it would be? Would it take like most of the calc memory?

Also no facepalming at people who are learning Sir. We do not want to lose members.
« Last Edit: September 14, 2010, 12:13:56 pm by DJ Omnimaga »

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: C# for the nspire
« Reply #25 on: September 14, 2010, 12:30:41 pm »
Microsoft made a .NET Compact Framework made to fit on most handheld devices with low disk space, such as phones running Windows CE. According to Wikipedia, it takes up 12 MB, which could fit on the nspire. There is also the .NET Micro Framework, which takes no more than 300KB of space and doesn't need an OS to run, it could even fit on a TI-84. So C# on the nspire should be possible with at least the .NET Micro Framework. Plus the fact Microsoft announced they will release the .NET Micro Framework 4.0 source code under an Apache License 2.0, it would be awesome if someone manages to run some C# on the nspire.

Sources:
http://en.wikipedia.org/wiki/.NET_Compact_Framework
http://en.wikipedia.org/wiki/.NET_Micro_Framework
« Last Edit: September 14, 2010, 12:35:37 pm by juju2143 »

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: C# for the nspire
« Reply #26 on: September 14, 2010, 12:40:25 pm »
Mhmm, if it's 12 MB and cannot be shrinked in size, it would take pretty much all of the Nspire mem or close. I think the original OS 1.1 leaves you with like 14-17 MB free x.x

Will the .NET Micro Framework thing be smaller?

EDIT: Nvm checked Wikipedia and it seems pretty small for the Nspire.
« Last Edit: September 14, 2010, 12:41:09 pm by DJ Omnimaga »

Offline qazz42

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1130
  • Rating: +30/-12
  • hiiiiiiiii
    • View Profile
Re: C# for the nspire
« Reply #27 on: September 14, 2010, 02:43:57 pm »
*facepalm* C# isn't interpreted...
At compile-time, it is compiled almost all the way.  Then, at run-time, it is JIT compiled (Just-In-Time) the rest of the way.  You can do the second step whenever you like and save the binary, thus making it not interpreted.
I have been planning for a while to make a .NET Framework-like thing and object oriented C# based language for the TI-83+/84+ (SE).


D: IT ISNT?!!?!?! I did not know that.... my C# book says it is

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: C# for the nspire
« Reply #28 on: September 14, 2010, 02:49:01 pm »
SirCmpwn, I already mentioned early in this topic that there are JITs in the .NET interpreters ;)
(and I have just edited the corresponding post to make "AOT" explicit)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

SirCmpwn

  • Guest
Re: C# for the nspire
« Reply #29 on: September 14, 2010, 04:46:15 pm »
Lionel, okay.  I'm just pointing out that it doesn't have to be interpreted.
DJ, probably, KOS is better suited to object oriented programming.