Annotation of hatari/src/includes/video.h, revision 1.1.1.12

1.1       root        1: /*
1.1.1.4   root        2:   Hatari - video.h
                      3: 
                      4:   This file is distributed under the GNU Public License, version 2 or at
                      5:   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
                     17:   Scan lines per VBL (50Hz)         : 313 (64 at top,200 screen,49 bottom)
                     18: 
                     19:   Clock cycles per line (60Hz)      : 508
                     20:   NOPs per scan line (60Hz)         : 127
                     21:   Scan lines per VBL (60Hz)         : 263
                     22: 
                     23:   Clock cycles per VBL (50Hz)       : 160256
                     24:   NOPs per VBL (50Hz)               : 40064
                     25: 
                     26:   Pixels per clock cycle (low res)  : 1
                     27:   Pixels per clock cycle (med res)  : 2
                     28:   Pixels per clock cycle (high res) : 4
                     29:   Pixels per NOP (low res)          : 4
                     30:   Pixels per NOP (med res)          : 8
                     31:   Pixels per NOP (high res)         : 16
                     32: */
                     33: 
                     34: /* Scan lines per frame */
                     35: #define SCANLINES_PER_FRAME_50HZ 313    /* Number of scan lines per frame in 50 Hz */
                     36: #define SCANLINES_PER_FRAME_60HZ 263    /* Number of scan lines per frame in 60 Hz */
1.1.1.8   root       37: #define SCANLINES_PER_FRAME_71HZ 501    /* could also be 500 ? */
1.1.1.12! root       38: #define MAX_SCANLINES_PER_FRAME  SCANLINES_PER_FRAME_71HZ    /* Max. number of scan lines per frame */
1.1.1.7   root       39: 
                     40: /* Cycles per line */
                     41: #define CYCLES_PER_LINE_50HZ  512
                     42: #define CYCLES_PER_LINE_60HZ  508
1.1.1.8   root       43: #define CYCLES_PER_LINE_71HZ  224
1.1.1.7   root       44: 
                     45: /* Vertical border/display enable/disable:
                     46:  * Normal screen starts 63 lines in, top border is 29 lines */
1.1.1.10  root       47: #define VIDEO_START_HBL_50HZ   63      /* Usually the first line of the displayed screen in 50 Hz */
                     48: #define VIDEO_START_HBL_60HZ   34      /* The first line of the displayed screen in 60 Hz */
                     49: #define VIDEO_START_HBL_71HZ   34      /* FIXME: 34 is not verified */
                     50: #define FIRST_VISIBLE_HBL_50HZ  34     /* At this line we start rendering our screen in 50 Hz */
                     51: #define FIRST_VISIBLE_HBL_60HZ  (34-29)        /* At this line we start rendering our screen in 60 Hz (29 = 63-34) */
                     52: #define FIRST_VISIBLE_HBL_71HZ  34     /* FIXME: 34 is not verified */
1.1.1.7   root       53: 
1.1.1.10  root       54: #define VIDEO_HEIGHT_HBL_COLOR  200    /* This is usually the height of the screen */
                     55: #define VIDEO_HEIGHT_HBL_MONO   400
1.1.1.8   root       56: 
1.1.1.10  root       57: #define VIDEO_HEIGHT_BOTTOM_50HZ 47    /* number of lines in a 50 Hz bottom border */
                     58: #define VIDEO_HEIGHT_BOTTOM_60HZ 29    /* number of lines in a 60 Hz bottom border */
1.1.1.7   root       59: 
1.1.1.10  root       60: #define VIDEO_END_HBL_50HZ     ( VIDEO_START_HBL_50HZ + VIDEO_HEIGHT_HBL_COLOR )       /* 263 */
                     61: #define VIDEO_END_HBL_60HZ     ( VIDEO_START_HBL_60HZ + VIDEO_HEIGHT_HBL_COLOR )       /* 234 */
1.1.1.8   root       62: 
1.1.1.9   root       63: #define LINE_REMOVE_TOP_CYCLE_STF      504     /* switch to 60 Hz on line 33 should not occur after cycle 504 to remove top border */
                     64:                                                /* switch to 50 Hz should occur after cycle 504 on line 33 */
                     65: #define LINE_REMOVE_BOTTOM_CYCLE_STF   504     /* same value than top border, but on line 262 (50 Hz) or 233 (60 Hz) */
                     66: 
1.1.1.10  root       67: #define LINE_REMOVE_TOP_CYCLE_STE      500     /* on STE, switch can occur 4 cycles earlier than STF */
1.1.1.9   root       68: #define LINE_REMOVE_BOTTOM_CYCLE_STE   500
1.1.1.8   root       69: 
                     70: 
                     71: #define LINE_START_CYCLE_50    56
                     72: #define LINE_START_CYCLE_60    52
