Page 1 of 1
(C/C++) How can i try to use something like jc?
Posted: Mon Dec 26, 2016 11:27 am
by NunoLava1998
I finally got to enable interrupts correctly (using my code and code of some other people, no errors or warnings using -Wextra/-Wall). However, my code sometimes fails to enable interrupts, and so i need something like a jc to repeat if the carry flag was set, or a rfics (repeat function if carry flag set).
How would i do this in C (or C++)? Yes, i use inline assembly to do lidt.
Re: (C/C++) How can i try to use something like jc?
Posted: Mon Dec 26, 2016 11:43 am
by iansjack
What has the carry flag got to do with enabling interrupts?
Techel
Posted: Mon Dec 26, 2016 11:43 am
by Techel
Why would you want to check the carry flag?
Simply use the jc instruction with a destination label.
Re: Techel
Posted: Mon Dec 26, 2016 11:47 am
by NunoLava1998
Techel wrote:Why would you want to check the carry flag?
Simply use the jc instruction with a destination label.
My loading interrupts function fails a lot, and since i try to use the PIC right after, it triple-faults (obviously).
Re: (C/C++) How can i try to use something like jc?
Posted: Mon Dec 26, 2016 11:50 am
by NunoLava1998
iansjack wrote:What has the carry flag got to do with enabling interrupts?
lidt can fail sometimes (and it does, it sometimes takes like 5 times until it finally does it succesfully).
Re: (C/C++) How can i try to use something like jc?
Posted: Mon Dec 26, 2016 11:53 am
by iansjack
NunoLava1998 wrote:iansjack wrote:What has the carry flag got to do with enabling interrupts?
lidt can fail sometimes (and it does, it sometimes takes like 5 times until it finally does it succesfully).
But what has that got to do with the carry flag? And what is difficult about enabling interrupts - it's a single instruction.
Techel
Posted: Mon Dec 26, 2016 11:58 am
by Techel
Did you clear the interrupt enabled flag before lidt'ing the idt? If not, the pit keeps triggering interrupts, but if you're lucky, this doesn't happen until you got the interrupt part successfully set up.
Re: Techel
Posted: Mon Dec 26, 2016 12:30 pm
by NunoLava1998
Techel wrote:Did you clear the interrupt enabled flag before lidt'ing the idt? If not, the pit keeps triggering interrupts, but if you're lucky, this doesn't happen until you got the interrupt part successfully set up.
Looks like that is , sometimes i can get it for a bit before PIT screws up.