Skip to main content
gamedev.net
🔒 Locked

Please help!

Started by VoidLogic 5 replies 150+ views
Original Post
VoidLogic
VoidLogic
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); }
Neff
Neff
Just a quick word of advice:
Use the title of your post to describe your problem.

Otherwise, some really grumpy/wierd people will complain to you about wasting their time..
Neff
Neff
Surely there are an infinite number of possibilities that could take place.

It appears the only one at loss should be the origional poster, not getting their desired help. The smart people don''t have to be annoyed at this.
Raduprv
Raduprv
From what I''ve seen there, yuo are trying to hook the keyboard intrerupt, right? I did that in ASM, long time ago, never programmed in C for DOS.
Are you sure you hook that intrerupt properly? Can you usea debugger to see where it crashes?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.