~ubuntu-branches/ubuntu/maverick/asc/maverick

« back to all changes in this revision

Viewing changes to source/dos/realint.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese, Eddy Petrișor, Gonéri Le Bouder, Cyril Brulebois, Barry deFreese
  • Date: 2008-01-08 19:54:18 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080108195418-n19fc4eobhhqxcy5
Tags: 2.0.1.0-1
[ Eddy Petrișor ]
* fixed Homepage semifield

[ Gonéri Le Bouder ]
* add a watchfile
* move homepage from the description to the new Homepage field

[ Cyril Brulebois ]
* Added Vcs-Svn and Vcs-Browser fields in the control file.

[ Barry deFreese ]
* Fix make-clean lintian warning
* New upstream release
* Bump debhelper build-dep to match compat
* Add desktop file
* Update watch file for new upstream naming
* Remove nostrip check from rules
* Bump Standards Version to 3.7.3
* Add myself to uploaders

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//     $Id: realint.cpp,v 1.1 2000/05/30 18:39:29 mbickel Exp $
2
 
//
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
7
 
//
8
 
//     Revision 1.4  2000/05/23 20:40:48  mbickel
9
 
//      Removed boolean type
10
 
//
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 ;-)
14
 
//
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'
22
 
//
23
 
//
24
 
/*
25
 
    This file is part of Advanced Strategic Command; http://www.asc-hq.de
26
 
    Copyright (C) 1994-1999  Martin Bickel  and  Marc Schellenberger
27
 
 
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.
32
 
 
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.
37
 
 
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
42
 
*/
43
 
 
44
 
#include "realint.h";
45
 
 
46
 
rminfo rmi;
47
 
 
48
 
call_real_int::call_real_int(short int msize)
49
 
{
50
 
   memsize = msize;
51
 
 
52
 
   reg.w.ax = 0x0100;
53
 
   reg.w.bx = (memsize / 16 ) +1;
54
 
 
55
 
   #ifdef showstatus
56
 
      printf("allocating low memory\n");
57
 
   #endif
58
 
 
59
 
   int386(0x31, &reg, &reg);
60
 
 
61
 
   if (reg.w.cflag) {
62
 
      #ifdef showstatus
63
 
         printf("memory allocation failed");
64
 
         printf("error-code %d\n", reg.w.ax);
65
 
      #endif
66
 
   } else {
67
 
      #ifdef showstatus
68
 
         printf("memory allocated\n");
69
 
      #endif
70
 
   }
71
 
   realsegment = reg.w.ax;
72
 
   infoselector = reg.w.dx;
73
 
   protectedsegment = realsegment * 0x10;
74
 
}
75
 
 
76
 
 
77
 
 
78
 
char call_real_int::real_call(char intnr)
79
 
{
80
 
 
81
 
   /* use dmpi call 300h to issue the dos interrupt */
82
 
   reg.w.ax = 0x0300;
83
 
   reg.h.bl = intnr;
84
 
   reg.h.bh = 0;
85
 
   reg.w.cx = 0;
86
 
   segmentreg.es = FP_SEG( &rmi ); 
87
 
   
88
 
   reg.x.edi = FP_OFF( &rmi );
89
 
   
90
 
   #ifdef showstatus
91
 
      printf("calling real mode interrupt\n");
92
 
   #endif
93
 
   
94
 
   int386x(0x31, &reg, &reg, &segmentreg);
95
 
   
96
 
   
97
 
   /*if ((rmi.eax & 0xffff) != 0x004f) {
98
 
      #ifdef showstatus
99
 
         printf("could not get infoblock\n");
100
 
         printf("result: %x", rmi.eax);
101
 
      #endif
102
 
      
103
 
      return (false);
104
 
   } else {
105
 
      #ifdef showstatus
106
 
         printf("got infoblock\n");
107
 
      #endif
108
 
   } */
109
 
   return (true);
110
 
}
111
 
 
112
 
call_real_int::~call_real_int(void)
113
 
{
114
 
   reg.w.ax = 0x0101;
115
 
   reg.w.dx = infoselector;
116
 
   
117
 
   int386(0x31, &reg, &reg);
118
 
   
119
 
   if (reg.w.cflag) {
120
 
      #ifdef showstatus
121
 
         printf("dos-memory deallocation failed\n");
122
 
         printf("error-code %d\n", reg.w.ax);
123
 
      #endif
124
 
   }
125
 
   else {
126
 
      #ifdef showstatus
127
 
         printf("dos-memory deallocation successful\n");
128
 
      #endif
129
 
   }
130
 
}
131
 
 
132
 
void call_real_int::setuprmi(void)
133
 
{
134
 
   /* set up real-mode call structure */
135
 
   
136
 
   #ifdef showstatus
137
 
      printf("fill rmi structure with 0\n");
138
 
   #endif
139
 
   
140
 
   memset(&rmi, 0, sizeof(rmi));
141
 
   segread(&segmentreg);
142
 
}