diff --git a/src/akiko.cpp b/src/akiko.cpp index e7c7606..c51c82f 100755 --- a/src/akiko.cpp +++ b/src/akiko.cpp @@ -200,6 +200,7 @@ static void nvram_read (void) if (!cd32_nvram || cd32_nvram_size != maxlen) { xfree(cd32_nvram); cd32_nvram = xmalloc(uae_u8, maxlen); + cd32_nvram_size = maxlen; } memset(cd32_nvram, 0, maxlen); TCHAR path[MAX_DPATH]; @@ -727,7 +728,6 @@ static void sys_cddev_close (void) sys_command_close (unitnum); } unitnum = -1; - } static bool cdrom_can_return_data(void) @@ -2116,4 +2116,3 @@ void akiko_mute (int muted) } } } - diff --git a/src/blitter.cpp b/src/blitter.cpp index 96135ef..bb7941e 100755 --- a/src/blitter.cpp +++ b/src/blitter.cpp @@ -28,12 +28,10 @@ int bltptxpos, bltptxc; static int blinea_shift; static uae_u16 blinea, blineb; -static int blitline, blitfc, blitfill, blitife, blitsing, blitdesc, blit_ovf; -static int blitline_started; +static int blitline, blitfc, blitfill, blitife, blitsing, blitdesc; static int blitonedot, blitsign, blitlinepixel; static int blit_add; static int blit_modadda, blit_modaddb, blit_modaddc, blit_modaddd; -static int blit_ch; static bool shifter_skip_b, shifter_skip_y; static bool shifter_skip_b_old, shifter_skip_y_old; static uae_u16 bltcon0_old, bltcon1_old; @@ -45,11 +43,9 @@ static uae_u8 blit_filltable[256][4][2]; uae_u32 blit_masktable[BLITTER_MAX_WORDS]; static int blit_cyclecounter, blit_waitcyclecounter; -static int blit_maxcyclecounter, blit_slowdown; +static int blit_slowdown; #ifdef CPUEMU_13 -extern uae_u8 cycle_line[256]; -static int blitter_cyclecounter; static int blitter_hcounter; static int blitter_vcounter; #endif @@ -57,7 +53,6 @@ static int blitter_vcounter; static long blit_firstline_cycles; static long blit_first_cycle; static int blit_last_cycle, blit_dmacount, blit_cyclecount; -static int blit_linecycles, blit_extracycles; static int blit_faulty; static int blt_delayed_irq; static uae_u16 ddat1; @@ -221,7 +216,7 @@ static void check_channel_mods (int hpos, int ch) // (or cycle where last D write would have been if // ONEDOT was active) -static void blitter_interrupt (int hpos, int done) +static void blitter_interrupt (int done) { blt_info.blit_main = 0; if (blt_info.blit_interrupt) @@ -233,36 +228,36 @@ static void blitter_interrupt (int hpos, int done) blitter_done_notify(blitline); } -static void blitter_done (int hpos) +static void blitter_done (void) { ddat1use = 0; blt_info.blit_finald = 0; - blitter_interrupt (hpos, 1); + blitter_interrupt (1); blitter_done_notify(blitline); event2_remevent (ev2_blitter); unset_special (SPCFLAG_BLTNASTY); blt_info.blitter_dangerous_bpl = 0; } -STATIC_INLINE void blitter_maybe_done_early(int hpos) +STATIC_INLINE void blitter_maybe_done_early(void) { if (currprefs.chipset_mask & CSMASK_AGA) { if (!(bltcon0 & 0x100) || blitline) { // immediately done if D disabled or line mode. - blitter_done(hpos); + blitter_done(); return; } } // busy cleared, interrupt generated. // last D write still pending if not linemode and D channel active if (blitline) { - blitter_done(hpos); + blitter_done(); } else { if (ddat1use && (bltcon0 & 0x100)) { blt_info.blit_finald = 1 + 2; - blitter_interrupt(hpos, 0); + blitter_interrupt(0); } else { - blitter_done(hpos); + blitter_done(); } } } @@ -592,11 +587,11 @@ static void actually_do_blit(void) static void blitter_doit (void) { if (blt_info.vblitsize == 0 || (blitline && blt_info.hblitsize != 2)) { - blitter_done (current_hpos()); + blitter_done (); return; } actually_do_blit (); - blitter_done (current_hpos ()); + blitter_done (); } void blitter_handler (uae_u32 data) @@ -641,9 +636,7 @@ static void blit_bltset(int con) bltcon1_old = bltcon1; } - blit_ch = (bltcon0 & 0x0f00) >> 8; blitline = bltcon1 & 1; - blit_ovf = (bltcon1 & 0x20) != 0; shifter_skip_b = (bltcon0 & 0x400) == 0; if (blitline) { @@ -821,7 +814,7 @@ static void blitter_next_cycle(void) if (blitter_vcounter == blt_info.vblitsize) { shifter_out = false; blit_cyclecounter = 0; - blitter_maybe_done_early(last_blitter_hpos); + blitter_maybe_done_early(); } } shifter[0] = shifter_out; @@ -851,7 +844,7 @@ static void blitter_next_cycle(void) STATIC_INLINE void blitter_doddma_new(int hpos) { chipmem_agnus_wput2(bltdpt, ddat1); - alloc_cycle_blitter(hpos, &bltdpt, 4); + alloc_cycle(hpos, CYCLE_BLITTER); if (!blitline) { bltdpt += blit_add; @@ -875,7 +868,7 @@ STATIC_INLINE void blitter_dodma_new(int ch, int hpos) last_custom_value1 = blt_info.bltadat; addr = &bltapt; mod = blit_modadda; - alloc_cycle_blitter (hpos, &bltapt, 1); + alloc_cycle (hpos, CYCLE_BLITTER); break; case 2: reg = 0x72; @@ -888,7 +881,7 @@ STATIC_INLINE void blitter_dodma_new(int ch, int hpos) else blt_info.bltbhold = (((uae_u32)blt_info.bltbold << 16) | blt_info.bltbdat) >> blt_info.blitbshift; blt_info.bltbold = blt_info.bltbdat; - alloc_cycle_blitter (hpos, &bltbpt, 2); + alloc_cycle (hpos, CYCLE_BLITTER); break; case 3: reg = 0x70; @@ -896,7 +889,7 @@ STATIC_INLINE void blitter_dodma_new(int ch, int hpos) last_custom_value1 = blt_info.bltcdat; addr = &bltcpt; mod = blit_modaddc; - alloc_cycle_blitter (hpos, &bltcpt, 3); + alloc_cycle (hpos, CYCLE_BLITTER); break; default: abort (); @@ -1004,7 +997,7 @@ bool decide_blitter_maybe_write(int hpos, uaecptr addr, uae_u16 value) if (blt_info.blit_finald == 1) { // final D write blitter_doddma_new(last_blitter_hpos); - blitter_done(last_blitter_hpos); + blitter_done(); break; } @@ -1028,7 +1021,7 @@ bool decide_blitter_maybe_write(int hpos, uaecptr addr, uae_u16 value) blt_info.bltcdat = chipmem_wget_indirect(bltcpt); last_custom_value1 = blt_info.bltcdat; - alloc_cycle_blitter(last_blitter_hpos, &bltcpt, 3); + alloc_cycle(last_blitter_hpos, CYCLE_BLITTER); } else if (c == 5 && blitline) { // line 3/4 (free) @@ -1050,7 +1043,7 @@ bool decide_blitter_maybe_write(int hpos, uaecptr addr, uae_u16 value) if (blt_info.bltddat) blt_info.blitzero = 0; chipmem_wput_indirect(bltdpt, blt_info.bltddat); - alloc_cycle_blitter(last_blitter_hpos, &bltdpt, 4); + alloc_cycle(last_blitter_hpos, CYCLE_BLITTER); blitlinepixel = 0; } bltdpt = bltcpt; @@ -1108,7 +1101,7 @@ static void blitter_force_finish(void) } else { actually_do_blit (); } - blitter_done (current_hpos ()); + blitter_done (); dmacon = odmacon; } @@ -1156,7 +1149,6 @@ static void blitter_start_init (void) { blit_faulty = 0; blt_info.blitzero = 1; - blitline_started = bltcon1 & 1; blit_bltset (1 | 2); shifter_skip_b_old = shifter_skip_b; @@ -1196,7 +1188,6 @@ void do_blitter(int hpos, int copper) last_blitter_hpos = hpos; blit_firstline_cycles = blit_first_cycle = get_cycles (); blit_last_cycle = 0; - blit_maxcyclecounter = 0; blit_cyclecounter = 0; blt_info.blit_pending = 1; @@ -1221,7 +1212,6 @@ void do_blitter(int hpos, int copper) blt_info.blit_pending = 0; } - blit_maxcyclecounter = 0x7fffffff; blit_waitcyclecounter = 0; if (blitter_cycle_exact) { @@ -1235,7 +1225,6 @@ void do_blitter(int hpos, int copper) blitter_vcounter = 0; blit_cyclecounter = -BLITTER_STARTUP_CYCLES; blit_waitcyclecounter = copper; - blit_maxcyclecounter = blt_info.hblitsize * blt_info.vblitsize + 2; blt_info.blit_pending = 0; blt_info.blit_main = 1; return; @@ -1243,7 +1232,7 @@ void do_blitter(int hpos, int copper) if (blt_info.vblitsize == 0 || (blitline && blt_info.hblitsize != 2)) { if (dmaen(DMA_BLITTER)) { - blitter_done (hpos); + blitter_done (); } return; } @@ -1463,7 +1452,7 @@ uae_u8 *restore_blitter_new (uae_u8 *src) blit_last_cycle = restore_u32 (); blit_waitcyclecounter = restore_u32 (); restore_u32(); - blit_maxcyclecounter = restore_u32 (); + /*blit_maxcyclecounter =*/ restore_u32 (); blit_firstline_cycles = restore_u32 (); blit_cyclecounter = restore_u32 (); blit_slowdown = restore_u32 (); @@ -1472,7 +1461,7 @@ uae_u8 *restore_blitter_new (uae_u8 *src) restore_u16(); blitter_vcounter = restore_u16(); restore_u16(); - blit_ch = restore_u8 (); + /* blit_ch = */ restore_u8 (); restore_u8(); restore_u8(); restore_u8(); @@ -1517,7 +1506,7 @@ uae_u8 *restore_blitter_new (uae_u8 *src) shifter[2] = (tmp & 4) != 0; shifter[3] = (tmp & 8) != 0; blt_info.blit_finald = restore_u8(); - blit_ovf = restore_u8(); + /* blit_ovf = */restore_u8(); blt_info.blit_main = 0; blt_info.blit_finald = 0; @@ -1567,7 +1556,7 @@ uae_u8 *save_blitter_new (int *len, uae_u8 *dstptr) save_u32 (blit_last_cycle); save_u32 (blit_waitcyclecounter); save_u32(0); //(blit_startcycles); - save_u32 (blit_maxcyclecounter); + save_u32 (0 /*blit_maxcyclecounter*/); save_u32 (blit_firstline_cycles); save_u32 (blit_cyclecounter); save_u32 (blit_slowdown); @@ -1576,7 +1565,7 @@ uae_u8 *save_blitter_new (int *len, uae_u8 *dstptr) save_u16(0); //(blitter_hcounter2); save_u16(blitter_vcounter); save_u16(0); //(blitter_vcounter2); - save_u8 (blit_ch); + save_u8 (0 /*blit_ch*/); save_u8 (blit_dmacount); save_u8(blit_cyclecount); save_u8(0); //(blit_nod); @@ -1616,7 +1605,7 @@ uae_u8 *save_blitter_new (int *len, uae_u8 *dstptr) save_u8 (blt_info.blitter_nasty); save_u8((shifter[0] ? 1 : 0) | (shifter[1] ? 2 : 0) | (shifter[2] ? 4 : 0) | (shifter[3] ? 8 : 0)); save_u8(blt_info.blit_finald); - save_u8(blit_ovf); + save_u8(0 /*blit_ovf*/); *len = dst - dstbak; return dstbak; diff --git a/src/blkdev.cpp b/src/blkdev.cpp index ffd29b3..155a8fe 100755 --- a/src/blkdev.cpp +++ b/src/blkdev.cpp @@ -660,7 +660,7 @@ int sys_command_cd_rawread (int unitnum, uae_u8 *data, int block, int size, int freesem (unitnum); return v; } -int sys_command_cd_rawread (int unitnum, uae_u8 *data, int block, int size, int sectorsize, uae_u8 sectortype, uae_u8 scsicmd9, uae_u8 subs) +static int sys_command_cd_rawread (int unitnum, uae_u8 *data, int block, int size, int sectorsize, uae_u8 sectortype, uae_u8 scsicmd9, uae_u8 subs) { int v; if (failunit (unitnum)) @@ -1861,4 +1861,3 @@ uae_u8 *restore_cd (int num, uae_u8 *src) } #endif - diff --git a/src/cfgfile.cpp b/src/cfgfile.cpp index 115e440..4ef3547 100755 --- a/src/cfgfile.cpp +++ b/src/cfgfile.cpp @@ -3911,7 +3911,7 @@ static int cfgfile_searchconfig(const TCHAR *in, int index, TCHAR *out, int outs goto end; } if (b == '\n') { - if (!_tcsncmp (tmp, in, inlen) && ((inlen > 0 && _tcslen (tmp) > inlen && tmp[inlen] == '=') || (joker))) { + if (inlen >= 0 && !_tcsncmp (tmp, in, inlen) && ((inlen > 0 && _tcslen (tmp) > inlen && tmp[inlen] == '=') || (joker))) { if (index <= 0) { TCHAR *p; if (joker) diff --git a/src/cia.cpp b/src/cia.cpp index e37f684..516c55b 100755 --- a/src/cia.cpp +++ b/src/cia.cpp @@ -58,7 +58,7 @@ static unsigned int ciabpra; static uae_u32 ciaala, ciaalb, ciabla, ciablb; static int ciaatodon, ciabtodon; -static unsigned int ciaapra, ciaaprb, ciaadra, ciaadrb, ciaasdr, ciaasdr_buf, ciaasdr_load, ciaasdr_cnt; +static unsigned int ciaapra, ciaaprb, ciaadra, ciaadrb, ciaasdr, ciaasdr_load, ciaasdr_cnt; static unsigned int ciabprb, ciabdra, ciabdrb, ciabsdr, ciabsdr_buf, ciabsdr_load, ciabsdr_cnt; static int div10; static int kbstate, kblostsynccnt; @@ -231,7 +231,6 @@ static int CIA_update_check (void) asp = 1; if (ciaasdr_load) { ciaasdr_load = 0; - ciaasdr_buf = ciaasdr; ciaasdr_cnt = 8 * 2; } } @@ -924,7 +923,6 @@ static void WriteCIAA (uae_u16 addr,uae_u8 val) if (ciaasdr_cnt == 0) { ciaasdr_cnt = 8 * 2; ciaasdr_load = 0; - ciaasdr_buf = ciaasdr; } } CIA_calctimers (); @@ -1732,7 +1730,7 @@ uae_u8 *restore_cia (int num, uae_u8 *src) b = restore_u8 (); if (num) ciabsdr_cnt = b; else ciaasdr_cnt = b; b = restore_u8 (); - if (num) ciabsdr_buf = b; else ciaasdr_buf = b; + if (num) ciabsdr_buf = b; return src; } @@ -1817,7 +1815,7 @@ uae_u8 *save_cia (int num, int *len, uae_u8 *dstptr) save_u8 (b); save_u8 (num ? div10 / CYCLE_UNIT : 0); save_u8 (num ? ciabsdr_cnt : ciaasdr_cnt); - save_u8(num ? ciabsdr_buf : ciaasdr_buf); + save_u8(num ? ciabsdr_buf : 0); *len = dst - dstbak; return dstbak; } diff --git a/src/custom.cpp b/src/custom.cpp index c579588..ef4f528 100755 --- a/src/custom.cpp +++ b/src/custom.cpp @@ -208,7 +208,7 @@ int maxvpos = MAXVPOS_PAL; int maxvpos_nom = MAXVPOS_PAL; // nominal value (same as maxvpos but "faked" maxvpos in fake 60hz modes) int maxvpos_display = MAXVPOS_PAL; // value used for display size static const int hsyncstartpos = maxhpos_short + 13; -static int maxvpos_total = 511; +static int maxvpos_total = MAXVPOS; int minfirstline = VBLANK_ENDLINE_PAL; static int equ_vblank_endline = EQU_ENDLINE_PAL; static bool equ_vblank_toggle = true; @@ -369,7 +369,7 @@ static int copper_enabled_thisline; * Statistics */ static uae_u32 lastframetime = 0; -uae_u32 timeframes = 0; +static uae_u32 timeframes = 0; uae_u32 hsync_counter = 0; uae_u32 idletime; @@ -485,28 +485,6 @@ STATIC_INLINE void setclr (uae_u16 *p, uae_u16 val) *p &= ~val; } -STATIC_INLINE void alloc_cycle (int hpos, int type) -{ -#ifdef CPUEMU_13 - cycle_line[hpos] = type; -#endif -} -STATIC_INLINE void alloc_cycle_maybe (int hpos, int type) -{ - if ((cycle_line[hpos] & CYCLE_MASK) == 0) - alloc_cycle (hpos, type); -} - -static void alloc_cycle_ext (int hpos, int type) -{ - alloc_cycle (hpos, type); -} - -void alloc_cycle_blitter (int hpos, uaecptr *ptr, int chnum) -{ - alloc_cycle (hpos, CYCLE_BLITTER); -} - static int expand_sprres (uae_u16 con0, uae_u16 con3) { int res; @@ -1161,7 +1139,7 @@ STATIC_INLINE void maybe_first_bpl1dat (int hpos) } } -static int fetch_warn (int nr, int hpos) +static int fetch_warn (int hpos) { int add; add = refptr_val; @@ -1180,7 +1158,7 @@ static void fetch (int nr, int fm, bool modulo, int hpos) // refresh conflict? if (hpos > maxhpos - 1 || hpos == 1 || hpos == 3 || hpos == 5) { - add = fetch_warn (nr, hpos); + add = fetch_warn (hpos); } uaecptr p = bplpt[nr]; @@ -2568,19 +2546,15 @@ static void decide_line (int hpos) bool diw = diwstate == DIW_waiting_stop; if (ecs) { - if (1) { - if (last_decide_line_hpos < plfstrt && hpos >= plfstrt) { - ddfstop_matched = false; - } + if (last_decide_line_hpos < plfstrt && hpos >= plfstrt) { + ddfstop_matched = false; } } else { - if (1) { - if (last_decide_line_hpos < plfstrt && hpos >= plfstrt) { - ddfstop_matched = false; - // plfstrt==0 works strangely (Nakudemo / Vision-X) - if (plfstrt > -DDF_OFFSET) - ocs_agnus_ddf_enable_toggle = false; - } + if (last_decide_line_hpos < plfstrt && hpos >= plfstrt) { + ddfstop_matched = false; + // plfstrt==0 works strangely (Nakudemo / Vision-X) + if (plfstrt > -DDF_OFFSET) + ocs_agnus_ddf_enable_toggle = false; } } @@ -2602,32 +2576,26 @@ static void decide_line (int hpos) if (ecs) { // ECS DDFSTRT/STOP matching does not require DMA or DIW. - if (1) { - if (last_decide_line_hpos < plfstrt && hpos >= plfstrt) { - // active == already started because ddfstop was not detected in last line - if (plf_state != plf_active) { - plf_state = plf_passed_start; - strtpassed = true; - plf_start_hpos = plfstrt + DDF_OFFSET; - } + if (last_decide_line_hpos < plfstrt && hpos >= plfstrt) { + // active == already started because ddfstop was not detected in last line + if (plf_state != plf_active) { + plf_state = plf_passed_start; + strtpassed = true; + plf_start_hpos = plfstrt + DDF_OFFSET; } } - if (1) { - if ((strtpassed && hpos >= plf_start_hpos) || (last_decide_line_hpos < plf_start_hpos && hpos >= plf_start_hpos)) { - if (plf_state == plf_passed_start) { - plf_state = plf_active; - hstart = plf_start_hpos; - } + if ((strtpassed && hpos >= plf_start_hpos) || (last_decide_line_hpos < plf_start_hpos && hpos >= plf_start_hpos)) { + if (plf_state == plf_passed_start) { + plf_state = plf_active; + hstart = plf_start_hpos; } } } else { - if (1) { - int start = HARD_DDF_START_REAL; - if (last_decide_line_hpos < start && hpos >= start) { - if (!ocs_agnus_ddf_enable_toggle) - plf_state = plf_passed_enable; - ocs_agnus_ddf_enable_toggle = true; - } + int start = HARD_DDF_START_REAL; + if (last_decide_line_hpos < start && hpos >= start) { + if (!ocs_agnus_ddf_enable_toggle) + plf_state = plf_passed_enable; + ocs_agnus_ddf_enable_toggle = true; } // OCS DDFSTRT/STOP matching requires DMA and DIW enabled. if (dma && diw) { @@ -2702,19 +2670,17 @@ static void decide_line (int hpos) } if (ecs) { - if (1) { - // ddfstrt == ddfstop: ddfstrt wins. - if (plfstrt != plfstop && last_decide_line_hpos < plfstop && hpos >= plfstop && plfstop <= maxhpos - DDF_OFFSET) { - ddfstop_matched = true; - if (plf_state != plf_wait && plf_state < plf_passed_stop) { - plf_state = plf_passed_stop; - plf_end_hpos = plfstop + DDF_OFFSET; - } - } - if (last_decide_line_hpos < HARD_DDF_STOP && hpos >= HARD_DDF_STOP) { - plf_state = plf_passed_stop_act; + // ddfstrt == ddfstop: ddfstrt wins. + if (plfstrt != plfstop && last_decide_line_hpos < plfstop && hpos >= plfstop && plfstop <= maxhpos - DDF_OFFSET) { + ddfstop_matched = true; + if (plf_state != plf_wait && plf_state < plf_passed_stop) { + plf_state = plf_passed_stop; + plf_end_hpos = plfstop + DDF_OFFSET; } } + if (last_decide_line_hpos < HARD_DDF_STOP && hpos >= HARD_DDF_STOP) { + plf_state = plf_passed_stop_act; + } } else { if (dma && diw) { if (last_decide_line_hpos < plfstop && hpos >= plfstop && plfstop <= maxhpos - DDF_OFFSET && plf_state != plf_wait) { @@ -2795,7 +2761,7 @@ static bool brdspractive(void) return (bplcon3 & 2) && (bplcon0 & 1); } -static bool issprbrd (int hpos, uae_u16 bplcon0, uae_u16 bplcon3) +static bool issprbrd (int hpos) { bool brdsprt; brdsprt = (aga_mode) && brdspractive(); @@ -2816,10 +2782,10 @@ static void record_register_change (int hpos, int regno, uae_u16 value) if (value & 0x800) thisline_decision.ham_seen = 1; isbrdblank (hpos, value, bplcon3); - issprbrd (hpos, value, bplcon3); + issprbrd (hpos); } else if (regno == 0x106) { // BPLCON3 isbrdblank (hpos, bplcon0, value); - issprbrd (hpos, bplcon0, value); + issprbrd (hpos); } record_color_change (hpos, regno + 0x1000, value); } @@ -3015,7 +2981,7 @@ static void record_sprite_1 (int sprxp, uae_u16 *buf, uae_u32 datab, int num, in The data is recorded either in lores pixels (if OCS/ECS), or in hires or superhires pixels (if AGA). */ -static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16 *datb, unsigned int ctl) +static void record_sprite (int num, int sprxp, uae_u16 *data, uae_u16 *datb) { struct sprite_entry *e = curr_sprite_entries + next_sprite_entry; int word_offs; @@ -3234,7 +3200,7 @@ static void decide_sprites(int hpos, bool usepointx, bool quick) for (i = 0; i < count; i++) { int nr = nrs[i] & (MAX_SPRITES - 1); struct sprite *s = &spr[nr]; - record_sprite (next_lineno, nr, posns[i], s->data, s->datb, s->ctl); + record_sprite (nr, posns[i], s->data, s->datb); } last_sprite_point = point; } @@ -3333,7 +3299,7 @@ static void reset_decisions (void) thisline_decision.plflinelen = -1; thisline_decision.ham_seen = !! (bplcon0 & 0x800); thisline_decision.ham_at_start = !! (bplcon0 & 0x800); - thisline_decision.bordersprite_seen = issprbrd (-1, bplcon0, bplcon3); + thisline_decision.bordersprite_seen = issprbrd (-1); thisline_decision.xor_seen = (bplcon4 & 0xff00) != 0; /* decided_res shouldn't be touched before it's initialized by decide_line(). */ @@ -3815,7 +3781,7 @@ static bool blit_busy(void) return true; } -STATIC_INLINE uae_u16 DMACONR (int hpos) +STATIC_INLINE uae_u16 DMACONR (void) { dmacon &= ~(0x4000 | 0x2000); dmacon |= (blit_busy() ? 0x4000 : 0x0000) | (blt_info.blitzero ? 0x2000 : 0); @@ -4296,7 +4262,7 @@ static void ADKCON (int hpos, uae_u16 v) if (currprefs.produce_sound > 0) update_audio (); DISK_update (hpos); - DISK_update_adkcon (hpos, v); + DISK_update_adkcon (v); setclr (&adkcon,v); audio_update_adkmasks (); } @@ -4938,7 +4904,7 @@ static void SPRxDATB_1 (uae_u16 v, int num) // Undocumented AGA feature: if sprite is 64 pixel wide, SPRxDATx is written and next // cycle is DMA fetch: sprite's first 32 pixels get replaced with bitplane data. -static void sprite_get_bpl_data(int hpos, struct sprite *s, uae_u16 *dat) +static void sprite_get_bpl_data(int hpos, uae_u16 *dat) { int nr = is_bitplane_dma_inline(hpos + 1); uae_u32 v = (fmode & 3) ? fetched_aga[nr] : fetched_aga_spr[nr]; @@ -4971,7 +4937,7 @@ static void SPRxDATA (int hpos, uae_u16 v, int num) // - following 16 pixel parts: written data if (fmode & 8) { if ((fmode & 4) && is_bitplane_dma_inline(hpos - 1)) { - sprite_get_bpl_data(hpos, s, &s->data[0]); + sprite_get_bpl_data(hpos, &s->data[0]); } else { s->data[0] = last_custom_value2; } @@ -4985,7 +4951,7 @@ static void SPRxDATB (int hpos, uae_u16 v, int num) // See above if (fmode & 8) { if ((fmode & 4) && is_bitplane_dma_inline(hpos - 1)) { - sprite_get_bpl_data(hpos, s, &s->datb[0]); + sprite_get_bpl_data(hpos, &s->datb[0]); } else { s->datb[0] = last_custom_value2; } @@ -5175,7 +5141,7 @@ static int copper_cant_read(int hpos, int alloc) { if (hpos + 1 >= maxhpos) // first refresh slot return 1; - if ((hpos == maxhpos - 3) && (maxhpos & 1) && alloc >= 0) { + if ((hpos == maxhpos - 3) && (maxhpos & 1)) { if (alloc) { alloc_cycle (hpos, CYCLE_COPPER); } @@ -5219,9 +5185,9 @@ static void predict_copper (void) int until_hpos = maxhpos - 3; int force_exit = 0; - w1 = cop_state.i1; - w2 = cop_state.i2; - + w1 = cop_state.saved_i1; + w2 = cop_state.saved_i2; + switch(state) { case COP_stop: case COP_waitforever: @@ -5230,6 +5196,11 @@ static void predict_copper (void) case COP_skip1: return; + case COP_read1: + case COP_read2: + w1 = cop_state.i1; + break; + case COP_wait: if ((w2 & 0x8000) == 0) return; // wait for blitter @@ -5301,7 +5272,7 @@ static void predict_copper (void) force_exit = 1; break; } - if(reg == 0x88 || reg == 0x8a|| reg == 0x2e|| reg == 0x9a || reg == 0x9c) { + if (reg == 0x88 || reg == 0x8a|| reg == 0x2e|| reg == 0x9a || reg == 0x9c) { // 0x88, 0x8a: Copper triggers strobe // 0x2e: Copper changes copper control // 0x9a, 0x9c: maybe copper triggers interupt @@ -5364,12 +5335,12 @@ static void predict_copper (void) } } -static int custom_wput_copper (int hpos, uaecptr addr, uae_u32 value, int noget) +static int custom_wput_copper (int hpos, uaecptr addr, uae_u32 value) { int v; copper_access = 1; - v = custom_wput_1 (hpos, addr, value, noget); + v = custom_wput_1 (hpos, addr, value, 0); copper_access = 0; return v; } @@ -5439,6 +5410,9 @@ static void update_copper (int until_hpos) if (until_hpos > (maxhpos & ~1)) until_hpos = maxhpos & ~1; + bool never_blocked = currprefs.fast_copper && + ((toscr_nr_planes2 < 5 && toscr_res == RES_LORES) || (toscr_nr_planes2 < 3 && toscr_res != RES_LORES)); + for (;;) { int old_hpos = c_hpos; int hp; @@ -5446,14 +5420,16 @@ static void update_copper (int until_hpos) if (c_hpos >= until_hpos) break; - /* So we know about the fetch state. */ - decide_line (c_hpos); - // bitplane only, don't want blitter to steal our cycles. - decide_fetch (c_hpos); - + if (!never_blocked) { // copper never blocked by bitplane dma + /* So we know about the fetch state. */ + decide_line (c_hpos); + // bitplane only, don't want blitter to steal our cycles. + decide_fetch (c_hpos); + } + if (cop_state.movedelay) { // cop_state.movedelay is 0 or 1 cop_state.movedelay = 0; - custom_wput_copper (c_hpos, cop_state.moveaddr, cop_state.movedata, 0); + custom_wput_copper (c_hpos, cop_state.moveaddr, cop_state.movedata); if (! copper_enabled_thisline) goto out; } @@ -5609,7 +5585,7 @@ static void update_copper (int until_hpos) cop_state.movedata = data; cop_state.movedelay = 1; } else { - custom_wput_copper (old_hpos, reg, data, 0); + custom_wput_copper (old_hpos, reg, data); } } } @@ -6547,7 +6523,7 @@ static void events_dmal_hsync(void) if (currprefs.cpu_memory_cycle_exact) { for (int i = 0; i < 6 + 8; i += 2) { if (dmal & (3 << i)) { - alloc_cycle_ext(i + 7, CYCLE_MISC); + alloc_cycle(i + 7, CYCLE_MISC); } } } @@ -7241,7 +7217,7 @@ static uae_u32 REGPARAM2 custom_wget_1(int hpos, uaecptr addr, int noput, bool i switch (addr & 0x1fe) { case 0x000: v = 0xffff; break; /* BPLDDAT */ - case 0x002: v = DMACONR (hpos); break; + case 0x002: v = DMACONR (); break; case 0x004: v = VPOSR (); break; case 0x006: v = VHPOSR (); break; @@ -7726,7 +7702,7 @@ uae_u8 *restore_custom (uae_u8 *src) RW; /* 06C ? */ RW; /* 06E ? */ BLTCDAT (0, RW); /* 070 BLTCDAT */ - BLTBDAT(0, RW); /* 072 BLTBDAT */ + BLTBDAT(0, RW); /* 072 BLTBDAT */ BLTADAT (0, RW); /* 074 BLTADAT */ RW; /* 076 ? */ RW; /* 078 ? */ @@ -7815,7 +7791,7 @@ uae_u8 *restore_custom (uae_u8 *src) current_colors.extra = 0; if (isbrdblank (-1, bplcon0, bplcon3)) current_colors.extra |= 1 << CE_BORDERBLANK; - if (issprbrd(-1, bplcon0, bplcon3)) + if (issprbrd(-1)) current_colors.extra |= 1 << CE_BORDERSPRITE; if ((currprefs.chipset_mask & CSMASK_ECS_DENISE) && (bplcon0 & 1) && (bplcon3 & 0x10)) current_colors.extra |= 1 << CE_BORDERNTRANS; diff --git a/src/disk.cpp b/src/disk.cpp index 2bdbeb3..87d0be9 100755 --- a/src/disk.cpp +++ b/src/disk.cpp @@ -2633,7 +2633,7 @@ static void disk_insert_2 (int num, const TCHAR *name, bool forced, bool forcedw } } -void disk_insert (int num, const TCHAR *name, bool forcedwriteprotect) +static void disk_insert (int num, const TCHAR *name, bool forcedwriteprotect) { set_config_changed (); target_addtorecent (name, 0); @@ -2685,7 +2685,7 @@ void DISK_vsync (void) int disk_empty (int num) { - return drive_empty (floppy + num); + return drive_empty (floppy + num); } static void fetch_DISK_select(uae_u8 data) @@ -3134,40 +3134,6 @@ static void wordsync_detected(bool startup) } } -static void disk_doupdate_read_reallynothing(int floppybits, bool state) -{ - // Only because there is at least one demo that checks wrong bit - // and hangs unless DSKSYNC bit it set with zero DSKSYNC value... - if (INTREQR() & 0x1000) - return; - while (floppybits >= get_floppy_speed()) { - bool skipbit = false; - word <<= 1; - word |= (state ? 1 : 0); - // MSBSYNC - if (adkcon & 0x200) { - if ((word & 0x0001) == 0 && bitoffset == 0) { - word = 0; - skipbit = true; - } - if ((word & 0x0001) == 0 && bitoffset == 8) { - word >>= 1; - skipbit = true; - } - } - if (!skipbit && (bitoffset & 7) == 7) { - dskbytr_val = word & 0xff; - dskbytr_val |= 0x8000; - } - if (!(adkcon & 0x200) && word == dsksync) { - INTREQ(0x8000 | 0x1000); - } - bitoffset++; - bitoffset &= 15; - floppybits -= get_floppy_speed(); - } -} - static void disk_doupdate_read_nothing(int floppybits) { while (floppybits >= get_floppy_speed()) { @@ -3478,8 +3444,6 @@ void DISK_update (int tohpos) disk_doupdate_read_nothing(cycles); } else if (dskdmaen == DSKDMA_WRITE) { disk_doupdate_write(cycles, get_floppy_speed()); - } else { - //disk_doupdate_read_reallynothing(cycles, true); } } @@ -3677,7 +3641,7 @@ void DSKLEN (uae_u16 v, int hpos) } } -void DISK_update_adkcon (int hpos, uae_u16 v) +void DISK_update_adkcon (uae_u16 v) { uae_u16 vold = adkcon; uae_u16 vnew = adkcon; diff --git a/src/drawing.cpp b/src/drawing.cpp index b20e877..137867d 100755 --- a/src/drawing.cpp +++ b/src/drawing.cpp @@ -596,7 +596,7 @@ static void fill_line2 (int startpos, int len) } } -static void fill_line_border (int lineno) +static void fill_line_border (void) { struct vidbuf_description *vidinfo = &adisplays.gfxvidinfo; int lastpos = visible_left_border; @@ -2064,16 +2064,16 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos) // blanked border line int tmp = hposblank; hposblank = 1; - fill_line_border(lineno); + fill_line_border(); hposblank = tmp; } else { // normal border line - fill_line_border(lineno); + fill_line_border(); } if (do_double) { xlinebuffer = row_map[follow_ypos] - linetoscr_x_adjust_pixbytes; - fill_line_border(lineno); + fill_line_border(); } return; } diff --git a/src/driveclick.cpp b/src/driveclick.cpp index 4faf643..0b6839b 100644 --- a/src/driveclick.cpp +++ b/src/driveclick.cpp @@ -93,44 +93,6 @@ static void freesample (struct drvsample *s) s->p = 0; } -static void processclicks (struct drvsample *ds) -{ - unsigned int nClick = 0; - - for (int n = 0; n < CLICK_TRACKS; n++) { - ds->indexes[n] = 0; - ds->lengths[n] = 0; - } - for(int n = 0; n < ds->len; n++) { - uae_s16 smp = ds->p[n]; - if (smp > 0x6ff0 && nClick < CLICK_TRACKS) { - ds->indexes[nClick] = n - 128; - ds->lengths[nClick] = 2800; - nClick ++; - n += 3000; - } - } - if (nClick == 0) { - for(int n = 0; n < CLICK_TRACKS; n++) { - ds->indexes[n] = 0; - ds->lengths[n] = ds->len; - } - } else { - if (nClick == 1) { - ds->lengths[0] = ds->len - ds->indexes[0]; - for(int n = 1; n < CLICK_TRACKS; n++) { - ds->indexes[n] = ds->indexes[0]; - ds->lengths[n] = ds->lengths[0]; - } - } else { - for(int n = nClick; n < CLICK_TRACKS; n++) { - ds->indexes[n] = ds->indexes[nClick-1]; - ds->lengths[n] = ds->lengths[nClick-1]; - } - } - } -} - static void driveclick_close(void) { for (int i = 0; i < 4; i++) { diff --git a/src/expansion.cpp b/src/expansion.cpp index fb12996..c2a6834 100755 --- a/src/expansion.cpp +++ b/src/expansion.cpp @@ -291,7 +291,7 @@ static void addextrachip (uae_u32 sysbase) addrbank expamem_null; DECLARE_MEMORY_FUNCTIONS(expamem); -addrbank expamem_bank = { +static addrbank expamem_bank = { expamem_lget, expamem_wget, expamem_bget, expamem_lput, expamem_wput, expamem_bput, default_xlate, default_check, NULL, NULL, _T("Autoconfig Z2"), @@ -1026,9 +1026,9 @@ static bool expamem_init_uaeboard(struct autoconfig_info *aci) * Z3fastmem Memory */ -MEMORY_ARRAY_FUNCTIONS(z3fastmem, 0); +DECLARE_MEMORY_ARRAY_FUNCTIONS(z3fastmem, 0); -addrbank z3fastmem_bank[MAX_RAM_BOARDS] = +static addrbank z3fastmem_bank[MAX_RAM_BOARDS] = { { z3fastmem0_lget, z3fastmem0_wget, z3fastmem0_bget, @@ -1039,6 +1039,8 @@ addrbank z3fastmem_bank[MAX_RAM_BOARDS] = } }; +MEMORY_ARRAY_FUNCTIONS(z3fastmem, 0); + /* ********************************************************** */ /* diff --git a/src/filesys.cpp b/src/filesys.cpp index c30453b..fc0ad73 100755 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -1408,11 +1408,6 @@ static uae_s64 key_seek(Key *k, uae_s64 offset, int whence) return fs_lseek64 (k->fd, offset, whence); } -static void set_highcyl(uaecptr volume, uae_u32 blocks) -{ - put_long(volume + 184 - 32, blocks); -} - static void set_volume_name (Unit *unit, struct mytimeval *tv) { int namelen; diff --git a/src/fpp.cpp b/src/fpp.cpp index f88ef94..13b272f 100755 --- a/src/fpp.cpp +++ b/src/fpp.cpp @@ -903,88 +903,6 @@ static bool fault_if_unimplemented_680x0 (uae_u16 opcode, uae_u16 extra, uaecptr return false; } -static bool fault_if_unimplemented_6888x (uae_u16 opcode, uae_u16 extra, uaecptr oldpc) -{ - if ((currprefs.fpu_model == 68881 || currprefs.fpu_model == 68882) && currprefs.fpu_no_unimplemented) { - uae_u16 v = extra & 0x7f; - switch(v) - { - case 0x00: /* FMOVE */ - case 0x01: /* FINT */ - case 0x02: /* FSINH */ - case 0x03: /* FINTRZ */ - case 0x04: /* FSQRT */ - case 0x06: /* FLOGNP1 */ - case 0x08: /* FETOXM1 */ - case 0x09: /* FTANH */ - case 0x0a: /* FATAN */ - case 0x0c: /* FASIN */ - case 0x0d: /* FATANH */ - case 0x0e: /* FSIN */ - case 0x0f: /* FTAN */ - case 0x10: /* FETOX */ - case 0x11: /* FTWOTOX */ - case 0x12: /* FTENTOX */ - case 0x14: /* FLOGN */ - case 0x15: /* FLOG10 */ - case 0x16: /* FLOG2 */ - case 0x18: /* FABS */ - case 0x19: /* FCOSH */ - case 0x1a: /* FNEG */ - case 0x1c: /* FACOS */ - case 0x1d: /* FCOS */ - case 0x1e: /* FGETEXP */ - case 0x1f: /* FGETMAN */ - case 0x20: /* FDIV */ - case 0x21: /* FMOD */ - case 0x22: /* FADD */ - case 0x23: /* FMUL */ - case 0x24: /* FSGLDIV */ - case 0x25: /* FREM */ - case 0x26: /* FSCALE */ - case 0x27: /* FSGLMUL */ - case 0x28: /* FSUB */ - case 0x30: /* FSINCOS */ - case 0x31: /* FSINCOS */ - case 0x32: /* FSINCOS */ - case 0x33: /* FSINCOS */ - case 0x34: /* FSINCOS */ - case 0x35: /* FSINCOS */ - case 0x36: /* FSINCOS */ - case 0x37: /* FSINCOS */ - case 0x38: /* FCMP */ - case 0x3a: /* FTST */ - - // 6888x invalid opmodes execute existing FPU instruction. - // Only opmodes 0x40-0x7f generate F-line exception. - case 0x05: - case 0x07: - case 0x0b: - case 0x13: - case 0x17: - case 0x1b: - case 0x29: - case 0x2a: - case 0x2b: - case 0x2c: - case 0x2d: - case 0x2e: - case 0x2f: - case 0x39: - case 0x3b: - case 0x3c: - case 0x3d: - case 0x3e: - case 0x3f: - return false; - default: - fpu_noinst (opcode, oldpc); - return true; - } - } - return false; -} - static bool fault_if_no_fpu_u (uae_u16 opcode, uae_u16 extra, uaecptr ea, bool easet, uaecptr oldpc) { if (fault_if_no_fpu (opcode, extra, ea, easet, oldpc)) diff --git a/src/fpp_native.cpp b/src/fpp_native.cpp index 5c496ad..11cd820 100755 --- a/src/fpp_native.cpp +++ b/src/fpp_native.cpp @@ -804,4 +804,3 @@ static void fpp_to_pack (fpdata *fpd, uae_u32 *wrd, int dummy) sscanf (str, "%le", &d); fpp_from_native(d, fpd); } - diff --git a/src/gencpu.cpp b/src/gencpu.cpp index 20f2edc..5c0e1ff 100755 --- a/src/gencpu.cpp +++ b/src/gencpu.cpp @@ -1838,9 +1838,6 @@ static void move_68000_address_error(int size, int *setapdi, int *fcmodeflags) if (set_low_word == 1) { // Low word: Z and N out("ccr_68000_long_move_ae_LZN(src);\n"); - } else if (set_low_word == 2) { - // Low word: N only - out("ccr_68000_long_move_ae_LN(src);\n"); } else if (set_high_word) { // High word: N and Z clear. out("ccr_68000_long_move_ae_HNZ(src);\n"); @@ -1951,9 +1948,6 @@ static void move_68010_address_error(int size, int *setapdi, int *fcmodeflags) if (set_low_word == 1) { // Low word: Z and N out("ccr_68000_long_move_ae_LZN(src);\n"); - } else if (set_low_word == 2) { - // Low word: N only - out("ccr_68000_long_move_ae_LN(src);\n"); } else if (set_high_word) { // High word: N and Z clear. out("ccr_68000_long_move_ae_HNZ(src);\n"); diff --git a/src/hardfile.cpp b/src/hardfile.cpp index c4dae90..c06adc4 100755 --- a/src/hardfile.cpp +++ b/src/hardfile.cpp @@ -78,7 +78,6 @@ static int rl (uae_u8 *p) return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]); } - static void getchs2 (struct hardfiledata *hfd, int *cyl, int *cylsec, int *head, int *tracksec) { unsigned int total = (unsigned int)(hfd->virtsize / 1024); diff --git a/src/include/blkdev.h b/src/include/blkdev.h index a07237c..29852e8 100755 --- a/src/include/blkdev.h +++ b/src/include/blkdev.h @@ -153,7 +153,6 @@ extern int sys_command_cd_qcode (int unitnum, uae_u8*, int lsn, bool all); extern int sys_command_cd_toc (int unitnum, struct cd_toc_head*); extern int sys_command_cd_read (int unitnum, uae_u8 *data, int block, int size); extern int sys_command_cd_rawread (int unitnum, uae_u8 *data, int sector, int size, int sectorsize); -int sys_command_cd_rawread (int unitnum, uae_u8 *data, int sector, int size, int sectorsize, uae_u8 sectortype, uae_u8 scsicmd9, uae_u8 subs); extern int sys_command_read (int unitnum, uae_u8 *data, int block, int size); extern int sys_command_scsi_direct(TrapContext *ctx, int unitnum, int type, uaecptr request); extern int sys_command_ismedia (int unitnum, int quick); diff --git a/src/include/custom.h b/src/include/custom.h index b8ab02e..07ae8c4 100755 --- a/src/include/custom.h +++ b/src/include/custom.h @@ -146,7 +146,16 @@ extern float hblank_hz; #define CYCLE_MASK 0x0f -extern uae_u32 timeframes; +#ifdef CPUEMU_13 +extern uae_u8 cycle_line[256 + 1]; +#endif + +STATIC_INLINE void alloc_cycle (int hpos, int type) +{ +#ifdef CPUEMU_13 + cycle_line[hpos] = type; +#endif +} /* 100 words give you 1600 horizontal pixels. Should be more than enough for * superhires. Don't forget to update the definition in genp2c.c as well. @@ -192,7 +201,6 @@ STATIC_INLINE int GET_PLANES(uae_u16 bplcon0) extern void fpscounter_reset (void); extern uae_u32 idletime; -extern void alloc_cycle_blitter (int hpos, uaecptr *ptr, int); extern int current_maxvpos (void); int is_bitplane_dma (int hpos); void custom_cpuchange(void); diff --git a/src/include/disk.h b/src/include/disk.h index 9c122ff..1376e5a 100755 --- a/src/include/disk.h +++ b/src/include/disk.h @@ -38,12 +38,11 @@ extern uae_u8 DISK_status_ciaa (void); extern void disk_eject (int num); extern int disk_empty (int num); extern void disk_insert (int num, const TCHAR *name); -extern void disk_insert (int num, const TCHAR *name, bool forcedwriteprotect); extern void DISK_vsync (void); extern int DISK_validate_filename (struct uae_prefs *p, const TCHAR *fname, TCHAR *outfname, int leave_open, bool *wrprot, uae_u32 *crc32, struct zfile **zf); extern void DISK_handler (uae_u32); extern void DISK_update (int hpos); -extern void DISK_update_adkcon (int hpos, uae_u16 v); +extern void DISK_update_adkcon (uae_u16 v); extern void DISK_hsync (void); extern void DISK_reset (void); extern int disk_getwriteprotect (struct uae_prefs *p, const TCHAR *name); diff --git a/src/include/inputdevice.h b/src/include/inputdevice.h index 206946d..22333f3 100755 --- a/src/include/inputdevice.h +++ b/src/include/inputdevice.h @@ -262,7 +262,6 @@ extern void inputdevice_unacquire (void); extern void inputdevice_releasebuttons(void); extern void warpmode (int mode); -extern void pausemode (int mode); extern void inputdevice_add_inputcode (int code, int state, const TCHAR *); extern void inputdevice_handle_inputcode (void); diff --git a/src/include/memory-uae.h b/src/include/memory-uae.h index d44b57c..cda6aea 100755 --- a/src/include/memory-uae.h +++ b/src/include/memory-uae.h @@ -305,6 +305,18 @@ static uae_u8 *REGPARAM2 name ## index ## _xlate (uaecptr addr) \ return name ## _bank[index].baseaddr + addr; \ } +#define DECLARE_MEMORY_ARRAY_FUNCTIONS(name, index) \ +static uae_u32 REGPARAM3 NOWARN_UNUSED(name ## index ## _lget) (uaecptr) REGPARAM; \ +static uae_u32 REGPARAM3 NOWARN_UNUSED(name ## index ## _lgeti) (uaecptr) REGPARAM; \ +static uae_u32 REGPARAM3 NOWARN_UNUSED(name ## index ## _wget) (uaecptr) REGPARAM; \ +static uae_u32 REGPARAM3 NOWARN_UNUSED(name ## index ## _wgeti) (uaecptr) REGPARAM; \ +static uae_u32 REGPARAM3 NOWARN_UNUSED(name ## index ## _bget) (uaecptr) REGPARAM; \ +static void REGPARAM3 NOWARN_UNUSED(name ## index ## _lput) (uaecptr, uae_u32) REGPARAM; \ +static void REGPARAM3 NOWARN_UNUSED(name ## index ## _wput) (uaecptr, uae_u32) REGPARAM; \ +static void REGPARAM3 NOWARN_UNUSED(name ## index ## _bput) (uaecptr, uae_u32) REGPARAM; \ +static int REGPARAM3 NOWARN_UNUSED(name ## index ## _check) (uaecptr addr, uae_u32 size) REGPARAM; \ +static uae_u8 *REGPARAM3 NOWARN_UNUSED(name ## index ## _xlate) (uaecptr addr) REGPARAM; + #define MEMORY_ARRAY_FUNCTIONS(name, index) \ MEMORY_ARRAY_LGET(name, index); \ MEMORY_ARRAY_WGET(name, index); \ @@ -323,7 +335,6 @@ extern addrbank cia_bank; extern addrbank rtarea_bank; extern addrbank filesys_bank; extern addrbank uaeboard_bank; -extern addrbank expamem_bank; extern addrbank expamem_null; extern addrbank fastmem_bank[MAX_RAM_BOARDS]; extern addrbank *gfxmem_banks[MAX_RTG_BOARDS]; @@ -332,13 +343,10 @@ extern addrbank gayle2_bank; extern addrbank mbres_bank; extern addrbank akiko_bank; extern addrbank bogomem_bank; -extern addrbank z3fastmem_bank[MAX_RAM_BOARDS]; extern addrbank a3000lmem_bank; extern addrbank a3000hmem_bank; extern addrbank extendedkickmem_bank; extern addrbank extendedkickmem2_bank; -extern addrbank custmem1_bank; -extern addrbank custmem2_bank; extern void rtarea_init (void); extern void rtarea_free(void); @@ -649,8 +657,6 @@ extern void REGPARAM3 chipmem_lput_fc (uaecptr, uae_u32) REGPARAM; extern void REGPARAM3 chipmem_wput_fc (uaecptr, uae_u32) REGPARAM; extern void REGPARAM3 chipmem_bput_fc (uaecptr, uae_u32) REGPARAM; -extern void REGPARAM3 chipmem_agnus_wput (uaecptr, uae_u32) REGPARAM; - extern uae_u32 chipmem_full_mask; extern addrbank dummy_bank; @@ -662,7 +668,14 @@ STATIC_INLINE uae_u32 chipmem_wget_indirect (uae_u32 addr) { return do_get_mem_word((uae_u16 *)(chipmem_bank.baseaddr + addr)); } -#define chipmem_wput_indirect chipmem_agnus_wput +STATIC_INLINE void chipmem_wput_indirect (uaecptr addr, uae_u32 w) +{ + uae_u16 *m; + + addr &= chipmem_full_mask; + m = (uae_u16 *)(chipmem_bank.baseaddr + addr); + do_put_mem_word (m, w); +} extern bool mapped_malloc (addrbank*); extern void mapped_free (addrbank*); diff --git a/src/include/newcpu.h b/src/include/newcpu.h index cade0ea..abc0316 100755 --- a/src/include/newcpu.h +++ b/src/include/newcpu.h @@ -365,8 +365,6 @@ extern uae_u32 REGPARAM3 get_disp_ea_020 (uae_u32 base) REGPARAM; extern uae_u32 REGPARAM3 get_bitfield (uae_u32 src, uae_u32 bdata[2], uae_s32 offset, int width) REGPARAM; extern void REGPARAM3 put_bitfield (uae_u32 dst, uae_u32 bdata[2], uae_u32 val, uae_s32 offset, int width) REGPARAM; -extern int get_cpu_model (void); - extern void set_cpu_caches (bool flush); extern void flush_cpu_caches_040(uae_u16 opcode); extern void REGPARAM3 MakeSR (void) REGPARAM; @@ -401,7 +399,6 @@ extern bool privileged_copro_instruction(uae_u16 opcode); extern bool generates_group1_exception(uae_u16 opcode); void ccr_68000_long_move_ae_LZN(uae_s32 src); -void ccr_68000_long_move_ae_LN(uae_s32 src); void ccr_68000_long_move_ae_HNZ(uae_s32 src); void ccr_68000_long_move_ae_normal(uae_s32 src); void ccr_68000_word_move_ae_normal(uae_s16 src); @@ -429,7 +426,6 @@ extern void exception3_read_prefetch(uae_u32 opcode, uaecptr addr); extern void exception3_read_prefetch_68040bug(uae_u32 opcode, uaecptr addr, uae_u16 secondarysr); extern void exception3_read_prefetch_only(uae_u32 opcode, uaecptr addr); extern void hardware_exception2(uaecptr addr, uae_u32 v, bool read, bool ins, int size); -extern void exception2_setup(uae_u32 opcode, uaecptr addr, bool read, int size, uae_u32 fc); extern void exception2_read(uae_u32 opcode, uaecptr addr, int size, int fc); extern void exception2_write(uae_u32 opcode, uaecptr addr, int size, uae_u32 val, int fc); extern void exception2_fetch_opcode(uae_u32 opcode, int offset, int pcoffset); diff --git a/src/include/uae/types.h b/src/include/uae/types.h index e84043c..e092f7e 100755 --- a/src/include/uae/types.h +++ b/src/include/uae/types.h @@ -25,10 +25,10 @@ typedef int32_t uae_s32; typedef uint32_t uae_u32; #ifndef uae_s64 -typedef long long int uae_s64; +typedef long long uae_s64; #endif #ifndef uae_u64 -typedef unsigned long long int uae_u64; +typedef unsigned long long uae_u64; #endif /* Parts of the UAE/WinUAE code uses the bool type (from C++). diff --git a/src/inputdevice.cpp b/src/inputdevice.cpp index 049d220..1a119e1 100755 --- a/src/inputdevice.cpp +++ b/src/inputdevice.cpp @@ -98,6 +98,7 @@ static int inputdevice_joyport_config(struct uae_prefs *p, const TCHAR *value1, static int jsem_isjoy (int port, const struct uae_prefs *p); static int jsem_ismouse (int port, const struct uae_prefs *p); static int jsem_iskbdjoy (int port, const struct uae_prefs *p); +static void pausemode (int mode);; static struct inputdevice_functions idev[IDTYPE_MAX]; @@ -2307,7 +2308,6 @@ static void queue_input_event (int evt, int state, int max, int linecnt, int aut } } -static uae_u8 keybuf[256]; #define MAX_PENDING_EVENTS 20 struct inputcode { @@ -2340,7 +2340,6 @@ void inputdevice_do_keyboard (int code, int state) { if (code < 0x80) { uae_u8 key = code | (state ? 0x00 : 0x80); - keybuf[key & 0x7f] = (key & 0x80) ? 0 : 1; record_key ((uae_u8)((key << 1) | (key >> 7))); return; } @@ -4090,7 +4089,6 @@ static void resetinput (void) mouse_deltanoreset[i][2] = 0; mouse_delta[i][2] = 0; } - memset (keybuf, 0, sizeof keybuf); for (int i = 0; i < INPUT_QUEUE_SIZE; i++) input_queue[i].linecnt = input_queue[i].nextlinecnt = -1; @@ -5102,7 +5100,7 @@ void warpmode (int mode) set_config_changed (); } -void pausemode (int mode) +static void pausemode (int mode) { if (mode < 0) pause_emulation = pause_emulation ? 0 : 9; diff --git a/src/jit/compemu_support.cpp b/src/jit/compemu_support.cpp index 22e241c..a4deacc 100755 --- a/src/jit/compemu_support.cpp +++ b/src/jit/compemu_support.cpp @@ -148,7 +148,7 @@ static void* popall_execute_exception = NULL; * lists that we maintain for each hash result. */ static cacheline cache_tags[TAGSIZE]; -static int letit=0; +static int cache_enabled=0; static blockinfo* hold_bi[MAX_HOLD_BI]; blockinfo* active; blockinfo* dormant; @@ -1680,9 +1680,9 @@ void calc_disp_ea_020(int base, uae_u32 dp, int target) void set_cache_state(int enabled) { - if (enabled != letit) + if (enabled != cache_enabled) flush_icache_hard(3); - letit = enabled; + cache_enabled = enabled; } void alloc_cache(void) @@ -2187,7 +2187,7 @@ STATIC_INLINE unsigned int get_opcode_cft_map(unsigned int f) void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) { - if (letit && compiled_code && currprefs.cpu_model >= 68020) { + if (cache_enabled && compiled_code && currprefs.cpu_model >= 68020) { #ifdef PROFILE_COMPILE_TIME compile_count++; clock_t start_time = clock(); diff --git a/src/memory.cpp b/src/memory.cpp index 785a920..5fe8af2 100755 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -538,17 +538,17 @@ addrbank extendedkickmem2_bank = { ABFLAG_ROM | ABFLAG_THREADSAFE, 0, S_WRITE }; -MEMORY_FUNCTIONS(custmem1); -MEMORY_FUNCTIONS(custmem2); +DECLARE_MEMORY_FUNCTIONS(custmem1); +DECLARE_MEMORY_FUNCTIONS(custmem2); -addrbank custmem1_bank = { +static addrbank custmem1_bank = { custmem1_lget, custmem1_wget, custmem1_bget, custmem1_lput, custmem1_wput, custmem1_bput, custmem1_xlate, custmem1_check, NULL, _T("custmem1"), _T("Non-autoconfig RAM #1"), custmem1_lget, custmem1_wget, ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 }; -addrbank custmem2_bank = { +static addrbank custmem2_bank = { custmem2_lget, custmem2_wget, custmem2_bget, custmem2_lput, custmem2_wput, custmem2_bput, custmem2_xlate, custmem2_check, NULL, _T("custmem2"), _T("Non-autoconfig RAM #2"), @@ -556,6 +556,9 @@ addrbank custmem2_bank = { ABFLAG_RAM | ABFLAG_THREADSAFE, 0, 0 }; +MEMORY_FUNCTIONS(custmem1); +MEMORY_FUNCTIONS(custmem2); + static bool singlebit (uae_u32 v) { while (v && !(v & 1)) diff --git a/src/newcpu.cpp b/src/newcpu.cpp index aec3bb0..b3626ad 100755 --- a/src/newcpu.cpp +++ b/src/newcpu.cpp @@ -73,14 +73,6 @@ int movem_next[256]; cpuop_func *cpufunctbl[65536]; -struct cputbl_data -{ - uae_s16 length; - uae_s8 disp020[2]; - uae_s8 branch; -}; -static struct cputbl_data cpudatatbl[65536]; - struct mmufixup mmufixup[1]; static uae_u64 fake_srp_030, fake_crp_030; @@ -790,10 +782,6 @@ static void build_cpufunctbl (void) for (i = 0; tbl[i].handler_ff != NULL; i++) { opcode = tbl[i].opcode; cpufunctbl[opcode] = tbl[i].handler_ff; - cpudatatbl[opcode].length = tbl[i].length; - cpudatatbl[opcode].disp020[0] = tbl[i].disp020[0]; - cpudatatbl[opcode].disp020[1] = tbl[i].disp020[1]; - cpudatatbl[opcode].branch = tbl[i].branch; } /* hack fpu to 68000/68010 mode */ @@ -802,10 +790,6 @@ static void build_cpufunctbl (void) for (i = 0; tbl[i].handler_ff != NULL; i++) { if ((tbl[i].opcode & 0xfe00) == 0xf200) { cpufunctbl[tbl[i].opcode] = tbl[i].handler_ff; - cpudatatbl[tbl[i].opcode].length = tbl[i].length; - cpudatatbl[tbl[i].opcode].disp020[0] = tbl[i].disp020[0]; - cpudatatbl[tbl[i].opcode].disp020[1] = tbl[i].disp020[1]; - cpudatatbl[tbl[i].opcode].branch = tbl[i].branch; } } } @@ -838,7 +822,6 @@ static void build_cpufunctbl (void) if (f == op_illg_1) abort(); cpufunctbl[opcode] = f; - memcpy(&cpudatatbl[opcode], &cpudatatbl[idx], sizeof(struct cputbl_data)); opcnt++; } } @@ -3132,7 +3115,7 @@ uae_u8 *save_cpu (int *len, uae_u8 *dstptr) uae_u8 *dstbak,*dst; int model, khz; uae_u32 flags; - + if (dstptr) dstbak = dst = dstptr; else @@ -3312,7 +3295,7 @@ void exception3_write(uae_u32 opcode, uaecptr addr, int size, uae_u32 val, int f exception3f(opcode, addr, true, ia, ni, 0xffffffff, size & 15, fc, 0); } -void exception2_setup(uae_u32 opcode, uaecptr addr, bool read, int size, uae_u32 fc) +static void exception2_setup(uae_u32 opcode, uaecptr addr, bool read, int size, uae_u32 fc) { last_addr_for_exception_3 = m68k_getpc(); last_fault_for_exception_3 = addr; diff --git a/src/newcpu_common.cpp b/src/newcpu_common.cpp index bdaa1ab..9ae8b8b 100755 --- a/src/newcpu_common.cpp +++ b/src/newcpu_common.cpp @@ -5,11 +5,6 @@ #include "newcpu.h" #include "cpummu.h" -int get_cpu_model(void) -{ - return currprefs.cpu_model; -} - static int movec_illg (int regno) { int regno2 = regno & 0x7ff; @@ -1270,14 +1265,6 @@ void ccr_68000_long_move_ae_LZN(uae_s32 src) SET_NFLG(vsrc < 0); } -// Low word: Clear + N only -void ccr_68000_long_move_ae_LN(uae_s32 src) -{ - CLEAR_CZNV(); - uae_s16 vsrc = (uae_s16)(src & 0xffff); - SET_NFLG(vsrc < 0); -} - // High word: N and Z clear. void ccr_68000_long_move_ae_HNZ(uae_s32 src) {