comparison src/sap/saplib/sapPokey.cxx @ 145:7804476ba85a trunk

[svn] - C++ files -> .cxx - build saplib inline - remove version.h and chase removal issues
author nenolod
date Mon, 30 Oct 2006 17:47:41 -0800
parents src/sap/saplib/sapPokey.cpp@c0b31cf2c7cd
children
comparison
equal deleted inserted replaced
144:5dfc0e491ad3 145:7804476ba85a
1 #include <ctype.h>
2 #include <math.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6
7 #include "sapGlobals.h"
8
9 extern void pokeyInit0( void );
10 extern void pokeyInit1( void );
11 extern void pokeyReset0( void );
12 extern void pokeyReset1( void );
13 extern void pokeyUpdateSound0( int n );
14 extern void pokeyUpdateSound1( int n );
15 extern void pokeyUpdateSoundCounters0( void );
16 extern void pokeyUpdateSoundCounters1( void );
17
18 void pokeyInit( void )
19 {
20 pokeyInit0();
21 pokeyInit1();
22 }
23 void pokeyReset( void )
24 {
25 pokeyReset0();
26 pokeyReset1();
27 }
28
29 void pokeyUpdateSound( int n )
30 {
31 int oldBufPtr = sndBufPtr;
32 pokeyUpdateSound0( n );
33 if( isStereo )
34 {
35 sndBufPtr = (oldBufPtr+1)&16383;
36 pokeyUpdateSound1( n );
37 sndBufPtr = (sndBufPtr-1)&16383;
38 }
39 }
40
41 void pokeyUpdateSoundCounters( void )
42 {
43 pokeyUpdateSoundCounters0();
44 pokeyUpdateSoundCounters1();
45 }
46
47 BYTE pokeyReadByte( short unsigned int address)
48 {
49 BYTE retVal;
50
51 switch( address&0x0F )
52 {
53 case 0x09:
54 return 0xFF;
55 case 0x0A:
56 retVal = (BYTE)((255*rand())/RAND_MAX);
57 return retVal;
58 case 0x0E:
59 return 0xFF;
60 case 0x0F:
61 return 0xFF;
62 }
63 return 0xFF;
64 }