Omnimaga

Calculator Community => TI Calculators => Calculator C => Topic started by: SirCmpwn on October 28, 2010, 07:03:20 pm

Title: Link Port
Post by: SirCmpwn on October 28, 2010, 07:03:20 pm
Hello,
How do I access the link port on the Nspire?  It's documented here: http://hackspire.unsads.com/wiki/index.php/Memory-mapped_I/O_ports#90100000_-_TI-84_Plus_link_port (http://hackspire.unsads.com/wiki/index.php/Memory-mapped_I/O_ports#90100000_-_TI-84_Plus_link_port), but this doesn't seem to work.
Title: Re: Link Port
Post by: SirCmpwn on October 29, 2010, 08:29:20 am
*bump*
Title: Re: Link Port
Post by: ExtendeD on October 29, 2010, 08:53:47 am
I suppose currently only calc84maniac or Goplat have any knowledge on this.
Title: Re: Link Port
Post by: DJ Omnimaga on October 29, 2010, 05:21:35 pm
I think even Calc84maniac doesn't, but again, I could be wrong. Maybe you might have more luck with Goplat.
Title: Re: Link Port
Post by: fb39ca4 on October 29, 2010, 05:36:39 pm
I guess it would mean you read/write those memory locations to control the port, like it said. INitilaize a pointer to it, and then modify the value. Haven't tried anything with it, though.
Title: Re: Link Port
Post by: SirCmpwn on October 29, 2010, 06:02:07 pm
Quote from: calc84maniac on Cemetech
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.
Now I'm just hoping he notices :P
Title: Re: Link Port
Post by: DJ Omnimaga on October 29, 2010, 08:16:29 pm
Oh, I thought he kinda moved on from the idea for a while or was still working on it. I knew about his lost source code, though.
Title: Re: Link Port
Post by: SirCmpwn on October 30, 2010, 01:29:38 pm
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 0x900A0000 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.
Title: Re: Link Port
Post by: calc84maniac on October 30, 2010, 01:55:58 pm
Access the link port:
To enable the link port, OR the value at 0x900A0000 with 0x20.
To disable, AND the same value with ~0x20.
Actually, that should be 0x900A0004. That could explain why nothing was happening.
Title: Re: Link Port
Post by: SirCmpwn on October 30, 2010, 02:11:21 pm
That would be a great explanation :P
Title: Re: Link Port
Post by: DJ Omnimaga on October 30, 2010, 02:13:44 pm
This is to use the I/O link port when in Nspire mode, after swapping the keypads, right? Has anyone gotten any success with the USB?
Title: Re: Link Port
Post by: SirCmpwn on October 30, 2010, 02:26:10 pm
I haven't tried USB, and this is intended to use the I/O port on an 84+ keypad.
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: [Select]
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?
Title: Re: Link Port
Post by: DJ Omnimaga on October 30, 2010, 11:56:41 pm
Oh wow you're trying to get sound to work? O.o

I hope you can get it figured out. Hopefully someone will be able to help soon.
Title: Re: Link Port
Post by: SirCmpwn on October 30, 2010, 11:57:39 pm
Well, right now what I have is static with the faintest inklings of the occasional tone, so I have a long way to go.
Title: Re: Link Port
Post by: DJ Omnimaga on October 31, 2010, 04:33:02 am
Yeah I know. I hope you can eventually manipulate sound and stuff, even if it's just to produce sound like this ;D :

Title: Re: Link Port
Post by: SirCmpwn on November 01, 2010, 08:49:29 am
I'm confident that much, much better quality is possible, akin to what you'd find on an mp3 player.
Title: Re: Link Port
Post by: ExtendeD on November 01, 2010, 09:20:47 am
The sound I got on TI-68k with TI-Vibe (http://www.ticalc.org/archives/files/fileinfo/386/38629.html) was already pretty good, I suppose we could get something even better with the TI-Nspire CPU.
Title: Re: Link Port
Post by: DJ Omnimaga on November 01, 2010, 11:44:09 am
Nice I didn't knew about that program. I'll have to try it on my 89T one day
Title: Re: Link Port
Post by: SirCmpwn on November 01, 2010, 04:50:30 pm
12 MHz TI-68k, 90 MHz TI-Nspire... :P
Title: Re: Link Port
Post by: DJ Omnimaga on November 01, 2010, 06:12:54 pm
Yeah true, and it's possible to set the Nspire to 150 MHz, according to Calc84maniac. Just don't go overboard, though, because it would suck if a Mario game, for example, grew by 8 MB in size just because of sound :P
Title: Re: Link Port
Post by: SirCmpwn on November 01, 2010, 06:15:41 pm
No way, 150 MHz?  I want to know how O.O
Title: Re: Link Port
Post by: apcalc on November 01, 2010, 06:18:20 pm
Put this at the beginning of your code:

Code: [Select]
*(volatile unsigned*) 0x900B0000=0x00000002;
*(volatile unsigned*) 0x900B000C=4;

And at the end, put this to set it back to 90:

Code: [Select]
*(volatile unsigned*) 0x900B0000=0x00141002;
*(volatile unsigned*) 0x900B000C=4;
Title: Re: Link Port
Post by: SirCmpwn on November 01, 2010, 06:24:02 pm
That's awesome.  Want to try.
Title: Re: Link Port
Post by: DJ Omnimaga on November 01, 2010, 06:25:20 pm
Yup. I am curious how quick this drains battery power, though...
Title: Re: Link Port
Post by: apcalc on November 01, 2010, 06:49:37 pm
I don't know if this is just my Nspire, but, in its life, it as gone through at least 10 Ndless 1.1 installs, countless Ndless 1.7 installs (it fails a lot :(), at least 7-8 hours of usage of gbc4nspire, a lot of hours of use with other Ndless programs, and quite a few hours of usage in school, and I have only had to replace my batteries once.  I don't know if that is just my Nspire (as I know they are notorious for draining batteries), but I find that this thing never needs new batteries.
Title: Re: Link Port
Post by: DJ Omnimaga on November 01, 2010, 10:14:59 pm
Wow. I wonder under which circumstances battery power is really drained fast... maybe it just takes good batteries?
Title: Re: Link Port
Post by: ExtendeD on November 02, 2010, 05:27:21 am
We could try to run a program at the 2 frequencies which write regularly its uptime to a file, and see the difference.
Title: Re: Link Port
Post by: fb39ca4 on November 02, 2010, 08:59:43 pm
Put this at the beginning of your code:

Code: [Select]
*(volatile unsigned*) 0x900B0000=0x00000002;
*(volatile unsigned*) 0x900B000C=4;

And at the end, put this to set it back to 90:

Code: [Select]
*(volatile unsigned*) 0x900B0000=0x00141002;
*(volatile unsigned*) 0x900B000C=4;
If you neglected to reset the CPU to 90mhz, would the OS still run at 150mhz?