Omnimaga

Calculator Community => TI Calculators => Calculator C => Topic started by: yoshi13 on May 15, 2010, 01:52:11 am

Title: Program Resets nSpire CAS
Post by: yoshi13 on May 15, 2010, 01:52:11 am
Hey, after finally getting the demo to compile I wrote up a Paint program for the nSpire.
However after selecting it from the menu it causes the calculator to reset automatically.

Has anyone else had this happen??

Also can the nSpire handle a 2d array of 320*240?? or is that what is causing the problem?

P.S. Can you record the nSpire's screen to make into a gif??
Title: Re: Program Resets nSpire CAS
Post by: bwang on May 15, 2010, 02:47:18 am
No. The Nspire cannot handle a 320 x 240 array if it is declared as int array[320][240]. Writing anything to it will crash the calculator. You will need to use malloc().
Are you using the array as a screen buffer? I have a modified utils.c and utils.h in the Ncaster package that supports writing to a separate buffer.
You can record the screen using the standard screen capture tools.
Title: Re: Program Resets nSpire CAS
Post by: yoshi13 on May 15, 2010, 03:11:43 am
Do I use malloc() by
Code: [Select]
int location[320][240]; malloc(sizeof(location * 320 * 240)); or by something like
Code: [Select]
malloc(location[320][240]

This is my second day using C and I haven't used C++ in a while so I am a bit fuzzy on everything.

I am using the array to store the color of the the pixel while the cursor is set at that location so I can restore it after the cursor is moved to the next pixel.

P.S. Do you have the addresses of the other keys, especially The clickpad and the clickpad button, I have no idea where to start when looking for key addresses

 I was just reading up on some stuff... am i supposed to use something like this for every variable I declare
Code: [Select]
int i malloc(sizeof(i)); int location[320][240] malloc(sizeof(location*320*240)); [/color]

P.S. I know it would use less memory if I just checked the location of the pixel saved it to an int then moved across and changed back the last visited pixel to the right color, however I was later going to use the 240*320 array to save the drawing .
Title: Re: Program Resets nSpire CAS
Post by: bwang on May 15, 2010, 03:51:21 am
Look at the Ncaster source for a modified version of the non-CAS os.h (in headers) which contains some keycodes. You can add to it by looking at this page: http://hackspire.unsads.com/wiki/index.php/Memory-mapped_I/O_ports#900E0000_-_Keypad
You allocate the buffer using something along the lines of
Code: [Select]
char* scrbuf = (char*) malloc(SCREEN_BYTES_SIZE);
Then you can use getPixelBuf() and setPixelBuf() (in the Ncaster utils.h and utils.c files) to read and write pixels to this buffer.
Title: Re: Program Resets nSpire CAS
Post by: yoshi13 on May 16, 2010, 01:33:56 am
I am finally getting somewhere with the program after getting Windows to compile programs (saving about 10 minutes a test). But how do you capture the screen? when I go into programs and click capture the computer just says Processing Request for ages.
Title: Re: Program Resets nSpire CAS
Post by: DJ Omnimaga on May 16, 2010, 01:38:35 am
I am not sure if it is possible, actually, I never really checked, though x.x, since when I use my Nspire I always use a digital video camera

Otherwise, there's Goplat's TI-Nspire emulator on United-TI (and in our downloads section)
Title: Re: Program Resets nSpire CAS
Post by: bwang on May 16, 2010, 09:56:24 pm
You can't do screen capture from the calculator. Use the emulator.
Title: Re: Program Resets nSpire CAS
Post by: DJ Omnimaga on May 16, 2010, 10:12:06 pm
That sucks, another downgrade from the older calcs TI made x.x

Oh well an emulator or digital cam can solve this I guess
Title: Re: Program Resets nSpire CAS
Post by: Lionel Debroux on July 06, 2010, 01:34:04 am
For completeness: the Nspire link protocol supports screenshots, but we don't yet know how to use it from ASM programs.