Calculator Community > Calculator C

Program Resets nSpire CAS

(1/2) > >>

yoshi13:
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??

bwang:
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.

yoshi13:
Do I use malloc() by
--- Code: --- int location[320][240]; malloc(sizeof(location * 320 * 240));
--- End code ---
or by something like
--- Code: --- malloc(location[320][240]
--- End code ---


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: --- int i malloc(sizeof(i)); int location[320][240] malloc(sizeof(location*320*240));
--- End code ---
[/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 .

bwang:
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: ---char* scrbuf = (char*) malloc(SCREEN_BYTES_SIZE);

--- End code ---
Then you can use getPixelBuf() and setPixelBuf() (in the Ncaster utils.h and utils.c files) to read and write pixels to this buffer.

yoshi13:
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.

Navigation

[0] Message Index

[#] Next page

Go to full version