Xemu [doxygen]  hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
main.c
Go to the documentation of this file.
1 /* Xep128: Minimalistic Enterprise-128 emulator with focus on "exotic" hardware
2  Copyright (C)2015-2017,2020 LGB (Gábor Lénárt) <lgblgblgb@gmail.com>
3  http://xep128.lgb.hu/
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
18 
19 
20 #include "xep128.h"
21 #include "main.h"
22 #include "dave.h"
23 #include "nick.h"
24 #include "configuration.h"
25 #include "sdext.h"
26 #include "exdos_wd.h"
27 #include "roms.h"
28 #include "screen.h"
29 #include "input.h"
30 #include "cpu.h"
31 #include "primoemu.h"
32 #include "emu_rom_interface.h"
33 #include "epnet.h"
34 #include "zxemu.h"
35 #include "printer.h"
36 #include "joystick.h"
37 #include "console.h"
38 #include "emu_monitor.h"
39 #include "rtc.h"
40 #include "fileio.h"
41 #include "xemu/z80.h"
42 #include "gui.h"
43 #include "snapshot.h"
44 
45 #include <string.h>
46 #include <stdlib.h>
47 #include <SDL.h>
48 #include <sys/time.h>
49 #include <time.h>
50 #include <unistd.h>
51 
52 
53 static Uint32 *ep_pixels;
54 static const int _cpu_speeds[4] = { 4000000, 6000000, 7120000, 10000000 };
55 static int _cpu_speed_index = 0;
56 static int guarded_exit = 0;
57 static unsigned int ticks;
58 int paused = 0;
59 static int cpu_cycles_for_dave_sync = 0;
60 static int td_balancer;
61 static Uint64 et_start, et_end;
62 static int td_em_ALL = 0, td_pc_ALL = 0, td_count_ALL = 0;
63 static double balancer;
64 static double SCALER;
65 static int sram_ready = 0;
66 time_t unix_time;
67 
68 int chatty_xemu = 1; // needed by the ugly mix of old Xep128 solutions and newer Xemu headers :-O
69 
70 
71 /* Ugly indeed, but it seems some architecture/OS does not support "standard"
72  aligned allocations or give strange error codes ... Note: this one only
73  works, if you don't want to free() the result pointer!! */
74 void *alloc_xep_aligned_mem ( size_t size )
75 {
76  // it seems _mm_malloc() is quite standard at least on gcc, mingw, clang ... so let's try to use it
77 #if defined(__EMSCRIPTEN__) || defined(__arm__)
78  return SDL_malloc(size);
79 #else
80  void *p = _mm_malloc(size, __BIGGEST_ALIGNMENT__);
81  DEBUG("ALIGNED-ALLOC: base_pointer=%p size=%d alignment=%d" NL, p, (int)size, __BIGGEST_ALIGNMENT__);
82  return p;
83 #endif
84 }
85 
86 
87 
88 void shutdown_sdl(void)
89 {
90  if (guarded_exit) {
91  audio_close();
92  printer_close();
93 #ifdef CONFIG_EPNET_SUPPORT
94  epnet_uninit();
95 #endif
96 #ifdef CONFIG_EXDOS_SUPPORT
98 #endif
99  if (sram_ready)
101  DEBUGPRINT("Shutdown callback, return." NL);
102  }
103  if (sdl_win) {
104 #ifdef __EMSCRIPTEN__
105  // This is used, because window title would remain as Emu would run after exit, which is not the case ...
106  SDL_SetWindowTitle(sdl_win, WINDOW_TITLE " v" VERSION " - EXITED");
107 #endif
108  SDL_DestroyWindow(sdl_win);
109  }
111  /* last stuff! */
112  if (debug_fp) {
113  DEBUGPRINT("Closing debug messages log file on exit." NL);
114  fclose(debug_fp);
115  debug_fp = NULL;
116  }
117  SDL_Quit();
118 }
119 
120 
121 
122 static int get_elapsed_time ( Uint64 t_old, Uint64 *t_new, time_t *store_unix_time )
123 {
124 #ifdef XEMU_OLD_TIMING
125 #define __TIMING_METHOD_DESC "gettimeofday"
126  struct timeval tv;
127  gettimeofday(&tv, NULL);
128  if (store_unix_time)
129  *store_unix_time = tv.tv_sec;
130  *t_new = tv.tv_sec * 1000000UL + tv.tv_usec;
131  return *t_new - t_old;
132 #else
133 #define __TIMING_METHOD_DESC "SDL_GetPerformanceCounter"
134  if (store_unix_time)
135  *store_unix_time = time(NULL);
136  *t_new = SDL_GetPerformanceCounter();
137  return 1000000 * (*t_new - t_old) / SDL_GetPerformanceFrequency();
138 #endif
139 }
140 
141 
142 
143 static inline void emu_sleep ( int td )
144 {
145  if (td <= 0)
146  return;
147 #ifdef __EMSCRIPTEN__
148 #define __SLEEP_METHOD_DESC "emscripten_set_main_loop_timing"
149  // If too short period of sleep (not enough for 1ms), give some time for browser to run
150  // to avoid the "stop the script" warning or so ...
151  // For Js, it's not really a sleep what name would mean for function (emu_sleep) but
152  // rather then a setTimeout value for the handler
153  emscripten_set_main_loop_timing(EM_TIMING_SETTIMEOUT, td > 999 ? td / 1000 : 1);
154 #elif defined(XEMU_SLEEP_IS_SDL_DELAY)
155 #define __SLEEP_METHOD_DESC "SDL_Delay"
156  SDL_Delay(td / 1000);
157 #elif defined(XEMU_SLEEP_IS_USLEEP)
158 #define __SLEEP_METHOD_DESC "usleep"
159  usleep(td);
160 #else
161 #define __SLEEP_METHOD_DESC "nanosleep"
162  struct timespec req, rem;
163  td *= 1000;
164  req.tv_sec = td / 1000000000UL;
165  req.tv_nsec = td % 1000000000UL;
166  for (;;) {
167  if (nanosleep(&req, &rem)) {
168  if (errno == EINTR) {
169  req.tv_sec = rem.tv_sec;
170  req.tv_nsec = rem.tv_nsec;
171  } else {
172  ERROR_WINDOW("Nanosleep() returned with unhandlable error");
173  return;
174  }
175  } else
176  return;
177  }
178 #endif
179 }
180 
181 
182 
183 static void emu_timekeeping_check ( void )
184 {
185  // check how much time we slept, initiated by last call of emu_timekeeping_delay()
186  // we also store current UT in "unix_time" to be used by emulator (ie, RTC emulation)
187  int td = get_elapsed_time(et_end, &et_start, &unix_time);
188  if (td >= 0) // td should be greater than zero or sleep was about for _minus_ time? eh, give me that time machine, dude! :)
189  td_balancer -= td; // time-difference balancer, decrease with time slept
190  else
191  DEBUG("TIMING: negative amount of time spent for sleeping?!" NL);
192  rtc_update_trigger = 1;
193 }
194 
195 
196 
197 
198 /* This is the emulation timing stuff
199  * Should be called at the END of the emulation loop.
200  * Input parameter: microseconds needed for the "real" (emulated) computer to do our loop
201  * This function also does the sleep itself */
202 static void emu_timekeeping_delay ( int td_em )
203 {
204  int td, td_pc = get_elapsed_time(et_start, &et_end, NULL); // the time was needed for our emulation loop
205  if (td_pc < 0) {
206  DEBUG("TIMING: negative amount of time spent for an emulation loop?!" NL);
207  td = 0;
208  } else
209  td = td_em - td_pc; // the time difference (+X = PC is faster - real time EP emulation, -X = EP is faster - real time EP emulation is not possible)
210  DEBUG("DELAY: pc=%d em=%d sleep=%d" NL, td_pc, td_em, td);
211  /* for reporting only: BEGIN */
212  td_em_ALL += td_em;
213  td_pc_ALL += td_pc;
214  if (td_count_ALL == 50) {
215  char buf[256];
216  //DEBUG("STAT: count = %d, EM = %d, PC = %d, usage = %f%" NL, td_count_ALL, td_em_ALL, td_pc_ALL, 100.0 * (double)td_pc_ALL / (double)td_em_ALL);
217  snprintf(buf, sizeof buf, "%s [%.2fMHz ~ %d%%]%s", WINDOW_TITLE " v" VERSION " ",
218  CPU_CLOCK / 1000000.0,
219  td_em_ALL ? (td_pc_ALL * 100 / td_em_ALL) : -1,
220  paused ? " PAUSED" : ""
221  );
222  SDL_SetWindowTitle(sdl_win, buf);
223  td_count_ALL = 0;
224  td_pc_ALL = 0;
225  td_em_ALL = 0;
226  } else
227  td_count_ALL++;
228  /* for reporting only: END */
229  td_balancer += td;
230  /* insane time-diff balancer values ... */
231  if (td_balancer > 1000000 || td_balancer < -1000000)
232  td_balancer = 0;
233  DEBUG("Balancer = %d" NL, td_balancer);
234  // Should be the last, as with Emscripten, it's not a real sleep, but the settimeout JS stuff ...
235  emu_sleep(td_balancer);
236 }
237 
238 
239 
240 
241 /* Should be started on each time, emulation is started/resumed (ie after any delay in emulation like pause, etc)
242  * You DO NOT need this during the active emulation loop! */
244 {
245  (void)get_elapsed_time(0, &et_start, &unix_time);
246  et_end = et_start;
247  td_balancer = 0;
248  rtc_update_trigger = 1;
249 }
250 
251 
252 
253 int set_cpu_clock ( int hz )
254 {
255  if (hz < 1000000) hz = 1000000;
256  if (hz > 12000000) hz = 12000000;
257  CPU_CLOCK = hz;
258  SCALER = (double)NICK_SLOTS_PER_SEC / (double)CPU_CLOCK;
259  DEBUG("CPU: clock = %d scaler = %f" NL, CPU_CLOCK, SCALER);
260  dave_set_clock();
261  return hz;
262 }
263 
264 
265 
267 {
268  hz = set_cpu_clock(hz);
269  OSD("CPU speed: %.2f MHz", hz / 1000000.0);
270  return hz;
271 }
272 
273 
274 
275 // called by nick.c
276 static int emu_one_frame_rasters = -1;
277 static int emu_one_frame_frameskip = 0;
278 
279 void emu_one_frame(int rasters, int frameskip)
280 {
281  emu_one_frame_rasters = rasters;
282  emu_one_frame_frameskip = frameskip;
283 }
284 
285 
286 static void __emu_one_frame(int rasters, int frameskip)
287 {
288  SDL_Event e;
289  while (SDL_PollEvent(&e) != 0)
290  switch (e.type) {
291  case SDL_WINDOWEVENT:
292  if (!is_fullscreen && e.window.event == SDL_WINDOWEVENT_RESIZED) {
293  DEBUG("UI: Window is resized to %d x %d" NL,
294  e.window.data1,
295  e.window.data2
296  );
297  screen_window_resized(e.window.data1, e.window.data2);
298  }
299  break;
300  case SDL_QUIT:
301  if (QUESTION_WINDOW("?No|!Yes", "Are you sure to exit?") == 1)
302  XEMUEXIT(0);
303  return;
304  case SDL_KEYDOWN:
305  case SDL_KEYUP:
306  if (e.key.repeat == 0 && (e.key.windowID == sdl_winid || e.key.windowID == 0)) {
307  int code = emu_kbd(e.key.keysym, e.key.state == SDL_PRESSED);
308  if (code == 0xF9) // // OSD REPLAY, default key GRAVE
309  osd_replay(e.key.state == SDL_PRESSED ? 0 : OSD_FADE_START);
310  else if (code && e.key.state == SDL_PRESSED)
311  switch(code) {
312 #ifndef __EMSCRIPTEN__
313  case 0xFF: // FULLSCREEN toogle, default key F11
315  break;
316  case 0xFE: // EXIT, default key F9
317  if (QUESTION_WINDOW("?No|!Yes", "Are you sure to exit?") == 1)
318  XEMUEXIT(0);
319  break;
320  case 0xFD: // SCREENSHOT, default key F10
321  screen_shot(ep_pixels, current_directory, "screenshot-*.png");
322  break;
323 #endif
324  case 0xFC: // RESET, default key PAUSE
325  if (e.key.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) {
326  zxemu_on = 0;
327  (void)ep_init_ram();
328  }
329  ep_reset();
330  break;
331  case 0xFB: // DOWNGRADE CPU SPEED, default key PAGE DOWN
332  if (_cpu_speed_index)
333  set_cpu_clock_with_osd(_cpu_speeds[-- _cpu_speed_index]);
334  break;
335  case 0xFA: // UPGRADE CPU SPEED, default key PAGE UP
336  if (_cpu_speed_index < 3)
337  set_cpu_clock_with_osd(_cpu_speeds[++ _cpu_speed_index]);
338  break;
339  case 0xF8: // CONSOLE, key pad minus
340  if (!console_is_open)
342  break;
343  }
344  } else if (e.key.repeat == 0)
345  DEBUG("UI: NOT HANDLED KEY EVENT: repeat = %d windowid = %d [our win = %d]" NL, e.key.repeat, e.key.windowID, sdl_winid);
346  break;
347  case SDL_MOUSEMOTION:
348  if (e.motion.windowID == sdl_winid)
349  emu_mouse_motion(e.motion.xrel, e.motion.yrel);
350  break;
351  case SDL_MOUSEWHEEL:
352  if (e.wheel.windowID == sdl_winid)
354  e.wheel.x, e.wheel.y,
355  e.wheel.direction == SDL_MOUSEWHEEL_FLIPPED
356  );
357  break;
358  case SDL_MOUSEBUTTONDOWN:
359  case SDL_MOUSEBUTTONUP:
360  if (e.button.windowID == sdl_winid)
361  emu_mouse_button(e.button.button, e.button.state == SDL_PRESSED);
362  break;
363  default:
364  joy_sdl_event(&e);
365  break;
366  }
367  if (!frameskip)
368  screen_present_frame(ep_pixels); // this should be after the event handler, as eg screenshot function needs locked texture state if this feature is used at all
371  emu_timekeeping_delay((1000000.0 * rasters * 57.0) / (double)NICK_SLOTS_PER_SEC);
372 }
373 
374 
375 
376 
377 static void xep128_emulation ( void )
378 {
379  emu_timekeeping_check();
380  for (;;) {
381  int t;
382  if (XEMU_UNLIKELY(paused && !z80ex.prefix)) {
383  /* Paused is non-zero for special cases, like pausing emulator :) or single-step execution mode
384  We only do this if z80ex.prefix is non-zero, ie not in the "middle" of a prefixed Z80 opcode or so ... */
385  __emu_one_frame(312, 0); // keep UI stuffs (and some timing) intact ... with a faked about 312 scanline (normal frame) timing needed ...
386  return;
387  }
388  if (XEMU_UNLIKELY(nmi_pending)) {
389  t = z80ex_nmi();
390  DEBUG("NMI: %d" NL, t);
391  if (t)
392  nmi_pending = 0;
393  } else
394  t = 0;
395  //if (XEMU_UNLIKELY((dave_int_read & 0xAA) && t == 0)) {
396  if ((dave_int_read & 0xAA) && t == 0) {
397  t = z80ex_int();
398  if (t)
399  DEBUG("CPU: int and accepted = %d" NL, t);
400  } else
401  t = 0;
402  if (XEMU_LIKELY(!t))
403  t = z80ex_step();
404  cpu_cycles_for_dave_sync += t;
405  //DEBUG("DAVE: SYNC: CPU cycles = %d, Dave sync val = %d, limit = %d" NL, t, cpu_cycles_for_dave_sync, cpu_cycles_per_dave_tick);
406  while (cpu_cycles_for_dave_sync >= cpu_cycles_per_dave_tick) {
407  dave_tick();
408  cpu_cycles_for_dave_sync -= cpu_cycles_per_dave_tick;
409  }
410  balancer += t * SCALER;
411  //DEBUG("%s [balance=%f t=%d]" NL, buffer, balancer, t);
412  while (balancer >= 0.5) {
414  balancer -= 1.0;
415  if (XEMU_UNLIKELY(emu_one_frame_rasters != -1)) {
416  __emu_one_frame(
417  emu_one_frame_rasters,
418  emu_one_frame_frameskip
419  );
420  emu_one_frame_rasters = -1;
421  return;
422  }
423  }
424  //DEBUG("[balance=%f t=%d]" NL, balancer, t);
425  }
426 }
427 
428 
429 
430 
431 
432 int main (int argc, char *argv[])
433 {
434  const char *snapshot;
435  atexit(shutdown_sdl);
436  if (SDL_Init(
437 #ifdef __EMSCRIPTEN__
438  // It seems there is an issue with emscripten SDL2: SDL_Init does not work if TIMER and/or HAPTIC is tried to be intialized or just "EVERYTHING" is used!!
439  SDL_INIT_EVERYTHING & ~(SDL_INIT_TIMER | SDL_INIT_HAPTIC)
440 #else
441  SDL_INIT_EVERYTHING
442 #endif
443  ) != 0) {
444  ERROR_WINDOW("Fatal SDL initialization problem: %s", SDL_GetError());
445  return 1;
446  }
447  if (config_init(argc, argv)) {
448 #ifdef __EMSCRIPTEN__
449  ERROR_WINDOW("Error with config parsing. Please check the (javascript) console of your browser to learn about the error.");
450 #endif
451  return 1;
452  }
453  guarded_exit = 1; // turn on guarded exit, with custom de-init stuffs
454  DEBUGPRINT("EMU: sleeping = \"%s\", timing = \"%s\"" NL,
456  );
457  fileio_init(
458 #ifdef __EMSCRIPTEN__
459  "/",
460 #else
462 #endif
463  "files");
464  if (screen_init())
465  return 1;
466  //if (xepgui_init(NULL))
467  // return 1;
468  xepgui_init(NULL); // allow to fail (do not exit if it fails). Some targets may not have X running
469  audio_init(config_getopt_int("audio"));
470  z80ex_init();
472  ep_pixels = nick_init();
473  if (ep_pixels == NULL)
474  return 1;
475  snapshot = config_getopt_str("snapshot");
476  if (strcmp(snapshot, "none")) {
477  if (ep128snap_load(snapshot))
478  snapshot = NULL;
479  } else
480  snapshot = NULL;
481  if (!snapshot) {
482  if (roms_load())
483  return 1;
485  ep_set_ram_config(config_getopt_str("ram"));
486  }
487  mouse_setup(config_getopt_int("mousemode"));
488  ep_reset();
490  joy_sdl_event(NULL); // this simply inits joy layer ...
491 #ifdef CONFIG_SDEXT_SUPPORT
492  if (!snapshot)
493  sdext_init();
494 #endif
495 #ifdef CONFIG_EXDOS_SUPPORT
496  wd_exdos_reset();
497  wd_attach_disk_image(config_getopt_str("wdimg"));
498 #endif
499 #ifdef CONFIG_EPNET_SUPPORT
500  epnet_init(NULL);
501 #endif
502  ticks = SDL_GetTicks();
503  balancer = 0;
506  audio_start();
507  if (config_getopt_int("fullscreen"))
509  DEBUGPRINT(NL "EMU: entering into main emulation loop" NL);
510  sram_ready = 1;
511  if (strcmp(config_getopt_str("primo"), "none") && !snapshot) {
512  // TODO: da stuff ...
514  OSD("Primo Emulator Mode");
515  }
516  if (snapshot)
518  console_monitor_ready(); // OK to run monitor on console now!
519 #ifdef __EMSCRIPTEN__
520  emscripten_set_main_loop(xep128_emulation, 50, 1);
521 #else
522  for (;;)
523  xep128_emulation();
524 #endif
525  printf("EXITING FROM main()?!" NL);
526  return 0;
527 }
wd_attach_disk_image
int wd_attach_disk_image(const char *fn)
Definition: exdos_wd.c:126
z80ex_init
void z80ex_init(void)
Definition: z80ex.c:175
emu_timekeeping_start
void emu_timekeeping_start(void)
Definition: main.c:243
nick_init
int nick_init(void)
Definition: nick.c:115
ep_reset
void ep_reset(void)
Definition: cpu.c:621
console_is_open
int console_is_open
Definition: console.c:54
ep128snap_set_cpu_and_io
void ep128snap_set_cpu_and_io(void)
Definition: snapshot.c:203
sdl_win
SDL_Window * sdl_win
Definition: screen.c:43
screen_present_frame
void screen_present_frame(Uint32 *ep_pixels)
Definition: screen.c:227
wd_exdos_reset
void wd_exdos_reset(void)
Definition: exdos_wd.c:163
z80ex_step
int z80ex_step(void)
Definition: z80ex.c:47
xepgui_init
#define xepgui_init
Definition: gui.h:31
console.h
screen.h
epnet.h
zxemu.h
unix_time
time_t unix_time
Definition: main.c:66
roms.h
set_cpu_clock
int set_cpu_clock(int hz)
Definition: main.c:253
set_ep_cpu
void set_ep_cpu(int type)
Definition: cpu.c:74
zxemu_on
int zxemu_on
Definition: zxemu.c:27
screen_init
int screen_init(void)
Definition: screen.c:357
monitor_process_queued
void monitor_process_queued(void)
Definition: emu_monitor.c:766
DEFAULT_CPU_CLOCK
#define DEFAULT_CPU_CLOCK
Definition: enterprise128.h:34
ep_init_ram
int ep_init_ram(void)
Definition: cpu.c:194
NICK_SLOTS_PER_SEC
#define NICK_SLOTS_PER_SEC
Definition: nick.h:24
app_pref_path
char * app_pref_path
Definition: configuration.c:84
paused
int paused
Definition: main.c:58
printer_close
void printer_close(void)
Definition: printer.c:61
dave.h
config_init
int config_init(int argc, char **argv)
Definition: configuration.c:565
roms_load
int roms_load(void)
Definition: roms.c:140
z80ex_int
int z80ex_int(void)
Definition: z80ex.c:225
Uint32
uint32_t Uint32
Definition: fat32.c:49
__BIGGEST_ALIGNMENT__
#define __BIGGEST_ALIGNMENT__
Definition: emutools_basicdefs.h:179
__TIMING_METHOD_DESC
#define __TIMING_METHOD_DESC
sdext.h
debug_fp
FILE * debug_fp
Definition: configuration.c:87
joy_sdl_event
void joy_sdl_event(SDL_Event *e)
Definition: joystick.c:383
joystick.h
emu_rom_interface.h
kbd_matrix_reset
void kbd_matrix_reset(void)
Definition: dave.c:199
nick_render_slot
void nick_render_slot(void)
Definition: nick.c:550
cpu.h
rtc.h
screen_window_resized
void screen_window_resized(int new_xsize, int new_ysize)
Definition: screen.c:172
z80.h
DEBUGPRINT
#define DEBUGPRINT(...)
Definition: emutools_basicdefs.h:171
primo_rom_seg
int primo_rom_seg
Definition: primoemu.c:32
console_open_window
void console_open_window(void)
Definition: console.c:135
exdos_wd.h
dave_tick
void dave_tick(void)
Definition: dave.c:254
CPU_Z80
#define CPU_Z80
Definition: cpu.h:24
chatty_xemu
int chatty_xemu
Definition: main.c:68
printer.h
ERROR_WINDOW
#define ERROR_WINDOW(...)
Definition: xep128.h:116
shutdown_sdl
void shutdown_sdl(void)
Definition: main.c:88
fileio_init
void fileio_init(const char *dir, const char *subdir)
Definition: fileio.c:55
ep128snap_load
int ep128snap_load(const char *fn)
Definition: snapshot.c:68
XEMU_LIKELY
#define XEMU_LIKELY(__x__)
Definition: emutools_basicdefs.h:124
emu_kbd
int emu_kbd(SDL_Keysym sym, int press)
Definition: input.c:420
NL
#define NL
Definition: fat32.c:37
set_cpu_clock_with_osd
int set_cpu_clock_with_osd(int hz)
Definition: main.c:266
wd_detach_disk_image
void wd_detach_disk_image(void)
Definition: exdos_wd.c:114
audio_init
void audio_init(int enable)
Definition: dave.c:153
audio_start
void audio_start(void)
Definition: dave.c:123
_z80_cpu_context::prefix
Z80EX_BYTE prefix
Definition: z80ex.h:163
audio_close
void audio_close(void)
Definition: dave.c:143
main
int main(int argc, char *argv[])
Definition: main.c:432
XEMUEXIT
#define XEMUEXIT(n)
Definition: emutools_basicdefs.h:246
primo_emulator_execute
void primo_emulator_execute(void)
Definition: primoemu.c:211
screen_shot
int screen_shot(Uint32 *ep_pixels, const char *directory, const char *filename)
Definition: screen.c:263
primo_search_rom
int primo_search_rom(void)
Definition: primoemu.c:158
snapshot.h
xep128.h
size
int size
Definition: inject.c:37
emu_mouse_button
void emu_mouse_button(Uint8 sdl_button, int press)
Definition: input_devices.c:274
dave_set_clock
void dave_set_clock(void)
Definition: dave.c:182
main.h
CPU_CLOCK
#define CPU_CLOCK
Definition: tvc.h:30
__SLEEP_METHOD_DESC
#define __SLEEP_METHOD_DESC
rtc_update_trigger
int rtc_update_trigger
Definition: rtc.c:31
is_fullscreen
int is_fullscreen
Definition: screen.c:42
OSD
#define OSD(...)
Definition: xep128.h:100
xepgui_iteration
#define xepgui_iteration
Definition: gui.h:32
configuration.h
emu_one_frame
void emu_one_frame(int rasters, int frameskip)
Definition: main.c:279
OSD_FADE_START
#define OSD_FADE_START
Definition: screen.h:36
emu_mouse_motion
void emu_mouse_motion(int dx, int dy)
Definition: input_devices.c:343
screen_set_fullscreen
void screen_set_fullscreen(int state)
Definition: screen.c:204
fileio.h
gui.h
cpu_cycles_per_dave_tick
int cpu_cycles_per_dave_tick
Definition: dave.c:36
QUESTION_WINDOW
#define QUESTION_WINDOW(items, msg)
Definition: xep128.h:124
z80ex
Z80EX_CONTEXT z80ex
Definition: primo.c:37
DEBUG
#define DEBUG(...)
Definition: emutools_basicdefs.h:167
osd_replay
void osd_replay(int fade)
Definition: screen.c:146
console_monitor_ready
void console_monitor_ready(void)
Definition: console.c:219
primoemu.h
WINDOW_TITLE
#define WINDOW_TITLE
Definition: xep128.h:50
alloc_xep_aligned_mem
void * alloc_xep_aligned_mem(size_t size)
Definition: main.c:74
z80ex_nmi
int z80ex_nmi(void)
Definition: z80ex.c:192
current_directory
char current_directory[PATH_MAX+1]
Definition: configuration.c:85
ep_set_ram_config
int ep_set_ram_config(const char *spec)
Definition: cpu.c:131
VERSION
#define VERSION
Definition: xep128.h:51
emu_monitor.h
input.h
XEMU_UNLIKELY
#define XEMU_UNLIKELY(__x__)
Definition: emutools_basicdefs.h:125
sdl_winid
Uint32 sdl_winid
Definition: screen.c:49
dave_int_read
Uint8 dave_int_read
Definition: dave.c:29
emu_mouse_wheel
void emu_mouse_wheel(int x, int y, int flipped)
Definition: input_devices.c:360
console_close_window_on_exit
void console_close_window_on_exit(void)
Definition: console.c:206
frameskip
int frameskip
Definition: vic3.c:75
mouse_setup
int mouse_setup(int cfg)
Definition: input_devices.c:500
nick.h
buf
Uint8 buf[512]
Definition: fat32.c:155
sram_save_all_segments
int sram_save_all_segments(void)
Definition: roms.c:87
nmi_pending
int nmi_pending
Definition: cpu.c:47