[SOLVED] What IPL is a TRAP exception?

GFA, ASM, STOS, ...

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

mikro
Atari God
Atari God
Posts: 1263
Joined: Sat Sep 10, 2005 11:11 am
Location: Brisbane, Queensland, Australia
Contact:

[SOLVED] What IPL is a TRAP exception?

Postby mikro » Fri Sep 15, 2017 4:37 am

I feel rather dumb but can't help myself. I have a loop with calling Setexc(0x4ba, -1). For instance I want to wait four 200 Hz ticks. However sometimes (not always but definitely very often, like in 80% of cases) whole loop just locks down. So instead of having one quick call where I wait for one tick I get a zillion of trap calls until the tick counter moves to +1 (taking easily one minute!).

Since the code is trivial and debugged, the only explanation left is that traps actually enjoy higher priority than MFP interrupts (in this case Timer C) but it feels wrong -- MFP is IPL 6 (basically the same as 7, i.e. the highest possible IPL) so I find it hard to believe. But maybe I'm wrong? Timer C is rather low on MFP interrupt priority list but still, it is an IPL 6, right?
Last edited by mikro on Fri Sep 15, 2017 5:04 am, edited 1 time in total.

mikro
Atari God
Atari God
Posts: 1263
Joined: Sat Sep 10, 2005 11:11 am
Location: Brisbane, Queensland, Australia
Contact:

Re: What IPL is a TRAP exception?

Postby mikro » Fri Sep 15, 2017 5:00 am

Btw 'A Hitchhiker's guide to the BIOS' lists _hz_200 as $4bc. First I though "Heureka, this is it!" but obviously, it is not. It's really $4ba.

mikro
Atari God
Atari God
Posts: 1263
Joined: Sat Sep 10, 2005 11:11 am
Location: Brisbane, Queensland, Australia
Contact:

Re: [SOLVED] What IPL is a TRAP exception?

Postby mikro » Fri Sep 15, 2017 5:06 am

OK, I'm an idiot. $4ba = 1210. 1210 / 4 = 302.5, i.e. I can't use Setexc! In reality I'm reading content of 302*4 = $4b8, i.e. unused/undocumented variable.

I should have known better, right? Sigh.

AtariZoll
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2759
Joined: Mon Feb 20, 2012 4:42 pm
Contact:

Re: [SOLVED] What IPL is a TRAP exception?

Postby AtariZoll » Fri Sep 15, 2017 6:36 am

Nice monolog :mrgreen:
English language is like bad boss on workplace: it expecting from you to strictly follow all, numerous rules, but self bending rules as much likes :mrgreen:

User avatar
shoggoth
Nature
Nature
Posts: 848
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: [SOLVED] What IPL is a TRAP exception?

Postby shoggoth » Fri Sep 15, 2017 7:53 am

mikro wrote:OK, I'm an idiot. $4ba = 1210. 1210 / 4 = 302.5, i.e. I can't use Setexc! In reality I'm reading content of 302*4 = $4b8, i.e. unused/undocumented variable.

I should have known better, right? Sigh.


Brainfart. Ssystem() does the trick, but then again you're stuck in the FreeMiNT domain in such case.
Ain't no space like PeP-space.

ThorstenOtto
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 129
Joined: Sun Aug 03, 2014 5:54 pm

Re: [SOLVED] What IPL is a TRAP exception?

Postby ThorstenOtto » Fri Sep 15, 2017 3:00 pm

Note that if you don't want to use Super() or Supexec() for some reason, you can still use Setexc() to fetch the value: just call it twice, and shift the two halfwords together. Or, in this case might be even enough to call it once for the 2nd halfword, if you are only waiting for a change in it.

mikro
Atari God
Atari God
Posts: 1263
Joined: Sat Sep 10, 2005 11:11 am
Location: Brisbane, Queensland, Australia
Contact:

Re: [SOLVED] What IPL is a TRAP exception?

Postby mikro » Fri Sep 15, 2017 11:56 pm

Thorsten: I was pretty close to what you have described but then I realised how pointless it is and went with classic clock() instead (which internally uses get_sysvar(0x4ba) which in turn uses Super() or Ssytem(), depending on the OS).

(the original idea was to save as many trap calls as possible)


Social Media

     

Return to “Coding”

Who is online

Users browsing this forum: No registered users and 2 guests