Implemented fix from Main (#34)
This commit is contained in:
parent
03c6ffd4c2
commit
5deaae7bc2
3 changed files with 6161 additions and 6115 deletions
|
@ -2458,7 +2458,8 @@ static void init_hz (bool fullinit)
|
||||||
sprite_vblank_endline = VBLANK_SPRITE_PAL;
|
sprite_vblank_endline = VBLANK_SPRITE_PAL;
|
||||||
equ_vblank_endline = EQU_ENDLINE_PAL;
|
equ_vblank_endline = EQU_ENDLINE_PAL;
|
||||||
equ_vblank_toggle = true;
|
equ_vblank_toggle = true;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
maxvpos = MAXVPOS_NTSC;
|
maxvpos = MAXVPOS_NTSC;
|
||||||
maxhpos = MAXHPOS_NTSC;
|
maxhpos = MAXHPOS_NTSC;
|
||||||
minfirstline = VBLANK_ENDLINE_NTSC;
|
minfirstline = VBLANK_ENDLINE_NTSC;
|
||||||
|
@ -2468,7 +2469,7 @@ static void init_hz (bool fullinit)
|
||||||
equ_vblank_toggle = false;
|
equ_vblank_toggle = false;
|
||||||
}
|
}
|
||||||
// long/short field refresh rate adjustment
|
// long/short field refresh rate adjustment
|
||||||
vblank_hz = vblank_hz * (maxvpos * 2 + 1) / ((maxvpos + lof_current) * 2);
|
// vblank_hz = vblank_hz * (maxvpos * 2 + 1) / ((maxvpos + lof_current) * 2);
|
||||||
|
|
||||||
maxvpos_nom = maxvpos;
|
maxvpos_nom = maxvpos;
|
||||||
maxvpos_display = maxvpos;
|
maxvpos_display = maxvpos;
|
||||||
|
@ -2477,18 +2478,20 @@ static void init_hz (bool fullinit)
|
||||||
// (someone poked VPOSW)
|
// (someone poked VPOSW)
|
||||||
if (vpos_count < 10)
|
if (vpos_count < 10)
|
||||||
vpos_count = 10;
|
vpos_count = 10;
|
||||||
float new_hz = (isntsc ? 15734.0 : 15625.0) / (float)vpos_count;
|
vblank_hz = (isntsc ? 15734.0 : 15625.0) / vpos_count;
|
||||||
vblank_hz = (int)(new_hz + 0.5);
|
|
||||||
maxvpos_nom = vpos_count - (lof_current ? 1 : 0);
|
maxvpos_nom = vpos_count - (lof_current ? 1 : 0);
|
||||||
if ((maxvpos_nom >= 256 && maxvpos_nom <= 313) || (beamcon0 & 0x80)) {
|
if ((maxvpos_nom >= 256 && maxvpos_nom <= 313) || (beamcon0 & 0x80)) {
|
||||||
maxvpos_display = maxvpos_nom;
|
maxvpos_display = maxvpos_nom;
|
||||||
} else if (maxvpos_nom < 256) {
|
}
|
||||||
|
else if (maxvpos_nom < 256) {
|
||||||
maxvpos_display = 255;
|
maxvpos_display = 255;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
maxvpos_display = 313;
|
maxvpos_display = 313;
|
||||||
}
|
}
|
||||||
reset_drawing ();
|
reset_drawing();
|
||||||
} else if (vpos_count == 0) {
|
}
|
||||||
|
else if (vpos_count == 0) {
|
||||||
// mode reset
|
// mode reset
|
||||||
vpos_count = maxvpos;
|
vpos_count = maxvpos;
|
||||||
vpos_count_diff = maxvpos;
|
vpos_count_diff = maxvpos;
|
||||||
|
@ -2502,15 +2505,29 @@ static void init_hz (bool fullinit)
|
||||||
if (htotal >= MAXHPOS)
|
if (htotal >= MAXHPOS)
|
||||||
htotal = MAXHPOS - 1;
|
htotal = MAXHPOS - 1;
|
||||||
maxhpos = htotal + 1;
|
maxhpos = htotal + 1;
|
||||||
float new_hz = 227.0 * 312.0 * 50.0 / (float)(maxvpos * maxhpos);
|
vblank_hz = 227.0 * 312.0 * 50.0 / (maxvpos * maxhpos);
|
||||||
vblank_hz = (int)(new_hz + 0.5);
|
|
||||||
|
if ((beamcon0 & 0x1000) && (beamcon0 & 0x0200)) { // VARVBEN + VARVSYEN
|
||||||
minfirstline = vsstop > vbstop ? vsstop : vbstop;
|
minfirstline = vsstop > vbstop ? vsstop : vbstop;
|
||||||
if (minfirstline > maxvpos / 2)
|
if (minfirstline > maxvpos / 2)
|
||||||
minfirstline = vsstop > vbstop ? vbstop : vsstop;
|
minfirstline = vsstop > vbstop ? vbstop : vsstop;
|
||||||
|
}
|
||||||
|
else if (beamcon0 & 0x0200) {
|
||||||
|
minfirstline = vsstop;
|
||||||
|
if (minfirstline > maxvpos / 2)
|
||||||
|
minfirstline = 0;
|
||||||
|
}
|
||||||
|
else if (beamcon0 & 0x1000) {
|
||||||
|
minfirstline = vbstop;
|
||||||
|
if (minfirstline > maxvpos / 2)
|
||||||
|
minfirstline = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (minfirstline < 2)
|
if (minfirstline < 2)
|
||||||
minfirstline = 2;
|
minfirstline = 2;
|
||||||
if (minfirstline >= maxvpos)
|
if (minfirstline >= maxvpos)
|
||||||
minfirstline = maxvpos - 1;
|
minfirstline = maxvpos - 1;
|
||||||
|
|
||||||
sprite_vblank_endline = minfirstline - 2;
|
sprite_vblank_endline = minfirstline - 2;
|
||||||
maxvpos_nom = maxvpos;
|
maxvpos_nom = maxvpos;
|
||||||
maxvpos_display = maxvpos;
|
maxvpos_display = maxvpos;
|
||||||
|
@ -2518,11 +2535,6 @@ static void init_hz (bool fullinit)
|
||||||
vpos_count = maxvpos_nom;
|
vpos_count = maxvpos_nom;
|
||||||
vpos_count_diff = maxvpos_nom;
|
vpos_count_diff = maxvpos_nom;
|
||||||
hzc = 1;
|
hzc = 1;
|
||||||
#ifdef WITH_INGAME_WARNING
|
|
||||||
char _info[64];
|
|
||||||
sprintf(_info, "Programmend HZ: %d", vblank_hz);
|
|
||||||
InGameMessage(_info);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (maxvpos_nom >= MAXVPOS)
|
if (maxvpos_nom >= MAXVPOS)
|
||||||
maxvpos_nom = MAXVPOS;
|
maxvpos_nom = MAXVPOS;
|
||||||
|
@ -2535,22 +2547,22 @@ static void init_hz (bool fullinit)
|
||||||
vblank_hz = 10;
|
vblank_hz = 10;
|
||||||
if (vblank_hz > 300)
|
if (vblank_hz > 300)
|
||||||
vblank_hz = 300;
|
vblank_hz = 300;
|
||||||
eventtab[ev_hsync].oldcycles = get_cycles ();
|
eventtab[ev_hsync].oldcycles = get_cycles();
|
||||||
eventtab[ev_hsync].evtime = get_cycles() + HSYNCTIME;
|
eventtab[ev_hsync].evtime = get_cycles() + HSYNCTIME;
|
||||||
events_schedule ();
|
events_schedule();
|
||||||
if (hzc) {
|
if (hzc) {
|
||||||
reset_drawing ();
|
reset_drawing();
|
||||||
}
|
}
|
||||||
maxvpos_total = (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? (MAXVPOS_LINES_ECS - 1) : (MAXVPOS_LINES_OCS - 1);
|
maxvpos_total = (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? (MAXVPOS_LINES_ECS - 1) : (MAXVPOS_LINES_OCS - 1);
|
||||||
if (maxvpos_total > MAXVPOS)
|
if (maxvpos_total > MAXVPOS)
|
||||||
maxvpos_total = MAXVPOS;
|
maxvpos_total = MAXVPOS;
|
||||||
|
|
||||||
compute_framesync ();
|
compute_framesync();
|
||||||
|
|
||||||
#ifdef PICASSO96
|
#ifdef PICASSO96
|
||||||
init_hz_p96 ();
|
init_hz_p96();
|
||||||
#endif
|
#endif
|
||||||
inputdevice_tablet_strobe ();
|
inputdevice_tablet_strobe();
|
||||||
|
|
||||||
if (fullinit)
|
if (fullinit)
|
||||||
vpos_count_diff = maxvpos_nom;
|
vpos_count_diff = maxvpos_nom;
|
||||||
|
@ -4533,7 +4545,7 @@ static void vsync_handler_pre (void)
|
||||||
// emulated hardware vsync
|
// emulated hardware vsync
|
||||||
static void vsync_handler_post (void)
|
static void vsync_handler_post (void)
|
||||||
{
|
{
|
||||||
DISK_vsync ();
|
DISK_vsync();
|
||||||
|
|
||||||
if (bplcon0 & 4) {
|
if (bplcon0 & 4) {
|
||||||
lof_store = lof_store ? 0 : 1;
|
lof_store = lof_store ? 0 : 1;
|
||||||
|
@ -4557,7 +4569,8 @@ static void vsync_handler_post (void)
|
||||||
lof_changed = 0;
|
lof_changed = 0;
|
||||||
}
|
}
|
||||||
lof_changing = 0;
|
lof_changing = 0;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
lof_changed_previous_field = 0;
|
lof_changed_previous_field = 0;
|
||||||
lof_lace = false;
|
lof_lace = false;
|
||||||
}
|
}
|
||||||
|
@ -4573,21 +4586,30 @@ static void vsync_handler_post (void)
|
||||||
vsyncmintime = last_synctime + vsynctimebase * (maxvpos_display - LAST_SPEEDUP_LINE) / maxvpos_display;
|
vsyncmintime = last_synctime + vsynctimebase * (maxvpos_display - LAST_SPEEDUP_LINE) / maxvpos_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PICASSO96
|
||||||
|
if (picasso_on)
|
||||||
|
{
|
||||||
|
vpos_count = (int) maxvpos * vblank_hz / 60;
|
||||||
|
vtotal = vpos_count;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if ((beamcon0 & (0x20 | 0x80)) != (new_beamcon0 & (0x20 | 0x80))) {
|
if ((beamcon0 & (0x20 | 0x80)) != (new_beamcon0 & (0x20 | 0x80))) {
|
||||||
init_hz ();
|
init_hz();
|
||||||
} else if (vpos_count > 0 && abs (vpos_count - vpos_count_diff) > 1 && vposw_change < 4) {
|
}
|
||||||
init_hz ();
|
else if (vpos_count > 0 && abs(vpos_count - vpos_count_diff) > 1 && vposw_change < 4) {
|
||||||
} else if (lof_changed) {
|
init_hz();
|
||||||
compute_framesync ();
|
}
|
||||||
|
else if (lof_changed) {
|
||||||
|
compute_framesync();
|
||||||
}
|
}
|
||||||
|
|
||||||
lof_changed = 0;
|
lof_changed = 0;
|
||||||
vposw_change = 0;
|
vposw_change = 0;
|
||||||
|
|
||||||
eventtab[ev_copper].active = 0;
|
eventtab[ev_copper].active = 0;
|
||||||
COPJMP (1, 1);
|
COPJMP(1, 1);
|
||||||
|
|
||||||
init_hardware_frame ();
|
init_hardware_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef JIT
|
#ifdef JIT
|
||||||
|
|
|
@ -438,20 +438,41 @@ extern void gui_message (const TCHAR *,...);
|
||||||
* Byte-swapping functions
|
* Byte-swapping functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ARMV6_ASSEMBLY
|
/* Try to use system bswap_16/bswap_32 functions. */
|
||||||
|
#if defined HAVE_BSWAP_16 && defined HAVE_BSWAP_32
|
||||||
STATIC_INLINE uae_u32 do_byteswap_32(uae_u32 v) {__asm__ (
|
# include <byteswap.h>
|
||||||
|
# ifdef HAVE_BYTESWAP_H
|
||||||
|
# include <byteswap.h>
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# ifdef ARMV6_ASSEMBLY
|
||||||
|
STATIC_INLINE uae_u32 do_byteswap_32(uae_u32 v) {
|
||||||
|
__asm__(
|
||||||
"rev %0, %0"
|
"rev %0, %0"
|
||||||
: "=r" (v) : "0" (v) ); return v;}
|
: "=r" (v) : "0" (v)); return v;
|
||||||
|
}
|
||||||
|
|
||||||
STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) {__asm__ (
|
STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) {
|
||||||
|
__asm__(
|
||||||
"revsh %0, %0\n\t"
|
"revsh %0, %0\n\t"
|
||||||
"uxth %0, %0"
|
"uxth %0, %0"
|
||||||
: "=r" (v) : "0" (v) ); return v;}
|
: "=r" (v) : "0" (v)); return v;
|
||||||
|
}
|
||||||
#endif
|
#define bswap_16(x) do_byteswap_16(x)
|
||||||
|
#define bswap_32(x) do_byteswap_32(x)
|
||||||
|
# else
|
||||||
|
/* Else, if using SDL, try SDL's endian functions. */
|
||||||
|
# ifdef USE_SDL
|
||||||
|
# include <SDL_endian.h>
|
||||||
|
# define bswap_16(x) SDL_Swap16(x)
|
||||||
|
# define bswap_32(x) SDL_Swap32(x)
|
||||||
|
# else
|
||||||
|
/* Otherwise, we'll roll our own. */
|
||||||
#define bswap_16(x) (((x) >> 8) | (((x) & 0xFF) << 8))
|
#define bswap_16(x) (((x) >> 8) | (((x) & 0xFF) << 8))
|
||||||
|
#define bswap_32(x) (((x) << 24) | (((x) << 8) & 0x00FF0000) | (((x) >> 8) & 0x0000FF00) | ((x) >> 24))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,9 @@ static struct PicassoResolution *newmodes = NULL;
|
||||||
|
|
||||||
static int picasso_convert, host_mode;
|
static int picasso_convert, host_mode;
|
||||||
|
|
||||||
/* These are the maximum resolutions... They are filled in by GetSupportedResolutions() */
|
/* These are the maximum resolutions... They are filled in by GetSupportedResolutions()
|
||||||
/* have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects
|
have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects
|
||||||
/* data here. */
|
data here. */
|
||||||
static struct ScreenResolution planar = { 320, 240 };
|
static struct ScreenResolution planar = { 320, 240 };
|
||||||
static struct ScreenResolution chunky = { 640, 480 };
|
static struct ScreenResolution chunky = { 640, 480 };
|
||||||
static struct ScreenResolution hicolour = { 640, 480 };
|
static struct ScreenResolution hicolour = { 640, 480 };
|
||||||
|
@ -1973,16 +1973,17 @@ FillRect:
|
||||||
* d5: UBYTE Mask
|
* d5: UBYTE Mask
|
||||||
* d7: uae_u32 RGBFormat
|
* d7: uae_u32 RGBFormat
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
__attribute__((optimize("O2"))) static uae_u32 REGPARAM2 picasso_FillRect (TrapContext *ctx)
|
//__attribute__((optimize("O2"))) is needed otherwise this crashes with O3!
|
||||||
|
__attribute__((optimize("O2"))) static uae_u32 REGPARAM2 picasso_FillRect(TrapContext *ctx)
|
||||||
{
|
{
|
||||||
uaecptr renderinfo = m68k_areg (regs, 1);
|
uaecptr renderinfo = m68k_areg(regs, 1);
|
||||||
uae_u32 X = (uae_u16)m68k_dreg (regs, 0);
|
uae_u32 X = (uae_u16)m68k_dreg(regs, 0);
|
||||||
uae_u32 Y = (uae_u16)m68k_dreg (regs, 1);
|
uae_u32 Y = (uae_u16)m68k_dreg(regs, 1);
|
||||||
uae_u32 Width = (uae_u16)m68k_dreg (regs, 2);
|
uae_u32 Width = (uae_u16)m68k_dreg(regs, 2);
|
||||||
uae_u32 Height = (uae_u16)m68k_dreg (regs, 3);
|
uae_u32 Height = (uae_u16)m68k_dreg(regs, 3);
|
||||||
uae_u32 Pen = m68k_dreg (regs, 4);
|
uae_u32 Pen = m68k_dreg(regs, 4);
|
||||||
uae_u8 Mask = (uae_u8)m68k_dreg (regs, 5);
|
uae_u8 Mask = (uae_u8)m68k_dreg(regs, 5);
|
||||||
RGBFTYPE RGBFormat = (RGBFTYPE) m68k_dreg (regs, 7);
|
RGBFTYPE RGBFormat = (RGBFTYPE) m68k_dreg(regs, 7);
|
||||||
uae_u8 *oldstart;
|
uae_u8 *oldstart;
|
||||||
int Bpp;
|
int Bpp;
|
||||||
struct RenderInfo ri;
|
struct RenderInfo ri;
|
||||||
|
@ -1990,8 +1991,8 @@ __attribute__((optimize("O2"))) static uae_u32 REGPARAM2 picasso_FillRect (TrapC
|
||||||
|
|
||||||
if (NOBLITTER)
|
if (NOBLITTER)
|
||||||
return 0;
|
return 0;
|
||||||
if (CopyRenderInfoStructureA2U (renderinfo, &ri) && Y != 0xFFFF) {
|
if (CopyRenderInfoStructureA2U(renderinfo, &ri) && Y != 0xFFFF) {
|
||||||
Bpp = GetBytesPerPixel (RGBFormat);
|
Bpp = GetBytesPerPixel(RGBFormat);
|
||||||
|
|
||||||
P96TRACE((_T("FillRect(%d, %d, %d, %d) Pen 0x%x BPP %d BPR %d Mask 0x%x\n"),
|
P96TRACE((_T("FillRect(%d, %d, %d, %d) Pen 0x%x BPP %d BPR %d Mask 0x%x\n"),
|
||||||
X, Y, Width, Height, Pen, Bpp, ri.BytesPerRow, Mask));
|
X, Y, Width, Height, Pen, Bpp, ri.BytesPerRow, Mask));
|
||||||
|
@ -2002,15 +2003,17 @@ __attribute__((optimize("O2"))) static uae_u32 REGPARAM2 picasso_FillRect (TrapC
|
||||||
if (Mask == 0xFF) {
|
if (Mask == 0xFF) {
|
||||||
|
|
||||||
/* Do the fill-rect in the frame-buffer */
|
/* Do the fill-rect in the frame-buffer */
|
||||||
do_fillrect_frame_buffer (&ri, X, Y, Width, Height, Pen, Bpp);
|
do_fillrect_frame_buffer(&ri, X, Y, Width, Height, Pen, Bpp);
|
||||||
result = 1;
|
result = 1;
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
/* We get here only if Mask != 0xFF */
|
/* We get here only if Mask != 0xFF */
|
||||||
if (Bpp != 1) {
|
if (Bpp != 1) {
|
||||||
write_log (_T("WARNING - FillRect() has unhandled mask 0x%x with Bpp %d. Using fall-back routine.\n"), Mask, Bpp);
|
write_log(_T("WARNING - FillRect() has unhandled mask 0x%x with Bpp %d. Using fall-back routine.\n"), Mask, Bpp);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Pen &= Mask;
|
Pen &= Mask;
|
||||||
Mask = ~Mask;
|
Mask = ~Mask;
|
||||||
oldstart = ri.Memory + Y * ri.BytesPerRow + X * Bpp;
|
oldstart = ri.Memory + Y * ri.BytesPerRow + X * Bpp;
|
||||||
|
@ -2021,8 +2024,8 @@ __attribute__((optimize("O2"))) static uae_u32 REGPARAM2 picasso_FillRect (TrapC
|
||||||
uae_u8 *p = start;
|
uae_u8 *p = start;
|
||||||
unsigned long cols;
|
unsigned long cols;
|
||||||
for (cols = 0; cols < Width; cols++) {
|
for (cols = 0; cols < Width; cols++) {
|
||||||
uae_u32 tmpval = do_get_mem_byte (p + cols) & Mask;
|
uae_u32 tmpval = do_get_mem_byte(p + cols) & Mask;
|
||||||
do_put_mem_byte (p + cols, (uae_u8)(Pen | tmpval));
|
do_put_mem_byte(p + cols, (uae_u8)(Pen | tmpval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue