(WIP) Further updates from WinUAE

This commit is contained in:
Dimitris Panokostas 2019-01-26 22:48:59 +01:00
parent f78994df5e
commit cb80696aa6
6 changed files with 579 additions and 342 deletions

View file

@ -372,6 +372,7 @@ static void blitter_done (int hpos)
blitter_done_notify (hpos);
event2_remevent (ev2_blitter);
unset_special (SPCFLAG_BLTNASTY);
blitter_dangerous_bpl = 0;
}
STATIC_INLINE void chipmem_agnus_wput2 (uaecptr addr, uae_u32 w)
@ -1133,6 +1134,22 @@ void maybe_blit2 (int hack)
blitter_handler (0);
}
void check_is_blit_dangerous(uaecptr *bplpt, int planes, int words)
{
blitter_dangerous_bpl = 0;
if (bltstate == BLT_done || !blitter_cycle_exact)
return;
// too simple but better than nothing
for (int i = 0; i < planes; i++) {
uaecptr bpl = bplpt[i];
uaecptr dpt = bltdpt & chipmem_bank.mask;
if (dpt >= bpl - 2 * words && dpt < bpl + 2 * words) {
blitter_dangerous_bpl = 1;
return;
}
}
}
int blitnasty (void)
{
int cycles, ccnt;

File diff suppressed because it is too large Load diff

View file

@ -21,6 +21,17 @@ int is_syncline;
frame_time_t vsyncmintime, vsyncmaxtime, vsyncwaittime;
int vsynctimebase;
static void events_fast(void)
{
cycles_do_special();
}
void events_reset_syncline(void)
{
is_syncline = 0;
events_fast();
}
void events_schedule(void)
{
int i;
@ -36,6 +47,24 @@ void events_schedule(void)
nextevent = currcycle + mintime;
}
static bool event_check_vsync(void)
{
/* Keep only CPU emulation running while waiting for sync point. */
if (is_syncline) {
int rpt = read_processor_time();
int v = rpt - vsyncmintime;
if (v > vsynctimebase || v < -vsynctimebase) {
v = 0;
}
if (v < speedup_timelimit) {
regs.pissoff = pissoff_value;
return true;
}
events_reset_syncline();
}
return false;
}
void do_cycles_cpu_fastest (unsigned long cycles_to_add)
{
if ((regs.pissoff -= cycles_to_add) > 0)

View file

@ -26,7 +26,9 @@ extern enum blitter_states {
extern struct bltinfo blt_info;
extern int blit_interrupt;
extern int blitter_nasty, blit_interrupt, blitter_dangerous_bpl;
extern void check_is_blit_dangerous(uaecptr *bplpt, int planes, int words);
extern uae_u16 bltsize;
extern uae_u16 bltcon0,bltcon1;

View file

@ -87,10 +87,7 @@ STATIC_INLINE void send_interrupt (int num)
INTREQ_0 (0x8000 | (1 << num));
}
extern void rethink_uae_int(void);
STATIC_INLINE uae_u16 INTREQR (void)
{
return intreq;
}
extern uae_u16 INTREQR(void);
/* maximums for statically allocated tables */
#ifdef UAE_MINI
@ -126,8 +123,8 @@ extern int maxhpos, maxhpos_short;
extern int maxvpos, maxvpos_nom, maxvpos_display;
extern int hsyncstartpos, hsyncendpos;
extern int minfirstline, vblank_endline, numscrlines;
extern double vblank_hz, fake_vblank_hz;
extern double hblank_hz;
extern float vblank_hz, fake_vblank_hz;
extern float hblank_hz;
extern int vblank_skip, doublescan;
extern bool programmedmode;

View file

@ -34,6 +34,7 @@ typedef void (*do_cycles_func)(unsigned long);
extern do_cycles_func do_cycles;
void do_cycles_cpu_fastest (unsigned long cycles_to_add);
void do_cycles_cpu_norm (unsigned long cycles_to_add);
extern void events_reset_syncline(void);
typedef unsigned long int evt;
@ -88,20 +89,20 @@ STATIC_INLINE void do_extra_cycles (unsigned long cycles_to_add)
regs.pissoff -= cycles_to_add;
}
STATIC_INLINE unsigned long int get_cycles (void)
STATIC_INLINE unsigned long int get_cycles(void)
{
return currcycle;
return currcycle;
}
STATIC_INLINE void set_cycles (unsigned long int x)
STATIC_INLINE void set_cycles(unsigned long int x)
{
currcycle = x;
currcycle = x;
eventtab[ev_hsync].oldcycles = x;
}
STATIC_INLINE int current_hpos (void)
STATIC_INLINE int current_hpos(void)
{
int hp = (get_cycles () - eventtab[ev_hsync].oldcycles) / CYCLE_UNIT;
int hp = (get_cycles() - eventtab[ev_hsync].oldcycles) / CYCLE_UNIT;
return hp;
}