1 /* 2 * ============================================================================ 3 * Title: Configuration Manager 4 * Author: J. Zbiciak 5 * ============================================================================ 6 * This module manages the machine configuration. It does commandline 7 * parsing and processes the configuration elements that were read in 8 * via the config-file parser. 9 * 10 * CFG owns the entire machine -- it is encapsulated in a cfg_t. 11 * ============================================================================ 12 * CFG_INIT -- Parse command line and get started 13 * CFG_FILE -- Parse a config file and extend the state of the machine. 14 * ============================================================================ 15 */ 16 17 #ifndef CFG_H_ 18 #define CFG_H_ 19 20 #ifndef USAGE_C_ 21 /* 22 * ============================================================================ 23 * CFG_T -- The current machine and its configuration 24 * ============================================================================ 25 */ 26 27 typedef struct cfg_t 28 { 29 /* -------------------------------------------------------------------- */ 30 /* Our baby, the Intellivision itself. */ 31 /* -------------------------------------------------------------------- */ 32 periph_bus_t *intv; /* Top level Intellivision object. */ 33 34 /* -------------------------------------------------------------------- */ 35 /* System 'peripherals' -- these aren't actual hardware devices. */ 36 /* -------------------------------------------------------------------- */ 37 gfx_t gfx; /* Graphics interface layer. */ 38 palette_t palette; /* Our display colors. */ 39 snd_t snd; /* Sound interface layer. */ 40 speed_t speed; /* Rate controller. */ 41 event_t event; /* Event subsystem. */ 42 debug_t debug; /* Debugger hooks. */ 43 cheat_t cheat; /* Cheat commands. */ 44 45 /* -------------------------------------------------------------------- */ 46 /* Hardware peripherals -- these model actual pieces of the Intv. */ 47 /* -------------------------------------------------------------------- */ 48 cp1600_t cp1600; /* CPU. */ 49 ay8910_t psg0; /* Base unit's Prog. Sound Generator. */ 50 ay8910_t psg1; /* ECS's Prog. Sound Generator. */ 51 ivoice_t ivoice; /* SP0256 Emulation. */ 52 stic_t stic; /* Standard Television Interface Chip */ 53 pad_t pad0; /* Base unit's controller pads. */ 54 pad_t pad1; /* ECS's controller pads. */ 55 pad_intv2pc_t i2pc0,i2pc1; /* Up to 2 INTV2PCs may be attached. */ 56 pad_cgc_t cgc0, cgc1; /* Up to 2 CGCs may be attached. */ 57 mem_t exec; /* EXEC ROM at 0x1000 - 0x1FFF */ 58 mem_t exec2; /* EXEC2 ROM at 0x0400 - 0x04FF */ 59 /* mem_t grom; */ /* Graphics ROM at 0x3000 - 0x37FF */ 60 /* mem_t gram; */ /* Graphics RAM at 0x3800 - 0x3FFF */ 61 mem_t sys_ram; /* 16-bit System RAM at 0x200 - 0x35F */ 62 mem_t sys_ram2; /* RA-3-9600A (SysRAM), 0x360 - 0x3FF */ 63 mem_t scr_ram; /* 8-bit Scratchpad RAM at 0x100 - 0x1EF */ 64 mem_t glt_ram; /* glitch RAM */ 65 icart_t icart; /* Game program. */ 66 legacy_t legacy; /* Legacy BIN+CFG game program */ 67 ecs_t ecs; /* Entertainment Computer System (ECS) */ 68 jlp_t jlp; /* Jean-Luc Project Support */ 69 t_locutus_wrap locutus; 70 71 uint16_t exec_img[4096 + 4096]; 72 uint16_t grom_img[2048 ]; 73 uint16_t ecs_img [4096 * 3]; 74 75 /* -------------------------------------------------------------------- */ 76 /* User-modifiable flags, etc. */ 77 /* -------------------------------------------------------------------- */ 78 int audio_rate; /* Sample rate for audio. 0 == no audio */ 79 int accutick; /* Min PSG ticks to sim on PSG write. */ 80 int psg_window; /* Window size for PSG sliding window */ 81 int ecs_enable; /* ECS enable/disable flag. */ 82 int ivc_enable; /* Ivoice enable/disable flag. */ 83 int ivc_window; /* Window size for Ivoice sliding window. */ 84 char *ivc_tname; /* Intellivoice sample file name template. */ 85 int gfx_flags; /* SDL mode flags (fullsc/windowed, etc) */ 86 uint32_t i2pc0_port; /* INTV2PC #0 I/O address. */ 87 uint32_t i2pc1_port; /* INTV2PC #1 I/O address. */ 88 int cgc0_num; /* CGC #0's ID number. */ 89 int cgc1_num; /* CGC #1's ID number. */ 90 char *cgc0_dev; /* CGC #0's device node */ 91 char *cgc1_dev; /* CGC #1's device node */ 92 int debugging; /* Debugger enabled flag. */ 93 int gui_mode; /* Are we running in "GUI mode?" */ 94 int prescale; /* Prescaler: 0=none, 1=scale2x, 2=3x, 3=4x */ 95 int start_dly; /* Delay at startup if we need to. */ 96 int pal_mode; /* 1 = PAL, 0 = NTSC */ 97 int gram_size; /* 0 = 64 cards, 1 = 128, 2 = 256 (TutorV) */ 98 double rate_ctl; /* Target rate. 1.0 is "normal speed." */ 99 double avi_time_scale; /* AVI recording time scaling. */ 100 101 char *fn_exec; /* File name of EXEC image. */ 102 char *fn_grom; /* File name of GROM image. */ 103 char *fn_game; /* File name of GAME image. */ 104 char *fn_ecs; /* File name of ECS image. */ 105 106 /* -------------------------------------------------------------------- */ 107 /* State flags, such as the global "exit" flag, etc. */ 108 /* -------------------------------------------------------------------- */ 109 uint32_t do_exit; /* Signal that an exit is requested. */ 110 uint32_t do_reset; /* Signal that a RESET is requested. */ 111 uint32_t do_pause; /* Signal that we are paused. */ 112 uint32_t do_dump; /* Signal that we'd like to save a game */ 113 uint32_t do_load; /* Signal that we'd like to load a game */ 114 uint32_t do_reload; /* Signal we'd like to reload jzIntv */ 115 uint32_t chg_evt_map; /* Change the current input event map. */ 116 117 /* -------------------------------------------------------------------- */ 118 /* Key bindings */ 119 /* -------------------------------------------------------------------- */ 120 cfg_kbd_t *binding; 121 122 /* -------------------------------------------------------------------- */ 123 /* Demo recorder. */ 124 /* -------------------------------------------------------------------- */ 125 demo_t demo; 126 127 /* -------------------------------------------------------------------- */ 128 /* AVI recorder. */ 129 /* -------------------------------------------------------------------- */ 130 avi_writer_t avi; 131 132 /* -------------------------------------------------------------------- */ 133 /* Other misc details about the game */ 134 /* -------------------------------------------------------------------- */ 135 const char *cart_name; 136 int cart_year; 137 } cfg_t; 138 139 extern cfg_t intv; 140 141 /* ======================================================================== */ 142 /* CFG_GET_EVTACT -- Convert an event action name into an event action */ 143 /* index. This is a horrible linear search. :-P */ 144 /* Hey, it works for now. */ 145 /* ======================================================================== */ 146 int cfg_get_evtact(const char *event); 147 148 /* ======================================================================== */ 149 /* CFG_SETBIND -- Set all of the key-bindings for the Intellivision. */ 150 /* ======================================================================== */ 151 int cfg_setbind(cfg_t *cfg, const char *kbdhackfile); 152 153 /* ======================================================================== */ 154 /* CFG_INIT -- Parse command line and get started */ 155 /* ======================================================================== */ 156 void cfg_init(cfg_t *cfg, int argc, char * argv[]); 157 158 /* ======================================================================== */ 159 /* CFG_DTOR -- Destroy a constructed Intellivision */ 160 /* ======================================================================== */ 161 void cfg_dtor(cfg_t *cfg); 162 #endif 163 164 /* ======================================================================== */ 165 /* USAGE -- Just give usage info and exit. */ 166 /* ======================================================================== */ 167 void usage(void); 168 169 /* ======================================================================== */ 170 /* LICENSE -- Just give license/authorship info and exit. */ 171 /* ======================================================================== */ 172 void license(void); 173 174 #endif 175 /* ======================================================================== */ 176 /* This program is free software; you can redistribute it and/or modify */ 177 /* it under the terms of the GNU General Public License as published by */ 178 /* the Free Software Foundation; either version 2 of the License, or */ 179 /* (at your option) any later version. */ 180 /* */ 181 /* This program is distributed in the hope that it will be useful, */ 182 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 183 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ 184 /* General Public License for more details. */ 185 /* */ 186 /* You should have received a copy of the GNU General Public License along */ 187 /* with this program; if not, write to the Free Software Foundation, Inc., */ 188 /* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ 189 /* ======================================================================== */ 190 /* Copyright (c) 1998-2001, Joseph Zbiciak */ 191 /* ======================================================================== */ 192