|
|
1.1 root 1: /*
1.1.1.4 root 2: Hatari - video.h
3:
1.1.1.16 root 4: This file is distributed under the GNU General Public License, version 2
5: or at your option any later version. Read the file gpl.txt for details.
1.1 root 6: */
7:
1.1.1.4 root 8: #ifndef HATARI_VIDEO_H
9: #define HATARI_VIDEO_H
10:
1.1.1.7 root 11: /*
12: All the following processor timings are based on a bog standard 8MHz 68000 as
13: found in all standard STs:
14:
15: Clock cycles per line (50Hz) : 512
16: NOPs per scan line (50Hz) : 128
1.1.1.21! root 17: Scan lines per VBL (50Hz) : 313 (63 at top,200 screen,47 bottom)
1.1.1.7 root 18:
19: Clock cycles per line (60Hz) : 508
20: NOPs per scan line (60Hz) : 127
1.1.1.21! root 21: Scan lines per VBL (60Hz) : 263 (34 at top,200 screen,26 bottom)
1.1.1.7 root 22:
23: Clock cycles per VBL (50Hz) : 160256
24: NOPs per VBL (50Hz) : 40064
1.1.1.21! root 25: Clock cycles per VBL (60Hz) : 133604
! 26: NOPs per VBL (50Hz) : 33401
1.1.1.7 root 27:
28: Pixels per clock cycle (low res) : 1
29: Pixels per clock cycle (med res) : 2
30: Pixels per clock cycle (high res) : 4
31: Pixels per NOP (low res) : 4
32: Pixels per NOP (med res) : 8
33: Pixels per NOP (high res) : 16
34: */
35:
1.1.1.19 root 36: #define VIDEO_50HZ 50
37: #define VIDEO_60HZ 60
38: #define VIDEO_71HZ 71
39:
1.1.1.7 root 40: /* Scan lines per frame */
41: #define SCANLINES_PER_FRAME_50HZ 313 /* Number of scan lines per frame in 50 Hz */
42: #define SCANLINES_PER_FRAME_60HZ 263 /* Number of scan lines per frame in 60 Hz */
1.1.1.8 root 43: #define SCANLINES_PER_FRAME_71HZ 501 /* could also be 500 ? */
1.1.1.12 root 44: #define MAX_SCANLINES_PER_FRAME SCANLINES_PER_FRAME_71HZ /* Max. number of scan lines per frame */
1.1.1.7 root 45:
46: /* Cycles per line */
47: #define CYCLES_PER_LINE_50HZ 512
48: #define CYCLES_PER_LINE_60HZ 508
1.1.1.8 root 49: #define CYCLES_PER_LINE_71HZ 224
1.1.1.7 root 50:
51: /* Vertical border/display enable/disable:
52: * Normal screen starts 63 lines in, top border is 29 lines */
1.1.1.10 root 53: #define VIDEO_START_HBL_50HZ 63 /* Usually the first line of the displayed screen in 50 Hz */
54: #define VIDEO_START_HBL_60HZ 34 /* The first line of the displayed screen in 60 Hz */
55: #define VIDEO_START_HBL_71HZ 34 /* FIXME: 34 is not verified */
56: #define FIRST_VISIBLE_HBL_50HZ 34 /* At this line we start rendering our screen in 50 Hz */
57: #define FIRST_VISIBLE_HBL_60HZ (34-29) /* At this line we start rendering our screen in 60 Hz (29 = 63-34) */
58: #define FIRST_VISIBLE_HBL_71HZ 34 /* FIXME: 34 is not verified */
1.1.1.7 root 59:
1.1.1.10 root 60: #define VIDEO_HEIGHT_HBL_COLOR 200 /* This is usually the height of the screen */
61: #define VIDEO_HEIGHT_HBL_MONO 400
1.1.1.8 root 62:
1.1.1.21! root 63: #define VIDEO_HEIGHT_BOTTOM_50HZ 47 /* number of extra pixel lines in a 50 Hz screen when removing bottom border */
! 64: /* (the 2 last lines are masked by the vblank signal and can be displayed */
! 65: /* by doing a 2nd 60/50 Hz switch at the end of line 308) */
1.1.1.20 root 66: #define VIDEO_HEIGHT_BOTTOM_60HZ 26 /* number of extra pixel lines in a 60 Hz screen when removing bottom border */
1.1.1.21! root 67: /* (the 2 last lines are masked by the vblank signal and can be displayed */
! 68: /* by doing a 2nd 50/60 Hz switch at the end of line 258) */
1.1.1.7 root 69:
1.1.1.10 root 70: #define VIDEO_END_HBL_50HZ ( VIDEO_START_HBL_50HZ + VIDEO_HEIGHT_HBL_COLOR ) /* 263 */
71: #define VIDEO_END_HBL_60HZ ( VIDEO_START_HBL_60HZ + VIDEO_HEIGHT_HBL_COLOR ) /* 234 */
1.1.1.19 root 72: #define VIDEO_END_HBL_71HZ ( VIDEO_START_HBL_71HZ + VIDEO_HEIGHT_HBL_MONO ) /* 434 */
1.1.1.8 root 73:
1.1.1.9 root 74: #define LINE_REMOVE_TOP_CYCLE_STF 504 /* switch to 60 Hz on line 33 should not occur after cycle 504 to remove top border */
75: /* switch to 50 Hz should occur after cycle 504 on line 33 */
76: #define LINE_REMOVE_BOTTOM_CYCLE_STF 504 /* same value than top border, but on line 262 (50 Hz) or 233 (60 Hz) */
77:
1.1.1.10 root 78: #define LINE_REMOVE_TOP_CYCLE_STE 500 /* on STE, switch can occur 4 cycles earlier than STF */
1.1.1.9 root 79: #define LINE_REMOVE_BOTTOM_CYCLE_STE 500
1.1.1.8 root 80:
81:
1.1.1.19 root 82: /* Values for VerticalOverscan */
83: #define V_OVERSCAN_NONE 0x00
84: #define V_OVERSCAN_NO_TOP 0x01
85: #define V_OVERSCAN_NO_BOTTOM_50 0x02
86: #define V_OVERSCAN_NO_BOTTOM_60 0x04
87: #define V_OVERSCAN_BOTTOM_SHORT_50 0x08
88: #define V_OVERSCAN_NO_DE 0x10
89:
90:
1.1.1.8 root 91: #define LINE_START_CYCLE_50 56
92: #define LINE_START_CYCLE_60 52
1.1.1.12 root 93: #define LINE_START_CYCLE_71 0
1.1.1.10 root 94: #define LINE_END_CYCLE_50 376 /* LINE_START_CYCLE_50 + 320 */
95: #define LINE_END_CYCLE_60 372 /* LINE_START_CYCLE_60 + 320 */
1.1.1.12 root 96: #define LINE_END_CYCLE_71 160
97: #define LINE_END_CYCLE_NO_RIGHT 460 /* 372 + 44*2 */
1.1.1.13 root 98: #define LINE_END_CYCLE_50_2 (LINE_END_CYCLE_50+44*2) /* 464, used in enchanted lands */
1.1.1.8 root 99: #define LINE_END_CYCLE_FULL 512 /* used in enchanted lands */
1.1.1.19 root 100: #define LINE_LEFT_STAB_LOW 16 /* remove left + med res stab using hi/med/lo switches */
1.1.1.8 root 101: #define LINE_SCROLL_13_CYCLE_50 20 /* 13 pixels right "hardware" scrolling */
102: #define LINE_SCROLL_9_CYCLE_50 24 /* 9 pixels right "hardware" scrolling */
103: #define LINE_SCROLL_5_CYCLE_50 28 /* 5 pixels right "hardware" scrolling */
104: #define LINE_SCROLL_1_CYCLE_50 32 /* 1 pixels right "hardware" scrolling */
1.1.1.12 root 105: #define LINE_LEFT_MED_CYCLE_1 20 /* med res overscan, shifts display by 0 byte */
106: #define LINE_LEFT_MED_CYCLE_2 28 /* med res overscan, shifts display by 2 bytes */
107: #define LINE_EMPTY_CYCLE_71_STF 28 /* on STF switch to hi/lo will create an empty line */
108: #define LINE_EMPTY_CYCLE_71_STE (28+4) /* on STE switch to hi/lo will create an empty line */
1.1.1.7 root 109:
110: /* Bytes for opened left and right border: */
1.1.1.8 root 111: #define BORDERBYTES_NORMAL 160 /* size of a "normal" line */
112: #define BORDERBYTES_LEFT 26
1.1.1.13 root 113: #define BORDERBYTES_LEFT_2_STE 20
1.1.1.8 root 114: #define BORDERBYTES_RIGHT 44
115: #define BORDERBYTES_RIGHT_FULL 22
1.1.1.7 root 116:
117:
118:
1.1.1.11 root 119: #define VBL_VIDEO_CYCLE_OFFSET_STF 64 /* value of cycle counter when VBL signal is sent */
1.1.1.10 root 120: #define VBL_VIDEO_CYCLE_OFFSET_STE (64+4) /* 4 cycles difference on STE */
121:
1.1.1.11 root 122: #define HBL_VIDEO_CYCLE_OFFSET 0 /* cycles after end of current line (ie on every 512 cycles in 50 Hz) */
1.1.1.16 root 123: #define TIMERB_VIDEO_CYCLE_OFFSET 24 /* cycles after last displayed pixels : 376+24 in 50 Hz or 372+24 in 60 Hz */
1.1.1.10 root 124:
1.1.1.20 root 125: /* This is when ff8205/07/09 are reloaded with the content of ff8201/03 : on line 310 cycle 56/60 in 50 Hz and on line 260 cycle 56/60 in 60 Hz */
1.1.1.19 root 126: /* (values were measured on real STF/STE) */
127: #define RESTART_VIDEO_COUNTER_LINE_50HZ ( SCANLINES_PER_FRAME_50HZ-3 )
128: #define RESTART_VIDEO_COUNTER_LINE_60HZ ( SCANLINES_PER_FRAME_60HZ-3 )
1.1.1.20 root 129: #define RESTART_VIDEO_COUNTER_CYCLE_STF ( 56 )
130: #define RESTART_VIDEO_COUNTER_CYCLE_STE ( 56 + 4 ) /* 4 cycles later than STF */
1.1.1.8 root 131:
1.1.1.21! root 132:
! 133: /* Values for some HW video signals, should be 0 or 1 */
! 134: #define VSYNC_SIGNAL_OFF 0
! 135: #define VSYNC_SIGNAL_ON 1
! 136: #define VBLANK_SIGNAL_OFF 0
! 137: #define VBLANK_SIGNAL_ON 1
! 138:
! 139:
! 140:
1.1.1.10 root 141: /* anything above 4 uses automatic frameskip */
142: #define AUTO_FRAMESKIP_LIMIT 5
1.1.1.8 root 143:
144: extern int STRes;
145: extern int TTRes;
1.1.1.10 root 146: extern int nFrameSkips;
147: extern bool bUseHighRes;
1.1.1.8 root 148: extern int nVBLs;
149: extern int nHBL;
150: extern int nStartHBL;
1.1.1.10 root 151: extern int nEndHBL;
1.1.1.19 root 152: extern int VerticalOverscan;
1.1.1.14 root 153: extern Uint16 HBLPalettes[HBL_PALETTE_LINES];
1.1.1.5 root 154: extern Uint16 *pHBLPalettes;
1.1.1.14 root 155: extern Uint32 HBLPaletteMasks[HBL_PALETTE_MASKS];
1.1.1.6 root 156: extern Uint32 *pHBLPaletteMasks;
1.1.1.5 root 157: extern Uint32 VideoBase;
1.1.1.3 root 158: extern int nScreenRefreshRate;
1.1 root 159:
1.1.1.7 root 160: extern int nScanlinesPerFrame;
161: extern int nCyclesPerLine;
1.1.1.19 root 162: extern int TTSpecialVideoMode;
163: extern int LineTimerBPos;
1.1.1.12 root 164: extern int TimerBEventCountCycleStart;
165:
1.1.1.15 root 166: #define HBL_JITTER_ARRAY_SIZE 5
1.1.1.11 root 167: extern int HblJitterIndex;
1.1.1.15 root 168: extern const int HblJitterArray[HBL_JITTER_ARRAY_SIZE];
169: extern const int HblJitterArrayPending[HBL_JITTER_ARRAY_SIZE];
170: #define VBL_JITTER_ARRAY_SIZE 5
1.1.1.11 root 171: extern int VblJitterIndex;
1.1.1.15 root 172: extern const int VblJitterArray[VBL_JITTER_ARRAY_SIZE];
173: extern const int VblJitterArrayPending[VBL_JITTER_ARRAY_SIZE];
1.1.1.11 root 174:
1.1.1.7 root 175:
1.1.1.12 root 176: /*--------------------------------------------------------------*/
177: /* Functions prototypes */
178: /*--------------------------------------------------------------*/
179:
180: extern void Video_MemorySnapShot_Capture(bool bSave);
181:
182: extern void Video_Reset(void);
183: extern void Video_Reset_Glue(void);
184:
1.1.1.19 root 185: extern void Video_InitTimings(void);
186: extern void Video_SetTimings( MACHINETYPE MachineType , VIDEOTIMINGMODE Mode );
187: extern const char* Video_GetTimings_Name ( void );
188:
1.1.1.12 root 189: extern void Video_ConvertPosition( int FrameCycles , int *pHBL , int *pLineCycles );
190: extern void Video_GetPosition( int *pFrameCycles , int *pHBL , int *pLineCycles );
191: extern void Video_GetPosition_OnWriteAccess( int *pFrameCycles , int *pHBL , int *pLineCycles );
192: extern void Video_GetPosition_OnReadAccess( int *pFrameCycles , int *pHBL , int *pLineCycles );
193:
194: extern void Video_Sync_WriteByte(void);
195:
196: extern int Video_TimerB_GetPos( int LineNumber );
197:
198: extern void Video_InterruptHandler_HBL(void);
199: extern void Video_InterruptHandler_EndLine(void);
1.1.1.4 root 200:
1.1.1.12 root 201: extern void Video_SetScreenRasters(void);
202: extern void Video_GetTTRes(int *width, int *height, int *bpp);
1.1.1.13 root 203: extern bool Video_RenderTTScreen(void);
1.1.1.12 root 204:
1.1.1.19 root 205: extern void Video_AddInterruptTimerB ( int LineVideo , int CycleVideo , int Pos );
1.1.1.12 root 206:
207: extern void Video_StartInterrupts ( int PendingCyclesOver );
208: extern void Video_InterruptHandler_VBL(void);
209:
1.1.1.19 root 210: extern void Video_ScreenBase_WriteByte(void);
1.1.1.8 root 211: extern void Video_ScreenCounter_ReadByte(void);
1.1.1.12 root 212: extern void Video_ScreenCounter_WriteByte(void);
1.1.1.5 root 213: extern void Video_Sync_ReadByte(void);
214: extern void Video_BaseLow_ReadByte(void);
215: extern void Video_LineWidth_ReadByte(void);
1.1.1.19 root 216: extern void Video_Res_ReadByte(void);
1.1.1.7 root 217: extern void Video_HorScroll_Read(void);
218: extern void Video_LineWidth_WriteByte(void);
1.1.1.5 root 219: extern void Video_Color0_WriteWord(void);
220: extern void Video_Color1_WriteWord(void);
221: extern void Video_Color2_WriteWord(void);
222: extern void Video_Color3_WriteWord(void);
223: extern void Video_Color4_WriteWord(void);
224: extern void Video_Color5_WriteWord(void);
225: extern void Video_Color6_WriteWord(void);
226: extern void Video_Color7_WriteWord(void);
227: extern void Video_Color8_WriteWord(void);
228: extern void Video_Color9_WriteWord(void);
229: extern void Video_Color10_WriteWord(void);
230: extern void Video_Color11_WriteWord(void);
231: extern void Video_Color12_WriteWord(void);
232: extern void Video_Color13_WriteWord(void);
233: extern void Video_Color14_WriteWord(void);
234: extern void Video_Color15_WriteWord(void);
1.1.1.17 root 235: extern void Video_Color0_ReadWord(void);
236: extern void Video_Color1_ReadWord(void);
237: extern void Video_Color2_ReadWord(void);
238: extern void Video_Color3_ReadWord(void);
239: extern void Video_Color4_ReadWord(void);
240: extern void Video_Color5_ReadWord(void);
241: extern void Video_Color6_ReadWord(void);
242: extern void Video_Color7_ReadWord(void);
243: extern void Video_Color8_ReadWord(void);
244: extern void Video_Color9_ReadWord(void);
245: extern void Video_Color10_ReadWord(void);
246: extern void Video_Color11_ReadWord(void);
247: extern void Video_Color12_ReadWord(void);
248: extern void Video_Color13_ReadWord(void);
249: extern void Video_Color14_ReadWord(void);
250: extern void Video_Color15_ReadWord(void);
1.1.1.19 root 251: extern void Video_Res_WriteByte(void);
252: extern void Video_HorScroll_Read_8264(void);
253: extern void Video_HorScroll_Read_8265(void);
1.1.1.10 root 254: extern void Video_HorScroll_Write_8264(void);
255: extern void Video_HorScroll_Write_8265(void);
1.1.1.7 root 256: extern void Video_HorScroll_Write(void);
1.1.1.8 root 257: extern void Video_TTShiftMode_WriteWord(void);
1.1.1.19 root 258: extern void Video_TTColorRegs_Write(void);
259: extern void Video_TTColorRegs_STRegWrite(void);
1.1.1.5 root 260:
1.1.1.18 root 261: extern void Video_Info(FILE *fp, Uint32 dummy);
1.1.1.17 root 262:
1.1.1.4 root 263: #endif /* HATARI_VIDEO_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.