Page 1 of 6

nAssembler

Unread postPosted: 11 Mar 2015, 18:30
by lkj
As the title suggests, this is an on-calc assembler for the Nspire :)
It's written in python, so you need micropython on your calc.
All instructions I'm aware of are supported (except CDP, LDC, STC. They are useless on the Nspire)
What's still missing are some pseudoinstructions which don't add functionality but make your life easier,
like for example automatically creating x when you write LDR R0, =x
There is also no linker or anything which means that programs are just translated to binary in the order
they are written and the first line is also the entry point.
Read the readme in the spoiler below for more details on the assembly language syntax used or look at the example.

Please report bugs, missing instructions and feature suggestions.
The code is available at https://github.com/lkjcalc/nAssembler
Download at http://ti-pla.net/a821835

Readme wrote:Usage
-----
Install micropython on your calc.
Launch the nassembler.py.tns file using micropython.
The program will ask you to specify the input file (containing the assembly source code)
and the output file (where the binary will be stored).
You have to specify the full path (for example /documents/test/clrscr.asm.tns)
If there are no errors, micropython will now tell you "Press any key to exit".
You should now see the output file after refreshing the docbrowser
(just go to the homescreen and back to the docbrowser).

Assembly language
-----------------
(Also look at the examples)
Instruction names must be preceded by whitespace
Labels must not be preceded by any whitespace
The instruction names and syntax are like in standard ARM assembly
(like in the official ARM online documentation)

All usual instructions are supported:
ADC(S), ADD(S), AND(S), B, BIC(S), BL, BX, CMP, CMN,
EOR(S), LDM.., LDR(B/T/BT/H/SH/SB), MCR, MLA(S), MOV(S),
MRC, MRS, MSR, MUL(S), MVN(S), ORR(S),
RSB(S), RSC(S), SBC(S), SMLAL(S), SMULL(S), STM..,
STR(B/T/BT/H), SUB(S), SVC/SWI, SWP(B), TEQ, TST, UMLAL(S), UMULL(S)

The DCD, DCDU, DCB and ALIGN directives are supported

Pseudo instruction (like PUSH, ADR etc) are not implemented at the moment.
Other instructions may be missing (report if you need one).

The first line of the source is also the entry point of the program.

Numeric literals:
Prefix with 0x for hexadecimal numbers, 0 for octal, 0b for binary.
Single characters enclosed in single quotes ' are interpreted as their ascii value
You can use DCB "some string" to create a string.



SCREENSHOTS0012.gif

Re: nAssembler

Unread postPosted: 11 Mar 2015, 18:39
by Lionel Debroux
Very interesting :)

You had gone quiet for a little while, but you used some of that time to something pretty good ;)

Re: nAssembler

Unread postPosted: 11 Mar 2015, 19:06
by Adriweb
That's indeed definitely interesting, good job :D

Re: nAssembler

Unread postPosted: 13 Mar 2015, 18:53
by Lu_Lu54
What is it supposed to do ? Sorry, I didn't get it.

Re: nAssembler

Unread postPosted: 13 Mar 2015, 20:44
by Lionel Debroux
nAssembler consumes text data, more precisely source code for some dialect of ARM ASM, parses and validates it, and produces a native code program, which can be launched by Ndless - just like the Nspire ports of Micro Python and Duktape.

Re: nAssembler

Unread postPosted: 13 Mar 2015, 20:51
by Lu_Lu54
all right. I knew what an assembler was, but I didn't find the dialect concerned... thx!

Re: nAssembler

Unread postPosted: 13 Apr 2015, 20:18
by Ti64CLi++
This is a good idea!!!
Very well !

Re: nAssembler

Unread postPosted: 15 Jun 2016, 15:41
by grosged
Wouah ! J'ai installé micropython , nAssembler, et j'ai assemblé l'example.asm.tns en tst.prg.tns...
! ça marche :P

J'ai trouvé ça...
ARM Instructions Set : http://simplemachines.it/doc/arm_inst.pdf

Est-ce que c'est une doc pour l' ARM9 ?...

Je voudrais aussi savoir , lequel de ces ARMs est dans ma CX CAS ? ( https://fr.wikipedia.org/wiki/Architecture_ARM)

EDIT: Le voilà, le processeur de la CX CAS !

Image
(voir http://www.allaboutcircuits.com/news/te ... alculator/ )

re-EDIT: Bon, je m'approche du but, il y a 3 sortes d'ARM9 !

Image

voir http://www.arm.com/products/processors/classic/arm9/ ;)


EDIT FINAL : En fait fallait pas chercher si loin, il suffisait de consulter https://wiki.tiplanet.org/S%C3%A9ries_TI-Nspire_CX !
Où l'on peut lire "Processeur ARM926EJ-S " :)

Re: nAssembler

Unread postPosted: 08 Jan 2017, 14:47
by Ti64CLi++
Je me permet de relancer ce topic, pour signaler que rajouter des instructions comme .WORD, .HWORD et d'autres relatives au stockage de données serait très utiles ^^
Et où puis-je trouver un bon tuto sur l'ASM de l'ARM9 de la TI Nspire CX CAS disponible en pdf si possible?

Re: nAssembler

Unread postPosted: 18 Jan 2017, 16:51
by grosged
Comme tu le sais déjà, je viens de commencer la rédaction d'un tuto sur l'Assembleur ARM9 ;)

Je me penche de nouveau sur l'excellent nAssembler de lkjI ...
En plus de la TI-nspire (via micro-python), on peut également le lancer depuis un ordinateur sous Linux, Mac, windows... grâce à Python 3 , bien sûr !! :p

Personnellement, je viens de lancer nAssembler depuis Python 3.4.2 (sur mon raspberry) ...ça marche nickel 8-)