1 /*
2 Copyright (C) 2000, 2001 Charles MacDonald
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
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 #include "shared.h"
20 #include <string.h>
21
system_init(FESTALON_HES * hes)22 int system_init(FESTALON_HES *hes)
23 {
24 pce_init();
25 vdc_init();
26 psg_init(hes);
27 return (1);
28 }
29
30
FESTAHES_Emulate(FESTALON_HES * hes,int * Count)31 float *FESTAHES_Emulate(FESTALON_HES *hes, int *Count)
32 {
33 int line;
34
35 hes->status &= ~STATUS_VD;
36
37 for(line = 0; line < 262; line += 1)
38 {
39 if((line + 64) == (hes->reg[6] & 0x3FF))
40 {
41 if(hes->reg[5] & 0x04)
42 {
43 hes->status |= STATUS_RR;
44 h6280_set_irq_line(hes->h6280, 0, ASSERT_LINE);
45 }
46 }
47
48 /* VBlank */
49 if(line == 240)
50 {
51 /* Cause VBlank interrupt if necessary */
52 hes->status |= STATUS_VD;
53 if(hes->reg[5] & 0x0008)
54 {
55 h6280_set_irq_line(hes->h6280, 0, ASSERT_LINE);
56 }
57 }
58
59 h6280_execute(hes->h6280, 455);
60 }
61
62 *Count = psg_flush(hes);
63
64 return(hes->psg.WaveIL);
65 }
66
67
system_reset(FESTALON_HES * hes)68 void system_reset(FESTALON_HES *hes)
69 {
70 pce_reset(hes);
71 vdc_reset(hes);
72 psg_reset(hes);
73 }
74
75
system_shutdown(FESTALON_HES * hes)76 void system_shutdown(FESTALON_HES *hes)
77 {
78 pce_shutdown();
79 vdc_shutdown();
80 psg_shutdown(hes);
81 }
82
83
84