| When I disable interrupts, grayscale doesn't work!

Previous | Graphics and Display | Next

Q: | I'm writing a game in C, but I encountered the following problem: when I disable interrupts, the grayscale doesn't work...

A:

Of course, because grayscale is based on interrupts. I.e. you must not disable them in grayscale programs. So, what to do? You probably want to disable auto-int 1 to avoid screwing up the status line. Instead of DISABLING auto-int 1, you may REDIRECT it to nothing. New header file intr.h provides very elegant methods for doing this. It is enough to do this:

    INT_HANDLER save_int_1;
    ...
    save_int_1 = GetIntVec (AUTO_INT_1);
    SetIntVec (AUTO_INT_1, DUMMY_HANDLER);   // redirect auto-int 1 to "nothing"
    // enable grayscale
    // do your code
    // disable grayscale
    SetIntVec (AUTO_INT_1, save_int_1);

This method is much more elegant than in previous releases of TIGCCLIB.