New multiplex scheme so that handlers can be removed
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2146
This commit is contained in:
parent
5ef7187b28
commit
c7a8672c2c
1 changed files with 18 additions and 18 deletions
|
@ -16,37 +16,39 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_misc.cpp,v 1.14 2005-02-14 15:58:50 qbix79 Exp $ */
|
||||
/* $Id: dos_misc.cpp,v 1.15 2005-03-25 08:51:34 qbix79 Exp $ */
|
||||
|
||||
#include "dosbox.h"
|
||||
#include "callback.h"
|
||||
#include "mem.h"
|
||||
#include "regs.h"
|
||||
#include "dos_inc.h"
|
||||
#include <list>
|
||||
|
||||
|
||||
static Bitu call_int2f,call_int2a;
|
||||
struct MultiplexBlock {
|
||||
MultiplexHandler * handler;
|
||||
MultiplexBlock * next;
|
||||
};
|
||||
|
||||
static MultiplexBlock * first_multiplex;
|
||||
static std::list<MultiplexHandler*> Multiplex;
|
||||
typedef std::list<MultiplexHandler*>::iterator Multiplex_it;
|
||||
|
||||
void DOS_AddMultiplexHandler(MultiplexHandler * handler) {
|
||||
MultiplexBlock * new_multiplex=new(MultiplexBlock);
|
||||
new_multiplex->next=first_multiplex;
|
||||
new_multiplex->handler=handler;
|
||||
first_multiplex=new_multiplex;
|
||||
Multiplex.push_front(handler);
|
||||
}
|
||||
|
||||
void DOS_DelMultiplexHandler(MultiplexHandler * handler) {
|
||||
for(Multiplex_it it =Multiplex.begin();it != Multiplex.end();it++) {
|
||||
if(*it == handler) {
|
||||
Multiplex.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Bitu INT2F_Handler(void) {
|
||||
MultiplexBlock * loop_multiplex=first_multiplex;
|
||||
while (loop_multiplex) {
|
||||
if ((*loop_multiplex->handler)()) return CBRET_NONE;
|
||||
loop_multiplex=loop_multiplex->next;
|
||||
}
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("DOS:Multiplex Unhandled call %4X",reg_ax);
|
||||
for(Multiplex_it it = Multiplex.begin();it != Multiplex.end();it++)
|
||||
if( (*it)() ) return CBRET_NONE;
|
||||
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("DOS:Multiplex Unhandled call %4X",reg_ax);
|
||||
return CBRET_NONE;
|
||||
};
|
||||
|
||||
|
@ -122,7 +124,6 @@ static bool DOS_MultiplexFunctions(void) {
|
|||
|
||||
void DOS_SetupMisc(void) {
|
||||
/* Setup the dos multiplex interrupt */
|
||||
first_multiplex=0;
|
||||
call_int2f=CALLBACK_Allocate();
|
||||
CALLBACK_Setup(call_int2f,&INT2F_Handler,CB_IRET,"DOS Int 2f");
|
||||
RealSetVec(0x2f,CALLBACK_RealPointer(call_int2f));
|
||||
|
@ -132,4 +133,3 @@ void DOS_SetupMisc(void) {
|
|||
CALLBACK_Setup(call_int2a,&INT2A_Handler,CB_IRET,"DOS Int 2a");
|
||||
RealSetVec(0x2A,CALLBACK_RealPointer(call_int2a));
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue