Well, here's the function I'm dealing with at the moment:

**Code:**

void VcountHandler (void)

{

static int lastbut = -1;

uint16 but = 0, x = 0, y = 0, xpx = 0, ypx = 0, z1 = 0, z2 = 0;

but = REG_KEYXY;

if (!( (but ^ lastbut) & (1 << 6)))

{

touchReadXY ( &tempPos );

if (tempPos.rawx == 0 || tempPos.rawy == 0)

{

but |= (1 <<6);

lastbut = but;

}

else

{

x = tempPos.rawx;

y = tempPos.rawy;

xpx = tempPos.px;

ypx = tempPos.py;

z1 = tempPos.z1;

z2 = tempPos.z2;

}

}

else

{

lastbut = but;

but |= (1 << 6);

}

if (but & (1 << 7))

needSleep = 1;

if (vcount == 80)

first = tempPos;

else

{

if (abs (xpx - first.px) > 10 || abs (ypx - first.py) > 10 || (but & (1 << 6)))

{

but |= (1 << 6);

lastbut = but;

}

else

{

IPC->mailBusy = 1;

IPC->touchX = x;

IPC->touchY = y;

IPC->touchXpx = xpx;

IPC->touchYpx = ypx;

IPC->touchZ1 = z1;

IPC->touchZ2 = z2;

IPC->mailBusy = 0;

}

}

IPC->buttons = but;

vcount ^= (80 ^ 130);

SetYtrigger (vcount);

}

Incidentally, to resolve another problem in the same file, what's the replacement for "SOUND_CR = SOUND_ENABLE | SOUND_VOL (0x7F);"? Just "powerOn(PM_SOUND_AMP);"?