π
<-

Utilization des Auto-Ints (92+)

Programmation et implémentation d'algorithmes.

Utilization des Auto-Ints (92+)

Unread postby utz » 15 Mar 2016, 13:48

Salut,

mon premier post ici ;) Excusez-moi, la langue française et moi, ça fait deux... mais il semble que la plupart des 68k codeurs sont ici, donc je vais essayer quand même.

J'essaye de compredre l'utilization des Auto-Ints sûr TI92+. Pour le début, je veux simplement détecter si la touche ON est pressée. C'est le Auto-Int 6, non? Alors, j'ai désactivé la protection de memoire (bclr #2,($600001)), et mis un nouveau vecteur à l'adresse $000078. Jusqu'ici tout va bien. Le debugger me montre que le nouveau vecteur est correctement chargé. Mais malhereusement, quand je presse la touche ON, le TI ne suit pas le vecteur. Au lieu de cela, il va crasher avec "ILLEGAL INSTRUCTION". Qu'est-ce que je fais mal?

Edit: Il semble que le vecteur est en effet suivi, mais un erreur est jeté après la fin de l'exécution du programme. Imbalance de stack, peut-être?
Comment le résoudre?

Edit2: Ok, un peut de progrès. Bien sûr, A7 est détruite par l'interrupt. Pas de problem, on peut corriger ça ;) Et maintenant, le programme se termine bien. Mais si je tente de l'exécuter à nouveau, il va se planter avec "Illegal Instruction". Hmmmm...
Last edited by utz on 15 Mar 2016, 17:13, edited 1 time in total.
User avatar
utz
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Level up: 36%
 
Posts: 13
Joined: 15 Mar 2016, 10:05
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: Utilization des Auto-Ints (92+)

Unread postby Ti64CLi++ » 15 Mar 2016, 17:10

Speak English because your French is bad ;)
Image
User avatar
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 32.5%
 
Posts: 3446
Images: 75
Joined: 04 Jul 2014, 14:40
Location: Clermont-Ferrand 63
Gender: Male
Calculator(s):
MyCalcs profile
Class: ENS Rennes
GitHub: Ti64CLi

Re: Utilization des Auto-Ints (92+)

Unread postby utz » 15 Mar 2016, 17:19

Ok, sure. I know my French sucks, just didn't want to be impolite...

So, in case my ramblings were to incoherent to comprehend, I'll try to sum them up in English.

I'm trying to figure out how to use the Auto-Ints on 92+. For the time being, I'm simply trying to detect if the ON key is pressed, and exit the program if so. I'm putting a new vector into ($000078) and I've now gotten as far as having it actually execute. I also figured that triggering the interrupt will trash the stack, so I'm restoring it to whatever value it had before. When the interrupt fires, i'm putting the old vector back at ($000078), and the program does a clean exit. But when I try to run it again, the calc will throw an "Illegal Instruction" and freeze. What am I doing wrong?
User avatar
utz
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Level up: 36%
 
Posts: 13
Joined: 15 Mar 2016, 10:05
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: Utilization des Auto-Ints (92+)

Unread postby loupiot » 15 Mar 2016, 17:31

you're not the only non french speaker, there is no problem if you speak english here :)
User avatar
loupiotProgrammeur
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Level up: 1.9%
 
Posts: 158
Images: 4
Joined: 30 Oct 2015, 13:23
Gender: Male
Calculator(s):
MyCalcs profile
Class: 2A ENS Lyon maths

Re: Utilization des Auto-Ints (92+)

Unread postby Adriweb » 15 Mar 2016, 17:59

I'm pretty sure Lionel Debroux will be able to help you - let's wait until he reads this topic :)

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
My calculator programs
Mes programmes pour calculatrices
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 80%
 
Posts: 14842
Images: 1133
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: Utilization des Auto-Ints (92+)

Unread postby Lionel Debroux » 15 Mar 2016, 19:29

Hi utz, nice to see you here :)

