Well, at that point, I didn't know how to access the TI-84+ link port through ARM assembly. Now I do, but I no longer have the source code for the TI-83+ emulator. Razz
calc84maniac wrote:
Well, at that point, I didn't know how to access the TI-84+ link port through ARM assembly. Now I do, but I no longer have the source code for the TI-83+ emulator. Razz
Sad Awww, sorry to hear it. I hope that you've at least learned the unfortunate lesson to back up your data more effectively and more frequently.
calc84maniac wrote:
Well, at that point, I didn't know how to access the TI-84+ link port through ARM assembly. Now I do, but I no longer have the source code for the TI-83+ emulator. Razz

Good to know Smile
May I ask why we are in the z80 assembly section, though?
calcdude84se wrote:
calc84maniac wrote:
Well, at that point, I didn't know how to access the TI-84+ link port through ARM assembly. Now I do, but I no longer have the source code for the TI-83+ emulator. Razz

Good to know Smile
May I ask why we are in the z80 assembly section, though?
I'm assuming because that's the closest he could come to ARM ASM; I guess he figured that ARM ASM is closer to z80 ASM than it is to the Other/catchall category. Smile
Yes, there is no Nspire C section.
Calc84maniac, you said you know how to access the link port through assembly/C? How is that?
Also, you mentioned timing things with interrupts and such, how would I set those up?
I'd like to use C if possible.
If you're writing in C, it's (relatively) easy to do interrupts. In fact, now that C is a possibility, someone really needs to port pthreads over. Smile I'll let calc84 talk about the link port access, since I haven't the faintest how it's done on the Nspire.
Could you tell me about interrupts?
SirCmpwn wrote:
Could you tell me about interrupts?
The more I'm looking at ANSI C documentation, you might not be able to do interrupts without some ASM linked into your programs. :/
Could I have a link to this?
SirCmpwn wrote:
Could I have a link to this?
Sadly, the most useful things I can find refer to DOS. :S For example:

http://www.frontiernet.net/~fys/demoisr.htm
Sad day... there are interrupts mentioned on Hackspire, just not in detail. I'll look into that.
Yeah yeah double post I know.
Calc84maniac and I were chatting last knight about how to fix this, and this is how you do both of our issues:
Access the link port:
To enable the link port, OR the value at 0x900A0004 with 0x20.
To disable, AND the same value with ~0x20.
Change the first two bits of 0x90100000 to reflect the state of the ring and tip, respectively.
Interrupts:
Back up the value at 0x38 first.
Load your own interrupt function into 0x38 by using &functionname to get a pointer to it.
Restore 0x38 upon leaving.
Also, the interrupt function apparently should be declared like this:

Code:
void functionname() __attribute__ ((interrupt ("IRQ")));
okay...
Sounds weird but I'll go with it.
I got sound to work now, it plays a tone, and pressing up and down on the keypad changes the tone.
The following code should play some sort of noise, but it only plays a high pitched tone:

Code:
int main(void) {
   enableLink();
   clearScreen();
   FILE* wavFile = fopen("HBFS.wav", "r");
   char currentSampleLeft, currentSampleRight;
   while (!isKeyPressed(KEY_84_ENTER))
   {
   }
   while (!isKeyPressed(KEY_NSPIRE_ESC) && !isKeyPressed(KEY_84_CLEAR))
   {
      fread(&currentSampleLeft, 1, 1, wavFile);
      fread(&currentSampleRight, 1, 1, wavFile);
      int count;
      for (count = 0; count <= 0xFF; count++)
      {
         int value = 0;
         if (count < currentSampleLeft)
         {
            value++;
         }
         if (count < currentSampleRight)
         {
            value += 2;
         }
         KEYPAD_84_IO = value;
      }
   }
   fclose(wavFile);
   disableLink();
   return 0;
}

void enableLink()
{
   MISC_PORTS |= 0x20;
}

void disableLink()
{
   MISC_PORTS &= ~0x20;
}

Any ideas?
One thing that jumps out at me is that you are opening the file as "r" instead of "rb" (binary mode). I'm not sure it makes a difference on TI-Nspire OS though. Oh, and do you really have a file called "HBFS.wav" on your calculator? I thought only .tns files were allowed. And you didn't specify the folder or anything, it's not automatically set to check in the folder the running program is in (to my knowledge). This might be your main problem, because you didn't even put a check to see if the file opened properly.
It's HBFS.wav.tns, do I need to include that?
I'll also add the folder and see if it works.
Yeah, you have to include the .tns, that is part of the filename after all (even if the My Documents GUI doesn't show it)

Edit:
I think the filepath is something like "documents/yourfolder/yourfile.tns". I haven't gotten much into file paths and stuff. If that doesn't work, maybe "/documents/yourfolder/yourfile.tns". If I remember correctly, you might also be able to do "./yourfolder/yourfile.tns" if the current path is set to the documents folder (and I think it is)
So I didn't get a solid tone, but I did get a nice stream of incomprehensible beeps and pops.
SirCmpwn wrote:
So I didn't get a solid tone, but I did get a nice stream of incomprehensible beeps and pops.
Any success or progress on this?
hehe, if this is perfected I better get myself a new 84 keypad Very Happy
  
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
Page 2 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement