This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's
Technology & Calculator Open Topic subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

Community News & Discuss Nspire =>
Technology & Calculator Open Topic
Author |
Message |
|
Galandros
Active Member

Joined: 29 Aug 2008 Posts: 565
|
|
Back to top |
|
|
bsl
Advanced Newbie

Joined: 09 Jan 2010 Posts: 94
|
Posted: 10 Jun 2010 06:10:34 pm Post subject: |
|
|
Here is a hand coded Ndless program that simply prints out "Hello World" to the emulator console.
It wont do anything on the calculator. Handcoding will have NOP instructions[mov r0,r0] and zeros here and there.
I also make use of the breakpoint instruction 0xe1200070 [ BKPT 0000 ] for the emulator to inspect code.
Code:
0: 00475250 "PRG\0" ; Ndless program header
4: e92d4ff0 stmdb sp!,{r4-r11,lr} ; save machine state
8: e1a00000 mov r0, r0 ; NOP or break point here - NOP for this release version
c: e28f0064 add r0, pc, 0x64 ; calculate address to format specifier "%s\n" below and save in r0 - first printf() argument
10: e28f1070 add r1, pc, 0x70 ; calculate address to string "Hellow World" below and save in r1 - second printf() argument
14: e1a00000 mov r0, r0 ; next 3 instructions do nothing
18: e1a00000 mov r0, r0
1c: e1a00000 mov r0, r0
20: e59f600c ldr r6, [pc, 0xc] ; load printf entry point from below into r6
24: e1a0e00f mov lr, pc ; save return address into lr just before call
28: e12fff16 bx r6 ; make the call: printf("%s\n","Hellow World");
2c: e3a00000 mov r0, 0x0 ; back from call- now return 0 in r0
30: e8bd8ff0 ldmia sp!,{r4-r11,pc} ; restore machine state and exit program
34: 10182c60 data - noncas printf() entry point
38-74: data 00000000 x 16 padded bytes - does nothing
78: data "%s\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" ; 4 byte aligned string
88: data "Hello World\n\x00\x00\x00\x00" ; 4 byte aligned string
Here are the CAS and NONCAS programs for the emulator:
[attachment=3191:hello.zip]
Last edited by Guest on 10 Jun 2010 07:05:20 pm; edited 1 time in total |
|
Back to top |
|
|
|
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
»
Go to Registration page