1.1.1.12! root       73: #define LINE_START_CYCLE_71    0
1.1.1.10  root       74: #define LINE_END_CYCLE_50      376             /* LINE_START_CYCLE_50 + 320 */
                     75: #define LINE_END_CYCLE_60      372             /* LINE_START_CYCLE_60 + 320 */
1.1.1.12! root       76: #define LINE_END_CYCLE_71      160
        !            77: #define LINE_END_CYCLE_NO_RIGHT        460             /* 372 + 44*2 */
1.1.1.8   root       78: #define LINE_END_CYCLE_50_2    (LINE_END_CYCLE_50+44*2)        /* used in enchanted lands */
                     79: #define LINE_END_CYCLE_FULL    512                             /* used in enchanted lands */
                     80: #define LINE_SCROLL_13_CYCLE_50        20      /* 13 pixels right "hardware" scrolling */
                     81: #define LINE_SCROLL_9_CYCLE_50 24      /*  9 pixels right "hardware" scrolling */
                     82: #define LINE_SCROLL_5_CYCLE_50 28      /*  5 pixels right "hardware" scrolling */
                     83: #define LINE_SCROLL_1_CYCLE_50 32      /*  1 pixels right "hardware" scrolling */
1.1.1.12! root       84: #define LINE_LEFT_MED_CYCLE_1  20      /* med res overscan, shifts display by 0 byte */
        !            85: #define LINE_LEFT_MED_CYCLE_2  28      /* med res overscan, shifts display by 2 bytes */
        !            86: #define        LINE_EMPTY_CYCLE_71_STF 28      /* on STF switch to hi/lo will create an empty line */
        !            87: #define        LINE_EMPTY_CYCLE_71_STE (28+4)  /* on STE switch to hi/lo will create an empty line */
1.1.1.7   root       88: 
                     89: /* Bytes for opened left and right border: */
1.1.1.8   root       90: #define BORDERBYTES_NORMAL     160     /* size of a "normal" line */
                     91: #define BORDERBYTES_LEFT       26
                     92: #define BORDERBYTES_RIGHT      44
                     93: #define BORDERBYTES_RIGHT_FULL 22
1.1.1.7   root       94: 
                     95: /* Legacy defines: */
                     96: #define CYCLES_PER_FRAME    (nScanlinesPerFrame*nCyclesPerLine)  /* Cycles per VBL @ 50fps = 160256 */
                     97: 
                     98: 
1.1.1.11  root       99: #define VBL_VIDEO_CYCLE_OFFSET_STF     64                      /* value of cycle counter when VBL signal is sent */
1.1.1.10  root      100: #define VBL_VIDEO_CYCLE_OFFSET_STE     (64+4)                  /* 4 cycles difference on STE */
                    101: 
1.1.1.11  root      102: #define HBL_VIDEO_CYCLE_OFFSET         0                       /* cycles after end of current line (ie on every 512 cycles in 50 Hz) */
1.1.1.10  root      103: #define TIMERB_VIDEO_CYCLE_OFFSET      28                      /* cycles after last displayed pixels : 376+28 in 50 Hz or 372+28 in 60 Hz */
                    104: 
                    105: /* This is when ff8205/07/09 are reloaded with the content of ff8201/03 (on line 310 in 50 Hz) */
1.1.1.12! root      106: #define RESTART_VIDEO_COUNTER_CYCLE_STF        ( (SCANLINES_PER_FRAME_50HZ-3) * CYCLES_PER_LINE_50HZ + 48 )
        !           107: #define RESTART_VIDEO_COUNTER_CYCLE_STE        ( (SCANLINES_PER_FRAME_50HZ-3) * CYCLES_PER_LINE_50HZ + 48 + 4 )        /* 4 cycles later than STF */
1.1.1.8   root      108: 
1.1.1.10  root      109: /* anything above 4 uses automatic frameskip */
                    110: #define AUTO_FRAMESKIP_LIMIT   5
1.1.1.8   root      111: 
                    112: extern int STRes;
                    113: extern int TTRes;
1.1.1.10  root      114: extern int nFrameSkips;
                    115: extern bool bUseSTShifter;
                    116: extern bool bUseHighRes;
1.1.1.8   root      117: extern int nVBLs;
                    118: extern int nHBL;
                    119: extern int nStartHBL;
1.1.1.10  root      120: extern int nEndHBL;
1.1       root      121: extern int OverscanMode;
1.1.1.7   root      122: extern Uint16 HBLPalettes[];
1.1.1.5   root      123: extern Uint16 *pHBLPalettes;
1.1.1.7   root      124: extern Uint32 HBLPaletteMasks[];
1.1.1.6   root      125: extern Uint32 *pHBLPaletteMasks;
1.1.1.5   root      126: extern Uint32 VideoBase;
1.1.1.3   root      127: extern int nScreenRefreshRate;
1.1       root      128: 
1.1.1.7   root      129: extern int nScanlinesPerFrame;
                    130: extern int nCyclesPerLine;
