I didn't know anyone ever used this, so I didn't continue work on it :P
What useful features are missing in your opinion?
Hi ikj,
may be there are some things missing, that only few people shows interest to your assembler.
Some points:
-installing should be easy. In the text file its explained, but not every beginner is able to work with it. A step by step describing would be better and it should content every step, also installing ndless and microphyton and pyWrite or another editor. Should folders me made? Which and where? For example, it's not clear in the beginning, that files have to be put in an ndless folder at root.
For example, I didnt get the nassembler to work up to now (already asking vogtinator about this).
Am using a nspire cx cas,
using os 4.4,
installed ndless 4.4,
started micropython (134/146) one time, as its told,
started nassembler but get error abour file format not supported.
May be that and the not so clear installation info hinders some interested people to try it.
Some simple lessons how to make the first short programs would be very helpful, some example programs you have already in your zip.
If you like I can give some more hints to that point.
cu
klaus
I didn't know anyone ever used this, so I didn't continue work on it :P[/quote]
What useful features are missing in your opinion?
It's working now, was a simple mistake I made: for testing micropython 134 and 146 I did rename the both files (micropython 134 for example). So the .py files couldn't get connected and also nAssembler didn't run. Now everthing works.I'm glad that it works now. Thanks for your many comments. I'm going to reply to some of their concerns below.
There has recently been some activity in the thread on tiplanet, and as a result I also made some updates, adding CLZ, ADR, and fixing a bug. I forgot to update the file in the first post, so now I removed it and added a link to the download on tiplanet, which should always be up to date.
It's working now, was a simple mistake I made: for testing micropython 134 and 146 I did rename the both files (micropython 134 for example). So the .py files couldn't get connected and also nAssembler didn't run. Now everthing works.
I'm glad that it works now. Thanks for your many comments. I'm going to reply to some of their concerns below.
I agree that more documentation, more examples and some explanations of the examples would help. But my main reasons for starting this project were that I was interested in writing an assembler, had a lot of time with nothing to do, and I was always a bit annoyed that it was impossible to write native programs for the Nspire on-calc. Nowadays, I don't have much time, and I've accomplished my main goal of writing an on-calc assembler with most of the useful features.
I may try to write another example or two, but for more, other people will have to do it. So, you're welcome to do it ;)
There probably already are some ARM assembler tutorials on the internet, for example for the GBA, but they can't explain the things specific to the Nspire, e.g. how to read the keyboard or display stuff (see https://hackspire.org (https://hackspire.org) and in particular https://hackspire.org/index.php/Memory-mapped_I/O_ports (https://hackspire.org/index.php/Memory-mapped_I/O_ports) for that kind of thing), and they probably use some pseudo-instructions I didn't implement or some different syntax, which will require some experimenting and/or googling to adapt to nAssembler.
Also, grosged over on tiplanet wrote a small demo and a short explanation of ARM assembly, but it's in French. (example link: https://tiplanet.org/forum/archives_voir.php?id=839558 (https://tiplanet.org/forum/archives_voir.php?id=839558), the file nsprtest.s is the code compatible with nAssembler)
I wrote about making the handling of nAssembler easier-so I tried by myself. But without being used in python I had no success. Was changing your code a little bit (yes, I know, it's a sacrileg), so that not the path but only the file name must be entered or in the other version path & filename get fixed to get a quick turnaround:Found it now, was not so difficult:
when I change your code at the end of the nassembler file
def calc_assemble():
inf = input('in:')
outf = input('out:')
return assembler(inf, outf)
to
def calc_assemble():
inf = /documents/ndless/example.asm.tns
outf = /documents/ndless/example.prg.tns
return assembler(inf, outf)
or
def calc_assemble():
inf = /documents/ndless/
inf = inf + input('in:')
outf = /documents/ndless/
outf = outf + input('out:')
return assembler(inf, outf)
all that doen't work, I get the 'File "/documents/ndless/nAssembler.py.tns", line 1600 Syntax Error: invalid Syntax. Tried also backslash for slashes but same reaction. Am wondering why I see 'nAssembler.py.tns' at the end of the string and not 'Example.asm.tns' as i wrote.
About the system calls: Yes, I guess it would be useful to have some way to access them with nAssembler. In programs compiled on the pc, ndless provides them.
Since neither reading keypad state nor displaying stuff on the screen uses them, you can actually already do many things without them, but there's obviously no file reading/writing.
.word is just called dcd here.
So it seems there is no os reassemble listing (with some comments)? Ok, in those days when we got such a book for the speccy it were 16 kb of rom. So making such a thing for the now 13 mb that the os contents would be an endless work. If there comes no infos from TI it may be to timesucking, esp. for a single person.
But when ndless contents some system calls, their programmers must know about them. However, they won't shout around with this knowledge that they got surely not without some trouble.
main
stmfd sp!, {r0-r12, lr}
adr r0, text
swi #22
bl wait
ldmfd sp!, {r0-r12, pc}
wait
stmfd sp!, {r0-r12, lr}
mvn r0, #0
mov r0, r0, lsr #4
waitloop
sub r0, r0, #1
cmp r0, #0
bgt waitloop
ldmfd sp!, {r0-r12, pc}
text
dcb "Hello World!"
Is it good?Writing a new compiler for C, in assembly, would be a huge project. I don't think it's realistically possible.
Porting some existing compiler would be easier, but may still be hard.
Yes with 341, it works.Gc is an OS variable. There is a bit of documentation on https://hackspire.org/index.php/Syscalls#Graphic_Context_API (https://hackspire.org/index.php/Syscalls#Graphic_Context_API).
But with the syscall void gui_gc_drawLine(Gc p1, int p2, int p3, int p4, int p5), what is Gc p1? A pointer to the screen area?
And p2, p3, p4, p5? The coordinates of the line?
Edit (Eeems): Merged double post
And if I want to reuse the return value of the syscall, in which register is the return value?I'd guess in R0 as usual.
Gc is an OS variable. There is a bit of documentation on https://hackspire.org/index.php/Syscalls#Graphic_Context_API (https://hackspire.org/index.php/Syscalls#Graphic_Context_API).
I'd guess in R0 as usual.
main
stmfd sp!, {r0-r12, lr}
mov r0, #0xC0000010
ldr r0, [r0]
bl clrscrCX
adr r0, text
swi #46 ;tolower
swi #341 ;disp_msg
bl wait
ldmfd sp!, {r0-r12, pc}
wait
stmfd sp!, {r0-r12, lr}
mvn r0, #0
mov r0, r0, lsr #4
waitloop
sub r0, r0, #1
cmp r0, #0
bgt waitloop
ldmfd sp!, {r0-r12, pc}
clrscrCX
stmfd sp!, {r0-r12, lr}
mov r4, r0
mov r5, #0
mov r6, #0
mov r7, #0
xloop
mov r0, r4
mov r1, r5
mov r2, r6
mov r11, r7
bl setPixel
add r5, r5, #1
cmp r5, #320
blt xloop
add r6, r6, #1
mov r5, #0
cmp r6, #240
blt xloop
ldmfd sp!, {r0-r12, pc}
setPixel
stmfd sp!, {r0}
add r0, r0, r1, lsl #1
add r0, r0, r2, lsl #9
add r0, r0, r2, lsl #7
strh r11, [r0]
ldmfd sp!, {r0}
bx lr
text
dcb "HELLO WORLD!", 0
void gui_gc_drawLine(Gc, int x1, int y1, int x2, int y2) - Draws a line from <x1,y1> to <x2,y2>.
Yeah, tolower doesn't take a string argument. It only takes a single character and returns the lowercase version. Apparently it interprets the pointer as a non-uppercase character and returns it unchanged.Code: [Select]main
stmfd sp!, {r0-r12, lr}
mov r0, #0xC0000010
ldr r0, [r0]
bl clrscrCX
adr r0, text
swi #46 ;tolower
swi #341 ;disp_msg
bl wait
ldmfd sp!, {r0-r12, pc}
wait
stmfd sp!, {r0-r12, lr}
mvn r0, #0
mov r0, r0, lsr #4
waitloop
sub r0, r0, #1
cmp r0, #0
bgt waitloop
ldmfd sp!, {r0-r12, pc}
clrscrCX
stmfd sp!, {r0-r12, lr}
mov r4, r0
mov r5, #0
mov r6, #0
mov r7, #0
xloop
mov r0, r4
mov r1, r5
mov r2, r6
mov r11, r7
bl setPixel
add r5, r5, #1
cmp r5, #320
blt xloop
add r6, r6, #1
mov r5, #0
cmp r6, #240
blt xloop
ldmfd sp!, {r0-r12, pc}
setPixel
stmfd sp!, {r0}
add r0, r0, r1, lsl #1
add r0, r0, r2, lsl #9
add r0, r0, r2, lsl #7
strh r11, [r0]
ldmfd sp!, {r0}
bx lr
text
dcb "HELLO WORLD!", 0
but he displays HELLO WORLD! :(