(C/C++) How can i try to use something like jc?

Programming, for all ages and all languages.
Post Reply
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

(C/C++) How can i try to use something like jc?

Post 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.
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
User avatar
iansjack
Member
Member
Posts: 4689
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: (C/C++) How can i try to use something like jc?

Post by iansjack »

What has the carry flag got to do with enabling interrupts?
Techel
Member
Member
Posts: 215
Joined: Fri Jan 30, 2015 4:57 pm
Location: Germany
Contact:

Techel

Post by Techel »

Why would you want to check the carry flag?
Simply use the jc instruction with a destination label.
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

Re: Techel

Post 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).
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

Re: (C/C++) How can i try to use something like jc?

Post 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).
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
User avatar
iansjack
Member
Member
Posts: 4689
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: (C/C++) How can i try to use something like jc?

Post 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
Member
Member
Posts: 215
Joined: Fri Jan 30, 2015 4:57 pm
Location: Germany
Contact:

Techel

Post 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.
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

Re: Techel

Post 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.
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
Post Reply