1.1.1.12! root      131: 
1.1.1.10  root      132: extern int LineTimerBCycle;
1.1.1.12! root      133: extern int TimerBEventCountCycleStart;
        !           134: 
        !           135: extern int LastCycleHblException;
1.1.1.7   root      136: 
1.1.1.11  root      137: extern int HblJitterIndex;
                    138: extern int HblJitterArray[];
                    139: extern int HblJitterArrayPending[];
                    140: extern int VblJitterIndex;
                    141: extern int VblJitterArray[];
                    142: extern int VblJitterArrayPending[];
                    143: 
1.1.1.7   root      144: 
1.1.1.12! root      145: /*--------------------------------------------------------------*/
        !           146: /* Functions prototypes                                                */
        !           147: /*--------------------------------------------------------------*/
        !           148: 
        !           149: extern void    Video_MemorySnapShot_Capture(bool bSave);
        !           150: 
        !           151: extern void    Video_Reset(void);
        !           152: extern void    Video_Reset_Glue(void);
        !           153: 
        !           154: extern void    Video_ConvertPosition( int FrameCycles , int *pHBL , int *pLineCycles );
        !           155: extern void    Video_GetPosition( int *pFrameCycles , int *pHBL , int *pLineCycles );
        !           156: extern void    Video_GetPosition_OnWriteAccess( int *pFrameCycles , int *pHBL , int *pLineCycles );
        !           157: extern void    Video_GetPosition_OnReadAccess( int *pFrameCycles , int *pHBL , int *pLineCycles );
        !           158: 
        !           159: extern void    Video_Sync_WriteByte(void);
        !           160: 
        !           161: extern int     Video_TimerB_GetPos( int LineNumber );
        !           162: 
        !           163: extern void    Video_InterruptHandler_HBL(void);
        !           164: extern void    Video_InterruptHandler_EndLine(void);
1.1.1.4   root      165: 
1.1.1.12! root      166: extern void    Video_SetScreenRasters(void);
        !           167: extern void    Video_GetTTRes(int *width, int *height, int *bpp);
        !           168: 
        !           169: extern void    Video_AddInterruptTimerB ( int Pos );
        !           170: 
        !           171: extern void    Video_StartInterrupts ( int PendingCyclesOver );
        !           172: extern void    Video_InterruptHandler_VBL(void);
        !           173: 
        !           174: extern void Video_ScreenBaseSTE_WriteByte(void);
1.1.1.8   root      175: extern void Video_ScreenCounter_ReadByte(void);
1.1.1.12! root      176: extern void Video_ScreenCounter_WriteByte(void);
1.1.1.5   root      177: extern void Video_Sync_ReadByte(void);
                    178: extern void Video_BaseLow_ReadByte(void);
                    179: extern void Video_LineWidth_ReadByte(void);
                    180: extern void Video_ShifterMode_ReadByte(void);
1.1.1.7   root      181: extern void Video_HorScroll_Read(void);
                    182: extern void Video_LineWidth_WriteByte(void);
1.1.1.5   root      183: extern void Video_Color0_WriteWord(void);
                    184: extern void Video_Color1_WriteWord(void);
                    185: extern void Video_Color2_WriteWord(void);
                    186: extern void Video_Color3_WriteWord(void);
                    187: extern void Video_Color4_WriteWord(void);
                    188: extern void Video_Color5_WriteWord(void);
                    189: extern void Video_Color6_WriteWord(void);
                    190: extern void Video_Color7_WriteWord(void);
                    191: extern void Video_Color8_WriteWord(void);
                    192: extern void Video_Color9_WriteWord(void);
                    193: extern void Video_Color10_WriteWord(void);
                    194: extern void Video_Color11_WriteWord(void);
                    195: extern void Video_Color12_WriteWord(void);
                    196: extern void Video_Color13_WriteWord(void);
                    197: extern void Video_Color14_WriteWord(void);
                    198: extern void Video_Color15_WriteWord(void);
                    199: extern void Video_ShifterMode_WriteByte(void);
1.1.1.10  root      200: extern void Video_HorScroll_Write_8264(void);
                    201: extern void Video_HorScroll_Write_8265(void);
1.1.1.7   root      202: extern void Video_HorScroll_Write(void);
1.1.1.8   root      203: extern void Video_TTShiftMode_WriteWord(void);
                    204: extern void Video_TTColorRegs_WriteWord(void);
                    205: extern void Video_TTColorSTRegs_WriteWord(void);
1.1.1.5   root      206: 
1.1.1.4   root      207: #endif  /* HATARI_VIDEO_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.