-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmachine.c
184 lines (177 loc) · 6.24 KB
/
machine.c
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*******************************************************************************
***
*** Filename : machine.c
*** Purpose : Machine detection for Psion Computers
*** Author : Matt J. Gumbley
*** Created : 23/07/97
*** Last updated : 10/07/98
***
********************************************************************************
***
*** Modification Record
***
*******************************************************************************/
#include <epoc.h>
#include <p_std.h>
#include <p_serial.h>
#include "machine.h"
GLDEF_D BYTE machine_type=MACH_UNKNOWN; /* One of the MACH_ codes above */
GLDEF_D UWORD machine_fullscreenwidth; /* Width of entire screen in pixels */
GLDEF_D UWORD machine_fullscreenheight; /* Height of entire screen in pixels */
GLDEF_D UWORD machine_fullscreencols; /* Width in columns */
GLDEF_D UWORD machine_fullscreenrows; /* Height in rows */
GLDEF_D UWORD machine_maxbaud; /* Highest baud rate supported */
GLDEF_D BYTE machine_hasIrDA; /* Have we an IrDA device? */
GLDEF_D BYTE machine_canreturntickcount; /* Can we do hi-res timing? */
GLDEF_D TEXT *machine_name; /* Model Name of this machine */
GLDEF_C VOID machine_check()
{
UINT lcdtype, osversion;
UINT port;
/* Determine machine type */
lcdtype=p_getlcd();
if (lcdtype == E_LCD_480_160) {
/* S3a or S3c */
osversion=p_version();
if (osversion>=0x390F) {
/* It is safe to call p_returnexpansionportinfo */
port = p_returnexpansionportinfo();
if ((port & 0x0700) == 0x0300) {
/* Must be S3c */
machine_type = MACH_S3c;
}
else {
/* Must be S3a */
machine_type = MACH_S3a;
}
}
else {
/* EPOC < 3.90 so must be S3a */
machine_type = MACH_S3a;
}
}
else {
/* Machine determined by LCD type */
switch (lcdtype) {
case E_LCD_640_400 : machine_type = MACH_MC400; break;
case E_LCD_640_200_SMALL : machine_type = MACH_MC200; break;
case E_LCD_160_80 : machine_type = MACH_HC; break;
case E_LCD_240_80 : machine_type = MACH_S3; break;
case E_LCD_240_100 : machine_type = MACH_WORKABOUT; break;
case E_LCD_240_160 : machine_type = MACH_SIENA; break;
default :
/* Assume we're running on a PC emulator: need to check ROM
version to determine whether we're running on the Siena
or 3a emulator. */
switch (p_romversion()) {
case 0x325F : machine_type = MACH_EM_S3a; break;
case 0x520F : machine_type = MACH_EM_S3c; break;
case 0x421A : machine_type = MACH_EM_SIENA; break;
case 0x200F : machine_type = MACH_EM_WORKABOUT; break;
default : machine_type = MACH_UNKNOWN; break;
}
break;
}
}
/* Set the other machine_ variables above */
machine_canreturntickcount = FALSE;
machine_maxbaud = P_BAUD_19200;
machine_hasIrDA = FALSE;
switch (machine_type) {
case MACH_SIENA:
machine_fullscreenwidth = 240;
machine_fullscreenheight = 160;
machine_maxbaud = P_BAUD_19200;
machine_hasIrDA = TRUE;
machine_name = "Siena";
machine_fullscreencols = 40;
machine_fullscreenrows = 17;
machine_canreturntickcount = TRUE;
break;
case MACH_EM_SIENA:
machine_fullscreenwidth = 240;
machine_fullscreenheight = 160;
machine_maxbaud = P_BAUD_19200;
machine_hasIrDA = TRUE;
machine_name = "Siena Emulator";
machine_fullscreencols = 40;
machine_fullscreenrows = 17;
break;
case MACH_S3a:
machine_fullscreenwidth = 480;
machine_fullscreenheight = 160;
machine_name = "Series 3a";
machine_fullscreencols = 80;
machine_fullscreenrows = 17;
break;
case MACH_EM_S3a:
machine_fullscreenwidth = 480;
machine_fullscreenheight = 160;
machine_name = "3a Emulator";
machine_fullscreencols = 80;
machine_fullscreenrows = 17;
break;
case MACH_S3c:
machine_fullscreenwidth = 480;
machine_fullscreenheight = 160;
machine_maxbaud = P_BAUD_56000;
machine_hasIrDA = TRUE;
machine_name = "Series 3c";
machine_fullscreencols = 80;
machine_fullscreenrows = 17;
machine_canreturntickcount = TRUE;
break;
case MACH_S3:
machine_fullscreenwidth = 240;
machine_fullscreenheight = 80;
machine_maxbaud = P_BAUD_19200; /* FIXME: Check */
machine_name = "Series 3";
machine_fullscreencols = 80;
machine_fullscreenrows = 18;
break;
case MACH_MC400:
machine_fullscreenwidth = 640;
machine_fullscreenheight = 400;
machine_maxbaud = P_BAUD_19200; /* FIXME: Check */
machine_name = "MC400";
break;
case MACH_MC200:
machine_fullscreenwidth = 640;
machine_fullscreenheight = 200;
machine_maxbaud = P_BAUD_19200; /* FIXME: Check */
machine_name = "MC200";
break;
case MACH_HC:
machine_fullscreenwidth = 160;
machine_fullscreenheight = 80;
machine_maxbaud = P_BAUD_19200; /* FIXME: CHECK */
machine_name = "HC";
break;
case MACH_WORKABOUT:
machine_fullscreenwidth = 240;
machine_fullscreenheight = 100;
machine_maxbaud = P_BAUD_19200; /* FIXME: Check */
machine_name = "Workabout";
machine_fullscreencols = 40;
machine_fullscreenrows = 10;
break;
case MACH_EM_WORKABOUT:
machine_fullscreenwidth = 240;
machine_fullscreenheight = 100;
machine_maxbaud = P_BAUD_19200; /* FIXME: Check */
machine_name = "Workabout Emulator";
machine_fullscreencols = 40;
machine_fullscreenrows = 10;
break;
case MACH_EM_S3c:
machine_fullscreenwidth = 480;
machine_fullscreenheight = 160;
machine_maxbaud = P_BAUD_56000;
machine_hasIrDA = TRUE;
machine_name = "3c Emulator";
machine_fullscreencols = 80;
machine_fullscreenrows = 17;
machine_canreturntickcount = TRUE;
break;
}
}