1
// $Id: realint.cpp,v 1.1 2000/05/30 18:39:29 mbickel Exp $
3
// $Log: realint.cpp,v $
4
// Revision 1.1 2000/05/30 18:39:29 mbickel
5
// Added support for multiple directories
6
// Moved DOS specific files to a separate directory
8
// Revision 1.4 2000/05/23 20:40:48 mbickel
9
// Removed boolean type
11
// Revision 1.3 2000/03/29 09:58:48 mbickel
12
// Improved memory handling for DOS version
13
// Many small changes I can't remember ;-)
15
// Revision 1.2 1999/11/16 03:42:23 tmwilson
16
// Added CVS keywords to most of the files.
17
// Started porting the code to Linux (ifdef'ing the DOS specific stuff)
18
// Wrote replacement routines for kbhit/getch for Linux
19
// Cleaned up parts of the code that gcc barfed on (char vs unsigned char)
20
// Added autoconf/automake capabilities
21
// Added files used by 'automake --gnu'
25
This file is part of Advanced Strategic Command; http://www.asc-hq.de
26
Copyright (C) 1994-1999 Martin Bickel and Marc Schellenberger
28
This program is free software; you can redistribute it and/or modify
29
it under the terms of the GNU General Public License as published by
30
the Free Software Foundation; either version 2 of the License, or
31
(at your option) any later version.
33
This program is distributed in the hope that it will be useful,
34
but WITHOUT ANY WARRANTY; without even the implied warranty of
35
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36
GNU General Public License for more details.
38
You should have received a copy of the GNU General Public License
39
along with this program; see the file COPYING. If not, write to the
40
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
41
Boston, MA 02111-1307 USA
48
call_real_int::call_real_int(short int msize)
53
reg.w.bx = (memsize / 16 ) +1;
56
printf("allocating low memory\n");
59
int386(0x31, ®, ®);
63
printf("memory allocation failed");
64
printf("error-code %d\n", reg.w.ax);
68
printf("memory allocated\n");
71
realsegment = reg.w.ax;
72
infoselector = reg.w.dx;
73
protectedsegment = realsegment * 0x10;
78
char call_real_int::real_call(char intnr)
81
/* use dmpi call 300h to issue the dos interrupt */
86
segmentreg.es = FP_SEG( &rmi );
88
reg.x.edi = FP_OFF( &rmi );
91
printf("calling real mode interrupt\n");
94
int386x(0x31, ®, ®, &segmentreg);
97
/*if ((rmi.eax & 0xffff) != 0x004f) {
99
printf("could not get infoblock\n");
100
printf("result: %x", rmi.eax);
106
printf("got infoblock\n");
112
call_real_int::~call_real_int(void)
115
reg.w.dx = infoselector;
117
int386(0x31, ®, ®);
121
printf("dos-memory deallocation failed\n");
122
printf("error-code %d\n", reg.w.ax);
127
printf("dos-memory deallocation successful\n");
132
void call_real_int::setuprmi(void)
134
/* set up real-mode call structure */
137
printf("fill rmi structure with 0\n");
140
memset(&rmi, 0, sizeof(rmi));
141
segread(&segmentreg);