Author Topic: Game for Ti-Nspire CAS  (Read 7460 times)

0 Members and 1 Guest are viewing this topic.

Offline R4iD

  • LV0 Newcomer (Next: 5)
  • Posts: 3
  • Rating: +2/-0
    • View Profile
Game for Ti-Nspire CAS
« on: March 24, 2010, 01:14:09 pm »
Hello community,
I'm new here and just wanted to tell from start on, that I am a newbie if it comes to complicated programming and so on.
I bet this question was already asked in the forums but I didn't know what to search for.
I always had the inspiration to make programs or games.
Starting with some rolling mini games or programs to solve mathematical program.
But the thing was, CAS version 1.7 had some really low possibilities for making advanced programs and/or visualizing them.
Short time ago I downloaded Ndless 1.0 and read a bit about it. Wow it can start third party programs and emulators and so on.
So maybe now I can program something more interesting. So here is my question. How to I make a program for my CAS.
Which software has to be used and which language should it be. BASIC or C, and how to compile everything.
Sorry if this question might be dumb, but I really have no idea ^^


Thanks for attention,
Daniel

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Game for Ti-Nspire CAS
« Reply #1 on: March 24, 2010, 02:32:12 pm »
Hi and welcome here :)

Unfortunately, I can't awnser most of your questions, but for the TI-Nspire, you can now program both ARM assembly (ARM9 I think) and C. Hopefully, someone like Bwang or Calc84maniac might be able to link you to the needed tools for programming for the TI-Nspire, since they are programming for it now.

Would it be for Windows, Mac or Linux?

Offline R4iD

  • LV0 Newcomer (Next: 5)
  • Posts: 3
  • Rating: +2/-0
    • View Profile
Re: Game for Ti-Nspire CAS
« Reply #2 on: March 24, 2010, 02:52:13 pm »
Thank you very much for the fast answer.

It would be for Windows if possible =]


P.S If possible, are there any sites like http://tibasicdev.wikidot.com/ that are made for total newbs to learn ARM?




Daniel
« Last Edit: March 24, 2010, 03:01:51 pm by R4iD »

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Game for Ti-Nspire CAS
« Reply #3 on: March 24, 2010, 03:32:22 pm »
The Ndless readme and the src/doc/Dev.txt have very useful information. Read them and if you have any other questions, feel free to ask.

If you use Linux, I can give you detailed instructions.

You probably want to code in C.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Game for Ti-Nspire CAS
« Reply #4 on: March 24, 2010, 03:38:34 pm »
Doesn't some stuff such as 3D require straight assembly, though? But again, the Nspire is 90 MHz so maybe it would still be fast. Also C is supposed to be easier to start with I think, not to mention such language knowledge is recommended to start with ASM later.

Offline R4iD

  • LV0 Newcomer (Next: 5)
  • Posts: 3
  • Rating: +2/-0
    • View Profile
Re: Game for Ti-Nspire CAS
« Reply #5 on: March 24, 2010, 05:08:40 pm »
Great thanks for your help, will try to make some reasearches and start learning C =P

Offline BrownyTCat

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 420
  • Rating: +37/-8
    • View Profile
Re: Game for Ti-Nspire CAS
« Reply #6 on: March 25, 2010, 05:35:08 pm »
I was starting a game when I hit a key input problem, can someone optimize this code?
When I execute this I get glitches. It quits immediately or draws pixels then crashes. All of the libraries work, it's just this part!  :-\

Code: [Select]
/BrownyTCat's test prog

#include <os.h>
#include "utils.h"
#include "keys.h"
#define MAX_ITER 16

asm(".string \"PRG\"\n");



