|
|
1.1 root 1: /*
2: * UAE - The Un*x Amiga Emulator
3: *
1.1.1.2 root 4: * Stuff
1.1 root 5: *
1.1.1.3 root 6: * Copyright 1995, 1996 Ed Hanway
1.1.1.5 root 7: * Copyright 1995-98 Bernd Schmidt
1.1 root 8: */
9:
10: #define UAEMAJOR 0
1.1.1.5 root 11: #define UAEMINOR 8
1.1.1.16! root 12: #define UAESUBREV 16
1.1 root 13:
1.1.1.2 root 14: typedef enum { KBD_LANG_US, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang;
1.1 root 15:
1.1.1.5 root 16: extern long int version;
17:
18: struct uaedev_mount_info;
1.1.1.3 root 19:
1.1.1.7 root 20: struct strlist {
21: struct strlist *next;
22: char *str;
23: };
24:
1.1.1.3 root 25: struct uae_prefs {
1.1.1.7 root 26: struct strlist *unknown_lines;
27:
28: char description[256];
29:
1.1.1.3 root 30: int illegal_mem;
31: int no_xhair;
32: int use_serial;
33: int serial_demand;
34: int parallel_demand;
35: int automount_uaedev;
1.1.1.7 root 36: int use_gfxlib;
1.1.1.9 root 37: int socket_emu;
1.1.1.7 root 38:
39: int start_debugger;
40: int start_gui;
1.1.1.3 root 41:
1.1.1.7 root 42: int jport0;
43: int jport1;
1.1.1.3 root 44: KbdLang keyboard_lang;
45: int allow_save;
46: int emul_accuracy;
47: int test_drawing_speed;
48:
49: int produce_sound;
50: int stereo;
1.1.1.16! root 51: int mixed_stereo;
1.1.1.3 root 52: int sound_bits;
53: int sound_freq;
54: int sound_minbsiz;
55: int sound_maxbsiz;
1.1.1.7 root 56: int sound_pri_time;
57: int sound_pri_cutoff;
1.1.1.10 root 58: int sound_interpol;
1.1.1.3 root 59:
1.1.1.9 root 60: int gfx_framerate;
1.1.1.3 root 61: int gfx_width;
62: int gfx_height;
63: int gfx_lores;
64: int gfx_linedbl;
65: int gfx_correct_aspect;
1.1.1.5 root 66: int gfx_afullscreen;
67: int gfx_pfullscreen;
1.1.1.3 root 68: int gfx_xcenter;
69: int gfx_ycenter;
70: int color_mode;
71:
72: int blits_32bit_enabled;
73: int immediate_blits;
1.1.1.9 root 74: unsigned int chipset_mask;
75: int ntscmode;
1.1.1.15 root 76: int collision_level;
1.1.1.3 root 77:
78: char df[4][256];
1.1.1.7 root 79: char romfile[256];
80: char keyfile[256];
81: char prtname[256];
82:
83: char path_floppy[256];
84: char path_hardfile[256];
85: char path_rom[256];
1.1.1.3 root 86:
87: int m68k_speed;
88: int cpu_level;
89: int cpu_compatible;
90: int address_space_24;
1.1.1.9 root 91:
1.1.1.5 root 92: uae_u32 z3fastmem_size;
93: uae_u32 fastmem_size;
94: uae_u32 chipmem_size;
95: uae_u32 bogomem_size;
96: uae_u32 a3000mem_size;
97: uae_u32 gfxmem_size;
1.1.1.7 root 98:
1.1.1.5 root 99: struct uaedev_mount_info *mountinfo;
1.1.1.7 root 100:
1.1.1.14 root 101: int nr_floppies;
102:
1.1.1.7 root 103: /* Target specific options */
104: int x11_use_low_bandwidth;
105: int x11_use_mitshm;
106: int x11_use_dgamode;
107: int x11_hide_cursor;
108: int svga_no_linear;
1.1.1.9 root 109: int win32_middle_mouse;
110: int win32_sound_style;
111: int win32_sound_tweak;
112: int win32_logfile;
113: int win32_iconified_nospeed;
114: int win32_iconified_nosound;
1.1.1.11 root 115: int curses_reverse_video;
1.1.1.3 root 116: };
117:
1.1.1.7 root 118: /* Contains the filename of .uaerc */
119: extern char optionsfile[];
120: extern void save_options (FILE *, struct uae_prefs *);
121:
122: extern void default_prefs (struct uae_prefs *);
123: extern void discard_prefs (struct uae_prefs *);
124:
1.1.1.10 root 125: extern int parse_cmdline_option (char, char *);
126:
1.1.1.7 root 127: extern int cfgfile_yesno (char *option, char *value, char *name, int *location);
128: extern int cfgfile_intval (char *option, char *value, char *name, int *location, int scale);
129: extern int cfgfile_strval (char *option, char *value, char *name, int *location, const char *table[], int more);
130: extern int cfgfile_string (char *option, char *value, char *name, char *location, int maxsz);
131: extern char *cfgfile_subst_path (const char *path, const char *subst, const char *file);
132:
133: extern int target_parse_option (struct uae_prefs *, char *option, char *value);
134: extern void target_save_options (FILE *, struct uae_prefs *);
135:
136: extern int cfgfile_load (struct uae_prefs *, const char *filename);
137: extern int cfgfile_save (struct uae_prefs *, const char *filename);
1.1.1.8 root 138: extern void cfgfile_parse_line (struct uae_prefs *p, char *);
139: extern int cfgfile_parse_option (struct uae_prefs *p, char *option, char *value);
1.1.1.7 root 140: extern int cfgfile_get_description (const char *filename, char *description);
141: extern void cfgfile_show_usage (void);
142:
1.1.1.5 root 143: extern void fixup_prefs_dimensions (struct uae_prefs *prefs);
144:
145: extern void check_prefs_changed_custom (void);
146: extern void check_prefs_changed_cpu (void);
147: extern void check_prefs_changed_audio (void);
148: extern int check_prefs_changed_gfx (void);
149:
1.1.1.7 root 150: #define JSEM_DECODEVAL(n,v) ((n) == 0 ? (v)->jport0 : (v)->jport1)
151: /* Determine how port n is configured */
1.1.1.3 root 152: #define JSEM_ISJOY0(n,v) (JSEM_DECODEVAL(n,v) == 0)
153: #define JSEM_ISJOY1(n,v) (JSEM_DECODEVAL(n,v) == 1)
154: #define JSEM_ISMOUSE(n,v) (JSEM_DECODEVAL(n,v) == 2)
155: #define JSEM_ISNUMPAD(n,v) (JSEM_DECODEVAL(n,v) == 3)
156: #define JSEM_ISCURSOR(n,v) (JSEM_DECODEVAL(n,v) == 4)
157: #define JSEM_ISSOMEWHEREELSE(n,v) (JSEM_DECODEVAL(n,v) == 5)
158: extern const char *gameport_state (int n);
159:
160: extern struct uae_prefs currprefs, changed_prefs;
161:
1.1.1.5 root 162: #if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 6
163: extern void write_log (const char *, ...) __attribute__ ((format (printf, 1, 2)));
164: #else
165: extern void write_log (const char *, ...);
166: #endif
167:
1.1.1.3 root 168: extern void machdep_init (void);
1.1 root 169:
170: /* AIX doesn't think it is Unix. Neither do I. */
171: #if defined(_ALL_SOURCE) || defined(_AIX)
172: #undef __unix
173: #define __unix
174: #endif
175:
1.1.1.3 root 176: extern char romfile[], keyfile[], prtname[], sername[];
177:
178: extern int cloanto_rom;
1.1 root 179:
1.1.1.2 root 180: #define MAX_COLOR_MODES 5
1.1 root 181:
1.1.1.2 root 182: extern int fast_memcmp(const void *foo, const void *bar, int len);
183: extern int memcmpy(void *foo, const void *bar, int len);
1.1 root 184:
185: /*
186: * You can specify numbers from 0 to 5 here. It is possible that higher
187: * numbers will make the CPU emulation slightly faster, but if the setting
188: * is too high, you will run out of memory while compiling.
189: * Best to leave this as it is.
190: */
191: #define CPU_EMU_SIZE 0
192:
193: /* #define NEED_TO_DEBUG_BADLY */
194:
1.1.1.2 root 195: #if !defined(USER_PROGRAMS_BEHAVE)
196: #define USER_PROGRAMS_BEHAVE 0
197: #endif
198:
1.1.1.3 root 199: /* Some memsets which know that they can safely overwrite some more memory
200: * at both ends and use that knowledge to align the pointers. */
201:
1.1.1.2 root 202: #define QUADRUPLIFY(c) (((c) | ((c) << 8)) | (((c) | ((c) << 8)) << 16))
203:
204: /* When you call this routine, bear in mind that it rounds the bounds and
205: * may need some padding for the array. */
206:
207: #define fuzzy_memset(p, c, o, l) fuzzy_memset_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 4) >> 2)
1.1.1.10 root 208: STATIC_INLINE void fuzzy_memset_1 (void *p, uae_u32 c, int offset, int len)
1.1.1.2 root 209: {
1.1.1.3 root 210: uae_u32 *p2 = (uae_u32 *)((char *)p + offset);
1.1.1.2 root 211: int a = len & 7;
212: len >>= 3;
213: switch (a) {
214: case 7: p2--; goto l1;
215: case 6: p2-=2; goto l2;
216: case 5: p2-=3; goto l3;
217: case 4: p2-=4; goto l4;
218: case 3: p2-=5; goto l5;
219: case 2: p2-=6; goto l6;
220: case 1: p2-=7; goto l7;
1.1.1.3 root 221: case 0: if (!--len) return; break;
1.1.1.2 root 222: }
223:
224: for (;;) {
225: p2[0] = c;
226: l1:
227: p2[1] = c;
228: l2:
229: p2[2] = c;
230: l3:
231: p2[3] = c;
232: l4:
233: p2[4] = c;
234: l5:
235: p2[5] = c;
236: l6:
237: p2[6] = c;
238: l7:
239: p2[7] = c;
1.1.1.3 root 240:
1.1.1.2 root 241: if (!len)
242: break;
243: len--;
244: p2 += 8;
245: }
246: }
247:
1.1.1.9 root 248: /* This one knows it will never be asked to clear more than 32 bytes. Make sure you call this with a
249: constant for the length. */
1.1.1.3 root 250: #define fuzzy_memset_le32(p, c, o, l) fuzzy_memset_le32_1 ((p), QUADRUPLIFY (c), (o) & ~3, ((l) + 7) >> 2)
1.1.1.10 root 251: STATIC_INLINE void fuzzy_memset_le32_1 (void *p, uae_u32 c, int offset, int len)
1.1.1.2 root 252: {
1.1.1.3 root 253: uae_u32 *p2 = (uae_u32 *)((char *)p + offset);
1.1.1.2 root 254:
255: switch (len) {
256: case 9: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; p2[8] = c; break;
257: case 8: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; p2[7] = c; break;
258: case 7: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; p2[6] = c; break;
259: case 6: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; p2[5] = c; break;
260: case 5: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; p2[4] = c; break;
261: case 4: p2[0] = c; p2[1] = c; p2[2] = c; p2[3] = c; break;
262: case 3: p2[0] = c; p2[1] = c; p2[2] = c; break;
263: case 2: p2[0] = c; p2[1] = c; break;
264: case 1: p2[0] = c; break;
265: case 0: break;
266: default: printf("Hit the programmer.\n"); break;
267: }
268: }
269:
1.1.1.3 root 270: #if defined(AMIGA) && defined(__GNUC__)
271: #include "od-amiga/amiga-kludges.h"
272: #endif
1.1.1.16! root 273:
! 274: /* Every Amiga hardware clock cycle takes this many "virtual" cycles. This
! 275: used to be hardcoded as 1, but using higher values allows us to time some
! 276: stuff more precisely.
! 277: 512 is the official value from now on - it can't change, unless we want
! 278: _another_ config option "finegrain2_m68k_speed".
! 279:
! 280: We define this value here rather than in events.h so that gencpu.c sees
! 281: it. */
! 282: #define CYCLE_UNIT 512
! 283:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.