dcastaway.h
  1  #define USE_FAME_CORE_C 1
  2  #define USE_FAME_CORE 1
  3  #define FAME_GLOBAL_CONTEXT 1
  4  //#define NO_SOUND 1
  5  
  6  
  7  #ifndef CONFIGH
  8  #define CONFIGH
  9  
 10  
 11  /*
 12   * Environment Configuration
 13   */
 14  #if !defined(USE_BIG_ENDIAN) && !defined(USE_LITTLE_ENDIAN)
 15  #define USE_LITTLE_ENDIAN
 16  #endif
 17  
 18  #ifndef INLINE
 19  #define INLINE static __inline__
 20  #endif
 21  
 22  
 23  #ifndef TRUE
 24  #define TRUE 1
 25  #endif
 26  
 27  #ifndef FALSE
 28  #define FALSE 0
 29  #endif
 30  
 31  /*
 32   * compiler representation of M68000 .B .W .L operands
 33   */
 34  #ifndef __cplusplus
 35  typedef signed char     bool;
 36  #endif
 37  #ifndef DREAMCAST
 38  typedef signed char     int8;
 39  typedef signed short    int16;
 40  typedef signed long     int32;
 41  typedef unsigned char   uint8;
 42  typedef unsigned short  uint16;
 43  typedef unsigned long   uint32;
 44  #else
 45  #include <kos.h>
 46  #endif
 47  
 48  /*
 49   * Atari ST emulator defaults
 50   */
 51  #define MEMBASE 0x00000000L
 52  #ifndef MEMSIZE
 53  #define MEMSIZE 0x00400000L /* default memsize 4 Mb */
 54  //#define MEMSIZE 0x00080000L /* default memsize 512 Kb */
 55  #endif
 56  #define CARBASE 0x00fa0000L
 57  #define CARSIZE 0x00020000L /* 128k cartridge */
 58  #define ROMBASE 0x00fc0000L
 59  #define ROMBASE2 0x00e00000L
 60  #define ROMSIZE 0x00030000L /* 192k */
 61  #define ROMSIZE2 0x00040000L /* 256k */
 62  #define IOBASE  0x00ff8000L
 63  #define IOSIZE  0x00008000L /* 32k */
 64  #define SVADDR  0x00000800L
 65  
 66  
 67  #define MONITOR 2           /* 0=color 320x200 or 2=monochrome 640x400 */
 68  #define SIDES   2           /* disk sides */
 69  #define TRACKS  80          /* tracks on disk */
 70  #define SECTORS 9           /* sectors per track */
 71  #define SECSIZE 512         /* byte per sector */
 72  #define TIMER   0           /* 0=normal (200Hz), 2=slow (100Hz) */
 73  #define NO_BLITTER
 74  #define NO_RTC              /* Do not emulate Real-Time-Clock */
 75  //#define CHKADDRESSERR       /* if set, unaligned access will raise an address
 76  //                               error (slower, but expected behaviour) */
 77  //#define CHKTRACE            /* if set, the trace bit works (slower). */
 78  //#define NATFEAT             /* if set, native features are supported */
 79  
 80  #undef DEBUG                /* Debug */
 81  
 82  #ifndef USE_BIG_ENDIAN
 83  #define BYTES_SWAP          1
 84  #endif
 85  
 86  #undef DISASS
 87  #undef DBGTRACE
 88  #undef DETECT_PREFETCH
 89  
 90  /*
 91   * Debug options
 92   */
 93  #ifdef DEBUG
 94  #ifndef CHKADDRESSERR
 95  #define CHKADDRESSERR       /* force address error checking */
 96  #endif
 97  #define VERBOSE 0x1         /* ~INT, IO, ~BLITTER */
 98  #define TRACEBACK 2000     /* 68k traceback buffer size */
 99  #undef INTERNALTRACE       /* trace 68k operation internal execution */
100  #define DBG_OUT if (verb_on) printf
101  #define DBG_STOP if (stop_on) Stop
102  #define NO_TIMER
103  /* special DEBUG action on traps */
104  #define ON_TRAP(number) if (number == 33) {stop_on++;};
105  /* special DEBUG action on R/W access to an unmapped address */
106  #define ON_UNMAPPED(address, value)
107  /* special DEBUG action on unmapped I/O access */
108  #define ON_NOIO(offset, value)
109  /* special DEBUG action on write access */
110  #define ON_WRITE(address, value)
111  extern int      trace_on;
112  extern int      stop_on;
113  extern int      verb_on;
114  extern void     SaveState(unsigned short inst);
115  extern void     Stop(void);
116  #else /* not DEBUG */
117  #define ON_TRAP(number)
118  #define ON_UNMAPPED(address, value)
119  #define ON_NOIO(address, value)
120  #define ON_WRITE(address, value)
121  // #  define ON_TRAP(number) if (number == 33 && GetMemW(areg[7]) == 0x4c) { TraceStop(); }
122  #endif
123  #endif
124  
125  #ifdef DEBUG_FAME_FFLUSH
126  #undef DEBUG_FAME_FFLUSH
127  #define DEBUG_FAME_FFLUSH fflush(stdout)
128  #else
129  #define DEBUG_FAME_FFLUSH
130  #endif
131  
132  #include<stdio.h>
133  #include<stdlib.h>
134  #include<string.h>
135  
136  
137  
138  extern int emulating;
139  extern int nScreenRefreshRate;
140  extern int maybe_border;
141  extern unsigned screen_pitch, screen_width, screen_height;
142  extern unsigned cyclenext;
143  extern unsigned vid_adr_cycleyet;
144  extern unsigned char *vid_cycle;