2d76a0c954c92260662d1349209405a831b6e8ef
[fceu.git] / fceu098.c
1 /* FCE Ultra - NES/Famicom Emulator
2  *
3  * Copyright notice for this file:
4  *  Copyright (C) 2003 Xodnizel
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include        <stdio.h>
22
23 #include        "types.h"
24 #include        "fce.h"
25 #include        "ppu098.h"
26 #include        "sound.h"
27 #include        "sound098.h"
28 #include        "input.h"
29 #include        "cart.h"
30 #include        "cheat.h"
31 #include        "x6502.h"
32 #include        "video.h"
33 #include        "svga.h"
34
35
36 int FCEUI_Initialize098(void)
37 {
38         FCEUPPU_Init();
39         return 1;
40 }
41
42
43 #ifdef FRAMESKIP
44 extern int FSkip;
45 #endif
46
47 void FCEUI_Emulate098(void)
48 {
49  for(;;)
50  {
51   int ssize;
52
53   UpdateInput();
54   if(geniestage!=1) FCEU_ApplyPeriodicCheats();
55   FCEUPPU_Loop(FSkip);
56
57   if(Exit)
58   {
59    break;
60   }
61
62   ssize=FlushEmulateSound098();
63
64   timestampbase += timestamp;
65   timestamp = 0;
66
67   #ifdef FRAMESKIP
68   if(FSkip)
69   {
70    FCEU_PutImageDummy();
71    FSkip--;
72    FCEUD_Update(0,WaveFinalMono,ssize);
73   }
74   else
75   #endif
76   {
77    FCEU_PutImage();
78    FCEUD_Update(XBuf+8,WaveFinalMono,ssize);
79   }
80  } // for
81 }
82
83
84 void ResetNES098(void)
85 {
86  ResetNES081();
87  FCEUSND_Reset();
88  FCEUPPU_Reset();
89 }
90
91
92 void PowerNES098(void)
93 {
94  PowerNES081();
95  FCEUSND_Power();
96  FCEUPPU_Power();
97 }
98