1 /* 2 * TTTTTTTTTTTTTT EEEEEEEEEEEEEE OOOOOOOOOOOOOO 3 * TTTTTTTTTTTTTT EEEEEEEEEEEEEE OOOOOOOOOOOOOO 4 * TT EE OO OO 5 * TT EE OO OO 6 * TT EE OO OO 7 * TT EEEEEEEEEE OO OO 8 * TT EEEEEEEEEE OO OO 9 * TT EE OO OO 10 * TT EE OO OO 11 * TT EE OO OO 12 * TT EEEEEEEEEEEEEE OOOOOOOOOOOOOO 13 * TT EEEEEEEEEEEEEE OOOOOOOOOOOOOO 14 * 15 * L'�mulateur Thomson TO8 16 * 17 * Copyright (C) 1997-2017 Gilles F�tis, Eric Botcazou, Alexandre Pukall, 18 * J�r�mie Guillaume, Fran�ois Mouret, 19 * Samuel Devulder 20 * 21 * This program is free software; you can redistribute it and/or modify 22 * it under the terms of the GNU General Public License as published by 23 * the Free Software Foundation; either version 2 of the License, or 24 * (at your option) any later version. 25 * 26 * This program is distributed in the hope that it will be useful, 27 * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 * GNU General Public License for more details. 30 * 31 * You should have received a copy of the GNU General Public License 32 * along with this program; if not, write to the Free Software 33 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 34 */ 35 36 /* 37 * Module : teo.h 38 * Version : 1.8.4 39 * Cr�� par : Gilles F�tis 40 * Modifi� par: Eric Botcazou 26/10/2003 41 * Fran�ois Mouret 30/01/2010 07/08/2011 05/03/2012 42 * 01/11/2012 20/09/2013 13/04/2014 43 * 20/10/2017 44 * Gilles F�tis 27/07/2011 45 * Samuel Devulder 05/02/2012 46 * 47 * Module de pilotage de l'�mulateur. 48 */ 49 50 51 #ifndef TEO_H 52 #define TEO_H 53 54 #ifndef MAX_PATH 55 # define MAX_PATH 300 56 #endif 57 58 #ifdef UNIX_TOOL 59 # define FOLDER_SLASH "/" 60 #else 61 # define FOLDER_SLASH "\\" 62 #endif 63 64 /* param�tres et symboles de l'�mulation */ 65 #define APPLICATION_DIR "teo" 66 #define TEO_YEAR_STRING "2017" 67 #define TEO_VERSION_STR "1.8.4" 68 #define PROG_NAME "teo" 69 #define PROG_CLASS "EmuTO" 70 71 #define ALLEGRO_CONFIG_FILE "allegro.cfg" 72 73 #define TEO_FRAME_FREQ 50 /* Hz: fr�quence de trame vid�o */ 74 #define TEO_CYCLES_PER_FRAME 19968 /* dur�e exacte en nb de cycles CPU d'une frame */ 75 #define TEO_MICROSECONDS_PER_FRAME 20000 /* dur�e exacte en microsecondes d'une frame */ 76 #define TEO_CPU_FREQ (TEO_FRAME_FREQ*TEO_CYCLES_PER_FRAME) /* Hz */ 77 #define TEO_NCOLORS 16 /* nombre de couleurs de la palette */ 78 79 #define TEO_WINDOW_W 320 /* largeur de la fen�tre de travail */ 80 #define TEO_BORDER_W 16 /* largeur de la bordure de l'�cran */ 81 #define TEO_SCREEN_W (TEO_WINDOW_W + TEO_BORDER_W*2) /* largeur de l'�cran */ 82 #define TEO_WINDOW_H 200 /* hauteur de la fen�tre de travail */ 83 #define TEO_BORDER_H 16 /* hauteur de la bordure de l'�cran */ 84 #define TEO_SCREEN_H (TEO_WINDOW_H + TEO_BORDER_H*2) /* hauteur de l'�cran */ 85 86 #define TEO_GPL_SIZE 8 /* taille d'un Groupe Point Ligne */ 87 #define TEO_WINDOW_GW (TEO_WINDOW_W/TEO_GPL_SIZE) /* largeur de la fen�tre de travail en GPL */ 88 89 #define TEO_CHAR_SIZE 8 /* taille d'un caract�re */ 90 #define TEO_WINDOW_CW (TEO_WINDOW_W/TEO_CHAR_SIZE) /* largeur de la fen�tre de travail en CHAR */ 91 #define TEO_BORDER_CW (TEO_BORDER_W/TEO_CHAR_SIZE) /* largeur de la bordure de l'�cran en CHAR */ 92 #define TEO_SCREEN_CW (TEO_SCREEN_W/TEO_CHAR_SIZE) /* largeur de l'�cran en CHAR */ 93 #define TEO_WINDOW_CH (TEO_WINDOW_H/TEO_CHAR_SIZE) /* hauteur de la fen�tre de travail en CHAR */ 94 #define TEO_BORDER_CH (TEO_BORDER_H/TEO_CHAR_SIZE) /* hauteur de la bordure de l'�cran en CHAR */ 95 #define TEO_SCREEN_CH (TEO_SCREEN_H/TEO_CHAR_SIZE) /* hauteur de l'�cran en CHAR */ 96 97 #define TEO_LEFT_BORDER 0x40 /* bitmask */ 98 #define TEO_RIGHT_BORDER 0x80 /* bitmask */ 99 100 #define TEO_COL40 0 /* mode 40 colonnes 16 couleurs */ 101 #define TEO_BITMAP4 0x21 /* mode bitmap 4 couleurs */ 102 #define TEO_PAGE1 0x24 /* mode commutation page 1 */ 103 #define TEO_PAGE2 0x25 /* mode commutation page 2 */ 104 #define TEO_STACK2 0x26 /* mode superposition 2 pages */ 105 #define TEO_COL80 0x2A /* mode 80 colonnes 2 couleurs */ 106 #define TEO_STACK4 0x3F /* mode superposition 4 pages */ 107 #define TEO_BITMAP4b 0x41 /* mode bitmap 4 non document� */ 108 #define TEO_BITMAP16 0x7B /* mode bitmap 16 couleurs */ 109 #define TEO_PALETTE 0xFF /* mode �cran de la palette */ 110 111 #define TEO_PALETTE_ADDR 0x1A18 /* adresse de transition des palettes */ 112 #define TEO_PALETTE_COL1 0x0000FF /* triplet RRGGBB couleur 1 */ 113 #define TEO_PALETTE_COL2 0xD7FBEF /* triplet RRGGBB couleur 2 */ 114 115 #define TEO_NJOYSTICKS 2 116 #define TEO_NBUTTONS 2 117 #define TEO_JOYSTICK_CENTER 0 118 #define TEO_JOYSTICK_LEFT (1<<0) 119 #define TEO_JOYSTICK_RIGHT (1<<1) 120 #define TEO_JOYSTICK_UP (1<<2) 121 #define TEO_JOYSTICK_DOWN (1<<3) 122 #define TEO_JOYSTICK_FIRE_ON 1 123 #define TEO_JOYSTICK_FIRE_OFF 0 124 125 #define TEO_TRAP_CODE 0xCD /* code pour le trap */ 126 127 enum teo_command { 128 TEO_COMMAND_NONE = 1, 129 TEO_COMMAND_PANEL, 130 TEO_COMMAND_SCREENSHOT, 131 TEO_COMMAND_DEBUGGER, 132 TEO_COMMAND_BREAKPOINT, 133 TEO_COMMAND_RESET, 134 TEO_COMMAND_COLD_RESET, 135 TEO_COMMAND_FULL_RESET, 136 TEO_COMMAND_QUIT 137 }; 138 139 enum { 140 TEO_STATUS_MOUSE = 1, 141 TEO_STATUS_LIGHTPEN 142 }; 143 144 extern int is_fr; 145 146 #define NBDRIVE 4 147 #define NBBREAKPOINT 10 148 #define MAX_BREAKPOINTS 16 149 150 struct EMUTEO { 151 int sound_enabled; 152 volatile enum teo_command command; 153 char *default_folder; 154 struct EMUTEO_SETTINGS { 155 int exact_speed; 156 int sound_volume; 157 int sound_enabled; 158 int interlaced_video; 159 int bank_range; 160 } setting; 161 struct EMUTEO_DISK { 162 int direct_access_allowed; 163 int side; 164 int write_protect; 165 char *file; 166 } disk[NBDRIVE]; 167 struct EMUTEO_CASS { 168 int write_protect; 169 char *file; 170 } cass; 171 struct EMUTEO_MEMO { 172 char *file; 173 char *label; 174 } memo; 175 struct EMUTEO_DEBUG { 176 int window_maximize; 177 int window_x; 178 int window_y; 179 int window_width; 180 int window_height; 181 int breakpoint[MAX_BREAKPOINTS]; 182 int extra_first_line; 183 int memory_address; 184 int ram_number; 185 int mon_number; 186 int video_number; 187 int cart_number; 188 } debug; 189 struct EMUTEO_LPRT { 190 int number; 191 int nlq; 192 int dip; 193 int raw_output; 194 int txt_output; 195 int gfx_output; 196 char *folder; 197 } lprt; 198 }; 199 200 extern struct EMUTEO teo; 201 extern int frame; 202 203 /* fonctions importables requises */ 204 extern void (*teo_SetColor)(int index, int r, int g, int b); 205 extern void (*teo_DrawGPL)(int mode, int addr, int pt, int col); 206 extern void (*teo_PutSoundByte)(unsigned long long int time, unsigned char value); 207 extern void (*teo_SetPointer)(int pointer); 208 209 /* fonctions importables optionnelles */ 210 extern int (*teo_DebugBreakPoint)(int pc); 211 extern void (*teo_SetBorderColor)(int mode, int color); 212 extern void (*teo_DrawBorderLine)(int col, int line); 213 extern void (*teo_SetKeyboardLed)(int state); 214 extern void (*teo_SetDiskLed)(int state); 215 extern int (*teo_DirectReadSector)(int drive, int track, int sector, int nsects, unsigned char data[]); 216 extern int (*teo_DirectWriteSector)(int drive, int track, int sector, int nsects, const unsigned char data[]); 217 extern int (*teo_DirectFormatTrack)(int drive, int track, const unsigned char data[]); 218 extern int (*teo_DirectIsDiskWritable)(int drive); 219 220 /* variables exportables */ 221 extern char *teo_error_msg; 222 extern int teo_new_video_params; 223 224 /* fonctions exportables */ 225 extern int teo_Init(int num_joy); 226 extern void teo_Exit(void); 227 extern void teo_Reset(void); 228 extern void teo_ColdReset(void); 229 extern void teo_FullReset(void); 230 extern void teo_InputReset(int mask, int value); 231 extern int teo_DoFrame(void); 232 extern void teo_FlushFrame(void); 233 234 #endif 235 236