1 /* 2 * traps.h - Allow VICE to replace ROM code with C function calls. 3 * 4 * Written by 5 * Teemu Rantanen <tvr@cs.hut.fi> 6 * Jarkko Sonninen <sonninen@lut.fi> 7 * Andreas Boose <viceteam@t-online.de> 8 * 9 * This file is part of VICE, the Versatile Commodore Emulator. 10 * See README for copyright notice. 11 * 12 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by 14 * the Free Software Foundation; either version 2 of the License, or 15 * (at your option) any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public License 23 * along with this program; if not, write to the Free Software 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 25 * 02111-1307 USA. 26 * 27 */ 28 29 #ifndef VICE_TRAPS_H 30 #define VICE_TRAPS_H 31 32 #include "mem.h" 33 #include "types.h" 34 35 /* JAM (0x02) is the trap-opcode. */ 36 /* Note: If you change this, you need to change */ 37 /* 6510core.c and 6510dtvcore.c too! */ 38 #define TRAP_OPCODE 0x02 39 40 typedef struct trap_s { 41 const char *name; 42 uint16_t address; 43 uint16_t resume_address; 44 uint8_t check[3]; 45 #if defined(__STDC__) || defined(__IBMC__) 46 int (*func)(void); 47 #else 48 int (*func)(); 49 #endif 50 read_func_t *readfunc; 51 store_func_t *storefunc; 52 } trap_t; 53 54 extern void traps_init(void); 55 extern void traps_shutdown(void); 56 extern int traps_resources_init(void); 57 extern int traps_cmdline_options_init(void); 58 extern int traps_add(const trap_t *trap); 59 extern int traps_remove(const trap_t *trap); 60 extern void traps_refresh(void); 61 extern uint32_t traps_handler(void); 62 extern int traps_checkaddr(unsigned int addr); 63 64 #endif 65