-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmachine.c
67 lines (55 loc) · 1.28 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
/*
spiffy - ZX spectrum emulator
Copyright Edward Cree, 2010-13
machine.c - machine variants
*/
#include "machine.h"
#include <stdint.h>
#include <string.h>
const char *name[_MACHINES]={ [MACHINE_48]="48",
[MACHINE_128]="128",
};
machine machine_from_name(const char *n)
{
for(machine m=0;m<_MACHINES;m++)
if(!strcmp(n, name[m])) return(m);
return(_MACHINES);
}
const char *name_from_machine(machine m)
{
if(m<_MACHINES) return(name[m]);
return(NULL);
}
#define CAP_128_PAGING 0x0001
#define CAP_AY 0x0002
#define CAP_128_ULA_TIMINGS 0x0004
uint32_t capabilities[_MACHINES]={ [MACHINE_48]=0,
[MACHINE_128]=CAP_128_PAGING|CAP_AY|CAP_128_ULA_TIMINGS,
};
int frame_len[_MACHINES]={[MACHINE_48]=69888, [MACHINE_128]=70908};
int rom_len[_MACHINES]={[MACHINE_48]=1, [MACHINE_128]=2,};
const char *def_rom[_MACHINES]={[MACHINE_48]="48.rom", [MACHINE_128]="128.rom",};
bool cap_128_paging(machine m)
{
return(capabilities[m]&CAP_128_PAGING);
}
bool cap_128_ula_timings(machine m)
{
return(capabilities[m]&CAP_128_ULA_TIMINGS);
}
bool cap_ay(machine m)
{
return(capabilities[m]&CAP_AY);
}
int frame_length(machine m)
{
return(frame_len[m]);
}
int rom_length(machine m)
{
return(rom_len[m]);
}
const char *default_rom(machine m)
{
return(def_rom[m]);
}