Annotation of hatari/src/includes/main.h, revision 1.1.1.9

1.1       root        1: /*
1.1.1.6   root        2:   Hatari - main.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.6   root        8: #ifndef HATARI_MAIN_H
                      9: #define HATARI_MAIN_H
1.1       root       10: 
                     11: typedef int BOOL;
                     12: 
1.1.1.9 ! root       13: #define PROG_NAME      "Hatari v0.60" /* Name, version for window title */
        !            14: #define PROG_VERSION   "v0.60"
1.1       root       15: 
1.1.1.9 ! root       16: /*#define DEBUG_TO_FILE*/             /* Use debug.txt files */
1.1       root       17: 
                     18: 
                     19: #include <stdio.h>
                     20: #include <stdlib.h>
                     21: #include <string.h>
                     22: #include <math.h>
                     23: #include <time.h>
                     24: 
1.1.1.8   root       25: #include <SDL_types.h>
                     26: 
                     27: 
                     28: #define MAX_STRING_LENGTH  512
1.1       root       29: 
                     30: #ifndef FALSE
                     31: #define FALSE 0
                     32: #define TRUE (!0)
                     33: #endif
                     34: 
                     35: #define CALL_VAR(func)  { ((void(*)(void))func)(); }
                     36: 
                     37: 
1.1.1.4   root       38: /* 68000 operand sizes */
1.1       root       39: #define SIZE_BYTE  1
                     40: #define SIZE_WORD  2
                     41: #define SIZE_LONG  4
                     42: 
                     43: /* 68000 Register defines */
                     44: enum {
                     45:   REG_D0,    /* D0.. */
                     46:   REG_D1,
                     47:   REG_D2,
                     48:   REG_D3,
                     49:   REG_D4,
                     50:   REG_D5,
                     51:   REG_D6,
                     52:   REG_D7,    /* ..D7 */
                     53:   REG_A0,    /* A0.. */
                     54:   REG_A1,
                     55:   REG_A2,
                     56:   REG_A3,
                     57:   REG_A4,
                     58:   REG_A5,
                     59:   REG_A6,
1.1.1.8   root       60:   REG_A7,    /* ..A7 (also SP) */
1.1       root       61: };
                     62: 
                     63: /* 68000 Condition code's */
                     64: #define SR_AUX      0x0010
                     65: #define SR_NEG      0x0008
                     66: #define SR_ZERO      0x0004
                     67: #define SR_OVERFLOW    0x0002
                     68: #define SR_CARRY    0x0001
                     69: 
                     70: #define SR_CLEAR_AUX    0xffef
                     71: #define SR_CLEAR_NEG    0xfff7
                     72: #define SR_CLEAR_ZERO    0xfffb
                     73: #define SR_CLEAR_OVERFLOW  0xfffd
                     74: #define SR_CLEAR_CARRY    0xfffe
                     75: 
                     76: #define SR_CCODE_MASK    (SR_AUX|SR_NEG|SR_ZERO|SR_OVERFLOW|SR_CARRY)
                     77: #define SR_MASK      0xFFE0
                     78: 
                     79: #define SR_TRACEMODE    0x8000
                     80: #define SR_SUPERMODE    0x2000
                     81: #define SR_IPL      0x0700
                     82: 
                     83: #define SR_CLEAR_IPL    0xf8ff
                     84: #define SR_CLEAR_TRACEMODE  0x7fff
                     85: #define SR_CLEAR_SUPERMODE  0xdfff
                     86: 
                     87: /* Exception vectors */
1.1.1.6   root       88: #define  EXCEPTION_BUSERROR   0x00000008
1.1       root       89: #define  EXCEPTION_ADDRERROR  0x0000000c
1.1.1.6   root       90: #define  EXCEPTION_ILLEGALINS 0x00000010
                     91: #define  EXCEPTION_DIVZERO    0x00000014
                     92: #define  EXCEPTION_CHK        0x00000018
                     93: #define  EXCEPTION_TRAPV      0x0000001c
                     94: #define  EXCEPTION_TRACE      0x00000024
                     95: #define  EXCEPTION_LINE_A     0x00000028
                     96: #define  EXCEPTION_LINE_F     0x0000002c
                     97: #define  EXCEPTION_HBLANK     0x00000068
                     98: #define  EXCEPTION_VBLANK     0x00000070
                     99: #define  EXCEPTION_TRAP0      0x00000080
                    100: #define  EXCEPTION_TRAP1      0x00000084
                    101: #define  EXCEPTION_TRAP2      0x00000088
                    102: #define  EXCEPTION_TRAP13     0x000000B4
                    103: #define  EXCEPTION_TRAP14     0x000000B8
1.1       root      104: 
1.1.1.6   root      105: /* Find IPL - don't forget to call MakeSR() before you use it! */
1.1       root      106: #define FIND_IPL    ((SR>>8)&0x7)
                    107: 
                    108: /* Size of 68000 instructions */
                    109: #define MAX_68000_INSTRUCTION_SIZE  10  /* Longest 68000 instruction is 10 bytes(6+4) */
                    110: #define MIN_68000_INSTRUCTION_SIZE  2   /* Smallest 68000 instruction is 2 bytes(ie NOP) */
                    111: 
                    112: /*
                    113:   All the following processor timings are based on a bog standard 8MHz 68000 as found in all standard ST's
                    114: 
                    115:   Clock cycles per line (50Hz)      : 512
                    116:   NOPs per scan line (50Hz)         : 128
1.1.1.7   root      117:   Scan lines per VBL (50Hz)         : 313 (64 at top,200 screen,49 bottom)
1.1       root      118: 
                    119:   Clock cycles per line (60Hz)      : 508
                    120:   NOPs per scan line (60Hz)         : 127
1.1.1.7   root      121:   Scan lines per VBL (60Hz)         : 263
1.1       root      122: 
1.1.1.7   root      123:   Clock cycles per VBL (50Hz)       : 160256
                    124:   NOPs per VBL (50Hz)               : 40064
1.1       root      125: 
                    126:   Pixels per clock cycle (low res)  : 1
                    127:   Pixels per clock cycle (med res)  : 2
                    128:   Pixels per clock cycle (high res) : 4
                    129:   Pixels per NOP (low res)          : 4
                    130:   Pixels per NOP (med res)          : 8
                    131:   Pixels per NOP (high res)         : 16
                    132: */
1.1.1.6   root      133: #define SCREEN_START_HBL   64           /* This is usually the first line of the displayed screen */
1.1       root      134: #define SCREEN_HEIGHT_HBL  200          /* This is usually the height of the screen */
                    135: #define FIRST_VISIBLE_HBL  (SCREEN_START_HBL-OVERSCAN_TOP)    /* Normal screen starts 64 lines in, top border is 28 lines */
1.1.1.6   root      136: #define NUM_VISIBLE_LINES  (OVERSCAN_TOP+SCREEN_HEIGHT_HBL+OVERSCAN_BOTTOM)  /* Number of visible screen lines including top/bottom borders */
1.1       root      137: 
                    138: /* Assumes 32 pixels left+right */
                    139: #define SCREENBYTES_LEFT    16          /* Bytes for left border in ST screen */
1.1.1.6   root      140: #define SCREENBYTES_MIDDLE  160         /* Middle(320 pixels) */
                    141: #define SCREENBYTES_RIGHT   16          /* right border */
1.1       root      142: #define SCREENBYTES_LINE    (SCREENBYTES_LEFT+SCREENBYTES_MIDDLE+SCREENBYTES_RIGHT)
                    143: 
                    144: /* Overscan values */
1.1.1.6   root      145: #define OVERSCAN_LEFT       (SCREENBYTES_LEFT*2)    /* Number of pixels in each border */
1.1       root      146: #define OVERSCAN_RIGHT      (SCREENBYTES_RIGHT*2)
1.1.1.6   root      147: #define OVERSCAN_TOP        29
                    148: #define OVERSCAN_BOTTOM     38
                    149: #define OVERSCAN_MIDDLE     320         /* Number of pixels across screen(low res) */
                    150: 
                    151: #define SCREEN_START_CYCLE  96          /* Cycle first normal pixel appears on */
                    152: #define SCANLINES_PER_FRAME 313         /* Number of scan lines per frame */
                    153: #define CYCLES_PER_LINE     512         /* Cycles per horiztonal line scan */
1.1.1.7   root      154: #define CYCLES_VBL_IN       (SCREEN_START_HBL*CYCLES_PER_LINE)     /* ((28+64)*CYCLES_PER_LINE) */
1.1       root      155: #define CYCLES_PER_FRAME    (SCANLINES_PER_FRAME*CYCLES_PER_LINE)  /* Cycles per VBL @ 50fps = 160256 */
1.1.1.6   root      156: #define CYCLES_PER_SEC      (CYCLES_PER_FRAME*50) /* Cycles per second */
                    157: #define CYCLES_ENDLINE      (64+320+88+40)        /* DE(Display Enable) */
                    158: #define CYCLES_HBL          (CYCLES_PER_LINE+96)  /* Cycles for first HBL - very inaccurate on ST */
1.1       root      159: 
                    160: /* Illegal Opcode used to help emulation. eg. free entries are 8 to 15 inc' */
                    161: #define  GEMDOS_OPCODE        8  /* Free op-code to intercept GemDOS trap */
1.1.1.7   root      162: #define  SYSINIT_OPCODE      10  /* Free op-code to initialize system (connected drives etc.) */
1.1       root      163: #define  VDI_OPCODE          12  /* Free op-code to call VDI handlers AFTER Trap#2 */
1.1.1.6   root      164: 
1.1       root      165: 
                    166: #define PRG_HEADER_SIZE    0x1c  /* Size of header at start of ST .prg files */
                    167: 
                    168: 
                    169: extern BOOL bQuitProgram;
1.1.1.2   root      170: extern BOOL bEnableDebug;
1.1       root      171: extern BOOL bEmulationActive;
1.1.1.8   root      172: extern char szBootDiscImage[FILENAME_MAX];
                    173: extern char szWorkingDir[FILENAME_MAX];
                    174: 
1.1       root      175: 
                    176: extern void Main_MemorySnapShot_Capture(BOOL bSave);
                    177: extern void Main_SysError(char *Error,char *Title);
1.1.1.9 ! root      178: extern int Main_Message(char *pText, char *pCaption);
1.1       root      179: extern void Main_PauseEmulation(void);
                    180: extern void Main_UnPauseEmulation(void);
1.1.1.9 ! root      181: extern void Main_WarpMouse(int x, int y);
        !           182: extern void Main_EventHandler(void);
1.1       root      183: 
1.1.1.6   root      184: #endif /* ifndef HATARI_MAIN_H */

unix.superglobalmegacorp.com

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