π
<-
Chat plein-écran
[^]

Utilization des Auto-Ints (92+)

Programmation et implémentation d'algorithmes.

Utilization des Auto-Ints (92+)

Message non lude 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...
Dernière édition par utz le 15 Mar 2016, 17:13, édité 1 fois.
Avatar de l’utilisateur
utz
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Prochain niv.: 36%
 
Messages: 13
Inscription: 15 Mar 2016, 10:05
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: Utilization des Auto-Ints (92+)

Message non lude Ti64CLi++ » 15 Mar 2016, 17:10

Speak English because your French is bad ;)
Image
Avatar de l’utilisateur
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 32.3%
 
Messages: 3441
Images: 75
Inscription: 04 Juil 2014, 14:40
Localisation: Clermont-Ferrand 63
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: ENS Rennes
GitHub: Ti64CLi

Re: Utilization des Auto-Ints (92+)

Message non lude 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?
Avatar de l’utilisateur
utz
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Prochain niv.: 36%
 
Messages: 13
Inscription: 15 Mar 2016, 10:05
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: Utilization des Auto-Ints (92+)

Message non lude loupiot » 15 Mar 2016, 17:31

you're not the only non french speaker, there is no problem if you speak english here :)
Avatar de l’utilisateur
loupiotProgrammeur
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Prochain niv.: 1.9%
 
Messages: 158
Images: 4
Inscription: 30 Oct 2015, 13:23
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: 2A ENS Lyon maths

Re: Utilization des Auto-Ints (92+)

Message non lude 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 :)
Image

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...)
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80.2%
 
Messages: 14614
Images: 1218
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: Utilization des Auto-Ints (92+)

Message non lude 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.
Avatar de l’utilisateur
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Prochain niv.: 11.2%
 
Messages: 6859
Inscription: 23 Déc 2009, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: -
GitHub: debrouxl

Re: Utilization des Auto-Ints (92+)

Message non lude Hayleia » 15 Mar 2016, 19:40

utz a écrit: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
Avatar de l’utilisateur
HayleiaGénéreux
Niveau 17: GM (Grand Maître des calculatrices)
Niveau 17: GM (Grand Maître des calculatrices)
Prochain niv.: 43.8%
 
Messages: 2509
Images: 2
Inscription: 30 Aoû 2011, 08:22
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile
Classe: Templar

Re: Utilization des Auto-Ints (92+)

Message non lude 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?
Avatar de l’utilisateur
utz
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Prochain niv.: 36%
 
Messages: 13
Inscription: 15 Mar 2016, 10:05
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: Utilization des Auto-Ints (92+)

Message non lude 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.
Avatar de l’utilisateur
Lionel DebrouxSuper Modo
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Prochain niv.: 11.2%
 
Messages: 6859
Inscription: 23 Déc 2009, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: -
GitHub: debrouxl

Re: Utilization des Auto-Ints (92+)

Message non lude 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?
Avatar de l’utilisateur
utz
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Prochain niv.: 36%
 
Messages: 13
Inscription: 15 Mar 2016, 10:05
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Suivante

Retourner vers Programmation

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 15 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
982 utilisateurs:
>949 invités
>28 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Autres sites intéressants
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)