summaryrefslogtreecommitdiff
path: root/sysspec.h
blob: d612b7856845ce521926ba409724dc82e137fc0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
** sysspec.h
** Header file for sysspec.c
** BYTEmark (tm)
** BYTE's Native Mode Benchmarks
** Rick Grehan, BYTE Magazine
**
** Creation:
** Revision: 3/95
**
** DISCLAIMER
** The source, executable, and documentation files that comprise
** the BYTEmark benchmarks are made available on an "as is" basis.
** This means that we at BYTE Magazine have made every reasonable
** effort to verify that the there are no errors in the source and
** executable code.  We cannot, however, guarantee that the programs
** are error-free.  Consequently, McGraw-HIll and BYTE Magazine make
** no claims in regard to the fitness of the source code, executable
** code, and documentation of the BYTEmark.
**  Furthermore, BYTE Magazine, McGraw-Hill, and all employees
** of McGraw-Hill cannot be held responsible for any damages resulting
** from the use of this code or the results obtained from using
** this code.
*/

/*
** Standard includes
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>

#include "nmglobal.h"

#if !defined(MAC) && !defined(OSX)
#include <malloc.h>
#endif


/*
** System-specific includes
*/

#ifdef DOS16MEM
#include "dos.h"
#endif

/* #include "time.h"
#include "io.h"
#include "fcntl.h"
#include "sys\stat.h" */
/* Removed for MSVC++
#include "alloc.h"
*/

/*
** MAC Time Manager routines (from Code Warrior)
*/
#ifdef MACTIMEMGR
#include <memory.h>
#include <lowmem.h>
#include <Types.h>
#include <Timer.h>
extern struct TMTask myTMTask;
extern long MacHSTdelay,MacHSTohead;
#endif

/*
** Windows 3.1 timer defines
*/
#ifdef WIN31TIMER
#include <windows.h>
#include <toolhelp.h>
TIMERINFO win31tinfo;
HANDLE hThlp;
FARPROC lpfn;
#endif

/**************
** EXTERNALS **
**************/
extern unsigned long mem_array[2][MEM_ARRAY_SIZE];
extern int mem_array_ents;
extern int global_align;

/****************************
**   FUNCTION PROTOTYPES   **
****************************/

void *AllocateMemory(unsigned long nbytes,
                int *errorcode);

void FreeMemory(void *mempointer,
                int *errorcode);

void MoveMemory( void *destination,
                void *source,
                unsigned long nbytes);

#ifdef DOS16MEM
void FarDOSmemmove(void *destination,
                void *source,
                unsigned long nbytes);
#endif

void InitMemArray(void);

int AddMemArray(unsigned long true_addr, unsigned long adj_addr);

int RemoveMemArray(unsigned long adj_addr,unsigned long *true_addr);

void ReportError(char *context, int errorcode);

void ErrorExit();

void CreateFile(char *filename,
                int *errorcode);

#ifdef DOS16
int bmOpenFile(char *fname,
                int *errorcode);

void CloseFile(int fhandle,
                int *errorcode);

void readfile(int fhandle,
                unsigned long offset,
                unsigned long nbytes,
                void *buffer,
                int *errorcode);

void writefile(int fhandle,
                unsigned long offset,
                unsigned long nbytes,
                void *buffer,
                int *errorcode);
#endif

#ifdef LINUX
FILE *bmOpenFile(char *fname,
                int *errorcode);

void CloseFile(FILE *fhandle,
                int *errorcode);

void readfile(FILE *fhandle,
                unsigned long offset,
                unsigned long nbytes,
                void *buffer,
                int *errorcode);

void writefile(FILE *fhandle,
                unsigned long offset,
                unsigned long nbytes,
                void *buffer,
                int *errorcode);

#endif

unsigned long StartStopwatch();

unsigned long StopStopwatch(unsigned long startticks);

unsigned long TicksToSecs(unsigned long tickamount);

double TicksToFracSecs(unsigned long tickamount);