1 /* spectrum.h: Spectrum 48K specific routines 2 Copyright (c) 1999-2016 Philip Kendall, Darren Salt 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License along 15 with this program; if not, write to the Free Software Foundation, Inc., 16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 18 Author contact information: 19 20 E-mail: philip-fuse@shadowmagic.org.uk 21 22 */ 23 24 #ifndef FUSE_SPECTRUM_H 25 #define FUSE_SPECTRUM_H 26 27 #include <stdlib.h> 28 29 #include <libspectrum.h> 30 31 #include "memory_pages.h" 32 33 /* How many tstates have elapsed since the last interrupt? (or more 34 precisely, since the ULA last pulled the /INT line to the Z80 low) */ 35 extern libspectrum_dword tstates; 36 37 /* Things relating to memory */ 38 39 extern libspectrum_byte RAM[ SPECTRUM_RAM_PAGES ][0x4000]; 40 41 typedef int 42 (*spectrum_port_from_ula_function)( libspectrum_word port ); 43 typedef libspectrum_byte 44 (*spectrum_contention_delay_function)( libspectrum_dword time ); 45 46 typedef struct spectrum_raminfo { 47 48 /* Is this port result supplied by the ULA? */ 49 spectrum_port_from_ula_function port_from_ula; 50 51 /* What's the actual delay at the current tstate with MREQ active */ 52 spectrum_contention_delay_function contend_delay; 53 54 /* And without MREQ */ 55 spectrum_contention_delay_function contend_delay_no_mreq; 56 57 int locked; /* Is the memory configuration locked? */ 58 int current_page, current_rom; /* Current paged memory */ 59 60 libspectrum_byte last_byte; /* The last byte sent to the 128K port */ 61 libspectrum_byte last_byte2; /* The last byte sent to +3 port */ 62 63 int special; /* Is a +3 special config in use? */ 64 65 int romcs; /* Is the /ROMCS line low? */ 66 67 int valid_pages; /* Available RAM */ 68 69 } spectrum_raminfo; 70 71 libspectrum_byte spectrum_contend_delay_none( libspectrum_dword time ); 72 libspectrum_byte spectrum_contend_delay_65432100( libspectrum_dword time ); 73 libspectrum_byte spectrum_contend_delay_76543210( libspectrum_dword time ); 74 75 libspectrum_byte spectrum_unattached_port( void ); 76 libspectrum_byte spectrum_unattached_port_none( void ); 77 78 /* Miscellaneous stuff */ 79 80 extern int spectrum_frame_event; 81 82 void spectrum_register_startup( void ); 83 int spectrum_frame( void ); 84 85 #endif /* #ifndef FUSE_SPECTRUM_H */ 86