DGen/SDL
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
md.h
Go to the documentation of this file.
1 // DGen
2 
3 #ifndef __MD_H__
4 #define __MD_H__
5 
6 #define VER VERSION
7 
8 #include <stdint.h>
9 
10 #ifdef WITH_STAR
11 #ifndef __STARCPU_H__
12 #include "star/starcpu.h"
13 #endif
14 #endif
15 
16 #ifdef WITH_MUSA
17 #ifndef M68K__HEADER
18 extern "C"
19 {
20 #include "musa/m68k.h"
21 }
22 #endif
23 #endif
24 
25 #ifdef WITH_CYCLONE
26 #include "cyclone/Cyclone.h"
27 #endif
28 
29 #ifdef WITH_MZ80
30 #ifndef _MZ80_H_
31 #include "mz80/mz80.h"
32 #endif
33 #endif
34 
35 #ifdef WITH_CZ80
36 #include "cz80/cz80.h"
37 #endif
38 
39 #ifdef WITH_DRZ80
40 #include "drz80/drz80.h"
41 #endif
42 
43 //#define BUILD_YM2612
44 extern "C" {
45 #include "fm.h"
46 }
47 
48 #include "sn76496.h"
49 #include "system.h"
50 
51 // Debugging macros and support functions. They look like this because C++98
52 // lacks support for variadic macros. Not my fault.
53 #ifndef NDEBUG
54 #include <stdarg.h>
55 #include <stdio.h>
56 
57 static inline const char *debug_basename_(const char *name)
58 {
59  const char *tmp;
60 
61  for (tmp = name; (*tmp != '\0'); ++tmp)
62  if (*tmp == '/')
63  name = (tmp + 1);
64  return name;
65 }
66 
67 static inline void debug_printf__()
68 {
69  fputc('\n', stderr);
70 }
71 
72 static inline void (*debug_printf_(const char *s, ...))()
73 {
74  va_list vl;
75 
76  va_start(vl, s);
77  vfprintf(stderr, s, vl);
78  va_end(vl);
79  return debug_printf__;
80 }
81 
82 static inline void (*(*debug_(const char *file, unsigned int line,
83  const char *func))(const char *, ...))()
84 {
85  fprintf(stderr, "%s:%u: %s: ", debug_basename_(file), line, func);
86  return debug_printf_;
87 }
88 
89 #define DEBUG(s) (((debug_(__FILE__, __LINE__, __func__))s)(), (void)0)
90 #else
91 #define DEBUG(s) (void)0
92 #endif
93 
94 extern "C" int test_ctv(unsigned char *dest, int len);
95 extern "C" int blur_bitmap_16(unsigned char *dest, int len);
96 extern "C" int blur_bitmap_15(unsigned char *dest, int len);
97 
98 struct bmap { unsigned char *data; int w,h; int pitch; int bpp; };
99 
100 // New struct, happily encapsulates all the sound info
101 struct sndinfo {
102  int16_t *lr;
103  unsigned int len; /* number of stereo samples */
104 };
105 
106 int get_md_palette(unsigned char pal[256],unsigned char *cram);
107 
108 class md;
109 class md_vdp
110 {
111 public:
112  // Next three lines are the state of the VDP
113  // They have to be public so we can save and load states
114  // and draw the screen.
115  uint8_t mem[(0x10100 + 0x35)]; //0x20+0x10+0x4+1 for dirt
116  uint8_t *vram, *cram, *vsram;
117  uint8_t reg[0x20];
121  bool cmd_pending; // set when first half of command arrives
123 private:
124  int poke_vram (int addr,unsigned char d);
125  int poke_cram (int addr,unsigned char d);
126  int poke_vsram(int addr,unsigned char d);
127  int dma_len();
128  int dma_addr();
129  unsigned char dma_mem_read(int addr);
130  int putword(unsigned short d);
131  int putbyte(unsigned char d);
132  // Used by draw_scanline to render the different display components
133  void draw_tile1(int which, int line, unsigned char *where);
134  void draw_tile1_solid(int which, int line, unsigned char *where);
135  void draw_tile2(int which, int line, unsigned char *where);
136  void draw_tile2_solid(int which, int line, unsigned char *where);
137  void draw_tile3(int which, int line, unsigned char *where);
138  void draw_tile3_solid(int which, int line, unsigned char *where);
139  void draw_tile4(int which, int line, unsigned char *where);
140  void draw_tile4_solid(int which, int line, unsigned char *where);
141  void draw_window(int line, int front);
142  void draw_sprites(int line, bool front);
143  void draw_plane_back0(int line);
144  void draw_plane_back1(int line);
145  void draw_plane_front0(int line);
146  void draw_plane_front1(int line);
147  struct sprite_info {
148  uint8_t* sprite; // sprite location
149  uint32_t* tile; // array of tiles (th * tw)
150  int x; // X position in pixels
151  int y; // Y position in pixels
152  int tw; // width in tiles
153  int th; // height in tiles
154  int w; // width in pixels
155  int h; // height in pixels
156  unsigned int prio:1; // high priority bit
157  unsigned int inter:1; // interlaced mode (8x16 tiles)
158  unsigned int xflip:1; // X-flipped
159  unsigned int yflip:1; // Y-flipped
160  };
161  inline void get_sprite_info(struct sprite_info&, int);
162  inline void sprite_mask_add(uint8_t*, int, struct sprite_info&, int);
163  // Working variables for the above
164  unsigned char sprite_order[0x101], *sprite_base;
165  uint8_t sprite_mask[512][512];
169  unsigned int Bpp;
170  unsigned int Bpp_times8;
171  struct bmap *bmap;
172  unsigned char *dest;
174 public:
175  md_vdp(md&);
176  ~md_vdp();
177 // These are called by MEM.CPP
178  int command(uint16_t cmd);
179  unsigned short readword();
180  unsigned char readbyte();
181  int writeword(unsigned short d);
182  int writebyte(unsigned char d);
183 
184  unsigned char *dirt; // Bitfield: what has changed VRAM/CRAM/VSRAM/Reg
185  void reset();
186 
187  uint32_t highpal[64];
188  // Draw a scanline
189  void sprite_masking_overflow(int line);
190  void sprite_mask_generate();
191  void draw_scanline(struct bmap *bits, int line);
192  void draw_pixel(struct bmap *bits, int x, int y, uint32_t rgb);
193  void write_reg(uint8_t addr, uint8_t data);
194 };
195 
196 /* Generic structures for dumping and restoring M68K and Z80 states. */
197 
198 typedef struct {
199  /* Stored MSB first (big endian) */
200  uint32_t d[8]; /* D0-D7 */
201  uint32_t a[8]; /* A0-A7 */
202  uint32_t pc;
203  uint16_t sr;
204 } m68k_state_t;
205 
206 typedef struct {
207  /* Stored LSB first (little endian) */
208  struct {
209  uint16_t fa;
210  uint16_t cb;
211  uint16_t ed;
212  uint16_t lh;
213  } alt[2]; /* [1] = alternate registers */
214  uint16_t ix;
215  uint16_t iy;
216  uint16_t sp;
217  uint16_t pc;
218  uint8_t r;
219  uint8_t i;
220  uint8_t iff; /* x x x x x x IFF2 IFF1 */
221  uint8_t im; /* interrupt mode */
222  uint8_t irq_asserted; /* IRQ asserted */
223  uint8_t irq_vector; /* IRQ vector */
224 } z80_state_t;
225 
226 #define MCLK_CYCLES_PER_LINE 3416 /* 3420 */
227 #define M68K_CYCLES_PER_LINE (MCLK_CYCLES_PER_LINE / 7)
228 #define M68K_CYCLES_HBLANK ((M68K_CYCLES_PER_LINE * 36) / 209)
229 #define M68K_CYCLES_VDELAY ((M68K_CYCLES_PER_LINE * 36) / 156)
230 #define Z80_CYCLES_PER_LINE (MCLK_CYCLES_PER_LINE / 15)
231 #define Z80_CYCLES_HBLANK ((Z80_CYCLES_PER_LINE * 36) / 209)
232 #define Z80_CYCLES_VDELAY ((Z80_CYCLES_PER_LINE * 36) / 156)
233 #define NTSC_LINES 262
234 #define NTSC_VBLANK 224
235 #define NTSC_HZ 60
236 #define NTSC_MCLK (MCLK_CYCLES_PER_LINE * NTSC_LINES * NTSC_HZ)
237 #define PAL_LINES 312
238 #define PAL_VBLANK 240
239 #define PAL_HZ 50
240 #define PAL_MCLK (MCLK_CYCLES_PER_LINE * PAL_LINES * PAL_HZ)
241 
242 #define MD_UP_MASK (1) // 0x00001
243 #define MD_DOWN_MASK (1 << 1) // 0x00002
244 #define MD_LEFT_MASK (1 << 2) // 0x00004
245 #define MD_RIGHT_MASK (1 << 3) // 0x00008
246 #define MD_B_MASK (1 << 4) // 0x00010
247 #define MD_C_MASK (1 << 5) // 0x00020
248 #define MD_A_MASK (1 << 12) // 0x01000
249 #define MD_START_MASK (1 << 13) // 0x02000
250 #define MD_Z_MASK (1 << 16) // 0x10000
251 #define MD_Y_MASK (1 << 17) // 0x20000
252 #define MD_X_MASK (1 << 18) // 0x40000
253 #define MD_MODE_MASK (1 << 19) // 0x80000
254 #define MD_PAD_UNTOUCHED 0xf303f
255 
256 class md {
257 public:
258  // ROM placeholder.
259  static const uint8_t no_rom[];
260  static const size_t no_rom_size;
261 
262  // Get default NTSC/PAL, Hz, VBLANK, lines number and memory byte
263  // for region, which is identified by a single character (J, X, U, E).
264  static void region_info(uint8_t region, int* pal, int* hz,
265  int* vblank, int* lines, uint8_t* mem)
266  {
267  // Make region code uppercase and replace space with 0.
268  region &= ~0x20;
269  switch (region) {
270  case 'X':
271  // Japan (PAL). This region code isn't found in ROMs
272  // but I wanted to label it somehow.
273  if (mem)
274  *mem = (0x00 | 0x40); // local + PAL
275  mem = 0;
276  case 'E':
277  // Europe (PAL).
278  if (pal)
279  *pal = 1;
280  if (hz)
281  *hz = PAL_HZ;
282  if (vblank)
283  *vblank = PAL_VBLANK;
284  if (lines)
285  *lines = PAL_LINES;
286  if (mem)
287  *mem = (0x80 | 0x40); // overseas + PAL
288  break;
289  case 'J':
290  default:
291  // Japan (NTSC).
292  if (mem)
293  *mem = 0x00; // local
294  mem = 0;
295  case 'U':
296  // America (NTSC).
297  if (pal)
298  *pal = 0;
299  if (hz)
300  *hz = NTSC_HZ;
301  if (vblank)
302  *vblank = NTSC_VBLANK;
303  if (lines)
304  *lines = NTSC_LINES;
305  if (mem)
306  *mem = 0x80; // overseas
307  break;
308  }
309  }
310 
311 #ifdef WITH_MUSA
312  static class md* md_musa;
313  unsigned int md_musa_ref;
314  class md* md_musa_prev;
315 
316  void md_set_musa(bool set);
317 #endif
318 #ifdef WITH_CYCLONE
319  static class md* md_cyclone;
320  unsigned int md_cyclone_ref;
321  class md* md_cyclone_prev;
322 
323  void md_set_cyclone(bool set);
324  uintptr_t checkpc(uintptr_t pc);
325 #endif
326 #ifdef WITH_STAR
327  static class md* md_star;
328  unsigned int md_star_ref;
329  class md* md_star_prev;
330 
331  void md_set_star(bool set);
332 #endif
333 #ifdef WITH_MZ80
334  static class md* md_mz80;
335  unsigned int md_mz80_ref;
336  class md* md_mz80_prev;
337 
338  void md_set_mz80(bool set);
339 #endif
340 #ifdef WITH_DRZ80
341  static class md* md_drz80;
342  unsigned int md_drz80_ref;
343  class md* md_drz80_prev;
344 
345  void md_set_drz80(bool set);
346 #endif
347  void md_set(bool set);
348 
349  unsigned int mclk; // Master clock
350  unsigned int clk0; // MCLK/15 for Z80, SN76489
351  unsigned int clk1; // MCLK/7 for M68K, YM2612
352  unsigned int lines;
353  unsigned int vhz;
354  unsigned int pal: 1;
355 
356  unsigned int vblank(); // Return first vblank line
357 
358 private:
359  static bool lock; // Prevent other MD objects
360 
361  unsigned int ok: 1;
362  unsigned int ok_ym2612: 1; // YM2612
363  unsigned int ok_sn76496: 1; // SN76496
364 
365  unsigned int romlen;
366  unsigned char *mem,*rom,*ram,*z80ram;
367  // Saveram stuff:
368  unsigned char *saveram; // The actual saveram buffer
369  unsigned save_start, save_len; // Start address and length
370  int save_prot, save_active; // Flags set from $A130F1
371 public:
375  void m68k_state_dump();
376  void m68k_state_restore();
377  void z80_state_dump();
378  void z80_state_restore();
379 private:
380 #ifdef WITH_MZ80
381  struct mz80context z80;
382 #endif
383 #ifdef WITH_CZ80
384  cz80_struc cz80;
385 #endif
386 #ifdef WITH_DRZ80
387  struct DrZ80 drz80 __attribute__((packed)); // See drz80.h and drz80.s.
388  friend uintptr_t drz80_rebaseSP(uint16_t new_sp);
389  uintptr_t drz80_rebase_pc(uint16_t address);
390  friend uintptr_t drz80_rebasePC(uint16_t new_pc);
391  uintptr_t drz80_rebase_sp(uint16_t address);
392  friend void drz80_irq_callback();
393  void drz80_irq_cb();
394 #endif
395 #ifdef WITH_STAR
396  struct S68000CONTEXT cpu;
398  STARSCREAM_DATAREGION *readbyte,*readword,*writebyte,*writeword;
399  int memory_map();
400  friend void star_irq_callback(void);
401 #endif
402 #ifdef WITH_MUSA
403  void *ctx_musa;
404  void musa_memory_map();
405  m68k_mem_t musa_memory[2]; // [0] = ROM, [1] = RAM
406  friend int musa_irq_callback(int);
407 #endif
408 #ifdef WITH_CYCLONE
409  struct Cyclone cyclonecpu;
410  friend int cyclone_irq_callback(int);
411 #endif
412 
413  uint32_t z80_bank68k;
414  unsigned int z80_st_busreq: 1; // in BUSREQ state
415  unsigned int z80_st_reset: 1; // in RESET state
416  unsigned int z80_st_running: 1; // Z80 is running
417  unsigned int z80_st_irq: 1; // Z80 IRQ asserted
418  unsigned int m68k_st_running: 1; // M68K is running
419  int z80_irq_vector; // Z80 IRQ vector
420  struct {
421  int m68k;
422  int m68k_max;
423  int z80;
424  int z80_max;
425  } odo;
426 
427  int ras;
428 
429  // Note order is (0) Vblank end -------- Vblank Start -- (HIGH)
430  // So int6 happens in the middle of the count
431 
434  unsigned char calculate_coo8();
435  unsigned char calculate_coo9();
436  int may_want_to_get_pic(struct bmap *bm,unsigned char retpal[256],int mark);
437  int may_want_to_get_sound(struct sndinfo *sndi);
438 
439  // Horizontal counter table
440  uint8_t hc_table[512][2];
441 
442  int m68k_odo(); // M68K odometer
443  void m68k_run(); // Run M68K to odo.m68k_max
444  void m68k_busreq_request(); // Issue BUSREQ
445  void m68k_busreq_cancel(); // Cancel BUSREQ
446  void m68k_irq(int i); // Trigger M68K IRQ
447  void m68k_vdp_irq_trigger(); // Trigger IRQ from VDP status
448  void m68k_vdp_irq_handler(); // Called when interrupts are acknowledged
449 
450  int z80_odo(); // Z80 odometer
451  void z80_run(); // Run Z80 to odo.z80_max
452  void z80_sync(int fake); // Synchronize Z80 with M68K
453  void z80_irq(int vector); // Trigger Z80 IRQ
454  void z80_irq_clear(); // Clear Z80 IRQ
455 
456  // Number of microseconds spent in current frame
457  unsigned int frame_usecs();
458 
459  int fm_timer_callback();
460  int myfm_read(int a);
461  int mysn_write(int v);
462  void fm_reset();
463  uint8_t fm_sel[2];
464  uint8_t fm_tover;
465  int fm_ticker[4];
466  signed short fm_reg[2][0x100]; // All of them (-1 = not def'd yet)
467 
469  // Since dac values are normally shifted << 6, 1 is used to mark unchanged
470  // values.
471  void dac_init() { dac_last = 1; dac_enabled = 1; dac_clear(); }
472  void dac_clear() {
473  dac_data[0] = dac_last;
474  for(int i = 1; i < 0x138; ++i)
475  dac_data[i] = 1;
476  }
477  void dac_submit(int d) {
478  dac_last = (d - 0x80) << 6; if(dac_enabled) dac_data[ras] = dac_last;
479  }
480  void dac_enable(int d) {
481  dac_enabled = d & 0x80;
482  dac_data[ras] = (dac_enabled? dac_last : 1);
483  }
484 
485  uint8_t m68k_ROM_read(uint32_t a);
486  uint8_t m68k_IO_read(uint32_t a);
487  uint8_t m68k_VDP_read(uint32_t a);
488  void m68k_ROM_write(uint32_t, uint8_t);
489  void m68k_IO_write(uint32_t, uint8_t);
490 
491 
492 public:
493  int myfm_write(int a,int v,int md);
494  // public struct, full with data from the cartridge header
495  struct _carthead_ {
496  char system_name[0x10]; // "SEGA GENESIS ", "SEGA MEGA DRIVE "
497  char copyright[0x10]; // "(C)SEGA 1988.JUL"
498  char domestic_name[0x30]; // Domestic game name
499  char overseas_name[0x30]; // Overseas game name
500  char product_no[0xe]; // "GM XXXXXXXX-XX" or "GM MK-XXXX -00"
501  unsigned short checksum; // ROM checksum
502  char control_data[0x10]; // I/O use data (usually only joystick)
503  unsigned rom_start, rom_end; // ROM start & end addresses
504  unsigned ram_start, ram_end; // RAM start & end addresses
505  unsigned short save_magic; // 0x5241("RA") if saveram, else 0x2020
506  unsigned short save_flags; // Misc saveram info
507  unsigned save_start, save_end; // Saveram start & end
508  unsigned short modem_magic; // 0x4d4f("MO") if uses modem, else 0x2020
509  char modem_firm[4]; // Modem firm name (should be same as (c))
510  char modem_ver[4]; // yy.z, yy=ID number, z=version
511  char memo[0x28]; // Extra data
512  char countries[0x10]; // Country code
513  } cart_head;
514  char region; // Emulator region.
515  uint8_t region_guess();
516  int one_frame(struct bmap *bm,unsigned char retpal[256],struct sndinfo *sndi);
517  void pad_update();
518  int pad[2];
519  uint8_t pad_com[2];
520 // c000004 bit 1 write fifo empty, bit 0 write fifo full (???)
521 // c000005 vint happened, (sprover, coll, oddinint)
522 // invblank, inhblank, dma busy, pal
523  unsigned char coo4,coo5;
524  int okay() {return ok;}
525  bool plugged;
526  md(bool pal, char region);
527  ~md();
528  void init_pal();
529  bool init_sound();
530  int plug_in(unsigned char *cart,int len);
531  int unplug();
532  int load(const char *name);
533 
534  int reset();
535 
536  uint8_t misc_readbyte(uint32_t a);
537  void misc_writebyte(uint32_t a, uint8_t d);
538  uint16_t misc_readword(uint32_t a);
539  void misc_writeword(uint32_t a, uint16_t d);
540 
541  void z80_init();
542  void z80_reset();
543  uint8_t z80_read(uint16_t a);
544  void z80_write(uint16_t a, uint8_t d);
545  uint8_t z80_port_read(uint16_t a);
546  void z80_port_write(uint16_t a, uint8_t d);
547 
548  enum z80_core {
550 #ifdef WITH_MZ80
551  Z80_CORE_MZ80,
552 #endif
553 #ifdef WITH_CZ80
554  Z80_CORE_CZ80,
555 #endif
556 #ifdef WITH_DRZ80
557  Z80_CORE_DRZ80,
558 #endif
560  } z80_core;
561  void cycle_z80();
562 
563  enum cpu_emu {
565 #ifdef WITH_STAR
566  CPU_EMU_STAR,
567 #endif
568 #ifdef WITH_MUSA
569  CPU_EMU_MUSA,
570 #endif
571 #ifdef WITH_CYCLONE
572  CPU_EMU_CYCLONE,
573 #endif
575  } cpu_emu; // OK to read it but call cycle_cpu() to change it
576  void cycle_cpu();
577 
578 #ifdef WITH_MZ80
579  mz80context& z80_context() {return z80;}
580 #endif
581  int import_gst(FILE *hand);
582  int export_gst(FILE *hand);
583 
584  char romname[256];
585 
586  int z80dump();
587 
588  // Fix ROM checksum
589  void fix_rom_checksum();
590 
591  // List of patches currently applied.
592  struct patch_elem {
593  struct patch_elem *next;
594  uint32_t addr;
595  uint16_t data;
596  } *patch_elem;
597  // Added by Joe Groff:
598  // Patch the ROM code, using Game Genie/Hex codes
599  int patch(const char *list, unsigned int *errors,
600  unsigned int *applied, unsigned int *reverted);
601  // Get/put the battery save RAM
602  int has_save_ram();
603  int get_save_ram(FILE *from);
604  int put_save_ram(FILE *into);
605 
606 #ifdef WITH_JOYSTICK
607  // Added by Phillip K. Hornung <redx@pknet.com>
608  void init_joysticks();
609  void deinit_joysticks();
610 #endif
611 
612  // Debugger stuff
613 #ifdef WITH_DEBUGGER
614 private:
615 // M68K FLAGS
616 // user byte
617 #define M68K_SR_CARRY (1<<0)
618 #define M68K_SR_OVERFLOW (1<<1)
619 #define M68K_SR_ZERO (1<<2)
620 #define M68K_SR_NEGATIVE (1<<3)
621 #define M68K_SR_EXTEND (1<<4)
622 // system byte
623 #define M68K_SR_IP_MASK1 (1<<8)
624 #define M68K_SR_IP_MASK2 (1<<9)
625 #define M68K_SR_IP_MASK3 (1<<10)
626 #define M68K_SR_MI_STATE (1<<12)
627 #define M68K_SR_SUP_STATE (1<<13)
628 #define M68K_SR_TRACE_EN1 (1<<14)
629 #define M68K_SR_TRACE_EN2 (1<<15)
630 // Z80 FLAGS
631 #define Z80_SR_CARRY (1<<0)
632 #define Z80_SR_ADD_SUB (1<<1)
633 #define Z80_SR_PARITY_OVERFLOW (1<<2)
634 #define Z80_SR_HALF_CARRY (1<<4)
635 #define Z80_SR_ZERO (1<<6)
636 #define Z80_SR_SIGN (1<<7)
637 public:
639  char *cmd;
640  int n_args;
641  int (md::*handler)(int, char **);
642  };
643  const static struct md::dgen_debugger_cmd debug_cmd_list[];
644  unsigned long debug_m68k_instr_count;
646  // commands
647  int debug_despatch_cmd(int n_toks, char **args);
648  int debug_cmd_cont(int n_args, char **args);
649  int debug_cmd_reg(int n_args, char **args);
650  int debug_cmd_help(int n_args, char **args);
651  int debug_cmd_break(int n_args, char **args);
652  int debug_cmd_quit(int n_args, char **args);
653  int debug_cmd_step(int n_args, char **args);
654  int debug_cmd_trace(int n_args, char **args);
655  int debug_cmd_minus_break(int n_args, char **args);
656  int debug_cmd_cpu(int n_args, char **args);
657  int debug_cmd_dis(int n_args, char **args);
658  int debug_cmd_mem(int n_args, char **args);
659  int debug_cmd_setbwlr(int n_args, char **args, unsigned int type);
660  int debug_cmd_setb(int n_args, char **args);
661  int debug_cmd_setw(int n_args, char **args);
662  int debug_cmd_setl(int n_args, char **args);
663  int debug_cmd_setr(int n_args, char **args);
664  int debug_cmd_watch(int n_args, char **args);
665  int debug_cmd_minus_watch(int n_args, char **args);
666  // misc
667  void debug_enter(void);
668  void debug_leave(void);
669  void debug_update_wp_cache(struct dgen_wp *w);
670  void debug_update_fired_wps(void);
671  void debug_set_wp_m68k(uint32_t start_addr, uint32_t end_addr);
672  void debug_print_disassemble(uint32_t from, int len);
673  void debug_show_m68k_regs(void);
674  void debug_show_z80_regs(void);
675  void debug_dump_mem(uint32_t addr, uint32_t len);
676 #endif
677 };
678 
679 inline int md::has_save_ram()
680 {
681  return save_len;
682 }
683 
684 #endif // __MD_H__