1 /*
2 * libtilemcore - Graphing calculator emulation library
3 *
4 * Copyright (C) 2001 Solignac Julien
5 * Copyright (C) 2004-2011 Benjamin Moody
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, see
19 * <http://www.gnu.org/licenses/>.
20 */
21
22 #ifdef HAVE_CONFIG_H
23 # include <config.h>
24 #endif
25
26 #include <stdio.h>
27 #include <tilem.h>
28
29 #include "x7.h"
30
x7_reset(TilemCalc * calc)31 void x7_reset(TilemCalc* calc)
32 {
33 calc->hwregs[PORT3] = 0x0B;
34 calc->hwregs[PORT4] = 0x77;
35 calc->hwregs[PORT6] = 0x1F;
36 calc->hwregs[PORT7] = 0x1F;
37
38 calc->mempagemap[0] = 0x00;
39 calc->mempagemap[1] = 0x1E;
40 calc->mempagemap[2] = 0x1F;
41 calc->mempagemap[3] = 0x1F;
42
43 calc->z80.r.pc.d = 0x8000;
44
45 calc->hwregs[NOEXEC] = 0;
46 calc->hwregs[PROTECTSTATE] = 0;
47
48 tilem_z80_set_speed(calc, 6000);
49
50 tilem_z80_set_timer(calc, TIMER_INT1, 1600, 8474, 1);
51 tilem_z80_set_timer(calc, TIMER_INT2A, 1300, 8474, 1);
52 tilem_z80_set_timer(calc, TIMER_INT2B, 1000, 8474, 1);
53 }
54
x7_stateloaded(TilemCalc * calc,int savtype TILEM_ATTR_UNUSED)55 void x7_stateloaded(TilemCalc* calc, int savtype TILEM_ATTR_UNUSED)
56 {
57 tilem_calc_fix_certificate(calc, calc->mem + (0x1E * 0x4000L),
58 0x08, 0x13, 0x1f18);
59 }
60