Original Post
Please help!
1. the following code if for real mode
2. it compiles
3. it is has correct syntax
4. it crashes
The main loop in constently looking for a new char, the int. function is called at a key press and fills the vector. The first time a key is pressed everything works, the second time everything works and after about 25-75 runs through the main loop the program freezes.
here she is:
note: DOS mode
#include <BIOS.h>
#include <Ctype.h>
#include <StdIO.h>
#include <DOS.h>
#include <Apqueue.h>
#define INTR 0011 // The Keyboard INT
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
apqueue KeyQue;
void interrupt ( *oldhandler)(__CPPARGS);
void interrupt handler(__CPPARGS)
{
disable();
oldhandler();
KeyQue.enqueue(bioskey(0));
enable();
}
void main(void)
{
bool Loop_Flag = true;
int key = 0;
oldhandler = getvect(INTR);
setvect(INTR, handler);
while(Loop_Flag)
{
cout<<".";
if (KeyQue.length() > 0)
{
KeyQue.dequeue(key);
if (isalnum(key & 0xFF))
printf("%c", key);
else
printf("%#02x", key);
if(char(key) == ''e'') Loop_Flag = false;
}
}
setvect(INTR, oldhandler);
}