cfgfile_write (f, _T("config_version"), _T("%d.%d.%d"), UAEMAJOR, UAEMINOR, UAESUBREV);
cfgfile_write_str (f, _T("config_hardware_path"), p->config_hardware_path);
cfgfile_write_str (f, _T("config_host_path"), p->config_host_path);
- cfgfile_write_str (f, _T("config_window_title"), p->config_window_title);
+ if (p->config_window_title[0])
+ cfgfile_write_str (f, _T("config_window_title"), p->config_window_title);
for (sl = p->all_lines; sl; sl = sl->next) {
if (sl->unknown) {
}
}
+void cia_set_overlay (bool overlay)
+{
+ oldovl = overlay;
+}
+
void CIA_reset (void)
{
#ifdef TOD_HACK
kblostsynccnt = 0;
serbits = 0;
- oldovl = 1;
oldcd32mute = 1;
oldled = true;
resetwarning_phase = resetwarning_timer = 0;
if (!savestate_state) {
+ oldovl = true;
kbstate = 0;
ciaatlatch = ciabtlatch = 0;
ciaapra = 0; ciaadra = 0;
serial_dtr_off (); /* Drop DTR at reset */
#endif
if (savestate_state) {
+ if (currprefs.cs_ciaoverlay) {
+ oldovl = true;
+ }
bfe001_change ();
if (!currprefs.cs_ciaoverlay) {
- map_overlay (1);
- oldovl = false;
+ map_overlay (oldovl ? 0 : 1);
}
}
#ifdef CD32
#endif
static uae_u16 bplxdat[8];
-static int bpl1dat_written, bpl1dat_early;
+static bool bpl1dat_written, bpl1dat_early, bpl1dat_written_at_least_once;
static uae_s16 bpl1mod, bpl2mod;
static uaecptr prevbpl[2][MAXVPOS][8];
static uaecptr bplpt[8], bplptx[8];
// early bpl1dat crap fix (Sequential engine animation)
if (plfleft_real < 0) {
int i;
- for (i = 0; i < thisline_decision.nr_planes; i++) {
+ for (i = 0; i < MAX_PLANES; i++) {
todisplay[i][0] = 0;
#ifdef AGA
todisplay[i][1] = 0;
#endif
}
plfleft_real = hpos;
- bpl1dat_early = 1;
+ bpl1dat_early = true;
}
} else {
plfleft_real = thisline_decision.plfleft = hpos;
bplpt[nr] += 2 << fm;
bplptx[nr] += 2 << fm;
if (nr == 0)
- bpl1dat_written = 1;
+ bpl1dat_written = true;
#ifdef DEBUGGER
if (debug_dma)
record_dma (0x110 + nr * 2, chipmem_wget_indirect (p), p, hpos, vpos, DMARECORD_BITPLANE);
// and we must not draw anything at all in next dma block if this happens
// (Disposable Hero titlescreen)
fetch_state = fetch_was_plane0;
- bpl1dat_written = 0;
+ bpl1dat_written = false;
}
fetch_cycle++;
}
}
-static void update_fetch_x (int hpos, int fm)
+static void update_bpldats (int hpos)
+{
+ for (int i = 0; i < MAX_PLANES; i++) {
+#ifdef AGA
+ fetched_aga0[i] = bplxdat[i];
+ fetched_aga1[i] = 0;
+#endif
+ fetched[i] = bplxdat[i];
+ }
+ beginning_of_plane_block (hpos, fetchmode);
+}
+
+static void update_fetch_x (int until, int fm)
{
int pos;
pos = last_fetch_hpos;
update_toscr_planes ();
- for (int i = 0; i < 8; i++)
- fetched[i] = bplxdat[i];
- beginning_of_plane_block (hpos, fm);
- for (; pos < hpos; pos++) {
+
+ // not optimized, update_fetch_x() is extremely rarely used.
+ for (; pos < until; pos++) {
toscr_nbits += 2 << toscr_res;
if (toscr_nbits > 16) {
- uae_abort (_T("toscr_nbits > 16 (%d)"), toscr_nbits);
+ uae_abort (_T("xtoscr_nbits > 16 (%d)"), toscr_nbits);
toscr_nbits = 0;
}
if (toscr_nbits == 16)
flush_display (fm);
}
+
+ if (until >= maxhpos) {
+ finish_final_fetch (pos, fm);
+ return;
+ }
+
flush_display (fm);
- bpl1dat_written = 0;
}
STATIC_INLINE void update_fetch (int until, int fm)
#endif
default: uae_abort (_T("fetchmode corrupt"));
}
- } else if (0 && bpl1dat_written) {
- // "pio" mode display
+ } else if (bpl1dat_written_at_least_once) {
+ // "PIO" mode display
update_fetch_x (hpos, fetchmode);
+ bpl1dat_written = false;
}
maybe_check (hpos);
last_fetch_hpos = hpos;
}
}
+static void reset_bpl_vars (void)
+{
+ out_nbits = 0;
+ out_offs = 0;
+ toscr_nbits = 0;
+ thisline_decision.bplres = bplcon0_res;
+}
+
static void start_bpl_dma (int hpos, int hstart)
{
if (first_bpl_vpos < 0)
fetch_cycle = 0;
last_fetch_hpos = hstart;
cycle_diagram_shift = last_fetch_hpos;
- out_nbits = 0;
- out_offs = 0;
- toscr_nbits = 0;
- thisline_decision.bplres = bplcon0_res;
+ reset_bpl_vars ();
ddfstate = DIW_waiting_stop;
compute_toscr_delay (last_fetch_hpos, bplcon1);
toscr_nr_planes = toscr_nr_planes2 = 0;
thisline_decision.bplres = bplcon0_res;
thisline_decision.nr_planes = 0;
- bpl1dat_written = 0;
- bpl1dat_early = 0;
+ bpl1dat_written = false;
+ bpl1dat_written_at_least_once = false;
+ bpl1dat_early = false;
plfleft_real = -1;
thisline_decision.plfleft = -1;
bpl2mod = v;
}
-/* needed in special OCS/ECS "7-plane" mode. */
-/* (in reality only BPL0DAT, BPL5DAT and BPL6DAT needed) */
+/* Needed in special OCS/ECS "7-plane" mode,
+ * also handles CPU generated bitplane data
+ */
static void BPLxDAT (int hpos, int num, uae_u16 v)
{
decide_line (hpos);
decide_fetch (hpos);
bplxdat[num] = v;
if (num == 0) {
- bpl1dat_written = 1;
+ bpl1dat_written = true;
+ bpl1dat_written_at_least_once = true;
if (thisline_decision.plfleft < 0) {
thisline_decision.plfleft = hpos;
+ reset_bpl_vars ();
compute_delay_offset ();
}
+ update_bpldats (hpos);
}
}
/* Determine which cycles are available for the copper in a display
* with a agiven number of planes. */
-STATIC_INLINE int copper_cant_read (int hpos, int alloc)
+STATIC_INLINE int copper_cant_read2 (int hpos, int alloc)
{
if (hpos + 1 >= maxhpos) // first refresh slot
return 1;
return is_bitplane_dma_inline (hpos);
}
+static int copper_cant_read (int hpos, int alloc)
+{
+ int cant = copper_cant_read2 (hpos, alloc);
+ if (cant && debug_dma)
+ record_dma_event (DMA_EVENT_COPPERWANTED, hpos, vpos);
+ return cant;
+}
+
static int custom_wput_copper (int hpos, uaecptr addr, uae_u32 value, int noget)
{
int v;
break;
case COP_wait1:
+#if 0
/* There's a nasty case here. As stated in the "Theory" comment above, we
test against the incremented copper position. I believe this means that
we have to increment the _vertical_ position at the last cycle in the line,
this hack: defer the entire decision until the next line if necessary. */
if (c_hpos >= (maxhpos & ~1) || (c_hpos & 1))
break;
-
+#endif
cop_state.state = COP_wait;
cop_state.vcmp = (cop_state.saved_i1 & (cop_state.saved_i2 | 0x8000)) >> 8;
if (!(v & 1))
v = 0;
currprefs.cs_compatible = changed_prefs.cs_compatible = v >> 24;
+ cia_set_overlay ((v & 2) != 0);
currprefs.genlock = changed_prefs.genlock = RBB;
currprefs.cs_rtc = changed_prefs.cs_rtc = RB;
else
dstbak = dst = xmalloc (uae_u8, 1000);
- SL ((currprefs.cs_compatible << 24) | 1);
+ SL ((currprefs.cs_compatible << 24) | (&get_mem_bank (0) != &chipmem_bank ? 2 : 0) | 1);
SB (currprefs.genlock ? 1 : 0);
SB (currprefs.cs_rtc);
SL (currprefs.cs_rtc_adjust);
_T(" Cl List currently found trainer addresses.\n")
_T(" D[idxzs <[max diff]>] Deep trainer. i=new value must be larger, d=smaller,\n")
_T(" x = must be same, z = must be different, s = restart.\n")
- _T(" W <address> <value[.x]> Write into Amiga memory.\n")
+ _T(" W <address> <values[.x] separated by space> Write into Amiga memory.\n")
+ _T(" W <address> 'string' Write into Amiga memory.\n")
_T(" w <num> <address> <length> <R/W/I/F/C> [<value>[.x]] (read/write/opcode/freeze/mustchange).\n")
_T(" Add/remove memory watchpoints.\n")
_T(" wd [<0-1>] Enable illegal access logger. 1 = enable break.\n")
_T(" dm Dump current address space map.\n")
_T(" v <vpos> [<hpos>] Show DMA data (accurate only in cycle-exact mode).\n")
_T(" v [-1 to -4] = enable visual DMA debugger.\n")
- _T(" ?<value> Hex/Bin/Dec converter.\n")
+ _T(" ?<value> Hex ($ and 0x)/Bin (%)/Dec (!) converter.\n")
#ifdef _WIN32
_T(" x Close debugger.\n")
_T(" xx Switch between console and GUI debugger.\n")
return 1;
}
+static bool iscancel (int counter)
+{
+ static int cnt;
+
+ cnt++;
+ if (cnt < counter)
+ return false;
+ cnt = 0;
+ if (!console_isch ())
+ return false;
+ console_getch ();
+ return true;
+}
static bool isoperator(TCHAR **cp)
{
return 1;
}
-static uae_u32 readbinx (TCHAR **c)
+static bool readbinx (TCHAR **c, uae_u32 *valp)
{
uae_u32 val = 0;
+ bool first = true;
ignore_ws (c);
for (;;) {
TCHAR nc = **c;
- if (nc != '1' && nc != '0')
+ if (nc != '1' && nc != '0') {
+ if (first)
+ return false;
break;
+ }
+ first = false;
(*c)++;
val <<= 1;
if (nc == '1')
val |= 1;
}
- return val;
+ *valp = val;
+ return true;
}
-static uae_u32 readhexx (TCHAR **c)
+static bool readhexx (TCHAR **c, uae_u32 *valp)
{
uae_u32 val = 0;
TCHAR nc;
ignore_ws (c);
+ if (!isxdigit (peekchar (c)))
+ return false;
while (isxdigit (nc = **c)) {
(*c)++;
val *= 16;
val += nc - 'A' + 10;
}
}
- return val;
+ *valp = val;
+ return true;
}
-static uae_u32 readintx (TCHAR **c)
+static bool readintx (TCHAR **c, uae_u32 *valp)
{
uae_u32 val = 0;
TCHAR nc;
ignore_ws (c);
if (**c == '-')
negative = 1, (*c)++;
+ if (!isdigit (peekchar (c)))
+ return false;
while (isdigit (nc = **c)) {
(*c)++;
val *= 10;
val += nc - '0';
}
- return val * (negative ? -1 : 1);
+ *valp = val * (negative ? -1 : 1);
+ return true;
}
nc = _totupper (**c);
if (nc == '!') {
(*c)++;
- *val = readintx (c);
- return 1;
+ return readintx (c, val) ? 1 : 0;
}
if (nc == '$') {
(*c)++;
- *val = readhexx (c);
- return 1;
+ return readhexx (c, val) ? 1 : 0;
}
if (nc == '0' && _totupper ((*c)[1]) == 'X') {
(*c)+= 2;
- *val = readhexx (c);
- return 1;
+ return readhexx (c, val) ? 1 : 0;
}
if (nc == '%') {
(*c)++;
- *val = readbinx (c);
- return 1;
+ return readbinx (c, val) ? 1: 0;
}
if (nc >= 'A' && nc <= 'Z' && nc != 'A' && nc != 'D') {
if (readregx (c, val))
return 1;
}
if (def == '!') {
- *val = readintx (c);
+ return readintx (c, val) ? -1 : 0;
return -1;
} else if (def == '$') {
- *val = readhexx (c);
- return -1;
+ return readhexx (c, val) ? -1 : 0;
} else if (def == '%') {
- *val = readbinx (c);
- return -1;
+ return readbinx (c, val) ? -1 : 0;
}
return 0;
}
static uae_u32 lastaddr (void)
{
+ if (currprefs.z3fastmem2_size)
+ return z3fastmem2_start + currprefs.z3fastmem2_size;
if (currprefs.z3fastmem_size)
return z3fastmem_start + currprefs.z3fastmem_size;
+ if (currprefs.z3chipmem_size)
+ return z3chipmem_start + currprefs.z3chipmem_size;
if (currprefs.mbresmem_high_size)
return a3000hmem_start + currprefs.mbresmem_high_size;
if (currprefs.mbresmem_low_size)
*next = -1;
return 0xffffffff;
}
- prev = currprefs.z3fastmem_start;
- size = currprefs.z3fastmem_size;
+ prev = currprefs.z3fastmem_start + currprefs.z3fastmem_size;
+ size = currprefs.z3fastmem2_size;
+ if (currprefs.z3fastmem_size) {
+ prevx = prev;
+ sizex = size;
+ size = currprefs.z3fastmem_size;
+ prev = z3fastmem_start;
+ if (addr == prev + size) {
+ *next = prevx + sizex;
+ return prevx;
+ }
+ }
+ if (currprefs.z3chipmem_size) {
+ prevx = prev;
+ sizex = size;
+ size = currprefs.z3chipmem_size;
+ prev = z3chipmem_start;
+ if (addr == prev + size) {
+ *next = prevx + sizex;
+ return prevx;
+ }
+ }
if (currprefs.mbresmem_high_size) {
sizex = size;
prevx = prev;
static uaecptr nextaddr (uaecptr addr, uaecptr last, uaecptr *end)
{
+ static uaecptr old;
uaecptr paddr = addr;
int next;
if (last && 0) {
addr = nextaddr2 (addr + 1, &next);
if (end)
*end = next;
+ if (old != next) {
+ if (addr != 0xffffffff)
+ console_out_f (_T("Scanning.. %08x - %08x (%s)\n"), addr & 0xffffff00, next, get_mem_bank (addr).name);
+ old = next;
+ }
#if 0
if (next && addr != 0xffffffff) {
uaecptr xa = addr;
return addr;
}
-int safe_addr(uaecptr addr, int size)
+int safe_addr (uaecptr addr, int size)
{
addrbank *ab = &get_mem_bank (addr);
if (!ab)
l3[cl2++] = 'p';
if (dr->evt & DMA_EVENT_COPPERWAKE)
l3[cl2++] = 'W';
+ if (dr->evt & DMA_EVENT_COPPERWANTED)
+ l3[cl2++] = 'c';
if (dr->evt & DMA_EVENT_CPUIRQ)
l3[cl2++] = 'I';
if (dr->evt & DMA_EVENT_INTREQ)
break;
addrcnt += 2;
}
+ if (iscancel (65536)) {
+ console_out_f (_T("Aborted at %08X\n"), addr);
+ break;
+ }
}
console_out_f (_T("%d addresses found\n"), cnt);
}
}
memcnt++;
+ if (iscancel (65536)) {
+ console_out_f (_T("Aborted at %08X\n"), addr);
+ break;
+ }
}
if (!first) {
while (prevmemcnt < memcnt) {
save_u32 (m->modval);
save_u32 (m->val_mask);
save_u32 (m->val_size);
+ save_u32 (m->val);
+ save_u32 (m->pc);
save_store_size ();
}
*len = dst - dstbak;
m->modval = restore_u32 ();
m->val_mask = restore_u32 ();
m->val_size = restore_u32 ();
+ m->val = restore_u32 ();
+ m->pc = restore_u32 ();
restore_store_size ();
}
return src;
ignore_ws(c);
addr = readhex (c);
- ignore_ws(c);
- val = readhex (c, &len);
-
- if (len == 4) {
- put_long (addr, val);
- cc = 'L';
- } else if (len == 2) {
- put_word (addr, val);
- cc = 'W';
+
+ ignore_ws (c);
+ if (!more_params (c))
+ return;
+ cc = peekchar (c);
+ if (cc == '\'' || cc == '\"') {
+ next_char (c);
+ while (more_params (c)) {
+ TCHAR str[2];
+ char *astr;
+ cc = next_char (c);
+ if (cc == '\'' || cc == '\"')
+ break;
+ str[0] = cc;
+ str[1] = 0;
+ astr = ua (str);
+ put_byte (addr, astr[0]);
+ xfree (astr);
+ addr++;
+ }
} else {
- put_byte (addr, val);
- cc = 'B';
+ for (;;) {
+ ignore_ws (c);
+ if (!more_params (c))
+ break;
+ val = readhex (c, &len);
+
+ if (len == 4) {
+ put_long (addr, val);
+ cc = 'L';
+ } else if (len == 2) {
+ put_word (addr, val);
+ cc = 'W';
+ } else if (len == 1) {
+ put_byte (addr, val);
+ cc = 'B';
+ } else {
+ break;
+ }
+ console_out_f (_T("Wrote %X (%u) at %08X.%c\n"), val, val, addr, cc);
+ addr += len;
+ }
}
- console_out_f (_T("Wrote %X (%u) at %08X.%c\n"), val, val, addr, cc);
}
static uae_u8 *dump_xlate (uae_u32 addr)
return 1;
}
-static int process_breakpoint(TCHAR **c)
+static int process_breakpoint (TCHAR **c)
{
processptr = 0;
xfree (processname);
break;
}
}
+ if (iscancel (65536)) {
+ console_out_f (_T("Aborted at %08X\n"), addr);
+ break;
+ }
}
if (!got)
console_out (_T("nothing found"));
end = readhex (inptr);
}
console_out_f (_T("Searching from %08X to %08X\n"), addr, end);
- while((addr = nextaddr(addr, end, &end)) != 0xffffffff) {
+ while((addr = nextaddr (addr, end, &end)) != 0xffffffff) {
if ((addr & 1) == 0 && addr + 6 <= end) {
sea = 0xffffffff;
dea = 0xffffffff;
break;
}
}
+ if (iscancel (65536)) {
+ console_out_f (_T("Aborted at %08X\n"), addr);
+ break;
+ }
}
}
}
void expansion_init (void)
{
- allocated_fastmem = 0;
- fastmem_mask = fastmem_start = 0;
- fastmemory = 0;
+ if (savestate_state != STATE_RESTORE) {
+
+ allocated_fastmem = 0;
+ fastmem_mask = fastmem_start = 0;
+ fastmemory = 0;
#ifdef PICASSO96
- allocated_gfxmem = 0;
- gfxmem_mask = gfxmem_start = 0;
- gfxmemory = 0;
+ allocated_gfxmem = 0;
+ gfxmem_mask = gfxmem_start = 0;
+ gfxmemory = 0;
#endif
#ifdef CATWEASEL
- catweasel_mask = catweasel_start = 0;
+ catweasel_mask = catweasel_start = 0;
#endif
+ allocated_z3fastmem = 0;
+ z3fastmem_mask = z3fastmem_start = 0;
+ z3fastmem = 0;
+ allocated_z3fastmem2 = 0;
+ z3fastmem2_mask = z3fastmem2_start = 0;
+ z3fastmem2 = 0;
+ allocated_z3chipmem = 0;
+ z3chipmem_mask = z3chipmem_start = 0;
+ z3chipmem = 0;
+ }
+
#ifdef FILESYS
filesys_start = 0;
filesysory = 0;
#endif
- allocated_z3fastmem = 0;
- z3fastmem_mask = z3fastmem_start = 0;
- z3fastmem = 0;
- allocated_z3fastmem2 = 0;
- z3fastmem2_mask = z3fastmem2_start = 0;
- z3fastmem2 = 0;
- allocated_z3chipmem = 0;
- z3chipmem_mask = z3chipmem_start = 0;
- z3chipmem = 0;
-
allocate_expamem ();
#ifdef FILESYS
op_illg (opcode);
}
-STATIC_INLINE int fault_if_no_fpu (uae_u32 opcode, int pcoffset)
+static bool fault_if_no_fpu (uae_u32 opcode, int pcoffset)
{
if ((regs.pcr & 2) || currprefs.fpu_model <= 0) {
fpu_op_illg (opcode, pcoffset);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
static int get_fpu_version (void)
if (fault_if_no_fpu (opcode, 4))
return;
+ regs.fpiar = m68k_getpc () - 4;
disp = (uae_s32) (uae_s16) x_next_iword ();
cc = fpp_cond (extra & 0x3f);
if (cc == -1) {
if (fault_if_no_fpu (opcode, 4))
return;
+ regs.fpiar = m68k_getpc () - 4;
cc = fpp_cond (extra & 0x3f);
if (cc == -1) {
fpu_op_illg (opcode, 4);
void fpuop_trapcc (uae_u32 opcode, uaecptr oldpc, uae_u16 extra)
{
int cc;
+ uaecptr pc = m68k_getpc ();
#if DEBUG_FPP
if (!isinrom ())
write_log (_T("ftrapcc_opp at %08lx\n"), m68k_getpc ());
#endif
- if (fault_if_no_fpu (opcode, m68k_getpc() - oldpc))
+ if (fault_if_no_fpu (opcode, pc - oldpc))
return;
+ regs.fpiar = oldpc;
cc = fpp_cond (extra & 0x3f);
if (cc == -1) {
- fpu_op_illg (opcode, m68k_getpc () - oldpc);
+ fpu_op_illg (opcode, pc - oldpc);
}
if (cc)
Exception (7);
}
-void fpuop_bcc (uae_u32 opcode, uaecptr pc, uae_u32 extra)
+void fpuop_bcc (uae_u32 opcode, uaecptr oldpc, uae_u32 extra)
{
int cc;
+ uaecptr pc = m68k_getpc ();
#if DEBUG_FPP
if (!isinrom ())
write_log (_T("fbcc_opp at %08lx\n"), m68k_getpc ());
#endif
- if (fault_if_no_fpu (opcode, m68k_getpc () - pc))
+ if (fault_if_no_fpu (opcode, pc - oldpc))
return;
+ regs.fpiar = oldpc;
cc = fpp_cond (opcode & 0x3f);
if (cc == -1) {
- fpu_op_illg (opcode, m68k_getpc () - pc);
+ fpu_op_illg (opcode, pc - oldpc);
} else if (cc) {
if ((opcode & 0x40) == 0)
extra = (uae_s32) (uae_s16) extra;
- m68k_setpc (pc + extra);
+ m68k_setpc (oldpc + extra);
}
}
uae_u32 ad;
int incr = (opcode & 0x38) == 0x20 ? -1 : 1;
int fpu_version = get_fpu_version();
+ uaecptr pc = m68k_getpc () - 2;
int i;
#if DEBUG_FPP
// if (regs.fpcr == 0 && regs.fpsr == 0 && regs.fpiar == 0 &&
// regs.fp[0] ==
+ regs.fpiar = pc;
+
if (currprefs.fpu_model == 68060) {
/* 12 byte 68060 IDLE frame. */
if (incr < 0) {
void fpuop_restore (uae_u32 opcode)
{
+ uaecptr pc = m68k_getpc () - 2;
uae_u32 ad;
uae_u32 d;
int incr = (opcode & 0x38) == 0x20 ? -1 : 1;
return;
}
+ regs.fpiar = pc;
+
if (currprefs.fpu_model == 68060) {
/* all 68060 FPU frames are 12 bytes */
if (incr < 0) {
{
int reg;
fptype src;
+ uaecptr pc = m68k_getpc () - 4;
#if DEBUG_FPP
if (!isinrom ())
- write_log (_T("FPP %04lx %04x at %08lx\n"), opcode & 0xffff, extra, m68k_getpc () - 4);
+ write_log (_T("FPP %04lx %04x at %08lx\n"), opcode & 0xffff, extra, pc);
#endif
if (fault_if_no_fpu (opcode, 4))
return;
case 3:
if (put_fp_value (regs.fp[(extra >> 7) & 7], opcode, extra) == 0) {
- m68k_setpc (m68k_getpc () - 4);
+ m68k_setpc (pc);
op_illg (opcode);
}
return;
int incr = 0;
if (get_fp_ad (opcode, &ad) == 0) {
- m68k_setpc (m68k_getpc () - 4);
+ m68k_setpc (pc);
op_illg (opcode);
return;
}
int incr = 0;
if (get_fp_ad (opcode, &ad) == 0) {
- m68k_setpc (m68k_getpc () - 4);
+ m68k_setpc (pc);
op_illg (opcode);
return;
}
if (extra & 0x2000) {
/* FMOVEM FPP->memory */
if (get_fp_ad (opcode, &ad) == 0) {
- m68k_setpc (m68k_getpc () - 4);
+ m68k_setpc (pc);
op_illg (opcode);
return;
}
} else {
/* FMOVEM memory->FPP */
if (get_fp_ad (opcode, &ad) == 0) {
- m68k_setpc (m68k_getpc () - 4);
+ m68k_setpc (pc);
op_illg (opcode);
return;
}
regs.fp[reg] = *fp_1e4096;
break;
default:
- m68k_setpc (m68k_getpc () - 4);
+ m68k_setpc (pc);
op_illg (opcode);
return;
}
return;
}
if (get_fp_value (opcode, extra, &src) == 0) {
- m68k_setpc (m68k_getpc () - 4);
+ m68k_setpc (pc);
op_illg (opcode);
return;
}
+ regs.fpiar = pc;
+
switch (extra & 0x7f) {
case 0x00: /* FMOVE */
MAKE_FPSR (src);
return;
default:
- m68k_setpc (m68k_getpc () - 4);
+ m68k_setpc (pc);
op_illg (opcode);
return;
}
MAKE_FPSR (regs.fp[reg]);
return;
}
- m68k_setpc (m68k_getpc () - 4);
+ m68k_setpc (pc);
op_illg (opcode);
}
int old_brace_level;
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0, 0);
+ if (cpu_level == 5 && curi->size > 0) {
+ printf ("\tif ((dsta & %d) && currprefs.cpu_compatible && get_cpu_model () == 68060) {\n", curi->size == 1 ? 1 : 3);
+ printf ("\t\top_unimpl ();\n");
+ printf ("\t\tgoto %s;\n", endlabelstr);
+ printf ("\t}\n");
+ need_endlabel = 1;
+ }
fill_prefetch_0 ();
start_brace ();
printf ("\tint ru = (src >> 6) & 7;\n");
extern void dumpcia (void);
extern void rethink_cias (void);
extern int resetwarning_do (int);
+extern void cia_set_overlay (bool);
extern int parallel_direct_write_data (uae_u8, uae_u8);
extern int parallel_direct_read_data (uae_u8*);
#define DMA_EVENT_COPPERWAKE 16
#define DMA_EVENT_CPUIRQ 32
#define DMA_EVENT_INTREQ 64
+#define DMA_EVENT_COPPERWANTED 128
#define DMARECORD_REFRESH 1
#define DMARECORD_CPU 2
void getfilteroffset (int *dx, int *dy, int *mx, int *my);
uae_u8 *getfilterbuffer (int *widthp, int *heightp, int *pitch, int *depth);
uae_u8 *getfilterbuffer3d (int *widthp, int *heightp, int *pitch, int *depth);
+uae_u8 *getrtgbuffer (int *widthp, int *heightp, int *pitch, int *depth, uae_u8 *palette);
+void freertgbuffer (uae_u8 *dst);
extern void getrtgfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height);
#endif
#endif
bool init_shm (void);
+void free_shm (void);
bool preinit_shm (void);
extern bool canbang;
extern int candirect;
uae_u8 *native_address;
int id;
uae_u32 size;
+ const TCHAR *name;
struct shmpiece_reg *next;
struct shmpiece_reg *prev;
} shmpiece;
#endif
extern uae_u32 REGPARAM3 op_illg (uae_u32) REGPARAM;
+extern void REGPARAM3 op_unimpl (void) REGPARAM;
typedef uae_u8 flagtype;
unsigned int suse:1;
unsigned int duse:1;
unsigned int unused1:1;
- unsigned int clev:3;
+ unsigned int clev:3, unimpclev:3;
unsigned int isjmp:1;
- unsigned int unused2:4;
+ unsigned int unused2:1;
} *table68k;
extern void read_table68k (void);
extern void console_out_f (const TCHAR *, ...);
extern void console_flush (void);
extern int console_get (TCHAR *, int);
+extern bool console_isch (void);
extern TCHAR console_getch (void);
extern void f_out (void *, const TCHAR *, ...);
extern TCHAR* buf_out (TCHAR *buffer, int *bufsize, const TCHAR *format, ...);
device_func_reset ();
savestate_free ();
memory_cleanup ();
+ free_shm ();
cfgfile_addcfgparam (0);
machdep_free ();
}
init_shm ();
#endif
+#ifdef PICASSO96
+ picasso_reset ();
+#endif
+
+#if 0
#ifdef JIT
if (!(currprefs.cpu_model >= 68020 && currprefs.address_space_24 == 0 && currprefs.cachesize))
canbang = 0;
+#endif
#endif
fixup_prefs (&currprefs);
savestate_init ();
keybuf_init (); /* Must come after init_joystick */
+ memory_hardreset (2);
memory_reset ();
#ifdef AUTOCONFIG
/* Set by each memory handler that does not simply access real memory. */
int special_mem;
#endif
-static int mem_hardreset = 3;
+static int mem_hardreset;
static bool isdirectjit (void)
{
}
static bool needmman (void)
{
- if (canjit ())
- return true;
#ifdef _WIN32
- if (currprefs.rtgmem_size)
- return true;
+ return true;
#endif
+ if (canjit ())
+ return true;
return false;
}
and we must clear all memory to prevent bogus contents from confusing
the Kickstart. */
static bool need_hardreset;
+static bool bogomem_aliasing;
/* The address space setting used during the last reset. */
static bool last_address_space_24;
case EXTENDED_ROM_CDTV:
extendedkickmemory = mapped_malloc (extendedkickmem_size, _T("rom_f0"));
extendedkickmem_bank.baseaddr = extendedkickmemory;
+ extendedkickmem_start = 0xf00000;
break;
case EXTENDED_ROM_CD32:
extendedkickmemory = mapped_malloc (extendedkickmem_size, _T("rom_e0"));
extendedkickmem_bank.baseaddr = extendedkickmemory;
+ extendedkickmem_start = 0xe00000;
break;
}
if (extendedkickmemory) {
extendedkickmem_type = EXTENDED_ROM_CDTV;
extendedkickmem_size *= 2;
extendedkickmemory = mapped_malloc (extendedkickmem_size, _T("rom_f0"));
+ extendedkickmem_start = 0xf00000;
} else {
extendedkickmem_type = EXTENDED_ROM_KS;
extendedkickmemory = mapped_malloc (extendedkickmem_size, _T("rom_e0"));
+ extendedkickmem_start = 0xe00000;
}
extendedkickmem_bank.baseaddr = extendedkickmemory;
zfile_fseek (f, extpos, SEEK_SET);
zfile_fseek (f, extpos + 524288 * 2, SEEK_SET);
read_kickstart (f, extendedkickmemory2 + 524288, 524288, 0, 1);
extendedkickmem2_mask = extendedkickmem2_size - 1;
+ extendedkickmem2_start = 0xa80000;
}
}
write_log (_T("End Dump:\n"));
}
-static shmpiece *find_shmpiece (uae_u8 *base)
+static shmpiece *find_shmpiece (uae_u8 *base, bool safe)
{
shmpiece *x = shm_start;
while (x && x->native_address != base)
x = x->next;
if (!x) {
+ if (safe || bogomem_aliasing)
+ return 0;
write_log (_T("NATMEM: Failure to find mapping at %08X, %p\n"), base - NATMEM_OFFSET, base);
nocanbang ();
return 0;
static void delete_shmmaps (uae_u32 start, uae_u32 size)
{
-#if 0
if (!needmman ())
return;
-#endif
while (size) {
uae_u8 *base = mem_banks[bankindex (start)]->baseaddr;
shmpiece *x;
//base = ((uae_u8*)NATMEM_OFFSET)+start;
- x = find_shmpiece (base);
+ x = find_shmpiece (base, true);
if (!x)
return;
shmpiece *y;
uae_u8 *base = what->baseaddr;
-#if 0
if (!needmman ())
return;
-#endif
+
if (!base)
return;
- x = find_shmpiece (base);
+ x = find_shmpiece (base, false);
if (!x)
return;
+
y = xmalloc (shmpiece, 1);
*y = *x;
base = ((uae_u8 *) NATMEM_OFFSET) + start;
shmpiece *x;
static int recurse;
-#if 0
if (!needmman ()) {
nocanbang ();
return xcalloc (uae_u8, s + 4);
}
-#endif
id = shmget (IPC_PRIVATE, s, 0x1ff, file);
if (id == -1) {
x->native_address = (uae_u8*)answer;
x->id = id;
x->size = s;
+ x->name = file;
x->next = shm_start;
x->prev = NULL;
if (x->next)
static void allocate_memory (void)
{
+ bogomem_aliasing = false;
/* emulate 0.5M+0.5M with 1M Agnus chip ram aliasing */
- if ((allocated_chipmem != currprefs.chipmem_size || allocated_bogomem != currprefs.bogomem_size) &&
- currprefs.chipmem_size == 0x80000 && currprefs.bogomem_size >= 0x80000 &&
- (currprefs.chipset_mask & CSMASK_ECS_AGNUS) && !(currprefs.chipset_mask & CSMASK_AGA) && !needmman ()) {
- int memsize1, memsize2;
- if (chipmemory)
- mapped_free (chipmemory);
- chipmemory = 0;
- if (bogomemory_allocated)
- mapped_free (bogomemory);
- bogomemory = 0;
- bogomemory_allocated = 0;
- memsize1 = allocated_chipmem = currprefs.chipmem_size;
- memsize2 = allocated_bogomem = currprefs.bogomem_size;
- chipmem_mask = allocated_chipmem - 1;
- chipmem_full_mask = allocated_chipmem * 2 - 1;
- chipmem_full_size = 0x80000 * 2;
- chipmemory = mapped_malloc (memsize1 + memsize2, _T("chip"));
- bogomemory = chipmemory + memsize1;
- bogomem_mask = allocated_bogomem - 1;
- if (chipmemory == 0) {
- write_log (_T("Fatal error: out of memory for chipmem.\n"));
- allocated_chipmem = 0;
- } else {
- need_hardreset = 1;
+ if (currprefs.chipmem_size == 0x80000 && currprefs.bogomem_size >= 0x80000 &&
+ (currprefs.chipset_mask & CSMASK_ECS_AGNUS) && !(currprefs.chipset_mask & CSMASK_AGA) && currprefs.cpu_model < 68020) {
+ if ((allocated_chipmem != currprefs.chipmem_size || allocated_bogomem != currprefs.bogomem_size)) {
+ int memsize1, memsize2;
+ if (chipmemory)
+ mapped_free (chipmemory);
+ chipmemory = 0;
+ if (bogomemory_allocated)
+ mapped_free (bogomemory);
+ bogomemory = 0;
+ bogomemory_allocated = 0;
+ memsize1 = allocated_chipmem = currprefs.chipmem_size;
+ memsize2 = allocated_bogomem = currprefs.bogomem_size;
+ chipmem_mask = allocated_chipmem - 1;
+ chipmem_full_mask = allocated_chipmem * 2 - 1;
+ chipmem_full_size = 0x80000 * 2;
+ chipmemory = mapped_malloc (memsize1 + memsize2, _T("chip"));
+ bogomemory = chipmemory + memsize1;
+ bogomem_mask = allocated_bogomem - 1;
+ if (chipmemory == 0) {
+ write_log (_T("Fatal error: out of memory for chipmem.\n"));
+ allocated_chipmem = 0;
+ } else {
+ need_hardreset = true;
+ }
}
+ bogomem_aliasing = true;
}
if (allocated_chipmem != currprefs.chipmem_size) {
write_log (_T("Fatal error: out of memory for chipmem.\n"));
allocated_chipmem = 0;
} else {
- need_hardreset = 1;
+ need_hardreset = true;
if (memsize > allocated_chipmem)
memset (chipmemory + allocated_chipmem, 0xff, memsize - allocated_chipmem);
}
allocated_bogomem = 0;
}
}
- need_hardreset = 1;
+ need_hardreset = true;
}
if (allocated_a3000lmem != currprefs.mbresmem_low_size) {
if (a3000lmemory)
allocated_a3000lmem = 0;
}
}
- need_hardreset = 1;
+ need_hardreset = true;
}
if (allocated_a3000hmem != currprefs.mbresmem_high_size) {
if (a3000hmemory)
allocated_a3000hmem = 0;
}
}
- need_hardreset = 1;
+ need_hardreset = true;
}
#ifdef CDTV
if (allocated_cardmem != currprefs.cs_cdtvcard * 1024) {
int bnk, bnk_end;
bool gayleorfatgary;
+ need_hardreset = false;
+ /* Use changed_prefs, as m68k_reset is called later. */
+ if (last_address_space_24 != changed_prefs.address_space_24)
+ need_hardreset = true;
+ last_address_space_24 = changed_prefs.address_space_24;
+
if (mem_hardreset > 2)
memory_init ();
gayleorfatgary = (currprefs.chipset_mask & CSMASK_AGA) || currprefs.cs_pcmcia || currprefs.cs_ide > 0 || currprefs.cs_mbdmac;
- need_hardreset = 0;
- /* Use changed_prefs, as m68k_reset is called later. */
- if (last_address_space_24 != changed_prefs.address_space_24)
- need_hardreset = 1;
-
- last_address_space_24 = changed_prefs.address_space_24;
-
init_mem_banks ();
allocate_memory ();
chipmem_setindirect ();
memcpy (currprefs.romfile, changed_prefs.romfile, sizeof currprefs.romfile);
memcpy (currprefs.romextfile, changed_prefs.romextfile, sizeof currprefs.romextfile);
- need_hardreset = 1;
+ need_hardreset = true;
mapped_free (extendedkickmemory);
extendedkickmemory = 0;
extendedkickmem_size = 0;
void memory_init (void)
{
+ init_mem_banks ();
virtualdevice_init ();
allocated_chipmem = 0;
custmem1 = 0;
custmem2 = 0;
- init_mem_banks ();
-
kickmemory = mapped_malloc (0x80000, _T("kick"));
memset (kickmemory, 0, 0x80000);
kickmem_bank.baseaddr = kickmemory;
}
xfree (s);
if (!crcdet)
- write_log (_T("WARNING: ROM '%s' not found!\n"), romn);
+ write_log (_T("WARNING: ROM '%s' %d.%d (CRC32=%08x %08x-%08x) not found!\n"),
+ romn, version >> 16, version & 0xffff, crc32, mem_start, mem_start + mem_size - 1);
xfree (romn);
return src;
}
mem_real_start = extendedkickmemory;
mem_size = extendedkickmem_size;
path = currprefs.romextfile;
+ version = longget (mem_start + 12); /* version+revision */
+ if (version == 0xffffffff)
+ version = longget (mem_start + 16);
_stprintf (tmpname, _T("Extended"));
break;
default:
op_illg (opcode);
return 4;
}
+static uae_u32 REGPARAM2 op_unimpl_1 (uae_u32 opcode)
+{
+ if ((opcode & 0xf000) == 0xf000 || currprefs.cpu_model < 68060)
+ op_illg (opcode);
+ else
+ op_unimpl ();
+ return 4;
+}
static void build_cpufunctbl (void)
{
cpufunctbl[tbl[i].opcode] = tbl[i].handler;
}
}
+
opcnt = 0;
for (opcode = 0; opcode < 65536; opcode++) {
cpuop_func *f;
+ instr *table = &table68k[opcode];
+
+ if (table->mnemo == i_ILLG)
+ continue;
- if (table68k[opcode].mnemo == i_ILLG)
+ /* unimplemented opcode? */
+ if (table->unimpclev > 0 && lvl >= table->unimpclev) {
+ if (currprefs.cpu_compatible && currprefs.cpu_model == 68060) {
+ cpufunctbl[opcode] = op_unimpl_1;
+ } else {
+ cpufunctbl[opcode] = op_illg_1;
+ }
continue;
+ }
+
if (currprefs.fpu_model && currprefs.cpu_model < 68020) {
/* more hack fpu to 68000/68010 mode */
- if (table68k[opcode].clev > lvl && (opcode & 0xfe00) != 0xf200)
+ if (table->clev > lvl && (opcode & 0xfe00) != 0xf200)
continue;
- } else if (table68k[opcode].clev > lvl) {
+ } else if (table->clev > lvl) {
continue;
}
- if (table68k[opcode].handler != -1) {
- int idx = table68k[opcode].handler;
+ if (table->handler != -1) {
+ int idx = table->handler;
f = cpufunctbl[idx];
if (f == op_illg_1)
abort ();
void m68k_divl (uae_u32 opcode, uae_u32 src, uae_u16 extra)
{
-#if defined (uae_s64)
+ if ((extra & 0x400) && currprefs.cpu_compatible && currprefs.cpu_model == 68060) {
+ op_unimpl ();
+ return;
+ }
if (src == 0) {
Exception (5);
return;
}
+#if defined (uae_s64)
if (extra & 0x800) {
/* signed variant */
uae_s64 a = (uae_s64)(uae_s32)m68k_dreg (regs, (extra >> 12) & 7);
}
}
#else
- if (src == 0) {
- Exception (5);
- return;
- }
if (extra & 0x800) {
/* signed variant */
uae_s32 lo = (uae_s32)m68k_dreg (regs, (extra >> 12) & 7);
void m68k_mull (uae_u32 opcode, uae_u32 src, uae_u16 extra)
{
+ if ((extra & 0x400) && currprefs.cpu_compatible && currprefs.cpu_model == 68060) {
+ op_unimpl ();
+ return;
+ }
#if defined (uae_s64)
if (extra & 0x800) {
/* signed variant */
fill_prefetch_quick ();
}
+void REGPARAM2 op_unimpl (void)
+{
+ Exception (61);
+}
+
uae_u32 REGPARAM2 op_illg (uae_u32 opcode)
{
uaecptr pc = m68k_getpc ();
void mmu_op30 (uaecptr pc, uae_u32 opcode, uae_u16 extra, uaecptr extraa)
{
- if (currprefs.cpu_model != 68030) {
- m68k_setpc (pc);
- op_illg (opcode);
- return;
- }
if (extra & 0x8000)
mmu_op30_ptest (pc, opcode, extra, extraa);
else if (extra & 0x2000)
struct mnemolookup *lookup;
struct instr *dp;
int oldpc;
+ int m68kpc_illg = 0;
+ bool illegal = false;
oldpc = m68kpc_offset;
opcode = get_iword_1 (m68kpc_offset);
- if (cpufunctbl[opcode] == op_illg_1) {
- opcode = 0x4AFC;
+ if (cpufunctbl[opcode] == op_illg_1 || cpufunctbl[opcode] == op_unimpl_1) {
+ m68kpc_illg = m68kpc_offset + 2;
+ illegal = TRUE;
}
+
dp = table68k + opcode;
+ if (dp->mnemo == i_ILLG) {
+ illegal = FALSE;
+ opcode = 0x4AFC;
+ dp = table68k + opcode;
+ }
for (lookup = lookuptab;lookup->mnemo != dp->mnemo; lookup++)
;
buf = buf_out (buf, &bufsize, _T("%08lX "), m68k_getpc () + m68kpc_offset);
m68kpc_offset += 2;
-
+
if (lookup->friendlyname)
_tcscpy (instrname, lookup->friendlyname);
else
while (i++ < 5)
buf = buf_out (buf, &bufsize, _T(" "));
+ if (illegal)
+ buf = buf_out (buf, &bufsize, _T("[ "));
buf = buf_out (buf, &bufsize, instrname);
+ if (illegal)
+ buf = buf_out (buf, &bufsize, _T(" ]"));
if (ccpt != 0) {
if (deaddr)
buf = buf_out (buf, &bufsize, _T(" == $%08lX"), newpc);
}
buf = buf_out (buf, &bufsize, _T("\n"));
+
+ if (illegal)
+ m68kpc_offset = m68kpc_illg;
}
if (nextpc)
*nextpc = m68k_getpc () + m68kpc_offset;
f_out (f, _T("\n"));
}
fpsr = get_fpsr ();
- f_out (f, _T("N=%d Z=%d I=%d NAN=%d\n"),
+ f_out (f, _T("FPSR: %04X FPCR: %08x FPIAR: %08x N=%d Z=%d I=%d NAN=%d\n"),
+ fpsr, regs.fpcr, regs.fpiar,
(fpsr & 0x8000000) != 0,
(fpsr & 0x4000000) != 0,
(fpsr & 0x2000000) != 0,
avioutput_fps = (int)(vblank_hz + 0.5);
if (!avioutput_fps)
avioutput_fps = ispal () ? 50 : 60;
- if (avioutput_originalsize)
- getfilterbuffer (&avioutput_width, &avioutput_height, NULL, &avioutput_bits);
+ if (avioutput_originalsize) {
+ int pitch;
+ if (!WIN32GFX_IsPicassoScreen ()) {
+ getfilterbuffer (&avioutput_width, &avioutput_height, &pitch, &avioutput_bits);
+ } else {
+ freertgbuffer (getrtgbuffer (&avioutput_width, &avioutput_height, &pitch, &avioutput_bits, NULL));
+ }
+ }
if (avioutput_width == 0 || avioutput_height == 0 || avioutput_bits == 0) {
avioutput_width = WIN32GFX_GetWidth ();
static int getFromBuffer (struct avientry *ae, int original)
{
int x, y, w, h, d;
- uae_u8 *src;
+ uae_u8 *src, *mem;
uae_u8 *dst = ae->lpVideo;
int spitch, dpitch;
+ mem = NULL;
dpitch = ((avioutput_width * avioutput_bits + 31) & ~31) / 8;
if (original) {
- src = getfilterbuffer (&w, &h, &spitch, &d);
+ if (!WIN32GFX_IsPicassoScreen ())
+ src = getfilterbuffer (&w, &h, &spitch, &d);
+ else
+ src = mem = getrtgbuffer (&w, &h, &spitch, &d, NULL);
} else {
spitch = gfxvidinfo.outbuffer->rowbytes;
src = bufmem_ptr;
}
src += spitch;
}
+ if (mem)
+ freertgbuffer (mem);
return 1;
}
#endif
dorestart ();
waitqueuefull ();
ae = allocavientry_video ();
- if (avioutput_originalsize && !WIN32GFX_IsPicassoScreen ()) {
+ if (avioutput_originalsize) {
v = getFromBuffer (ae, 1);
} else {
#if defined (GFXFILTER)
- if (!usedfilter || WIN32GFX_IsPicassoScreen ())
+ if (!usedfilter)
v = getFromDC (ae);
else
v = getFromBuffer (ae, 0);
/* open device level access to cd rom drive */
static int sys_cddev_open (struct dev_info_ioctl *ciw, int unitnum)
{
- uae_u8 inquiry[256];
- int datalen;
ciw->cdda_volume[0] = 0x7fff;
ciw->cdda_volume[1] = 0x7fff;
return 1;
}
+ memset (ciw->di.vendorid, 0, sizeof ciw->di.vendorid);
+ memset (ciw->di.productid, 0, sizeof ciw->di.productid);
+ memset (ciw->di.revision, 0, sizeof ciw->di.revision);
_tcscpy (ciw->di.vendorid, _T("UAE"));
_stprintf (ciw->di.productid, _T("SCSI CD%d IMG"), unitnum);
_tcscpy (ciw->di.revision, _T("0.2"));
+
+#if 0
+ uae_u8 inquiry[256];
+ int datalen;
memset (inquiry, 0, sizeof inquiry);
if (spti_inquiry (ciw, unitnum, inquiry, &datalen)) {
// check also that device type is non-zero and it is removable
}
close_createfile (ciw);
}
+#endif
if (!open_createfile (ciw, 0)) {
write_log (_T("IOCTL: failed to open '%s', err=%d\n"), ciw->devname, GetLastError ());
goto error;
}
+
+ STORAGE_PROPERTY_QUERY query;
+ UCHAR outBuf[20000];
+ ULONG returnedLength;
+ memset (&query, 0, sizeof query);
+ query.PropertyId = StorageDeviceProperty;
+ query.QueryType = PropertyStandardQuery;
+ if (DeviceIoControl(
+ ciw->h,
+ IOCTL_STORAGE_QUERY_PROPERTY,
+ &query,
+ sizeof (STORAGE_PROPERTY_QUERY),
+ &outBuf,
+ sizeof (outBuf),
+ &returnedLength,
+ NULL
+ )) {
+ PSTORAGE_DEVICE_DESCRIPTOR devDesc;
+ devDesc = (PSTORAGE_DEVICE_DESCRIPTOR) outBuf;
+ int size = devDesc->Version;
+ PUCHAR p = (PUCHAR) outBuf;
+ for (;;) {
+ if (offsetof(STORAGE_DEVICE_DESCRIPTOR, CommandQueueing) > size)
+ break;
+ if (size > offsetof(STORAGE_DEVICE_DESCRIPTOR, VendorIdOffset) && devDesc->VendorIdOffset && p[devDesc->VendorIdOffset]) {
+ ciw->di.vendorid[0] = 0;
+ ciw->di.productid[0] = 0;
+ ciw->di.revision[0] = 0;
+ int j = 0;
+ for (int i = devDesc->VendorIdOffset; p[i] != (UCHAR) NULL && i < returnedLength && j < sizeof (ciw->di.vendorid) / sizeof (TCHAR) - 1; i++)
+ ciw->di.vendorid[j++] = p[i];
+ }
+ if (size > offsetof(STORAGE_DEVICE_DESCRIPTOR, ProductIdOffset) && devDesc->ProductIdOffset && p[devDesc->ProductIdOffset]) {
+ int j = 0;
+ for (int i = devDesc->ProductIdOffset; p[i] != (UCHAR) NULL && i < returnedLength && j < sizeof (ciw->di.productid) / sizeof (TCHAR) - 1; i++)
+ ciw->di.productid[j++] = p[i];
+ }
+ if (size > offsetof(STORAGE_DEVICE_DESCRIPTOR, ProductRevisionOffset) && devDesc->ProductRevisionOffset && p[devDesc->ProductRevisionOffset]) {
+ int j = 0;
+ for (int i = devDesc->ProductRevisionOffset; p[i] != (UCHAR) NULL && i < returnedLength && j < sizeof (ciw->di.revision) / sizeof (TCHAR) - 1; i++)
+ ciw->di.revision[j++] = p[i];
+ }
+ trim (ciw->di.vendorid);
+ trim (ciw->di.productid);
+ trim (ciw->di.revision);
+ break;
+ }
+ }
+
write_log (_T("IOCTL: device '%s' (%s/%s/%s) opened succesfully (unit=%d,media=%d)\n"),
ciw->devname, ciw->di.vendorid, ciw->di.productid, ciw->di.revision,
unitnum, ciw->di.media_inserted);
hr = d3ddev->TestCooperativeLevel ();
if (hr == S_PRESENT_OCCLUDED)
return 0;
- if (hr == D3DERR_DEVICENOTRESET) {
- write_log (_T("%s: DEVICENOTRESET\n"), D3DHEAD);
+ if (hr == D3DERR_DEVICENOTRESET || hr == D3DERR_DEVICELOST) {
+ write_log (_T("%s: %s\n"), D3DHEAD, hr == D3DERR_DEVICENOTRESET ? _T("DEVICENOTRESET"): _T("DEVICELOST"));
devicelost = 2;
invalidatedeviceobjects ();
hr = reset ();
write_log (_T("%s: Reset succeeded\n"), D3DHEAD);
restoredeviceobjects ();
return -1;
- } else if (hr == D3DERR_DEVICELOST) {
- write_log (_T("%s: D3DERR_DEVICELOST\n"), D3DHEAD);
- invalidatedeviceobjects ();
- return 0;
} else if (hr == S_PRESENT_MODE_CHANGED) {
write_log (_T("%s: S_PRESENT_MODE_CHANGED (%d,%d)\n"), D3DHEAD, ddraw_fs, ddraw_fs_attempt);
#if 0
UCHAR outBuf[20000];
DISK_GEOMETRY dg;
GET_LENGTH_INFORMATION gli;
- PSTORAGE_ADAPTER_DESCRIPTOR adpDesc;
int gli_ok;
BOOL status;
ULONG length = 0, returned = 0, returnedLength;
showonly = TRUE;
}
- query.PropertyId = StorageAdapterProperty;
- query.QueryType = PropertyStandardQuery;
-
- status = DeviceIoControl(
- hDevice,
- IOCTL_STORAGE_QUERY_PROPERTY,
- &query,
- sizeof(STORAGE_PROPERTY_QUERY),
- &outBuf,
- sizeof (outBuf),
- &returnedLength,
- NULL
- );
- if (!status) {
- write_log (_T("IOCTL_STORAGE_QUERY_PROPERTY failed with error code %d.\n"), GetLastError());
- } else {
- adpDesc = (PSTORAGE_ADAPTER_DESCRIPTOR) outBuf;
- }
-
memset (outBuf, 0, sizeof outBuf);
query.PropertyId = StorageDeviceProperty;
query.QueryType = PropertyStandardQuery;
hDevice,
IOCTL_STORAGE_QUERY_PROPERTY,
&query,
- sizeof(STORAGE_PROPERTY_QUERY),
+ sizeof (STORAGE_PROPERTY_QUERY),
&outBuf,
sizeof outBuf,
&returnedLength,
#endif
DWORD index = 0, index2 = 0, drive;
uae_u8 *buffer;
- UINT errormode;
DWORD dwDriveMask;
static int done;
#ifdef WINDDK
buffer = (uae_u8*)VirtualAlloc (NULL, 65536, MEM_COMMIT, PAGE_READWRITE);
if (buffer) {
- errormode = SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
memset (uae_drives, 0, sizeof (uae_drives));
num_drives = 0;
hIntDevInfo = SetupDiGetClassDevs (&GUID_DEVINTERFACE_DISK, NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
}
dwDriveMask >>= 1;
}
- SetErrorMode (errormode);
#if 0
hIntDevInfo = SetupDiGetClassDevs (&GUID_DEVCLASS_MTD, NULL, NULL, DIGCF_PRESENT);
if (hIntDevInfo != INVALID_HANDLE_VALUE) {
int first = 1;
while (hfd->handle_valid) {
- DWORD errormode;
write_log (_T("testing if %s has media inserted\n"), hfd->emptyname);
status = 0;
- errormode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
SetFilePointer (hfd->handle->h, 0, NULL, FILE_BEGIN);
ret = ReadFile (hfd->handle->h, buf, hfd->blocksize, &got, NULL);
err = GetLastError ();
- SetErrorMode(errormode);
if (ret) {
if (got == hfd->blocksize) {
write_log (_T("read ok (%d)\n"), got);
uae_u32 max_z3fastmem;
-/* JIT can access few bytes outside of memory block of it executes code at the very end of memory block */
+/* JIT can access few bytes outside of memory block if it executes code at the very end of memory block */
#define BARRIER 32
-#define MAXZ3MEM 0x7F000000
+#define MAXZ3MEM32 0x7F000000
#define MAXZ3MEM64 0xF0000000
static struct shmid_ds shmids[MAX_SHMID];
}
}
size64 = total64;
- if (maxmem < 0)
- size64 = MAXZ3MEM;
- else if (maxmem > 0)
- size64 = maxmem * 1024 * 1024;
if (os_64bit) {
if (size64 > MAXZ3MEM64)
size64 = MAXZ3MEM64;
} else {
- if (size64 > MAXZ3MEM)
- size64 = MAXZ3MEM;
+ if (size64 > MAXZ3MEM32)
+ size64 = MAXZ3MEM32;
}
+ if (maxmem < 0)
+ size64 = MAXZ3MEM64;
+ else if (maxmem > 0)
+ size64 = maxmem * 1024 * 1024;
if (size64 < 8 * 1024 * 1024)
size64 = 8 * 1024 * 1024;
if (max_allowed_mman * 1024 * 1024 > size64)
if (natmem_size < 256 * 1024 * 1024)
natmem_size = 256 * 1024 * 1024;
- write_log (_T("Total physical RAM %uM\n"), totalphys64 >> 20);
+ write_log (_T("Total physical RAM %lluM. Attempting to reserve: %uM.\n"), totalphys64 >> 20, natmem_size >> 20);
for (;;) {
natmem_offset = (uae_u8*)VirtualAlloc (NULL, natmem_size, MEM_RESERVE | (VAMODE == 1 ? MEM_WRITE_WATCH : 0), PAGE_READWRITE);
if (natmem_offset)
}
}
max_z3fastmem = natmem_size;
- write_log (_T("NATMEM: Our special area: 0x%p-0x%p (%08x %dM)\n"),
+ write_log (_T("Reserved: 0x%p-0x%p (%08x %dM)\n"),
natmem_offset, (uae_u8*)natmem_offset + natmem_size,
natmem_size, natmem_size >> 20);
return true;
}
-static void resetmem (void)
+static void resetmem (bool decommit)
{
int i;
continue;
if (s->fake)
continue;
- if (((uae_u8*)s->attached - (uae_u8*)s->natmembase) >= 0x10000000)
+ if (!decommit && ((uae_u8*)s->attached - (uae_u8*)s->natmembase) >= 0x10000000)
continue;
shmaddr = natmem_offset + ((uae_u8*)s->attached - (uae_u8*)s->natmembase);
- result = virtualallocwithlock (shmaddr, size, MEM_COMMIT, PAGE_READWRITE);
- if (result != shmaddr)
- write_log (_T("NATMEM: realloc(%p-%p,%d,%d,%s) failed, err=%d\n"), shmaddr, shmaddr + size, size, s->mode, s->name, GetLastError ());
- else
- write_log (_T("NATMEM: rellocated(%p-%p,%d,%s)\n"), shmaddr, shmaddr + size, size, s->name);
+ if (decommit) {
+ VirtualFree (shmaddr, size, MEM_DECOMMIT);
+ } else {
+ result = virtualallocwithlock (shmaddr, size, decommit ? MEM_DECOMMIT : MEM_COMMIT, PAGE_READWRITE);
+ if (result != shmaddr)
+ write_log (_T("NATMEM: realloc(%p-%p,%d,%d,%s) failed, err=%d\n"), shmaddr, shmaddr + size, size, s->mode, s->name, GetLastError ());
+ else
+ write_log (_T("NATMEM: rellocated(%p-%p,%d,%s)\n"), shmaddr, shmaddr + size, size, s->name);
+ }
}
}
natmem_offset_end = natmem_offset + natmemsize;
}
- resetmem ();
+ resetmem (false);
return canbang;
}
doinit_shm ();
- resetmem ();
+ resetmem (false);
clear_shm ();
memory_hardreset (2);
return true;
}
+void free_shm (void)
+{
+ resetmem (true);
+ clear_shm ();
+}
+
void mapped_free (uae_u8 *mem)
{
shmpiece *x = shm_start;
got = TRUE;
if (getz2endaddr () <= 2 * 1024 * 1024 || currprefs.chipmem_size < 2 * 1024 * 1024)
size += BARRIER;
- }
- if(!_tcscmp (shmids[shmid].name, _T("kick"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("kick"))) {
shmaddr=natmem_offset + 0xf80000;
got = TRUE;
size += BARRIER;
readonly = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("rom_a8"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("rom_a8"))) {
shmaddr=natmem_offset + 0xa80000;
got = TRUE;
readonly = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("rom_e0"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("rom_e0"))) {
shmaddr=natmem_offset + 0xe00000;
got = TRUE;
readonly = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("rom_f0"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("rom_f0"))) {
shmaddr=natmem_offset + 0xf00000;
got = TRUE;
readonly = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("rtarea"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("rtarea"))) {
shmaddr=natmem_offset + rtarea_base;
got = TRUE;
readonly = TRUE;
readonlysize = RTAREA_TRAPS;
- }
- if(!_tcscmp (shmids[shmid].name, _T("fast"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("fast"))) {
shmaddr=natmem_offset + 0x200000;
got = TRUE;
if (!(currprefs.rtgmem_size && !currprefs.rtgmem_type))
size += BARRIER;
- }
- if(!_tcscmp (shmids[shmid].name, _T("z2_gfx"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("z2_gfx"))) {
ULONG start = getz2rtgaddr ();
got = TRUE;
p96special = TRUE;
p96ram_start = start;
if (start + currprefs.rtgmem_size < 10 * 1024 * 1024)
size += BARRIER;
- }
- if(!_tcscmp (shmids[shmid].name, _T("ramsey_low"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("ramsey_low"))) {
shmaddr=natmem_offset + a3000lmem_start;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("ramsey_high"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("ramsey_high"))) {
shmaddr=natmem_offset + a3000hmem_start;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("z3"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("z3"))) {
shmaddr=natmem_offset + z3fastmem_start;
if (!currprefs.z3fastmem2_size)
size += BARRIER;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("z3_2"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("z3_2"))) {
shmaddr=natmem_offset + z3fastmem_start + currprefs.z3fastmem_size;
size += BARRIER;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("z3_chip"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("z3_chip"))) {
shmaddr=natmem_offset + z3chipmem_start;
size += BARRIER;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("z3_gfx"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("z3_gfx"))) {
got = TRUE;
p96special = TRUE;
p96ram_start = p96mem_offset - natmem_offset;
shmaddr = natmem_offset + p96ram_start;
size += BARRIER;
- }
- if(!_tcscmp (shmids[shmid].name, _T("bogo"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("bogo"))) {
shmaddr=natmem_offset+0x00C00000;
got = TRUE;
if (currprefs.bogomem_size <= 0x100000)
size += BARRIER;
- }
- if(!_tcscmp (shmids[shmid].name, _T("filesys"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("filesys"))) {
static uae_u8 *filesysptr;
if (filesysptr == NULL)
filesysptr = xcalloc (uae_u8, size);
shmids[shmid].attached = result;
shmids[shmid].fake = true;
return result;
- }
- if(!_tcscmp (shmids[shmid].name, _T("custmem1"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("custmem1"))) {
shmaddr=natmem_offset + currprefs.custom_memory_addrs[0];
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("custmem2"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("custmem2"))) {
shmaddr=natmem_offset + currprefs.custom_memory_addrs[1];
got = TRUE;
- }
-
- if(!_tcscmp (shmids[shmid].name, _T("hrtmem"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("hrtmem"))) {
shmaddr=natmem_offset + 0x00a10000;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("arhrtmon"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("arhrtmon"))) {
shmaddr=natmem_offset + 0x00800000;
size += BARRIER;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("xpower_e2"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("xpower_e2"))) {
shmaddr=natmem_offset + 0x00e20000;
size += BARRIER;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("xpower_f2"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("xpower_f2"))) {
shmaddr=natmem_offset + 0x00f20000;
size += BARRIER;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("nordic_f0"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("nordic_f0"))) {
shmaddr=natmem_offset + 0x00f00000;
size += BARRIER;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("nordic_f4"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("nordic_f4"))) {
shmaddr=natmem_offset + 0x00f40000;
size += BARRIER;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("nordic_f6"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("nordic_f6"))) {
shmaddr=natmem_offset + 0x00f60000;
size += BARRIER;
got = TRUE;
- }
- if(!_tcscmp(shmids[shmid].name, _T("superiv_b0"))) {
+ } else if(!_tcscmp(shmids[shmid].name, _T("superiv_b0"))) {
shmaddr=natmem_offset + 0x00b00000;
size += BARRIER;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("superiv_d0"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("superiv_d0"))) {
shmaddr=natmem_offset + 0x00d00000;
size += BARRIER;
got = TRUE;
- }
- if(!_tcscmp (shmids[shmid].name, _T("superiv_e0"))) {
+ } else if(!_tcscmp (shmids[shmid].name, _T("superiv_e0"))) {
shmaddr=natmem_offset + 0x00e00000;
size += BARRIER;
got = TRUE;
setspriteimage (boardinfo);
}
-static void setconvert (void)
+static int getconvert (int rgbformat, int pixbytes)
{
- static int ohost_mode, orgbformat;
- int d = picasso_vidinfo.pixbytes;
- int v;
+ int v = 0;
+ int d = pixbytes;
- v = 0;
- switch (picasso96_state.RGBFormat)
+ switch (rgbformat)
{
case RGBFB_CLUT:
if (d == 1)
v = RGBFB_R8G8B8A8_32;
break;
}
- picasso_convert = v;
+ return v;
+}
+
+static void setconvert (void)
+{
+ static int ohost_mode, orgbformat;
+
+ picasso_convert = getconvert (picasso96_state.RGBFormat, picasso_vidinfo.pixbytes);
if (currprefs.gfx_api) {
- host_mode = d == 4 ? RGBFB_B8G8R8A8 : RGBFB_B5G6R5PC;
+ host_mode = picasso_vidinfo.pixbytes == 4 ? RGBFB_B8G8R8A8 : RGBFB_B5G6R5PC;
} else {
host_mode = DirectDraw_GetSurfacePixelFormat (NULL);
}
- if (d == 4)
+ if (picasso_vidinfo.pixbytes == 4)
alloc_colors_rgb (8, 8, 8, 16, 8, 0, 0, 0, 0, 0, p96rc, p96gc, p96bc);
else
alloc_colors_rgb (5, 6, 5, 11, 5, 0, 0, 0, 0, 0, p96rc, p96gc, p96bc);
gfx_set_picasso_colors (picasso96_state.RGBFormat);
picasso_palette ();
if (host_mode != ohost_mode || picasso96_state.RGBFormat != orgbformat) {
- write_log (_T("RTG conversion: Depth=%d HostRGBF=%d P96RGBF=%d Mode=%d\n"), d, host_mode, picasso96_state.RGBFormat, v);
+ write_log (_T("RTG conversion: Depth=%d HostRGBF=%d P96RGBF=%d Mode=%d\n"),
+ picasso_vidinfo.pixbytes, host_mode, picasso96_state.RGBFormat, picasso_convert);
ohost_mode = host_mode;
orgbformat = picasso96_state.RGBFormat;
}
uae_u16 count = m68k_dreg (regs, 1);
uaecptr boardinfo = m68k_areg (regs, 0);
uaecptr clut = boardinfo + PSSO_BoardInfo_CLUT;
+ if (start > 256 || start + count > 256)
+ return 0;
if (updateclut (clut, start, count))
full_refresh = 1;
P96TRACE((_T("SetColorArray(%d,%d)\n"), start, count));
}
}
-static void copyrow (uae_u8 *src, uae_u8 *dst, int x, int y, int width)
+static void copyrow (uae_u8 *src, uae_u8 *dst, int x, int y, int width, int srcbytesperrow, int srcpixbytes, int dstbytesperrow, int dstpixbytes, bool direct, int convert_mode)
{
- uae_u8 *src2 = src + y * picasso96_state.BytesPerRow;
- uae_u8 *dst2 = dst + y * picasso_vidinfo.rowbytes;
+ uae_u8 *src2 = src + y * srcbytesperrow;
+ uae_u8 *dst2 = dst + y * dstbytesperrow;
int endx = x + width, endx4;
- int dstpix = picasso_vidinfo.pixbytes;
- int srcpix = picasso96_state.BytesPerPixel;
+ int dstpix = dstpixbytes;
+ int srcpix = srcpixbytes;
- if (picasso96_state.RGBFormat == host_mode) {
+ if (direct) {
memcpy (dst2 + x * dstpix, src2 + x * srcpix, width * dstpix);
return;
}
// native match?
if (currprefs.gfx_api) {
- switch (picasso_convert)
+ switch (convert_mode)
{
case RGBFB_B8G8R8A8_32:
case RGBFB_R5G6B5PC_16:
return;
}
} else {
- switch (picasso_convert)
+ switch (convert_mode)
{
case RGBFB_B8G8R8A8_32:
case RGBFB_R5G6B5PC_16:
endx4 = endx & ~3;
- switch (picasso_convert)
+ switch (convert_mode)
{
/* 24bit->32bit */
case RGBFB_R8G8B8_32:
}
}
-static void copyallinvert (uae_u8 *src, uae_u8 *dst, int pwidth, int pheight)
+static void copyallinvert (uae_u8 *src, uae_u8 *dst, int pwidth, int pheight, int srcbytesperrow, int srcpixbytes, int dstbytesperrow, int dstpixbytes, bool direct, int mode_convert)
{
int x, y, w;
- w = pwidth * picasso_vidinfo.pixbytes;
- if (picasso96_state.RGBFormat == host_mode) {
+ w = pwidth * dstpixbytes;
+ if (direct) {
for (y = 0; y < pheight; y++) {
for (x = 0; x < w; x++)
dst[x] = src[x] ^ 0xff;
- dst += picasso_vidinfo.rowbytes;
- src += picasso96_state.BytesPerRow;
+ dst += dstbytesperrow;
+ src += srcbytesperrow;
}
} else {
uae_u8 *src2 = src;
for (y = 0; y < pheight; y++) {
for (x = 0; x < w; x++)
src2[x] ^= 0xff;
- copyrow (src, dst, 0, y, pwidth);
+ copyrow (src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, dstbytesperrow, dstpixbytes, direct, mode_convert);
for (x = 0; x < w; x++)
src2[x] ^= 0xff;
- src2 += picasso96_state.BytesPerRow;
+ src2 += srcbytesperrow;
}
}
}
-static void copyall (uae_u8 *src, uae_u8 *dst, int pwidth, int pheight)
+static void copyall (uae_u8 *src, uae_u8 *dst, int pwidth, int pheight, int srcbytesperrow, int srcpixbytes, int dstbytesperrow, int dstpixbytes, bool direct, int mode_convert)
{
int y;
- if (picasso96_state.RGBFormat == host_mode) {
+ if (direct) {
int w = pwidth * picasso_vidinfo.pixbytes;
for (y = 0; y < pheight; y++) {
memcpy (dst, src, w);
- dst += picasso_vidinfo.rowbytes;
- src += picasso96_state.BytesPerRow;
+ dst += dstbytesperrow;
+ src += srcbytesperrow;
}
} else {
for (y = 0; y < pheight; y++)
- copyrow (src, dst, 0, y, pwidth);
+ copyrow (src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, dstbytesperrow, dstpixbytes, direct, mode_convert);
+ }
+}
+
+uae_u8 *getrtgbuffer (int *widthp, int *heightp, int *pitch, int *depth, uae_u8 *palette)
+{
+ uae_u8 *src = p96ram_start + natmem_offset;
+ int off = picasso96_state.XYOffset - gfxmem_start;
+ int width, height, pixbytes;
+ uae_u8 *dst;
+ int convert;
+ int hmode;
+
+ if (!picasso_vidinfo.extra_mem)
+ return NULL;
+
+ width = picasso96_state.VirtualWidth;
+ height = picasso96_state.VirtualHeight;
+ pixbytes = picasso96_state.BytesPerPixel == 1 && palette ? 1 : 4;
+
+ dst = xmalloc (uae_u8, width * height * pixbytes);
+ if (!dst)
+ return NULL;
+ hmode = pixbytes == 1 ? RGBFB_CLUT : RGBFB_B8G8R8A8;
+ convert = getconvert (picasso96_state.RGBFormat, pixbytes);
+
+ if (pixbytes > 1 && hmode != convert) {
+ copyall (src + off, dst, width, height, picasso96_state.BytesPerRow, picasso96_state.BytesPerPixel, width * pixbytes, pixbytes, false, convert);
+ } else {
+ uae_u8 *dstp = dst;
+ uae_u8 *srcp = src;
+ for (int y = 0; y < height; y++) {
+ memcpy (dstp, srcp, width * pixbytes);
+ dstp += width * pixbytes;
+ srcp += picasso96_state.BytesPerRow;
+ }
}
+ if (pixbytes == 1) {
+ for (int i = 0; i < 256; i++) {
+ palette[i * 3 + 0] = picasso96_state.CLUT[i].Red;
+ palette[i * 3 + 1] = picasso96_state.CLUT[i].Green;
+ palette[i * 3 + 2] = picasso96_state.CLUT[i].Blue;
+ }
+ }
+
+ *widthp = width;
+ *heightp = height;
+ *pitch = width * pixbytes;
+ *depth = pixbytes * 8;
+
+ return dst;
+}
+void freertgbuffer (uae_u8 *dst)
+{
+ xfree (dst);
}
static bool flushpixels (void)
if (dofull) {
if (flashscreen != 0)
- copyallinvert (src + off, dst, pwidth, pheight);
+ copyallinvert (src + off, dst, pwidth, pheight,
+ picasso96_state.BytesPerRow, picasso96_state.BytesPerPixel,
+ picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes,
+ picasso96_state.RGBFormat == host_mode, picasso_convert);
else
- copyall (src + off, dst, pwidth, pheight);
+ copyall (src + off, dst, pwidth, pheight,
+ picasso96_state.BytesPerRow, picasso96_state.BytesPerPixel,
+ picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes,
+ picasso96_state.RGBFormat == host_mode, picasso_convert);
+
miny = 0;
maxy = pheight;
break;
int w = gwwpagesize / picasso96_state.BytesPerPixel;
x = (realoffset % picasso96_state.BytesPerRow) / picasso96_state.BytesPerPixel;
if (x < pwidth)
- copyrow (src + off, dst, x, y, pwidth - x);
+ copyrow (src + off, dst, x, y, pwidth - x,
+ picasso96_state.BytesPerRow, picasso96_state.BytesPerPixel,
+ picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes,
+ picasso96_state.RGBFormat == host_mode, picasso_convert);
w = (gwwpagesize - (picasso96_state.BytesPerRow - x * picasso96_state.BytesPerPixel)) / picasso96_state.BytesPerPixel;
if (y < miny)
miny = y;
y++;
while (y < pheight && w > 0) {
int maxw = w > pwidth ? pwidth : w;
- copyrow (src + off, dst, 0, y, maxw);
+ copyrow (src + off, dst, 0, y, maxw,
+ picasso96_state.BytesPerRow, picasso96_state.BytesPerPixel,
+ picasso_vidinfo.rowbytes, picasso_vidinfo.pixbytes,
+ picasso96_state.RGBFormat == host_mode, picasso_convert);
w -= maxw;
y++;
}
void picasso_reset (void)
{
- uaegfx_base = 0;
- uaegfx_old = 0;
- uaegfx_active = 0;
- interrupt_enabled = 0;
- reserved_gfxmem = 0;
- resetpalette ();
- InitPicasso96 ();
+ if (savestate_state != STATE_RESTORE) {
+ uaegfx_base = 0;
+ uaegfx_old = 0;
+ uaegfx_active = 0;
+ interrupt_enabled = 0;
+ reserved_gfxmem = 0;
+ resetpalette ();
+ InitPicasso96 ();
+ }
}
void uaegfx_install_code (uaecptr start)
init_alloc (NULL, 0);
if (uaegfx_rom && boardinfo)
inituaegfxfuncs (uaegfx_rom, boardinfo);
- if (set_gc_called) {
+#if 0
+ if (picasso_requested_on) {
+ picasso_on = true;
+ set_gc_called = 1;
init_picasso_screen ();
init_hz_p96 ();
+ picasso_refresh ();
}
+#endif
}
uae_u8 *restore_p96 (uae_u8 *src)
boardinfo = restore_u32 ();
for (i = 0; i < 4; i++)
cursorrgb[i] = restore_u32 ();
+ if (flags & 64) {
+ for (i = 0; i < 256; i++) {
+ picasso96_state.CLUT[i].Red = restore_u8 ();
+ picasso96_state.CLUT[i].Green = restore_u8 ();
+ picasso96_state.CLUT[i].Blue = restore_u8 ();
+ }
+ }
picasso96_state.HostAddress = NULL;
picasso_SetPanningInit();
picasso96_state.Extent = picasso96_state.Address + picasso96_state.BytesPerRow * picasso96_state.VirtualHeight;
dstbak = dst = xmalloc (uae_u8, 1000);
save_u32 (2);
save_u32 ((picasso_on ? 1 : 0) | (set_gc_called ? 2 : 0) | (set_panning_called ? 4 : 0) |
- (hwsprite ? 8 : 0) | (cursorvisible ? 16 : 0) | (interrupt_enabled ? 32 : 0));
+ (hwsprite ? 8 : 0) | (cursorvisible ? 16 : 0) | (interrupt_enabled ? 32 : 0) | 64);
save_u32 (currprefs.rtgmem_size);
save_u32 (picasso96_state.Address);
save_u32 (picasso96_state.RGBFormat);
save_u32 (boardinfo);
for (i = 0; i < 4; i++)
save_u32 (cursorrgb[i]);
+ for (i = 0; i < 256; i++) {
+ save_u8 (picasso96_state.CLUT[i].Red);
+ save_u8 (picasso96_state.CLUT[i].Green);
+ save_u8 (picasso96_state.CLUT[i].Blue);
+ }
*len = dst - dstbak;
return dstbak;
}
}
static HDC surface_dc, offscreen_dc;
-static BITMAPINFO bi; // bitmap info
+static BITMAPINFO *bi; // bitmap info
static LPVOID lpvBits = NULL; // pointer to bitmap bits array
static HBITMAP offscreen_bitmap;
static int screenshot_prepared;
regqueryint (NULL, _T("Screenshot_Original"), &screenshot_originalsize);
- if (screenshot_originalsize && !WIN32GFX_IsPicassoScreen ()) {
+ if (screenshot_originalsize) {
int spitch, dpitch, x, y;
- uae_u8 *src, *dst;
+ uae_u8 *src, *dst, *mem;
+ uae_u8 *palette = NULL;
+ int rgb_bb2, rgb_gb2, rgb_rb2;
+ int rgb_bs2, rgb_gs2, rgb_rs2;
+ uae_u8 pal[256 * 3];
- src = getfilterbuffer (&width, &height, &spitch, &bits);
+ if (WIN32GFX_IsPicassoScreen ()) {
+ src = mem = getrtgbuffer (&width, &height, &spitch, &bits, pal);
+ rgb_bb2 = 8;
+ rgb_gb2 = 8;
+ rgb_rb2 = 8;
+ rgb_bs2 = 0;
+ rgb_gs2 = 8;
+ rgb_rs2 = 16;
+ } else {
+ src = mem = getfilterbuffer (&width, &height, &spitch, &bits);
+ rgb_bb2 = rgb_bb;
+ rgb_gb2 = rgb_gb;
+ rgb_rb2 = rgb_rb;
+ rgb_bs2 = rgb_bs;
+ rgb_gs2 = rgb_gs;
+ rgb_rs2 = rgb_rs;
+ }
if (src == NULL || width == 0 || height == 0)
goto donormal;
- ZeroMemory (&bi, sizeof(bi));
- bi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
- bi.bmiHeader.biWidth = width;
- bi.bmiHeader.biHeight = height;
- bi.bmiHeader.biPlanes = 1;
- bi.bmiHeader.biBitCount = 24;
- bi.bmiHeader.biCompression = BI_RGB;
- dpitch = ((bi.bmiHeader.biWidth * bi.bmiHeader.biBitCount + 31) & ~31) / 8;
- bi.bmiHeader.biSizeImage = dpitch * bi.bmiHeader.biHeight;
- bi.bmiHeader.biXPelsPerMeter = 0;
- bi.bmiHeader.biYPelsPerMeter = 0;
- bi.bmiHeader.biClrUsed = 0;
- bi.bmiHeader.biClrImportant = 0;
- if (!(lpvBits = xmalloc (uae_u8, bi.bmiHeader.biSizeImage)))
+ ZeroMemory (bi, sizeof(bi));
+ bi->bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
+ bi->bmiHeader.biWidth = width;
+ bi->bmiHeader.biHeight = height;
+ bi->bmiHeader.biPlanes = 1;
+ bi->bmiHeader.biBitCount = bits <= 8 ? 8 : 24;
+ bi->bmiHeader.biCompression = BI_RGB;
+ dpitch = ((bi->bmiHeader.biWidth * bi->bmiHeader.biBitCount + 31) & ~31) / 8;
+ bi->bmiHeader.biSizeImage = dpitch * bi->bmiHeader.biHeight;
+ bi->bmiHeader.biXPelsPerMeter = 0;
+ bi->bmiHeader.biYPelsPerMeter = 0;
+ bi->bmiHeader.biClrUsed = bits <= 8 ? (1 << bits) : 0;
+ bi->bmiHeader.biClrImportant = bi->bmiHeader.biClrUsed;
+ if (bits <= 8) {
+ for (int i = 0; i < bi->bmiHeader.biClrUsed; i++) {
+ bi->bmiColors[i].rgbRed = pal[i * 3 + 0];
+ bi->bmiColors[i].rgbGreen = pal[i * 3 + 1];
+ bi->bmiColors[i].rgbBlue = pal[i * 3 + 2];
+ }
+ }
+ if (!(lpvBits = xmalloc (uae_u8, bi->bmiHeader.biSizeImage)))
goto oops;
dst = (uae_u8*)lpvBits + (height - 1) * dpitch;
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- int shift;
- uae_u32 v = 0;
- uae_u32 v2;
-
- if (bits == 16)
- v = ((uae_u16*)src)[x];
- else if (bits == 32)
- v = ((uae_u32*)src)[x];
-
- shift = 8 - rgb_bb;
- v2 = (v >> rgb_bs) & ((1 << rgb_bb) - 1);
- v2 <<= shift;
- if (rgb_bb < 8)
- v2 |= (v2 >> shift) & ((1 < shift) - 1);
- dst[x * 3 + 0] = v2;
-
- shift = 8 - rgb_gb;
- v2 = (v >> rgb_gs) & ((1 << rgb_gb) - 1);
- v2 <<= (8 - rgb_gb);
- if (rgb_gb < 8)
- v2 |= (v2 >> shift) & ((1 < shift) - 1);
- dst[x * 3 + 1] = v2;
-
- shift = 8 - rgb_rb;
- v2 = (v >> rgb_rs) & ((1 << rgb_rb) - 1);
- v2 <<= (8 - rgb_rb);
- if (rgb_rb < 8)
- v2 |= (v2 >> shift) & ((1 < shift) - 1);
- dst[x * 3 + 2] = v2;
-
+ if (bits <=8) {
+ for (y = 0; y < height; y++) {
+ memcpy (dst, src, width);
+ src += spitch;
+ dst -= dpitch;
+ }
+ } else {
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ int shift;
+ uae_u32 v = 0;
+ uae_u32 v2;
+
+ if (bits == 16)
+ v = ((uae_u16*)src)[x];
+ else if (bits == 32)
+ v = ((uae_u32*)src)[x];
+
+ shift = 8 - rgb_bb2;
+ v2 = (v >> rgb_bs2) & ((1 << rgb_bb2) - 1);
+ v2 <<= shift;
+ if (rgb_bb2 < 8)
+ v2 |= (v2 >> shift) & ((1 < shift) - 1);
+ dst[x * 3 + 0] = v2;
+
+ shift = 8 - rgb_gb2;
+ v2 = (v >> rgb_gs2) & ((1 << rgb_gb2) - 1);
+ v2 <<= (8 - rgb_gb2);
+ if (rgb_gb < 8)
+ v2 |= (v2 >> shift) & ((1 < shift) - 1);
+ dst[x * 3 + 1] = v2;
+
+ shift = 8 - rgb_rb2;
+ v2 = (v >> rgb_rs2) & ((1 << rgb_rb2) - 1);
+ v2 <<= (8 - rgb_rb2);
+ if (rgb_rb < 8)
+ v2 |= (v2 >> shift) & ((1 < shift) - 1);
+ dst[x * 3 + 2] = v2;
+
+ }
+ src += spitch;
+ dst -= dpitch;
}
- src += spitch;
- dst -= dpitch;
}
+ if (WIN32GFX_IsPicassoScreen ())
+ freertgbuffer (mem);
} else {
donormal:
// de-select offscreen_bitmap
SelectObject (offscreen_dc, hgdiobj);
- ZeroMemory (&bi, sizeof(bi));
- bi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
- bi.bmiHeader.biWidth = width;
- bi.bmiHeader.biHeight = height;
- bi.bmiHeader.biPlanes = 1;
- bi.bmiHeader.biBitCount = 24;
- bi.bmiHeader.biCompression = BI_RGB;
- bi.bmiHeader.biSizeImage = (((bi.bmiHeader.biWidth * bi.bmiHeader.biBitCount + 31) & ~31) / 8) * bi.bmiHeader.biHeight;
- bi.bmiHeader.biXPelsPerMeter = 0;
- bi.bmiHeader.biYPelsPerMeter = 0;
- bi.bmiHeader.biClrUsed = 0;
- bi.bmiHeader.biClrImportant = 0;
+ ZeroMemory (bi, sizeof(bi));
+ bi->bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
+ bi->bmiHeader.biWidth = width;
+ bi->bmiHeader.biHeight = height;
+ bi->bmiHeader.biPlanes = 1;
+ bi->bmiHeader.biBitCount = 24;
+ bi->bmiHeader.biCompression = BI_RGB;
+ bi->bmiHeader.biSizeImage = (((bi->bmiHeader.biWidth * bi->bmiHeader.biBitCount + 31) & ~31) / 8) * bi->bmiHeader.biHeight;
+ bi->bmiHeader.biXPelsPerMeter = 0;
+ bi->bmiHeader.biYPelsPerMeter = 0;
+ bi->bmiHeader.biClrUsed = 0;
+ bi->bmiHeader.biClrImportant = 0;
// Reserve memory for bitmap bits
- if (!(lpvBits = xmalloc (uae_u8, bi.bmiHeader.biSizeImage)))
+ if (!(lpvBits = xmalloc (uae_u8, bi->bmiHeader.biSizeImage)))
goto oops; // out of memory
// Have GetDIBits convert offscreen_bitmap to a DIB (device-independent bitmap):
- if (!GetDIBits (offscreen_dc, offscreen_bitmap, 0, bi.bmiHeader.biHeight, lpvBits, &bi, DIB_RGB_COLORS))
+ if (!GetDIBits (offscreen_dc, offscreen_bitmap, 0, bi->bmiHeader.biHeight, lpvBits, bi, DIB_RGB_COLORS))
goto oops; // GetDIBits FAILED
releasehdc (surface_dc);
void Screenshot_RGBinfo (int rb, int gb, int bb, int rs, int gs, int bs)
{
+ if (!bi)
+ bi = xcalloc (BITMAPINFO, sizeof BITMAPINFO + 256 * sizeof RGBQUAD);
rgb_rb = rb;
rgb_gb = gb;
rgb_bb = rb;
png_structp png_ptr;
png_infop info_ptr;
png_bytep *row_pointers;
- int h = bi.bmiHeader.biHeight;
- int w = bi.bmiHeader.biWidth;
+ int h = bi->bmiHeader.biHeight;
+ int w = bi->bmiHeader.biWidth;
+ int d = bi->bmiHeader.biBitCount;
+ png_color pngpal[256];
int i;
png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, pngtest_blah, pngtest_blah, pngtest_blah);
png_init_io (png_ptr, fp);
png_set_filter (png_ptr, 0, PNG_FILTER_NONE);
png_set_IHDR (png_ptr, info_ptr,
- w, h, 8, PNG_COLOR_TYPE_RGB,
+ w, h, 8, d <= 8 ? PNG_COLOR_TYPE_PALETTE : PNG_COLOR_TYPE_RGB,
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+ if (d <= 8) {
+ for (i = 0; i < (1 << d); i++) {
+ pngpal[i].red = bi->bmiColors[i].rgbRed;
+ pngpal[i].green = bi->bmiColors[i].rgbGreen;
+ pngpal[i].blue = bi->bmiColors[i].rgbBlue;
+ }
+ png_set_PLTE (png_ptr, info_ptr, pngpal, 1 << d);
+ }
row_pointers = xmalloc (png_bytep, h);
for (i = 0; i < h; i++) {
int j = h - i - 1;
- row_pointers[i] = (uae_u8*)lpvBits + j * (((w * 24 + 31) & ~31) / 8);
+ row_pointers[i] = (uae_u8*)lpvBits + j * (((w * (d <= 8 ? 8 : 24) + 31) & ~31) / 8);
}
png_set_rows (png_ptr, info_ptr, row_pointers);
png_write_png (png_ptr,info_ptr, PNG_TRANSFORM_BGR, NULL);
png_destroy_write_struct (&png_ptr, &info_ptr);
+ xfree (row_pointers);
return 1;
}
#endif
BITMAPFILEHEADER bfh;
// write the file header, bitmap information and pixel data
bfh.bfType = 19778;
- bfh.bfSize = sizeof (BITMAPFILEHEADER) + sizeof (BITMAPINFOHEADER) + bi.bmiHeader.biSizeImage;
+ bfh.bfSize = sizeof (BITMAPFILEHEADER) + sizeof (BITMAPINFOHEADER) + (bi->bmiHeader.biClrUsed * sizeof RGBQUAD) + bi->bmiHeader.biSizeImage;
bfh.bfReserved1 = 0;
bfh.bfReserved2 = 0;
- bfh.bfOffBits = sizeof (BITMAPFILEHEADER) + sizeof (BITMAPINFOHEADER);
+ bfh.bfOffBits = sizeof (BITMAPFILEHEADER) + sizeof (BITMAPINFOHEADER) + bi->bmiHeader.biClrUsed * sizeof RGBQUAD;
if (fwrite (&bfh, 1, sizeof (BITMAPFILEHEADER), fp) < sizeof (BITMAPFILEHEADER))
return 0; // failed to write bitmap file header
+ if (bi->bmiHeader.biClrUsed) {
+ if (fwrite (bi->bmiColors, 1, bi->bmiHeader.biClrUsed * sizeof RGBQUAD, fp) < bi->bmiHeader.biClrUsed * sizeof RGBQUAD)
+ return 0; // failed to write bitmap file header
+ }
if (fwrite (&bi, 1, sizeof (BITMAPINFOHEADER), fp) < sizeof (BITMAPINFOHEADER))
return 0; // failed to write bitmap infomation header
- if (fwrite (lpvBits, 1, bi.bmiHeader.biSizeImage, fp) < bi.bmiHeader.biSizeImage)
+ if (fwrite (lpvBits, 1, bi->bmiHeader.biSizeImage, fp) < bi->bmiHeader.biSizeImage)
return 0; // failed to write the bitmap
return 1;
}
}
if (mode == 0) {
- toclipboard (&bi, lpvBits);
+ toclipboard (bi, lpvBits);
} else {
TCHAR filename[MAX_DPATH];
TCHAR path[MAX_DPATH];
fclose (fp);
if (doprepare)
- screenshot_free();
+ screenshot_free ();
recursive--;
int shmget (key_t key, size_t size, int shmflg, const TCHAR*);
int shmctl (int shmid, int cmd, struct shmid_ds *buf);
bool init_shm (void);
+void free_shm (void);
#define PROT_READ 0x01
#define PROT_WRITE 0x02
}
#endif
#endif
+ SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
SetDllDirectory (_T(""));
/* Make sure we do an InitCommonControls() to get some advanced controls */
InitCommonControls ();
#define LANG_DLL 1
//#define WINUAEBETA _T("")
-#define WINUAEBETA _T("7")
-#define WINUAEDATE MAKEBD(2012, 7, 20)
+#define WINUAEBETA _T("9")
+#define WINUAEDATE MAKEBD(2012, 8, 1)
#define WINUAEEXTRA _T("")
//#define WINUAEEXTRA _T("AmiKit Preview")
#define WINUAEREV _T("")
ew (hDlg, IDC_CS_CACHE_TEXT, enable);
ew (hDlg, IDC_CACHE, enable);
ew (hDlg, IDC_JITENABLE, jitenable);
- ew (hDlg, IDC_COMPATIBLE, !workprefs.cpu_cycle_exact && !workprefs.cachesize);
+ ew (hDlg, IDC_COMPATIBLE, (!workprefs.cpu_cycle_exact && !workprefs.cachesize) || workprefs.cpu_model >= 68040);
ew (hDlg, IDC_COMPATIBLE_FPU, workprefs.fpu_model > 0);
#if 0
ew (hDlg, IDC_CPU_MULTIPLIER, workprefs.cpu_cycle_exact);
if (workprefs.cpu_idle > 0)
workprefs.cpu_idle = (12 - workprefs.cpu_idle) * 15;
- if (workprefs.cachesize > 0)
- workprefs.cpu_compatible = 0;
if (pages[KICKSTART_ID])
SendMessage (pages[KICKSTART_ID], WM_USER, 0, 0);
if (pages[DISPLAY_ID])
- restore only single input target to default.
+Beta 9:
+
+- Replaced readpu.c 68020+ special case TST An/PC-rel and CMP #imm,PC-rel variants with proper table68k entries.
+- Debugger disassembler decodes illegal instructions if opcode is supported by higher CPU model,
+ shown in parenthesis, note that PC is only incremented by 2 in this situation.
+- Debugger W (write to memory) command supports multiple values and strings.
+- Slow debugger commands can be aborted by pressing return (console only)
+- 64-bit DIVL.L checked div by zero exception before checking if instruction is 68060 compatible.
+- Use IOCTL_STORAGE_QUERY_PROPERTY to query optical drive vendor/product/version information instead of SCSI inquiry.
+- "Take screenshots before filtering" supported in RTG modes, takes screenshot from emulated VRAM buffer.
+ 8-bit png if 8-bit RTG mode, 24-bit png if >8 bit RTG mode. Does not capture mouse if mouse is emulated hardware sprite.
+- "Capture before filtering" recording option supported in RTG modes.
+- D3D D3DERR_DEVICELOST handling improved.
+- Inhibit Windows error dialogs completely. On some systems missing harddrive still opened annoying Windows no disk error dialog(s).
+- Improved extended ROM statefile support.
+- Save ROM overlay state to statefile separately from CIA OVL pin state, fixes loading of statefiles if current configuration has
+ CIA overlay support but state configuration does not. (Gayle based chipset or CD32)
+- Misc statefile load compatibility improvements when current config is very different compared to statefile's configuration.
+- DMA debugger 'c' = copper wanted this cycle but it wasn't available
+- BPLxDAT non-DMA modifications emulated while bitplane DMA is disabled, not perfect but at least screen isn't completely blank anymore.
+- Ancient Superfrog copper hack removed, it isn't needed anymore. (EyeQlazer/Scoopex is nearly correct now)
+
+Beta 8:
+
+- 68060 and CPU compatible checkbox ticked: generate unimplemented instruction exceptions instead of emulating instructions
+ that real 68060 don't have. Integer instructions only, 040/060 FPU emulation still supports all 6888x instructions.
+- Set FPU FPIAR register (No one shouldn't care, except unimplemented FPU exception handler which isn't supported)
+- RTG state restore broke in previous update.
+- Save RTG mode palette to statefile (Quite important missing information if dislay mode is 8-bit..)
+- More memory space reservation updates.
+- "Restart" GUI option improved, shouldn't cause strange errors if new config has 32-bit RAM enabled and old one didn't.
+- Savestates with 32-bit RAM configured should now load without need to first load configuration that has same amount
+ (or more) RAM configured.
+
Beta 7:
- Directory filesystem 64-bit seek (ACTION_CHANGE_FILE_POSITION64) broke in 240b27
console_put (txt);
}
+bool console_isch (void)
+{
+ if (realconsole) {
+ return false;
+ } else if (consoleopen < 0) {
+ DWORD events = 0;
+ GetNumberOfConsoleInputEvents (stdinput, &events);
+ return events > 0;
+ }
+ return false;
+}
+
TCHAR console_getch (void)
{
if (realconsole) {
struct instr *table68k;
-static int specialcase (uae_u16 opcode, int cpu_lev)
-{
- int mode = (opcode >> 3) & 7;
- int reg = opcode & 7;
-
- if (cpu_lev >= 2)
- return cpu_lev;
- /* TST.W A0, TST.L A0, TST.x (d16,PC) and TST.x (d8,PC,Xn) are 68020+ only */
- if ((opcode & 0xff00) == 0x4a00) {
- if (mode == 7 && (reg == 4 || reg == 2 || reg == 3))
- return 2;
- if (mode == 1) /* Ax */
- return 2;
- }
- /* CMPI.W #x,(d16,PC) and CMPI.W #x,(d8,PC,Xn) are 68020+ only */
- if ((opcode & 0xff00) == 0x0c00) {
- if (mode == 7 && (reg == 2 || reg == 3))
- return 2;
- }
- return cpu_lev;
-}
-
static amodes mode_from_str (const TCHAR *str)
{
if (_tcsncmp (str, _T("Dreg"), 4) == 0) return Dreg;
table68k[opc].duse = usedst;
table68k[opc].stype = srctype;
table68k[opc].plev = id.plevel;
- table68k[opc].clev = specialcase(opc, id.cpulevel);
+ table68k[opc].clev = id.cpulevel;
+ table68k[opc].unimpclev = id.unimpcpulevel;
#if 0
for (i = 0; i < 5; i++) {
0000 1010 0011 1100:000:XNZVC:XNZVC:10: EORSR.B #1
0000 1010 0111 1100:002:?????:?????:10: EORSR.W #1
0000 1010 zzdd dDDD:000:-NZ00:-----:13: EOR.z #z,d[!Areg]
-0000 1100 zzss sSSS:000:-NZVC:-----:11: CMP.z #z,s[!Areg,Immd]
+0000 1100 zzss sSSS:000:-NZVC:-----:11: CMP.z #z,s[!Areg,Immd,PC8r,PC16]
+0000 1100 zzss sSSS:200:-NZVC:-----:11: CMP.z #z,s[PC8r,PC16]
0000 1010 11ss sSSS:200:?????:?????:13: CAS.B #1,s[!Dreg,Areg,Immd,PC8r,PC16]
0000 1100 11ss sSSS:200:?????:?????:13: CAS.W #1,s[!Dreg,Areg,Immd,PC8r,PC16]
0000 1100 1111 1100:250:?????:?????:10: CAS2.W #2
0000 1110 zzss sSSS:202:?????:?????:13: MOVES.z #1,s[!Dreg,Areg,Immd,PC8r,PC16]
-0000 1110 11ss sSSS:250:?????:?????:13: CAS.L #1,s[!Dreg,Areg,Immd,PC8r,PC16]
+0000 1110 11ss sSSS:200:?????:?????:13: CAS.L #1,s[!Dreg,Areg,Immd,PC8r,PC16]
0000 1110 1111 1100:250:?????:?????:10: CAS2.L #2
0000 rrr1 00dd dDDD:000:-----:-----:12: MVPMR.W d[Areg-Ad16],Dr
0100 1000 11dd dDDD:000:-NZ00:-----:30: EXT.L d[Dreg]
0100 1000 11dd dDDD:000:-----:-----:02: MVMLE.L #1,d[!Dreg,Areg,Aipi]
0100 1001 11dd dDDD:200:-NZ00:-----:30: EXT.B d[Dreg]
-0100 1010 zzss sSSS:000:-NZ00:-----:10: TST.z s
+0100 1010 zzss sSSS:000:-NZ00:-----:10: TST.z s[!Areg,PC16,PC8r]
+0100 1010 zzss sSSS:200:-NZ00:-----:10: TST.z s[Areg,PC16,PC8r]
0100 1010 11dd dDDD:000:?????:?????:30: TAS.B d[!Areg]
0100 1010 1111 1100:000:?????:?????:00: ILLEGAL
-0100 1100 00ss sSSS:250:-NZVC:-----:13: MULL.L #1,s[!Areg]
-0100 1100 01ss sSSS:250:?????:?????:13: DIVL.L #1,s[!Areg]
+0100 1100 00ss sSSS:200:-NZVC:-----:13: MULL.L #1,s[!Areg]
+0100 1100 01ss sSSS:200:?????:?????:13: DIVL.L #1,s[!Areg]
0100 1100 10ss sSSS:000:-----:-----:01: MVMEL.W #1,s[!Dreg,Areg,Apdi,Immd]
0100 1100 11ss sSSS:000:-----:-----:01: MVMEL.L #1,s[!Dreg,Areg,Apdi,Immd]
0100 1110 0100 JJJJ:000:-----:XNZVC:10: TRAP #J
1111 0101 0000 1rrr:402:-----:-----:00: PFLUSH Ara
1111 0101 0001 0rrr:402:-----:-----:00: PFLUSHAN Ara
1111 0101 0001 1rrr:402:-----:-----:00: PFLUSHA Ara
+% 68040 only
1111 0101 0100 1rrr:452:-----:-----:00: PTESTR Ara
1111 0101 0110 1rrr:452:-----:-----:00: PTESTW Ara