merge PCM code from FCEUX
[fceu.git] / fceu098.c
CommitLineData
6244011f 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 "input.h"
28#include "cart.h"
29#include "cheat.h"
30#include "x6502.h"
31#include "video.h"
32#include "svga.h"
33
34
35int FCEUI_Initialize098(void)
36{
37 FCEUPPU_Init();
38 return 1;
39}
40
41
42#ifdef FRAMESKIP
43extern int FSkip;
44#endif
45
46void FCEUI_Emulate098(void)
47{
48 for(;;)
49 {
50 int ssize;
51
52 UpdateInput();
53 if(geniestage!=1) FCEU_ApplyPeriodicCheats();
54 FCEUPPU_Loop(FSkip);
55
56 if(Exit)
57 {
58 break;
59 }
60
77887306 61 ssize=FlushEmulateSound();
6244011f 62
63 timestampbase += timestamp;
64 timestamp = 0;
65
66 #ifdef FRAMESKIP
67 if(FSkip)
68 {
69 FCEU_PutImageDummy();
70 FSkip--;
71 FCEUD_Update(0,WaveFinalMono,ssize);
72 }
73 else
74 #endif
75 {
76 FCEU_PutImage();
77 FCEUD_Update(XBuf+8,WaveFinalMono,ssize);
78 }
79 } // for
80}
81
82
83void ResetNES098(void)
84{
85 ResetNES081();
5bd16b94 86 FCEUSND_Reset();
6244011f 87 FCEUPPU_Reset();
88}
89