The LazyBoy Library Manual - IDLE_HOOK

Value stored in the Data Segment.

word [IDLE_HOOK]

Is a chain of processes to perform when a program is not busy and has invoked the Idle macro.

The Idle macro performs a near call to the location stored in this variable. Each item in the chain must jump to the previous IDLE_HOOK. The final original hook will perform a return to the caller.

Note: Items in this chain should not take long to complete. The Delay macro will call Idle repeatedly while waiting for time to elapse. A time consuming process inserted into the chain will cause the requested delay to be extended. It will also create lag while waiting for keyboard input.

Example of inserting into the chain:

; all flat DOS binaries start at 0x100 org 0x100 ; include and initialize the LazyBoy library %include "lazy.inc" ; insert into idle process chain mov ax, [IDLE_HOOK] mov [OLD_HOOK], ax mov [IDLE_HOOK], word MY_HOOK ; infinite idle loop Idling: Idle jmp Idling ; abort and exit to DOS Abort: KeyFlush Terminate 0x01 ; custom idle hook, if keypressed Abort ; else, jump to next idle hook in chain MY_HOOK: KeyPressed Abort jmp near [OLD_HOOK] ; include any required supporting code or data LAZY_CODE ; unintialized DATA segment section .bss OLD_HOOK: resw 1

See also: Idle