int main(void) {

int i;
int lose = 0;

int playerX = 160;
int playerY = 100;


showSimpleDialogBox(
    "Ndless - Test Software",
    "-------------------------------\n"
    "Ndless C Demo\n"
    "Copyright 2010 by BrownyTCat\n"
    "-------------------------------\n"
    "ESC - Exit"
);


 for (i = 0; i < 0x0F; ++i) {
    fade(1);
    WAIT("0x1FFFFF", "fade");
  }
  



while (lose != 1 && !isKeyEscPressed())
  {
  
  setPixel(playerX,playerY,16)

    ;if (isKeyUpPressed())
    {
  setPixel(playerX,playerY,0)
  ;playerY = playerY - 1
    ;}
    else if (isKeyDownPressed())
    {
  setPixel(playerX,playerY,0)
  ;playerY = playerY + 1
    ;}
    else if (isKeyLeftPressed())
    {
  setPixel(playerX,playerY,0)
  ;playerX = playerX - 1
    ;}
    else if (isKeyRightPressed())
    {
  setPixel(playerX,playerY,0)
  ;playerX = playerX + 1
    ;}

}
  return 0;
}
« Last Edit: March 25, 2010, 05:35:56 pm by BrownyTCat »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Game for Ti-Nspire CAS
« Reply #7 on: March 25, 2010, 05:43:50 pm »
(I can't really help you but I will say I am happy that you are getting into calc game dev ^^)

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Game for Ti-Nspire CAS
« Reply #8 on: March 25, 2010, 06:06:26 pm »
setPixel's third argument only goes up to 15; therefore, 16 will crash.
« Last Edit: March 25, 2010, 06:07:18 pm by bwang »

Offline BrownyTCat

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 420
  • Rating: +37/-8
    • View Profile
Re: Game for Ti-Nspire CAS
« Reply #9 on: March 26, 2010, 05:10:26 pm »
setPixel's third argument only goes up to 15; therefore, 16 will crash.
No, I used it in a working image program. 0 is blank, 16 is darkest.
And I was into development before, but not in C or nSpire.

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Game for Ti-Nspire CAS
« Reply #10 on: March 26, 2010, 05:41:27 pm »
No, 0 is darkest, 15 is blank, for a total of 16 shades. I don't know what happens when you pass 16 though. Does it mod out 16?

Can you post the contents of keys.h?

Does the dialog box at least appear?
« Last Edit: March 26, 2010, 05:42:37 pm by bwang »

Offline BrownyTCat

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 420
  • Rating: +37/-8
    • View Profile
Re: Game for Ti-Nspire CAS
« Reply #11 on: March 27, 2010, 03:20:38 pm »
 The box appears correctly and fades out, here's keys.h:

Code: [Select]
int isKeyEscPressed();
int isKeyCtrlPressed();
int isKeyMajPressed();
int isKeyEnterPressed();
int isKeyLeftPressed();
int isKeyRightPressed();
int isKeyUpPressed();
int isKeyDownPressed();

Here's keys.c:

Code: [Select]
asm(".macro is_key_pressed row, column");
asm("ldr r0, =(0x900E0000 + \\row )");
asm("ldrh r0, [r0]");
asm("tst r0, \\column");
asm(".endm");

int isKeyEscPressed()
{
   asm("is_key_pressed 0x1c, #0b00010000000");
   asm("movne r0, #0x0");
   asm("moveq r0, #0x1");
}


int isKeyCtrlPressed()
{
   asm("is_key_pressed 0x1e, #0b001000000000");
   asm("movne r0, #0x0");
   asm("moveq r0, #0x1");
}

int isKeyMajPressed()
{
   asm("is_key_pressed 0x1a, #0b001000000000");
   asm("movne r0, #0x0");
   asm("moveq r0, #0x1");
}

int isKeyEnterPressed()
{
   asm("is_key_pressed 0x10, #0b000000000010");
   asm("movne r0, #0x0");
   asm("moveq r0, #0x1");
}


int isKeyLeftPressed()
{
   asm("is_key_pressed 0x1e, #0b000001000000");
   asm("movne r0, #0x0");
   asm("moveq r0, #0x1");
}

int isKeyRightPressed()
{
   asm("is_key_pressed 0x1e, #0b000000000100");
   asm("movne r0, #0x0");
   asm("moveq r0, #0x1");
}

int isKeyUpPressed()
{
   asm("is_key_pressed 0x1e, #0b000000000001");
   asm("movne r0, #0x0");
   asm("moveq r0, #0x1");
}

int isKeyDownPressed()
{
   asm("is_key_pressed 0x1e, #0b000000010000");
   asm("movne r0, #0x0");
   asm("moveq r0, #0x1");
}