beautypg.com

Allegro get keystroke function (allegro_getch()), Allegro cpu busy function (allegro_cpubusy) – Juniper Systems Allegro DOS Manual User Manual

Page 122

background image

122 Allegro DOS Owner’s Manual

Allegro Get Keystroke Function (Allegro_Getch())

The following function can be used to put the Allegro to sleep while
waiting for a keystroke.

char Allegro_Getch(void)
{

while(!kbhit())

// do sleep function until key is pressed

{

_asm

{

push ax
push bx
mov

ax,

2F19h

mov bl,

10000000b //load

regs

for

sleep

call

int 10h

//call

sleep

function

pop bx
pop ax

}

}

return(getch());
}

Allegro CPU Busy Function (Allegro_CpuBusy)

This function overrides the Power Manager and causes the CPU to
enter a high power state. It remains in this state until the Allegro_
CpuDone function is called. It is used to temporarily speed up the
CPU when data needs to be processed rapidly.

void Allegro_CpuBusy (void)
{
_asm

{

push

ax

push

bx

mov

ax,

2E0Bh

mov

bl, 0

// setup regs for function call

int 10h

// call cpu busy function

pop

bx

pop

ax

}

}