You need to (EDIT: or at least, should - that's what most programs do, AFAIK) use port 60001A instead of AUTO_INT_6, like I did for http://www.ticalc.org/archives/files/fi ... 43329.html .
You can find the latest version of the hardware reference mirrored at http://tict.ticalc.org/docs/J89hw.txt .

Don't worry about your French skills. Lots of native French speakers are doing it worse than you are...
Membre de la TI-Chess Team.
Co-mainteneur de GCC4TI (documentation en ligne de GCC4TI), TIEmu et TILP.
User avatar
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Level up: 11.4%
 
Posts: 6873
Joined: 23 Dec 2009, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Class: -
GitHub: debrouxl

Re: Utilization des Auto-Ints (92+)

Unread postby Hayleia » 15 Mar 2016, 19:40

utz wrote:Ok, sure. I know my French sucks, just didn't want to be impolite...

I wouldn't say you were the impolite one here...

Plus, your French isn't bad at all. The only mistakes I see are :
  • "utilization" instead of "utilisation" (no one cares, it doesn't hurt readability)
  • "un erreur est jeté", instead of "une erreur est jetée" (same, we can see you're not French but it's just a gender issue that doesn't hurt readability)
  • "Imbalance". Ok, only place where people who don't speak English at all can't see what you mean, but on the other hand, they're at fault too...
  • "problem" instead of "problème" (no one cares either)

Image
ImageImageImage
Pokemon Topaze (Axe) discussion and download links here
(19:29:36) noelnadal: plus sérieusemen​t, j'ai très peu de problèmes
(22:45:44) Clifward: J'aime rire du malheur des autres :troll:

(2017.11.18 - 17:07:12) Fireworks: Hayleia !!!!!
(2017.11.18 - 17:07:19) TI-Bot: Fireworks has been logged out (Kicked).
(2017.11.18 - 17:07:22) TI-Bot: Ban of user Fireworks revoked.
(2017.11.18 - 17:07:25) TI-Bot: Fireworks logs into the Chat.
(2017.11.18 - 17:07:28) Fireworks: <3
(2017.11.18 - 17:07:31) Fireworks: 208
User avatar
HayleiaGénéreux
Niveau 17: GM (Grand Maître des calculatrices)
Niveau 17: GM (Grand Maître des calculatrices)
Level up: 43.8%
 
Posts: 2509
Images: 2
Joined: 30 Aug 2011, 08:22
Gender: Not specified
Calculator(s):
MyCalcs profile
Class: Templar

Re: Utilization des Auto-Ints (92+)

Unread postby utz » 15 Mar 2016, 20:42

Thanks for the cheers y'all... I'll try some more French later on, but right now my brain's too tired ;)

Ok, so the thing is that I don't want to use the IO ports. I'm writing some timing-critical code (yep, you might have guessed it already - it's a sound driver), and using ports would cost me a lot of cycles, not least because I'd need to balance out the cycle count from the inevitable Bcc. Hence my question: Is there any possibility to directly use AUTO_INT_6, or should I just forget about it? I've deduced that doing so will escalate privileges (enable supervisor mode, that is), but when I try to deescalate that before exiting the program, the calc will immediately freeze with "Illegal Instruction" on exit.

I was also (and more importantly) planning on using AUTO_INT_5, ie. the timer interrupt. Will that cause the same sort of problems, or can it be used safely somehow?
User avatar
utz
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Level up: 36%
 
Posts: 13
Joined: 15 Mar 2016, 10:05
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: Utilization des Auto-Ints (92+)

Unread postby Lionel Debroux » 15 Mar 2016, 21:01

using ports would cost me a lot of cycles

I'm not aware using the port for the ON key is slower than letting the interrupt trigger, handling it, and returning. You could benchmark a loop of checking the port using the timer interrupt, anyway :)
Unless checking the port yields special implicit hardware delay (TI-68k ports normally don't for reads not preceded by writes, such as the keyboard ports needing a relatively short delay before reading after writing the row), checking the port will end up being faster.

Hence my question: Is there any possibility to directly use AUTO_INT_6

Sure, that's what the OS does.
Likewise, AUTO_INT_5 is used by lots of programs for their purposes, starting by Geogeo's PolySnd (I contributed several optimizations in the fast path) for producing sound through the legacy I/O port on a TI-68k calculator.

The user and supervisor stacks are fully separate: 0x400-0x41FF for the former, 0x4204-0x4BFF for the latter, stack fence 0xDEADDEAD in-between. Don't try to play weird games and mix the two pointers, and don't forget to use rte instead of rts to return from your interrupt handlers :)
Membre de la TI-Chess Team.
Co-mainteneur de GCC4TI (documentation en ligne de GCC4TI), TIEmu et TILP.
User avatar
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Level up: 11.4%
 
Posts: 6873
Joined: 23 Dec 2009, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Class: -
GitHub: debrouxl

Re: Utilization des Auto-Ints (92+)

Unread postby utz » 15 Mar 2016, 21:19

Alright, thanks for your advice! I'll have a go at figuring out how to properly return from the interrupt, and study PolySnd, then.

Regarding the speed thing... say I want to check the ON key status during a running sound loop. For reading and evaluating the port, I have to put some code into the loop to handle it. If I use the auto-int on the other hand, no additional code is required within the loop. So naturally, it'll save me a few cycles ;) As far as the actual cycle count of checking the IO port vs handling the interrupt goes, I'm pretty sure IO would indeed be faster. Well, it was more a hypothetical thing, ultimately one shouldn't put the keyhandling into the synth core in the first place :o

Btw, my user stack is sitting somewhere at 3cxx... is that normal? Using a "compressed" prgm btw.

Edit: Just looked into PolySnd a bit. I can't figure out how it's using AUTO_INT_5. There's a move.w #$700,d0, trap #1 at the beginning... so how exactly does this work?
User avatar
utz
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Level up: 36%
 
Posts: 13
Joined: 15 Mar 2016, 10:05
Gender: Not specified
Calculator(s):
MyCalcs profile

Next

Return to Programmation

Who is online

Users browsing this forum: ClaudeBot [spider] and 5 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
1234
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1162 utilisateurs:
>1110 invités
>46 membres
>6 robots
Record simultané (sur 6 mois):
7582 utilisateurs (le 25/06/2025)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)