extern uint8 * jaguarMainRAM;
extern uint8 * jaguarMainROM;
-extern uint8 jaguarBootROM[];
-extern uint8 jaguarCDBootROM[];
+//extern uint8 jaguarBootROM[];
+//extern uint8 jaguarCDBootROM[];
+//extern uint8 jaguarDevBootROM1[];
+//extern uint8 jaguarDevBootROM2[];
+//extern uint8 jaguarDevCDBootROM[];
extern uint8 * gpuRAM;
extern uint8 * dspRAM;
-extern uint16 & memcon1, & memcon2, & hc, & vc, & lph, & lpv;
-
#if 1
extern uint32 & butch, & dscntrl;
extern uint16 & ds_data;
extern uint32 butch, dscntrl, ds_data, i2cntrl, sbcntrl, subdata, subdatb, sb_time, fifo_data, i2sdat2, unknown;
#endif
-extern uint32 obData, olp, obf, vmode, bord1, bord2, hp, hbb, hbe, hs, hvs,
- hdb1, hdb2, hde, vp, vbb, vbe, vs, vdb, vde, veb, vee, vi, pit0, pit1, heq, bg, int1, int2, clut, lbuf,
- g_flags, g_mtxc, g_mtxa, g_end, g_pc, g_ctrl, g_hidata, g_remain, g_divctrl,
- a1_base, a1_pixel, a1_flags, a1_clip, a1_step, a1_fstep, a1_fpixel, a1_inc, a1_finc,
- a2_base, a2_flags, a2_pixel, a2_mask, a2_step, b_cmd, b_count, b_srcd, b_dstd, b_dstz, b_srcz1, b_srcz2,
- b_patd, b_iinc, b_zinc, b_stop, b_i3, b_i2, b_i1, b_i0, b_z3, b_z2, b_z1, b_z0,
- jpit1, jpit2, jpit3, jpit4, clk1, clk2, clk3, j_int, asidata, asistat, asictrl, asiclk, joystick,
- joybuts, d_flags, d_mtxc, d_mtxa, d_end, d_pc, d_ctrl, d_mod, d_remain, d_divctrl, d_machi,
- ltxd, rtxd, sstat, sclk, smode;
+extern uint16 & memcon1, & memcon2, & hc, & vc, & lph, & lpv;
+extern uint64 & obData;
+extern uint32 & olp;
+extern uint16 & obf, & vmode, & bord1, & bord2, & hp, & hbb, & hbe, & hs,
+ & hvs, & hdb1, & hdb2, & hde, & vp, & vbb, & vbe, & vs, & vdb, & vde,
+ & veb, & vee, & vi, & pit0, & pit1, & heq;
+extern uint32 & bg;
+extern uint16 & int1, & int2;
+extern uint8 * clut, * lbuf;
+extern uint32 & g_flags, & g_mtxc, & g_mtxa, & g_end, & g_pc, & g_ctrl,
+ & g_hidata, & g_divctrl;
+extern uint32 g_remain;
+extern uint32 & a1_base, & a1_flags, & a1_clip, & a1_pixel, & a1_step,
+ & a1_fstep, & a1_fpixel, & a1_inc, & a1_finc, & a2_base, & a2_flags,
+ & a2_mask, & a2_pixel, & a2_step, & b_cmd, & b_count;
+extern uint64 & b_srcd, & b_dstd, & b_dstz, & b_srcz1, & b_srcz2, & b_patd;
+extern uint32 & b_iinc, & b_zinc, & b_stop, & b_i3, & b_i2, & b_i1, & b_i0, & b_z3,
+ & b_z2, & b_z1, & b_z0;
+extern uint16 & jpit1, & jpit2, & jpit3, & jpit4, & clk1, & clk2, & clk3, & j_int,
+ & asidata, & asictrl;
+extern uint16 asistat;
+extern uint16 & asiclk, & joystick, & joybuts;
+extern uint32 & d_flags, & d_mtxc, & d_mtxa, & d_end, & d_pc, & d_ctrl,
+ & d_mod, & d_divctrl;
+extern uint32 d_remain;
+extern uint32 & d_machi;
+extern uint16 & ltxd, lrxd, & rtxd, rrxd;
+extern uint8 & sclk, sstat;
+extern uint32 & smode;
+/*
+uint16 & ltxd = *((uint16 *)&jagMemSpace[0xF1A148]);
+uint16 lrxd; // Dual register with $F1A148
+uint16 & rtxd = *((uint16 *)&jagMemSpace[0xF1A14C]);
+uint16 rrxd; // Dual register with $F1A14C
+uint8 & sclk = *((uint8 *) &jagMemSpace[0xF1A150]);
+uint8 sstat; // Dual register with $F1A150
+uint32 & smode = *((uint32 *)&jagMemSpace[0xF1A154]);
+*/
// Read/write tracing enumeration
enum { UNKNOWN, JAGUAR, DSP, GPU, TOM, JERRY, M68K, BLITTER, OP };
extern const char * whoName[9];
+// BIOS identification enum
+
+//enum { BIOS_NORMAL=0x01, BIOS_CD=0x02, BIOS_STUB1=0x04, BIOS_STUB2=0x08, BIOS_DEV_CD=0x10 };
+//extern int biosAvailable;
+
// Some handy macros to help converting native endian to big endian (jaguar native)
// & vice versa
#define SET16(r, a, v) r[(a)] = ((v) & 0xFF00) >> 8, r[(a)+1] = (v) & 0xFF
#define GET16(r, a) ((r[(a)] << 8) | r[(a)+1])
+//This doesn't seem to work on OSX. So have to figure something else out. :-(
+//byteswap.h doesn't exist on OSX.
+#if 0
// This is GCC specific, but we can fix that if we need to...
// Big plus of this approach is that these compile down to single instructions on little
// endian machines while one big endian machines we don't have any overhead. :-)
#define ESAFE32(x) (x)
#define ESAFE64(x) (x)
#endif
+#endif
+
+#if 0
+Stuff ripped out of Hatari, that may be useful:
+
+/* Can the actual CPU access unaligned memory? */
+#ifndef CPU_CAN_ACCESS_UNALIGNED
+# if defined(__i386__) || defined(powerpc) || defined(__mc68020__)
+# define CPU_CAN_ACCESS_UNALIGNED 1
+# else
+# define CPU_CAN_ACCESS_UNALIGNED 0
+# endif
+#endif
+
+
+/* If the CPU can access unaligned memory, use these accelerated functions: */
+#if CPU_CAN_ACCESS_UNALIGNED
+
+#include <SDL_endian.h>
+
+
+static inline uae_u32 do_get_mem_long(void *a)
+{
+ return SDL_SwapBE32(*(uae_u32 *)a);
+}
+
+static inline uae_u16 do_get_mem_word(void *a)
+{
+ return SDL_SwapBE16(*(uae_u16 *)a);
+}
+
+
+static inline void do_put_mem_long(void *a, uae_u32 v)
+{
+ *(uae_u32 *)a = SDL_SwapBE32(v);
+}
+
+static inline void do_put_mem_word(void *a, uae_u16 v)
+{
+ *(uae_u16 *)a = SDL_SwapBE16(v);
+}
+
+
+#else /* Cpu can not access unaligned memory: */
+
+
+static inline uae_u32 do_get_mem_long(void *a)
+{
+ uae_u8 *b = (uae_u8 *)a;
+
+ return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3];
+}
+
+static inline uae_u16 do_get_mem_word(void *a)
+{
+ uae_u8 *b = (uae_u8 *)a;
+
+ return (b[0] << 8) | b[1];
+}
+
+
+static inline void do_put_mem_long(void *a, uae_u32 v)
+{
+ uae_u8 *b = (uae_u8 *)a;
+
+ b[0] = v >> 24;
+ b[1] = v >> 16;
+ b[2] = v >> 8;
+ b[3] = v;
+}
+
+static inline void do_put_mem_word(void *a, uae_u16 v)
+{
+ uae_u8 *b = (uae_u8 *)a;
+
+ b[0] = v >> 8;
+ b[1] = v;
+}
+
+
+#endif /* CPU_CAN_ACCESS_UNALIGNED */
+
+
+/* These are same for all architectures: */
+
+static inline uae_u8 do_get_mem_byte(uae_u8 *a)
+{
+ return *a;
+}
+
+static inline void do_put_mem_byte(uae_u8 *a, uae_u8 v)
+{
+ *a = v;
+}
+#endif
#endif // __MEMORY_H__