1 /*
2  * libtilemcore - Graphing calculator emulation library
3  *
4  * Copyright (C) 2001 Solignac Julien
5  * Copyright (C) 2004-2009 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 "x1.h"
30 
x1_reset(TilemCalc * calc)31 void x1_reset(TilemCalc* calc)
32 {
33 	calc->hwregs[PORT3] = 0x08;
34 	calc->hwregs[PORT2] = 0x00;
35 	calc->hwregs[PORT5] = 0x00;
36 	calc->hwregs[PORT6] = 0x00;
37 
38 	calc->mempagemap[0] = 0x00;
39 	calc->mempagemap[1] = 0x01;
40 	calc->mempagemap[2] = 0x00;
41 	calc->mempagemap[3] = 0x02;
42 
43 	if (calc->hwregs[HW_VERSION] != 2)
44 		calc->lcd.rowstride = 12;
45 
46 	tilem_z80_set_speed(calc, 2000);
47 
48 	/* FIXME: measure actual frequency */
49 	tilem_z80_set_timer(calc, TIMER_INT, 6000, 6000, 1);
50 }
51