AH = 41h: WAIT FOR EVENT

This power-saving function tests a specified byte in either System RAM or in I/O space as a condition for return to the caller. A timeout may also be specified.

If the condition code (in register AL) is invalid, this function immediately returns to the caller with CARRY = 1.

If the condition code is valid, the function enters the light sleep and waits for a wakeup event. Periodic timer (both TIMER0 and TIMER1) wakeups, as well as keyboard and other hardware events occur to bring the CPU into a temporary RUN State. Every wakeup causes the specified condition as well as timeout to be tested for a possible return to the caller. If the condition is true, the function returns with CARRY=0. If the return timeout occurs, the function returns with CARRY=1. The return timeout (in BL) can vary between 1 and 255 TIMER0 ticks (55 msecs per tick). If BL=0, return timeout is disabled. The value in BL is recorded in HALTVAL (40h:7Bh). The TIMER0 interrupt service decrements HALTVAL, and the return timeout condition is satisfied when HALTVAL=0.

This function will also enter the Deep Sleep state if Auto-Timeout occurs and there is no AC Adaptor installed. On wakeup from the Deep Sleep state, this function will return to the caller with CARRY=1 just as if the specified timeout had expired.

Begin:

TimeOutRet: CARRY <-- 1. go to WtEventExit

OKRET: CARRY <-- 0. go to WtEventExit

WtEventExit: Clear Annunciators, INTLST <-- 0, Exit.

Notes: