|
|
1.1 ! root 1: /* ! 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. ! 6: */ ! 7: ! 8: #ifndef HATARI_MAIN_H ! 9: #define HATARI_MAIN_H ! 10: ! 11: typedef int BOOL; ! 12: #ifndef bool ! 13: typedef int bool; ! 14: #endif /* bool */ ! 15: ! 16: #define PROG_NAME "Frontier: Elite 2" /* Name, version for window title */ ! 17: ! 18: #define MAX_FILENAME_LENGTH 256 ! 19: #define MAX_STRING_LENGTH 512 ! 20: ! 21: #include <stdio.h> ! 22: #include <stdlib.h> ! 23: #include <string.h> ! 24: #include <math.h> ! 25: #include <time.h> ! 26: #include <assert.h> ! 27: ! 28: ! 29: #ifndef FALSE ! 30: #define FALSE 0 ! 31: #define TRUE (!0) ! 32: #endif ! 33: ! 34: #define CALL_VAR(func) { ((void(*)(void))func)(); } ! 35: ! 36: /* VM Memory size */ ! 37: #define MEMORY_SIZE (16*1024*1024) ! 38: ! 39: /* 68000 operand sizes */ ! 40: #define SIZE_BYTE 1 ! 41: #define SIZE_WORD 2 ! 42: #define SIZE_LONG 4 ! 43: ! 44: /* 68000 Register defines */ ! 45: enum { ! 46: REG_D0, /* D0.. */ ! 47: REG_D1, ! 48: REG_D2, ! 49: REG_D3, ! 50: REG_D4, ! 51: REG_D5, ! 52: REG_D6, ! 53: REG_D7, /* ..D7 */ ! 54: REG_A0, /* A0.. */ ! 55: REG_A1, ! 56: REG_A2, ! 57: REG_A3, ! 58: REG_A4, ! 59: REG_A5, ! 60: REG_A6, ! 61: REG_A7, /* ..A7(also SP) */ ! 62: }; ! 63: ! 64: /* PC Condition code's */ ! 65: #define PC_CARRY 0x0001 /* Bit 0 */ ! 66: #define PC_AUX 0x0010 /* Bit 4 */ ! 67: #define PC_ZERO 0x0040 /* Bit 6 */ ! 68: #define PC_NEG 0x0080 /* Bit 7 */ ! 69: #define PC_OVERFLOW 0x0800 /* Bit 11 */ ! 70: ! 71: /* 68000 Condition code's */ ! 72: #define SR_AUX 0x0010 ! 73: #define SR_NEG 0x0008 ! 74: #define SR_ZERO 0x0004 ! 75: #define SR_OVERFLOW 0x0002 ! 76: #define SR_CARRY 0x0001 ! 77: ! 78: #define SR_CLEAR_AUX 0xffef ! 79: #define SR_CLEAR_NEG 0xfff7 ! 80: #define SR_CLEAR_ZERO 0xfffb ! 81: #define SR_CLEAR_OVERFLOW 0xfffd ! 82: #define SR_CLEAR_CARRY 0xfffe ! 83: ! 84: #define SR_CCODE_MASK (SR_AUX|SR_NEG|SR_ZERO|SR_OVERFLOW|SR_CARRY) ! 85: #define SR_MASK 0xFFE0 ! 86: ! 87: #define SR_TRACEMODE 0x8000 ! 88: #define SR_SUPERMODE 0x2000 ! 89: #define SR_IPL 0x0700 ! 90: ! 91: #define SR_CLEAR_IPL 0xf8ff ! 92: #define SR_CLEAR_TRACEMODE 0x7fff ! 93: #define SR_CLEAR_SUPERMODE 0xdfff ! 94: ! 95: /* Emuation condition codes, ordered so can do 'xor al,al' to set XNZVC -0000 */ ! 96: #define EMU_X 0x0100 ! 97: #define EMU_N 0x0080 ! 98: #define EMU_Z 0x0040 ! 99: #define EMU_V 0x0020 ! 100: #define EMU_C 0x0010 ! 101: ! 102: #define EMU_CLEAR_X 0xfeff ! 103: #define EMU_CLEAR_N 0xff7f ! 104: #define EMU_CLEAR_Z 0xffbf ! 105: #define EMU_CLEAR_V 0xffdf ! 106: #define EMU_CLEAR_C 0xffef ! 107: ! 108: /* Exception vectors */ ! 109: #define EXCEPTION_BUSERROR 0x00000008 ! 110: #define EXCEPTION_ADDRERROR 0x0000000c ! 111: #define EXCEPTION_ILLEGALINS 0x00000010 ! 112: #define EXCEPTION_DIVZERO 0x00000014 ! 113: #define EXCEPTION_CHK 0x00000018 ! 114: #define EXCEPTION_TRAPV 0x0000001c ! 115: #define EXCEPTION_TRACE 0x00000024 ! 116: #define EXCEPTION_LINE_A 0x00000028 ! 117: #define EXCEPTION_LINE_F 0x0000002c ! 118: #define EXCEPTION_HBLANK 0x00000068 ! 119: #define EXCEPTION_VBLANK 0x00000070 ! 120: #define EXCEPTION_INPUT 0x00000074 ! 121: #define EXCEPTION_TRAP0 0x00000080 ! 122: #define EXCEPTION_TRAP1 0x00000084 ! 123: #define EXCEPTION_TRAP2 0x00000088 ! 124: #define EXCEPTION_TRAP13 0x000000B4 ! 125: #define EXCEPTION_TRAP14 0x000000B8 ! 126: ! 127: /* Find IPL - don't forget to call MakeSR() before you use it! */ ! 128: #define FIND_IPL ((SR>>8)&0x7) ! 129: ! 130: /* Size of 68000 instructions */ ! 131: #define MAX_68000_INSTRUCTION_SIZE 10 /* Longest 68000 instruction is 10 bytes(6+4) */ ! 132: #define MIN_68000_INSTRUCTION_SIZE 2 /* Smallest 68000 instruction is 2 bytes(ie NOP) */ ! 133: ! 134: /* ! 135: All the following processor timings are based on a bog standard 8MHz 68000 as found in all standard ST's ! 136: ! 137: Clock cycles per line (50Hz) : 512 ! 138: NOPs per scan line (50Hz) : 128 ! 139: Scan lines per VBL (50Hz) : 313 (64 at top,200 screen,49 bottom) ! 140: ! 141: Clock cycles per line (60Hz) : 508 ! 142: NOPs per scan line (60Hz) : 127 ! 143: Scan lines per VBL (60Hz) : 263 ! 144: ! 145: Clock cycles per VBL (50Hz) : 160256 ! 146: NOPs per VBL (50Hz) : 40064 ! 147: ! 148: Pixels per clock cycle (low res) : 1 ! 149: Pixels per clock cycle (med res) : 2 ! 150: Pixels per clock cycle (high res) : 4 ! 151: Pixels per NOP (low res) : 4 ! 152: Pixels per NOP (med res) : 8 ! 153: Pixels per NOP (high res) : 16 ! 154: */ ! 155: #define SCREEN_HEIGHT_HBL 200 /* This is usually the height of the screen */ ! 156: ! 157: #define SCREENBYTES_LINE 320 ! 158: ! 159: #define SCREEN_START_CYCLE 96 /* Cycle first normal pixel appears on */ ! 160: #define SCANLINES_PER_FRAME 313 /* Number of scan lines per frame */ ! 161: #define CYCLES_PER_LINE 512 /* Cycles per horiztonal line scan */ ! 162: #define CYCLES_PER_FRAME (SCANLINES_PER_FRAME*CYCLES_PER_LINE) /* Cycles per VBL @ 50fps = 160256 */ ! 163: #define CYCLES_PER_SEC (CYCLES_PER_FRAME*50) /* Cycles per second */ ! 164: #define CYCLES_ENDLINE (64+320+88+40) /* DE(Display Enable) */ ! 165: #define CYCLES_HBL (CYCLES_PER_LINE+96) /* Cycles for first HBL - very inaccurate on ST */ ! 166: #define CYCLES_DEBUGGER 3000 /* Check debugger every 'x' cycles */ ! 167: ! 168: /* Illegal Opcode used to call C code from 68k emu */ ! 169: #define HOSTCALL_OPCODE 10 /* Free op-code to initialize system (connected drives etc.) */ ! 170: #define HCALL_OPCODE 11 ! 171: ! 172: #define PRG_HEADER_SIZE 0x1c /* Size of header at start of ST .prg files */ ! 173: ! 174: ! 175: extern BOOL bQuitProgram; ! 176: extern BOOL bEmulationActive; ! 177: extern char szName[]; ! 178: extern char szBootDiscImage[MAX_FILENAME_LENGTH]; ! 179: extern char szWorkingDir[MAX_FILENAME_LENGTH]; ! 180: extern char szCurrentDir[MAX_FILENAME_LENGTH]; ! 181: ! 182: extern void Main_SysError(char *Error,char *Title); ! 183: extern int Main_Message(char *lpText, char *lpCaption /*, unsigned int uType*/); ! 184: extern void Main_PauseEmulation(void); ! 185: extern void Main_UnPauseEmulation(void); ! 186: extern void Main_EventHandler(); ! 187: ! 188: #endif /* ifndef HATARI_MAIN_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.