-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
139 lines (118 loc) · 2.54 KB
/
main.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
/*
* UAE - The Un*x Amiga Emulator
*
* Main program
*
* (c) 1995 Bernd Schmidt, Ed Hanway
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "amiga.h"
#include "options.h"
#include "memory.h"
#include "custom.h"
#include "newcpu.h"
#include "disk.h"
#include "debug.h"
#include "xwin.h"
#include "os.h"
#include "filesys.h"
#include "keybuf.h"
int framerate = DEFAULT_FRAMERATE;
bool dont_want_aspect = DEFAULT_NO_ASPECT;
bool use_fast_draw = true;
bool use_debugger = false;
bool use_slow_mem = false;
bool automount_uaedev = true;
bool produce_sound = true;
KbdLang keyboard_lang = DEFAULT_KBD_LANG;
#if 1 //__unix
static bool mount_seen = false;
void parse_cmdline(int argc, char **argv)
{
int c;
extern char *optarg;
while(((c = getopt(argc, argv, "l:Df:dxasSm:M:")) != EOF)) switch(c) {
case 'm':
case 'M':
{
/* mount file system (repeatable)
* syntax: [-m | -M] VOLNAME:/mount_point
* example: -M CDROM:/cdrom -m UNIXFS:./disk
*/
static char buf[256];
char *s2;
bool readonly = (c == 'M');
if (mount_seen)
fprintf (stderr, "Multiple mounts not supported right now, sorry.\n");
else {
mount_seen = true;
strcpy(buf, optarg);
s2 = strchr(buf, ':');
if(s2) {
*s2++ = '\0';
printf("add_filesys_unit needs to be ported.. sorry\n");
//add_filesys_unit(buf, s2, readonly);
} else {
fprintf(stderr, "Usage: [-m | -M] VOLNAME:/mount_point\n");
}
}
}
break;
case 'S':
produce_sound = false;
break;
case 'f':
framerate = atoi(optarg);
break;
case 'd':
dont_want_aspect = false;
break;
case 'x':
use_fast_draw = false;
break;
case 'D':
use_debugger = true;
break;
case 'l':
if (0 == strcasecmp(optarg, "de"))
keyboard_lang = KBD_LANG_DE;
else if (0 == strcasecmp(optarg, "us"))
keyboard_lang = KBD_LANG_US;
break;
case 'a':
automount_uaedev = false;
break;
case 's':
use_slow_mem = true;
break;
}
}
#endif
int main(int argc, char **argv)
{
parse_cmdline(argc, argv);
if (produce_sound && !init_sound()) {
fprintf(stderr, "Sound driver unavailable: Sound output disabled\n");
produce_sound = false;
}
init_joystick();
keybuf_init ();
graphics_init();
memory_init();
custom_init();
DISK_init();
MC68000_init();
MC68000_reset();
debug();
graphics_leave();
close_joystick();
#if 0
extern void dump_counts();
dump_counts();
#endif
return 0;
}