--- uae/src/custom.c 2018/04/24 17:00:18 1.1.1.15 +++ uae/src/custom.c 2018/04/24 17:07:27 1.1.1.19 @@ -16,7 +16,7 @@ #include "config.h" #include "options.h" -#include "threaddep/penguin.h" +#include "threaddep/thread.h" #include "uae.h" #include "gensound.h" #include "sounddep/sound.h" @@ -125,13 +125,12 @@ static uae_s16 bpl1mod, bpl2mod; static uaecptr bplpt[8]; uae_u8 *real_bplpt[8]; /* Used as a debugging aid, to offset any bitplane temporarily. */ -int bploff[8]; +int bpl_off[8]; /*static int blitcount[256]; blitter debug */ static struct color_entry current_colors; static unsigned int bplcon0, bplcon1, bplcon2, bplcon3, bplcon4; -static int nr_planes_from_bplcon0, corrected_nr_planes_from_bplcon0; static unsigned int diwstrt, diwstop, diwhigh; static int diwhigh_written; static unsigned int ddfstrt, ddfstop; @@ -511,7 +510,7 @@ static void finish_playfield_line (void) } if (dmaen (DMA_BITPLANE)) - switch (nr_planes_from_bplcon0) { + switch (GET_PLANES (bplcon0)) { case 8: bplpt[7] += m2; case 7: bplpt[6] += m1; case 6: bplpt[5] += m2; @@ -564,6 +563,67 @@ static int fetchunits[] = { 8,8,8,0, 16, static int fetchstarts[] = { 3,2,1,0, 4,3,2,0, 5,4,3,0 }; static int fm_maxplanes[] = { 3,2,1,0, 3,3,2,0, 3,3,3,0 }; +static int cycle_diagram_table[3][3][9][32]; +static int *curr_diagram; +static int cycle_sequences[3*8] = { 2,1,2,1,2,1,2,1, 4,2,3,1,4,2,3,1, 8,4,6,2,7,3,5,1 }; + +static void debug_cycle_diagram(void) +{ + int fm, res, planes, cycle, v; + char aa; + + for (fm = 0; fm < 3; fm++) { + write_log ("FMODE %d\n=======\n", fm); + for (res = 0; res <= 2; res++) { + for (planes = 0; planes <= 8; planes++) { + write_log("%d: ",planes); + for (cycle = 0; cycle < 32; cycle++) { + v=cycle_diagram_table[fm][res][planes][cycle]; + if (v==0) aa='-'; else if(v>0) aa='1'; else aa='X'; + write_log("%c",aa); + } + write_log("\n"); + } + write_log("\n"); + } + } + fm=0; +} + +static void create_cycle_diagram_table(void) +{ + int fm, res, cycle, planes, v; + int fetch_start, max_planes; + int *cycle_sequence; + + for (fm = 0; fm <= 2; fm++) { + for (res = 0; res <= 2; res++) { + max_planes = fm_maxplanes[fm * 4 + res]; + fetch_start = 1 << fetchstarts[fm * 4 + res]; + cycle_sequence = &cycle_sequences[(max_planes - 1) * 8]; + max_planes = 1 << max_planes; + for (planes = 0; planes <= 8; planes++) { + for (cycle = 0; cycle < 32; cycle++) + cycle_diagram_table[fm][res][planes][cycle] = -1; + if (planes <= max_planes) { + for (cycle = 0; cycle < fetch_start; cycle++) { + if (cycle < max_planes && planes >= cycle_sequence[cycle & 7]) { + v = 1; + } else { + v = 0; + } + cycle_diagram_table[fm][res][planes][cycle] = v; + } + } + } + } + } +#if 0 + debug_cycle_diagram (); +#endif +} + + /* Used by the copper. */ static int estimated_last_fetch_cycle; static int cycle_diagram_shift; @@ -613,7 +673,14 @@ STATIC_INLINE void compute_delay_offset /* this fixes most horizontal scrolling jerkyness but can't be correct */ delayoffset = ((hpos - fm_maxplane - 0x18) & fetchstart_mask) << 1; delayoffset &= ~7; - delayoffset &= 31; + if (delayoffset & 8) + delayoffset = 8; + else if (delayoffset & 16) + delayoffset = 16; + else if (delayoffset & 32) + delayoffset = 32; + else + delayoffset = 0; } static void expand_fmodes (void) @@ -684,7 +751,7 @@ STATIC_INLINE void fetch (int nr, int fm uaecptr p; if (nr >= toscr_nr_planes) return; - p = bplpt[nr] + bploff[nr]; + p = bplpt[nr] + bpl_off[nr]; switch (fm) { case 0: fetched[nr] = chipmem_wget (p); @@ -935,7 +1002,7 @@ STATIC_INLINE void beginning_of_plane_bl /* The usual inlining tricks - don't touch unless you know what you are doing. */ STATIC_INLINE void long_fetch_ecs (int plane, int nwords, int weird_number_of_bits, int dma) { - uae_u16 *real_pt = (uae_u16 *)pfield_xlateptr (bplpt[plane] + bploff[plane], nwords * 2); + uae_u16 *real_pt = (uae_u16 *)pfield_xlateptr (bplpt[plane] + bpl_off[plane], nwords * 2); int delay = ((plane & 1) ? toscr_delay2 : toscr_delay1); int tmp_nbits = out_nbits; uae_u32 shiftbuffer = todisplay[plane][0]; @@ -990,7 +1057,7 @@ STATIC_INLINE void long_fetch_ecs (int p STATIC_INLINE void long_fetch_aga (int plane, int nwords, int weird_number_of_bits, int fm, int dma) { - uae_u32 *real_pt = (uae_u32 *)pfield_xlateptr (bplpt[plane] + bploff[plane], nwords * 2); + uae_u32 *real_pt = (uae_u32 *)pfield_xlateptr (bplpt[plane] + bpl_off[plane], nwords * 2); int delay = ((plane & 1) ? toscr_delay2 : toscr_delay1); int tmp_nbits = out_nbits; uae_u32 *shiftbuffer = todisplay[plane]; @@ -1226,7 +1293,7 @@ STATIC_INLINE void update_fetch (int unt update_toscr_planes (); pos = last_fetch_hpos; - cycle_diagram_shift = (last_fetch_hpos - fetch_cycle) & 7; + cycle_diagram_shift = (last_fetch_hpos - fetch_cycle) & fetchstart_mask; /* First, a loop that prepares us for the speedup code. We want to enter the SPEEDUP case with fetch_state == fetch_was_plane0, and then unroll @@ -1385,6 +1452,12 @@ STATIC_INLINE void decide_line (int hpos * but the new color has not been entered into the table yet. */ static void record_color_change (int hpos, int regno, unsigned long value) { + if (regno == -1 && value) { + thisline_decision.ham_seen = 1; + if (hpos < 0x18) + thisline_decision.ham_at_start = 1; + } + /* Early positions don't appear on-screen. */ if (framecnt != 0 || vpos < minfirstline || hpos < 0x18 /*|| currprefs.emul_accuracy == 0*/) @@ -1832,6 +1905,8 @@ static void reset_decisions (void) thisline_decision.plfleft = -1; thisline_decision.plflinelen = -1; + thisline_decision.ham_seen = !! (bplcon0 & 0x800); + thisline_decision.ham_at_start = !! (bplcon0 & 0x800); /* decided_res shouldn't be touched before it's initialized by decide_line(). */ thisline_decision.diwfirstword = -1; @@ -1922,14 +1997,14 @@ static void calcdiw (void) #if 0 /* This happens far too often. */ if (plffirstline < minfirstline) { - fprintf(stderr, "Warning: Playfield begins before line %d!\n", minfirstline); + write_log ("Warning: Playfield begins before line %d!\n", minfirstline); plffirstline = minfirstline; } #endif #if 0 /* Turrican does this */ if (plflastline > 313) { - fprintf (stderr, "Warning: Playfield out of range!\n"); + write_log ("Warning: Playfield out of range!\n"); plflastline = 313; } #endif @@ -1989,13 +2064,22 @@ static uae_u32 mousehack_helper (void) #ifdef PICASSO96 if (picasso_on) { - mousexpos = lastmx - picasso96_state.XOffset; - mouseypos = lastmy - picasso96_state.YOffset; + picasso_clip_mouse (&lastmx, &lastmy); + mousexpos = lastmx; + mouseypos = lastmy; } else #endif { + /* @@@ This isn't completely right, it doesn't deal with virtual + screen sizes larger than physical very well. */ if (lastmy >= gfxvidinfo.height) lastmy = gfxvidinfo.height - 1; + if (lastmy < 0) + lastmy = 0; + if (lastmx < 0) + lastmx = 0; + if (lastmx >= gfxvidinfo.width) + lastmx = gfxvidinfo.width - 1; mouseypos = coord_native_to_amiga_y (lastmy) << 1; mousexpos = coord_native_to_amiga_x (lastmx); } @@ -2264,22 +2348,10 @@ static void DMACON (int hpos, uae_u16 v) if (cdp->dmaen == chan_ena) continue; cdp->dmaen = chan_ena; - if (cdp->dmaen) { - if (cdp->state == 0) { - cdp->state = 1; - cdp->pt = cdp->lc; - cdp->wper = cdp->per; - cdp->wlen = cdp->len; - cdp->data_written = 2; - cdp->evtime = eventtab[ev_hsync].evtime - get_cycles (); - } - } else { - if (cdp->state == 1 || cdp->state == 5) { - cdp->state = 0; - cdp->last_sample = 0; - cdp->current_sample = 0; - } - } + if (cdp->dmaen) + audio_channel_enable_dma (cdp); + else + audio_channel_disable_dma (cdp); } schedule_audio (); } @@ -2291,7 +2363,7 @@ static void DMACON (int hpos, uae_u16 v) STATIC_INLINE void INTENA (uae_u16 v) { /* if (trace_intena) - fprintf (stderr, "INTENA: %04x\n", v);*/ + write_log ("INTENA: %04x\n", v);*/ setclr (&intena,v); /* There's stupid code out there that does [some INTREQ bits at level 3 are set] @@ -2343,7 +2415,8 @@ static void ADKCON (uae_u16 v) static void BEAMCON0 (uae_u16 v) { - new_beamcon0 = v & 0x20; + if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) + new_beamcon0 = v & 0x20; } static void BPLPTH (int hpos, uae_u16 v, int num) @@ -2371,15 +2444,13 @@ static void BPLCON0 (int hpos, uae_u16 v decide_line (hpos); decide_fetch (hpos); + /* HAM change? */ + if ((bplcon0 ^ v) & 0x800) { + record_color_change (hpos, -1, !! (v & 0x800)); + } + bplcon0 = v; - nr_planes_from_bplcon0 = GET_PLANES (v); - - if (currprefs.chipset_mask & CSMASK_AGA) - /* It's not clear how the copper timings are affected by the number - * of bitplanes on AGA machines */ - corrected_nr_planes_from_bplcon0 = 4; - else - corrected_nr_planes_from_bplcon0 = nr_planes_from_bplcon0 << GET_RES (bplcon0); + curr_diagram = cycle_diagram_table[fetchmode][GET_RES(bplcon0)][GET_PLANES (v)]; if (currprefs.chipset_mask & CSMASK_AGA) { decide_sprites (hpos); @@ -2516,8 +2587,9 @@ static void DDFSTOP (int hpos, uae_u16 v { /* ??? "Virtual Meltdown" sets this to 0xD2 and expects it to behave differently from 0xD0. RSI Megademo sets it to 0xd1 and expects it - to behave like 0xd0. So mask it with 0xFE. */ - v &= ~1; + to behave like 0xd0. Some people also write the high 8 bits and + expect them to be ignored. So mask it with 0xFE. */ + v &= 0xFE; if (ddfstop == v) return; decide_line (hpos); @@ -2554,12 +2626,13 @@ static void FMODE (uae_u16 v) fetchmode = 2; break; } + curr_diagram = cycle_diagram_table[fetchmode][GET_RES (v)][GET_PLANES (bplcon0)]; expand_fmodes (); } static void BLTADAT (uae_u16 v) { - maybe_blit (); + maybe_blit (0); blt_info.bltadat = v; } @@ -2570,7 +2643,7 @@ static void BLTADAT (uae_u16 v) */ static void BLTBDAT (uae_u16 v) { - maybe_blit (); + maybe_blit (0); if (bltcon1 & 2) blt_info.bltbhold = v << (bltcon1 >> 12); @@ -2578,39 +2651,39 @@ static void BLTBDAT (uae_u16 v) blt_info.bltbhold = v >> (bltcon1 >> 12); blt_info.bltbdat = v; } -static void BLTCDAT (uae_u16 v) { maybe_blit (); blt_info.bltcdat = v; } +static void BLTCDAT (uae_u16 v) { maybe_blit (0); blt_info.bltcdat = v; } -static void BLTAMOD (uae_u16 v) { maybe_blit (); blt_info.bltamod = (uae_s16)(v & 0xFFFE); } -static void BLTBMOD (uae_u16 v) { maybe_blit (); blt_info.bltbmod = (uae_s16)(v & 0xFFFE); } -static void BLTCMOD (uae_u16 v) { maybe_blit (); blt_info.bltcmod = (uae_s16)(v & 0xFFFE); } -static void BLTDMOD (uae_u16 v) { maybe_blit (); blt_info.bltdmod = (uae_s16)(v & 0xFFFE); } +static void BLTAMOD (uae_u16 v) { maybe_blit (1); blt_info.bltamod = (uae_s16)(v & 0xFFFE); } +static void BLTBMOD (uae_u16 v) { maybe_blit (1); blt_info.bltbmod = (uae_s16)(v & 0xFFFE); } +static void BLTCMOD (uae_u16 v) { maybe_blit (1); blt_info.bltcmod = (uae_s16)(v & 0xFFFE); } +static void BLTDMOD (uae_u16 v) { maybe_blit (1); blt_info.bltdmod = (uae_s16)(v & 0xFFFE); } -static void BLTCON0 (uae_u16 v) { maybe_blit (); bltcon0 = v; blinea_shift = v >> 12; } +static void BLTCON0 (uae_u16 v) { maybe_blit (0); bltcon0 = v; blinea_shift = v >> 12; } /* The next category is "Most useless hardware register". * And the winner is... */ static void BLTCON0L (uae_u16 v) { if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; - maybe_blit (); bltcon0 = (bltcon0 & 0xFF00) | (v & 0xFF); + maybe_blit (0); bltcon0 = (bltcon0 & 0xFF00) | (v & 0xFF); } -static void BLTCON1 (uae_u16 v) { maybe_blit (); bltcon1 = v; } +static void BLTCON1 (uae_u16 v) { maybe_blit (0); bltcon1 = v; } -static void BLTAFWM (uae_u16 v) { maybe_blit (); blt_info.bltafwm = v; } -static void BLTALWM (uae_u16 v) { maybe_blit (); blt_info.bltalwm = v; } +static void BLTAFWM (uae_u16 v) { maybe_blit (0); blt_info.bltafwm = v; } +static void BLTALWM (uae_u16 v) { maybe_blit (0); blt_info.bltalwm = v; } -static void BLTAPTH (uae_u16 v) { maybe_blit (); bltapt = (bltapt & 0xffff) | ((uae_u32)v << 16); } -static void BLTAPTL (uae_u16 v) { maybe_blit (); bltapt = (bltapt & ~0xffff) | (v & 0xFFFE); } -static void BLTBPTH (uae_u16 v) { maybe_blit (); bltbpt = (bltbpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTBPTL (uae_u16 v) { maybe_blit (); bltbpt = (bltbpt & ~0xffff) | (v & 0xFFFE); } -static void BLTCPTH (uae_u16 v) { maybe_blit (); bltcpt = (bltcpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTCPTL (uae_u16 v) { maybe_blit (); bltcpt = (bltcpt & ~0xffff) | (v & 0xFFFE); } -static void BLTDPTH (uae_u16 v) { maybe_blit (); bltdpt = (bltdpt & 0xffff) | ((uae_u32)v << 16); } -static void BLTDPTL (uae_u16 v) { maybe_blit (); bltdpt = (bltdpt & ~0xffff) | (v & 0xFFFE); } +static void BLTAPTH (uae_u16 v) { maybe_blit (0); bltapt = (bltapt & 0xffff) | ((uae_u32)v << 16); } +static void BLTAPTL (uae_u16 v) { maybe_blit (0); bltapt = (bltapt & ~0xffff) | (v & 0xFFFE); } +static void BLTBPTH (uae_u16 v) { maybe_blit (0); bltbpt = (bltbpt & 0xffff) | ((uae_u32)v << 16); } +static void BLTBPTL (uae_u16 v) { maybe_blit (0); bltbpt = (bltbpt & ~0xffff) | (v & 0xFFFE); } +static void BLTCPTH (uae_u16 v) { maybe_blit (0); bltcpt = (bltcpt & 0xffff) | ((uae_u32)v << 16); } +static void BLTCPTL (uae_u16 v) { maybe_blit (0); bltcpt = (bltcpt & ~0xffff) | (v & 0xFFFE); } +static void BLTDPTH (uae_u16 v) { maybe_blit (0); bltdpt = (bltdpt & 0xffff) | ((uae_u32)v << 16); } +static void BLTDPTL (uae_u16 v) { maybe_blit (0); bltdpt = (bltdpt & ~0xffff) | (v & 0xFFFE); } static void BLTSIZE (uae_u16 v) { - maybe_blit (); + maybe_blit (0); blt_info.vblitsize = v >> 6; blt_info.hblitsize = v & 0x3F; @@ -2625,7 +2698,7 @@ static void BLTSIZV (uae_u16 v) { if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; - maybe_blit (); + maybe_blit (0); oldvblts = v & 0x7FFF; } @@ -2633,7 +2706,7 @@ static void BLTSIZH (uae_u16 v) { if (! (currprefs.chipset_mask & CSMASK_ECS_AGNUS)) return; - maybe_blit (); + maybe_blit (0); blt_info.hblitsize = v & 0x7FF; blt_info.vblitsize = oldvblts; if (!blt_info.vblitsize) blt_info.vblitsize = 32768; @@ -2753,9 +2826,9 @@ static uae_u16 COLOR_READ (int num) cg = (current_colors.color_regs_aga[colreg] >> 8) & 0xFF; cb = current_colors.color_regs_aga[colreg] & 0xFF; if (bplcon3 & 0x200) - cval = ((cr & 15) << 12) | ((cg & 15) << 4) | ((cb & 15) << 0); + cval = ((cr & 15) << 8) | ((cg & 15) << 4) | ((cb & 15) << 0); else - cval = ((cr >> 4) << 12) | ((cg >> 4) << 4) | ((cb >> 4) << 0); + cval = ((cr >> 4) << 8) | ((cg >> 4) << 4) | ((cb >> 4) << 0); return cval; } @@ -2914,29 +2987,14 @@ static void JOYTEST (uae_u16 v) /* Determine which cycles are available for the copper in a display * with a agiven number of planes. */ -static int cycles_for_plane[9][8] = { - { 0, -1, 0, -1, 0, -1, 0, -1 }, - { 0, -1, 0, -1, 0, -1, 0, -1 }, - { 0, -1, 0, -1, 0, -1, 0, -1 }, - { 0, -1, 0, -1, 0, -1, 0, -1 }, - { 0, -1, 0, -1, 0, -1, 0, -1 }, - { 0, -1, 0, -1, 0, -1, 1, -1 }, - { 0, -1, 1, -1, 0, -1, 1, -1 }, - { 1, -1, 1, -1, 1, -1, 1, -1 }, - { 1, -1, 1, -1, 1, -1, 1, -1 } -}; -STATIC_INLINE int copper_cant_read (int hpos, int planes) +STATIC_INLINE int copper_cant_read (int hpos) { int t; if (hpos + 1 >= maxhpos) return 1; - if (currprefs.chipset_mask & CSMASK_AGA) - /* FIXME */ - return 0; - if (fetch_state == fetch_not_started || hpos < thisline_decision.plfleft) return 0; @@ -2944,7 +3002,7 @@ STATIC_INLINE int copper_cant_read (int || hpos >= estimated_last_fetch_cycle) return 0; - t = cycles_for_plane[planes][(hpos + cycle_diagram_shift) & 7]; + t = curr_diagram[(hpos + cycle_diagram_shift) & fetchstart_mask]; #if 0 if (t == -1) abort (); @@ -3213,7 +3271,7 @@ static void update_copper (int until_hpo } c_hpos += 2; - if (copper_cant_read (old_hpos, corrected_nr_planes_from_bplcon0)) + if (copper_cant_read (old_hpos)) continue; switch (cop_state.state) { @@ -3519,7 +3577,7 @@ static void adjust_array_sizes (void) if (p1) sprite_entries[0] = p1; if (p2) sprite_entries[1] = p2; if (p1 && p2) { - fprintf (stderr, "new max_sprite_entry=%d\n",mcc); + write_log ("new max_sprite_entry=%d\n",mcc); max_sprite_entry = mcc; } } @@ -3532,7 +3590,7 @@ static void adjust_array_sizes (void) if (p1) color_changes[0] = p1; if (p2) color_changes[1] = p2; if (p1 && p2) { - fprintf (stderr, "new max_color_change=%d\n",mcc); + write_log ("new max_color_change=%d\n",mcc); max_color_change = mcc; } } @@ -3616,7 +3674,12 @@ static void vsync_handler (void) if (bplcon0 & 4) lof ^= 0x8000; +#ifdef PICASSO96 + if (picasso_on) + picasso_handle_vsync (); +#endif vsync_handle_redraw (lof, lof_changed); + if (quit_program > 0) return; @@ -3715,12 +3778,12 @@ static void hsync_handler (void) update_audio (); /* Sound data is fetched at the beginning of each line */ - for (nr = 0; nr < 6; nr++) { + for (nr = 0; nr < 4; nr++) { struct audio_channel_data *cdp = audio_channel + nr; if (cdp->data_written == 2) { cdp->data_written = 0; - cdp->nextdat = chipmem_wget(cdp->pt); + cdp->nextdat = chipmem_wget (cdp->pt); cdp->pt += 2; if (cdp->state == 2 || cdp->state == 3) { if (cdp->wlen == 1) { @@ -3728,7 +3791,7 @@ static void hsync_handler (void) cdp->wlen = cdp->len; cdp->intreq2 = 1; } else - cdp->wlen--; + cdp->wlen = (cdp->wlen - 1) & 0xFFFF; } } } @@ -3736,7 +3799,12 @@ static void hsync_handler (void) hardware_line_completed (next_lineno); - if (++vpos == (maxvpos + (lof != 0))) { + /* In theory only an equality test is needed here - but if a program + goes haywire with the VPOSW register, it can cause us to miss this, + with vpos going into the thousands (and all the nasty consequences + this has). */ + + if (++vpos >= (maxvpos + (lof != 0))) { vpos = 0; vsync_handler (); } @@ -3886,6 +3954,7 @@ void customreset (void) copcon = 0; DSKLEN (0, 0); + bplcon0 = 0; bplcon4 = 0x11; /* Get AGA chipset into ECS compatibility mode */ bplcon3 = 0xC00; @@ -3968,7 +4037,7 @@ void customreset (void) v = bplcon0; BPLCON0 (0, 0); BPLCON0 (0, v); - FMODE (v); + FMODE (fmode); if (!(currprefs.chipset_mask & CSMASK_AGA)) { for(i = 0 ; i < 32 ; i++) { vv = current_colors.color_regs_ecs[i]; @@ -3988,6 +4057,8 @@ void customreset (void) current_colors.acolors[i] = CONVERT_RGB(vv); } } + CLXCON (clxcon); + CLXCON2 (clxcon2); calcdiw (); write_log ("State restored\n"); dumpcustom (); @@ -4010,7 +4081,7 @@ void dumpcustom (void) if (total_skipped) write_log ("Skipped frames: %d\n", total_skipped); } - /*for (i=0; i<256; i++) if (blitcount[i]) fprintf (stderr, "minterm %x = %d\n",i,blitcount[i]); blitter debug */ + /*for (i=0; i<256; i++) if (blitcount[i]) write_log ("minterm %x = %d\n",i,blitcount[i]); blitter debug */ } int intlev (void) @@ -4073,11 +4144,11 @@ void custom_init (void) pos = here (); - org (0xF0FF70); + org (RTAREA_BASE+0xFF70); calltrap (deftrap (mousehack_helper)); dw (RTS); - org (0xF0FFA0); + org (RTAREA_BASE+0xFFA0); calltrap (deftrap (timehack_helper)); dw (RTS); @@ -4091,7 +4162,9 @@ void custom_init (void) mousestate = unknown_mouse; if (needmousehack ()) - mousehack_setfollow(); + mousehack_setfollow (); + + create_cycle_diagram_table (); } /* Custom chip memory bank */ @@ -4278,6 +4351,7 @@ void REGPARAM2 custom_wput_1 (int hpos, case 0x108: BPL1MOD (hpos, value); break; case 0x10A: BPL2MOD (hpos, value); break; + case 0x10E: CLXCON2 (value); break; case 0x110: BPL1DAT (hpos, value); break; case 0x112: BPL2DAT (value); break; @@ -4464,7 +4538,7 @@ uae_u8 *restore_custom (uae_u8 *src) bpl1mod = RW; /* 108 BPL1MOD */ bpl2mod = RW; /* 10A BPL2MOD */ bplcon4 = RW; /* 10C BPLCON4 */ - RW; /* 10E CLXCON2* */ + clxcon2 = RW; /* 10E CLXCON2* */ for(i = 0; i < 8; i++) RW; /* BPLXDAT */ for(i = 0; i < 32; i++) @@ -4606,7 +4680,7 @@ uae_u8 *save_custom (int *len) SW (bpl1mod); /* 108 BPL1MOD */ SW (bpl2mod); /* 10A BPL2MOD */ SW (bplcon4); /* 10C BPLCON4 */ - SW (0); /* 10E CLXCON2 */ + SW (clxcon2); /* 10E CLXCON2 */ for (i = 0;i < 8; i++) SW (0); /* 110 BPLxDAT */ for ( i = 0; i < 32; i++) @@ -4690,7 +4764,7 @@ uae_u8 *save_custom_sprite(int *len, int { uae_u8 *dstbak, *dst; - dstbak = dst = malloc (1 + 4 + 2 + 2 + 2 +2 + 3*2); + dstbak = dst = malloc (25); SL (spr[num].pt); /* 120-13E SPRxPT */ SW (sprpos[num]); /* 1x0 SPRxPOS */ SW (sprctl[num]); /* 1x2 SPRxPOS */