Author Topic: Nspire assembly  (Read 6555 times)

0 Members and 5 Guests are viewing this topic.

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Nspire assembly
« on: July 09, 2013, 05:49:17 am »
I want to take a dive in the deep and dark depths of the nspire and learn to do stuff with assembly. I figure the way to start would be to learn to work with ndless and C, but for assembly I have no clue where to start or even how.

Some people need a high five in the face... with a chair.
~EC

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Nspire assembly
« Reply #1 on: July 09, 2013, 05:54:45 am »
As you know, the Nspire has an ARM processor. There are plenty of tutorials for ARM assembly all over the Web ;)

Note that the general rule of thumb is that developing in ASM takes 3-5 times more development time (coding + testing + debugging + fixing) than developing in C, all other things being equal (same usage of external libraries, etc.). C++ is even more productive, at the expense of a bit of efficiency, especially if used improperly (it's entirely possible to make efficient C++ code). That explains why most Nspire programmers use C, or recently, C++.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: Nspire assembly
« Reply #2 on: July 09, 2013, 06:13:30 am »
I know it will take more time and I definitely need to go with C/C++ as well (I'm trying to learn it anyways), but assembly attracts me for some reason :P I like the low-levelness of it.
I'll start working through ARM tutorials then and see what I can figure out :)
[Edit: ] I guess the first thing I should do is update ndless from r685 to r825 :P
« Last Edit: July 09, 2013, 06:16:57 am by ElementCoder »

Some people need a high five in the face... with a chair.
~EC

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Nspire assembly
« Reply #3 on: July 09, 2013, 06:21:23 am »
I know it will take more time and I definitely need to go with C/C++ as well (I'm trying to learn it anyways), but assembly attracts me for some reason :P I like the low-levelness of it.
Yeah I have the same interest as you do. Probably because you work closely with the hardware and know what you're doing. :D
Edit : I found this stackoverflow thread which contains several links and book recommendations. I'll check those out when I'm not too lazy. :P
« Last Edit: July 09, 2013, 06:33:26 am by Streetwalker »

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: Nspire assembly
« Reply #4 on: July 09, 2013, 07:46:04 am »
I just found the same page and I'm reading through some others now. I can surely say this is going to be an interesting journey, wether I manage to last or not :P

Some people need a high five in the face... with a chair.
~EC

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: Nspire assembly
« Reply #5 on: July 09, 2013, 12:54:47 pm »
This is the easiest and best I found so far:
http://simplemachines.it/doc/arm_inst.pdf.
It explains the most important things of the arm instruction set.
For more in-depth features and instructions for e.g. the FPU (which the nspire doesn't have), you should also read the "ARMv5 Architecture Reference Manual.pdf" which you can find somewhere in the internet.

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Nspire assembly
« Reply #6 on: July 09, 2013, 04:07:06 pm »
As Lionel Debroux points it out, ARM assembly is not the recommended language to develop for Ndless, although it can be a good option for low-level interaction with the hardware of for performance (as for example used by Goplat or calc84maniac for their emulators).

So I haven't really been maintaining anything in the Ndless SDK to make things really easy when developping in ARM.
But I have fixed what has been broken in the past revisions for your two to be able to get your hands on ARM assembly. Don't except things to go without any hassle, but you can report anything missing that could help you.

1) Download the Ndless SDK r833 or higher
2) Have a look at _samples\helloworld-asm I've added
3) The Makefile template and the Ndless Editor are now ARM assembly aware. When creating a new project, build your .S (mind the upper case, so that the file is processed by the preprocessor) with Tools>Build to generate the Makefile as you would do for a C/C++ program.

Some things (defines, structures, ...) won't always be directly available in assembly, in these cases you'll have to browse into the include files to understand the C definitions and translate them into assembly. The  Hackspire Wiki will also be a good source of information.
Ndless.me with the finest TI-Nspire programs

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: Nspire assembly
« Reply #7 on: July 09, 2013, 04:16:22 pm »
YEah I agree with Lionel and ExtendeD, unless you really like old school languages or prefer ASM syntax. This is probably why there are so few ASM coders for the Nspire and PRIZM and why 68K ASM almost completely died immediately after TIGCC came out.

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: Nspire assembly
« Reply #8 on: July 10, 2013, 05:36:53 am »
@Extended thanks for the tips :)
As for the hard/problematic part, that's part of the reason why I want to do it. I like the idea of a challenge and venturing into somewhat unknown areas (though you guys most likely know more about it then I do atm). I'll do my best and see if I can come up with anything and if it all fails horribly then I'll go back to C/C++ :P

Some people need a high five in the face... with a chair.
~EC

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: Nspire assembly
« Reply #9 on: July 22, 2013, 08:35:12 am »
Progress is going slow, but I managed to keep myself going with learning ARM :) I have a question though: When I comment out "bl lcd_ingray" in the asm example, the editor promptly closes (crashes ?). Commenting out "lcd_ingray()" in the C example however doesn't crash and the program works fine.

Some people need a high five in the face... with a chair.
~EC

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Nspire assembly
« Reply #10 on: July 22, 2013, 10:54:21 am »
The ARM instruction manuals (i've got the "technical reference manual" and "architecture reference manual") have lots of good information. Personally i love ARM assembly, i think it's a lot of fun and the instructions are really flexible. I never actually got anything to assemble for the NSpire, but i've played more with the GBA/DS anyway.

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: Nspire assembly
« Reply #11 on: July 22, 2013, 12:44:45 pm »
Would it be possible to do a straight port of an actual DS game but remove dual screen support?

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Nspire assembly
« Reply #12 on: July 22, 2013, 01:22:50 pm »
Well the DS has dedicated video hardware so it'd be hard, let alone sound.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Nspire assembly
« Reply #13 on: July 22, 2013, 01:30:36 pm »
I would say it depends on the program in question. If the program is hardware independent then it's more likely. Some stuff might work with some modifications, and some not at all.

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Nspire assembly
« Reply #14 on: July 22, 2013, 04:15:41 pm »
I have a question though: When I comment out "bl lcd_ingray" in the asm example, the editor promptly closes (crashes ?). Commenting out "lcd_ingray()" in the C example however doesn't crash and the program works fine.

It seems that nspireio2 supports color screen buffers although the ReadMe doesn't advertised it, so skipping lcd_ingray() may not be a problem.
But the ARM demo does expect a gray screen buffer (2 pixels per byte).
« Last Edit: July 22, 2013, 04:15:48 pm by ExtendeD »
Ndless.me with the finest TI-Nspire programs