--- hatari/src/includes/video.h 2019/04/01 07:13:44 1.1.1.8 +++ hatari/src/includes/video.h 2019/04/01 07:15:32 1.1.1.11 @@ -44,32 +44,35 @@ /* Vertical border/display enable/disable: * Normal screen starts 63 lines in, top border is 29 lines */ -#define SCREEN_START_HBL_50HZ 63 /* Usually the first line of the displayed screen in 50 Hz */ -#define SCREEN_START_HBL_60HZ 34 /* The first line of the displayed screen in 60 Hz */ -#define SCREEN_START_HBL_71HZ 34 /* FIXME: 34 is not verified */ -#define FIRST_VISIBLE_HBL_50HZ 34 /* At this line we start rendering our screen in 50 Hz */ -#define FIRST_VISIBLE_HBL_60HZ (34-29) /* At this line we start rendering our screen in 60 Hz (29 = 63-34) */ -#define FIRST_VISIBLE_HBL_71HZ 34 /* FIXME: 34 is not verified */ - -#define SCREEN_HEIGHT_HBL_COLOR 200 /* This is usually the height of the screen */ -#define SCREEN_HEIGHT_HBL_MONO 400 - -#define SCREEN_END_HBL_50HZ ( SCREEN_START_HBL_50HZ + SCREEN_HEIGHT_HBL_COLOR ) /* 263 */ -#define SCREEN_END_HBL_60HZ ( SCREEN_START_HBL_60HZ + SCREEN_HEIGHT_HBL_COLOR ) /* 234 */ - -/* FIXME: SCREEN_START_CYCLE should rather be 52 or so, but this breaks a lot of other things at the moment... */ -#define SCREEN_START_CYCLE 56 /* Cycle first normal pixel appears on */ - -#define LINE_REMOVE_TOP_CYCLE 504 /* switch to 60 Hz on line 33 should not occur after cycle 504 to remove top border */ - /* switch to 50 Hz should occur after cycle 504 on line 33 */ -#define LINE_REMOVE_BOTTOM_CYCLE 504 /* same value than top border, but on line 262 (50 Hz) or 233 (60 Hz) */ +#define VIDEO_START_HBL_50HZ 63 /* Usually the first line of the displayed screen in 50 Hz */ +#define VIDEO_START_HBL_60HZ 34 /* The first line of the displayed screen in 60 Hz */ +#define VIDEO_START_HBL_71HZ 34 /* FIXME: 34 is not verified */ +#define FIRST_VISIBLE_HBL_50HZ 34 /* At this line we start rendering our screen in 50 Hz */ +#define FIRST_VISIBLE_HBL_60HZ (34-29) /* At this line we start rendering our screen in 60 Hz (29 = 63-34) */ +#define FIRST_VISIBLE_HBL_71HZ 34 /* FIXME: 34 is not verified */ + +#define VIDEO_HEIGHT_HBL_COLOR 200 /* This is usually the height of the screen */ +#define VIDEO_HEIGHT_HBL_MONO 400 + +#define VIDEO_HEIGHT_BOTTOM_50HZ 47 /* number of lines in a 50 Hz bottom border */ +#define VIDEO_HEIGHT_BOTTOM_60HZ 29 /* number of lines in a 60 Hz bottom border */ + +#define VIDEO_END_HBL_50HZ ( VIDEO_START_HBL_50HZ + VIDEO_HEIGHT_HBL_COLOR ) /* 263 */ +#define VIDEO_END_HBL_60HZ ( VIDEO_START_HBL_60HZ + VIDEO_HEIGHT_HBL_COLOR ) /* 234 */ + +#define LINE_REMOVE_TOP_CYCLE_STF 504 /* switch to 60 Hz on line 33 should not occur after cycle 504 to remove top border */ + /* switch to 50 Hz should occur after cycle 504 on line 33 */ +#define LINE_REMOVE_BOTTOM_CYCLE_STF 504 /* same value than top border, but on line 262 (50 Hz) or 233 (60 Hz) */ + +#define LINE_REMOVE_TOP_CYCLE_STE 500 /* on STE, switch can occur 4 cycles earlier than STF */ +#define LINE_REMOVE_BOTTOM_CYCLE_STE 500 #define LINE_START_CYCLE_50 56 #define LINE_START_CYCLE_60 52 #define LINE_START_CYCLE_70 0 -#define LINE_END_CYCLE_50 376 -#define LINE_END_CYCLE_60 372 +#define LINE_END_CYCLE_50 376 /* LINE_START_CYCLE_50 + 320 */ +#define LINE_END_CYCLE_60 372 /* LINE_START_CYCLE_60 + 320 */ #define LINE_END_CYCLE_70 160 #define LINE_END_CYCLE_NO_RIGHT 460 #define LINE_END_CYCLE_50_2 (LINE_END_CYCLE_50+44*2) /* used in enchanted lands */ @@ -92,19 +95,28 @@ #define CYCLES_PER_FRAME (nScanlinesPerFrame*nCyclesPerLine) /* Cycles per VBL @ 50fps = 160256 */ -#define VBL_VIDEO_CYCLE_OFFSET (60+4) -#define HBL_VIDEO_CYCLE_OFFSET (12-12) /* cycles after end of current line */ -#define TIMERB_VIDEO_CYCLE_OFFSET (96+12) /* cycles before end of current line (28 cycles after display off) */ -#define RESTART_VIDEO_COUNTER_CYCLE ( (MAX_SCANLINES_PER_FRAME-3) * CYCLES_PER_LINE_50HZ + 48 ) +#define VBL_VIDEO_CYCLE_OFFSET_STF 64 /* value of cycle counter when VBL signal is sent */ +#define VBL_VIDEO_CYCLE_OFFSET_STE (64+4) /* 4 cycles difference on STE */ + +#define HBL_VIDEO_CYCLE_OFFSET 0 /* cycles after end of current line (ie on every 512 cycles in 50 Hz) */ +#define TIMERB_VIDEO_CYCLE_OFFSET 28 /* cycles after last displayed pixels : 376+28 in 50 Hz or 372+28 in 60 Hz */ +/* This is when ff8205/07/09 are reloaded with the content of ff8201/03 (on line 310 in 50 Hz) */ +#define RESTART_VIDEO_COUNTER_CYCLE_STF ( (MAX_SCANLINES_PER_FRAME-3) * CYCLES_PER_LINE_50HZ + 48 ) +#define RESTART_VIDEO_COUNTER_CYCLE_STE ( (MAX_SCANLINES_PER_FRAME-3) * CYCLES_PER_LINE_50HZ + 48 + 4 ) /* 4 cycles later than STF */ + +/* anything above 4 uses automatic frameskip */ +#define AUTO_FRAMESKIP_LIMIT 5 extern int STRes; extern int TTRes; -extern BOOL bUseSTShifter; -extern BOOL bUseHighRes; +extern int nFrameSkips; +extern bool bUseSTShifter; +extern bool bUseHighRes; extern int nVBLs; extern int nHBL; extern int nStartHBL; +extern int nEndHBL; extern int OverscanMode; extern Uint16 HBLPalettes[]; extern Uint16 *pHBLPalettes; @@ -115,10 +127,20 @@ extern int nScreenRefreshRate; extern int nScanlinesPerFrame; extern int nCyclesPerLine; +extern int LineTimerBCycle; + +extern int HblJitterIndex; +extern int HblJitterArray[]; +extern int HblJitterArrayPending[]; +extern int VblJitterIndex; +extern int VblJitterArray[]; +extern int VblJitterArrayPending[]; +extern void Video_SetSystemTimings(void); extern void Video_Reset(void); -extern void Video_MemorySnapShot_Capture(BOOL bSave); +extern void Video_Reset_Glue(void); +extern void Video_MemorySnapShot_Capture(bool bSave); extern void Video_GetTTRes(int *width, int *height, int *bpp); extern void Video_StartInterrupts(void); extern void Video_InterruptHandler_VBL(void); @@ -154,6 +176,8 @@ extern void Video_Color13_WriteWord(void extern void Video_Color14_WriteWord(void); extern void Video_Color15_WriteWord(void); extern void Video_ShifterMode_WriteByte(void); +extern void Video_HorScroll_Write_8264(void); +extern void Video_HorScroll_Write_8265(void); extern void Video_HorScroll_Write(void); extern void Video_TTShiftMode_WriteWord(void); extern void Video_TTColorRegs_WriteWord(void);