First pass at KidVid support. Note that while the code compiles, no

functionality whatsoever is available.  This is just an initial import
of the z26 code.  Still TODO is test all this stuff, and the more
difficult part; mix the audio with the sound system in Stella (which
is quite a bit different than z26.

Reduces the time in which autoframe is applied in the TIA from every 32
frames to every 8 frames.  This means the autoframe handler will detect
changes faster, and inform the sound system more accurately.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1681 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-03-16 00:23:42 +00:00
parent 787f8598da
commit 33a5284307
10 changed files with 645 additions and 15 deletions

View File

@ -13,9 +13,11 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TIADebug.cxx,v 1.30 2009-01-19 16:52:32 stephena Exp $
// $Id: TIADebug.cxx,v 1.31 2009-03-16 00:23:42 stephena Exp $
//============================================================================
//#define NEWTIA
#include "System.hxx"
#include "Debugger.hxx"
@ -615,7 +617,11 @@ uInt8 TIADebug::hmP0(int newVal)
if(newVal > -1)
mySystem.poke(HMP0, newVal << 4);
#ifdef NEWTIA
return myTIA.myHMP0 >> 4;
#else
return myTIA.myHMP0;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -624,7 +630,11 @@ uInt8 TIADebug::hmP1(int newVal)
if(newVal > -1)
mySystem.poke(HMP1, newVal << 4);
#ifdef NEWTIA
return myTIA.myHMP1 >> 4;
#else
return myTIA.myHMP1;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -633,7 +643,11 @@ uInt8 TIADebug::hmM0(int newVal)
if(newVal > -1)
mySystem.poke(HMM0, newVal << 4);
#ifdef NEWTIA
return myTIA.myHMM0 >> 4;
#else
return myTIA.myHMM0;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -642,7 +656,11 @@ uInt8 TIADebug::hmM1(int newVal)
if(newVal > -1)
mySystem.poke(HMM1, newVal << 4);
#ifdef NEWTIA
return myTIA.myHMM1 >> 4;
#else
return myTIA.myHMM1;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -651,7 +669,11 @@ uInt8 TIADebug::hmBL(int newVal)
if(newVal > -1)
mySystem.poke(HMBL, newVal << 4);
#ifdef NEWTIA
return myTIA.myHMBL >> 4;
#else
return myTIA.myHMBL;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Console.cxx,v 1.157 2009-02-01 22:17:09 stephena Exp $
// $Id: Console.cxx,v 1.158 2009-03-16 00:23:42 stephena Exp $
//============================================================================
#include <cassert>
@ -31,6 +31,7 @@
#include "EventHandler.hxx"
#include "Joystick.hxx"
#include "Keyboard.hxx"
#include "KidVid.hxx"
#include "M6502Hi.hxx"
#include "M6502Low.hxx"
#include "M6532.hxx"
@ -162,11 +163,12 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
myProperties.set(Display_Height, "250");
}
const string& md5 = myProperties.get(Cartridge_MD5);
// Add the real controllers for this system
setControllers();
setControllers(md5);
// Bumper Bash requires all 4 directions
const string& md5 = myProperties.get(Cartridge_MD5);
bool allow = (md5 == "aa1c41f86ec44c0a44eb64c332ce08af" ||
md5 == "1bf503c724001b09be79c515ecfcbd03");
myOSystem->eventHandler().allowAllDirections(allow);
@ -573,7 +575,7 @@ void Console::changeHeight(int direction)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::setControllers()
void Console::setControllers(const string& rommd5)
{
delete myControllers[0];
delete myControllers[1];
@ -681,6 +683,10 @@ void Console::setControllers()
myControllers[rightPort] = new SaveKey(Controller::Right, *myEvent, *mySystem,
eepromfile);
}
else if(right == "KIDVID")
{
myControllers[rightPort] = new KidVid(Controller::Right, *myEvent, *mySystem, rommd5);
}
else
{
myControllers[rightPort] = new Joystick(Controller::Right, *myEvent, *mySystem);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Console.hxx,v 1.73 2009-01-24 18:11:47 stephena Exp $
// $Id: Console.hxx,v 1.74 2009-03-16 00:23:42 stephena Exp $
//============================================================================
#ifndef CONSOLE_HXX
@ -53,7 +53,7 @@ struct ConsoleInfo
This class represents the entire game console.
@author Bradford W. Mott
@version $Id: Console.hxx,v 1.73 2009-01-24 18:11:47 stephena Exp $
@version $Id: Console.hxx,v 1.74 2009-03-16 00:23:42 stephena Exp $
*/
class Console : public Serializable
{
@ -271,7 +271,7 @@ class Console : public Serializable
/**
Adds the left and right controllers to the console
*/
void setControllers();
void setControllers(const string& rommd5);
void toggleTIABit(TIA::TIABit bit, const string& bitname, bool show = true) const;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Control.cxx,v 1.14 2009-01-01 18:13:35 stephena Exp $
// $Id: Control.cxx,v 1.15 2009-03-16 00:23:42 stephena Exp $
//============================================================================
#include <cassert>
@ -70,6 +70,9 @@ Controller::Controller(Jack jack, const Event& event, const System& system,
case SaveKey:
myName = "SaveKey";
break;
case KidVid:
myName = "KidVid";
break;
}
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Control.hxx,v 1.18 2009-01-01 18:13:35 stephena Exp $
// $Id: Control.hxx,v 1.19 2009-03-16 00:23:42 stephena Exp $
//============================================================================
#ifndef CONTROLLER_HXX
@ -57,7 +57,7 @@ class System;
of the controller from the perspective of the controller's jack.
@author Bradford W. Mott
@version $Id: Control.hxx,v 1.18 2009-01-01 18:13:35 stephena Exp $
@version $Id: Control.hxx,v 1.19 2009-03-16 00:23:42 stephena Exp $
*/
class Controller : public Serializable
{
@ -81,7 +81,8 @@ class Controller : public Serializable
enum Type
{
BoosterGrip, Driving, Keyboard, Paddles, Joystick,
TrackBall22, TrackBall80, AmigaMouse, AtariVox, SaveKey
TrackBall22, TrackBall80, AmigaMouse, AtariVox, SaveKey,
KidVid
};
public:

View File

@ -0,0 +1,483 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2009 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: KidVid.cxx,v 1.1 2009-03-16 00:23:42 stephena Exp $
//============================================================================
#include <cstdlib>
#include "KidVid.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KidVid::KidVid(Jack jack, const Event& event, const System& system,
const string& rommd5)
: Controller(jack, event, system, Controller::KidVid),
myEnabled(myJack == Right),
myFileOpened(false),
mySongCounter(0),
myTape(0)
{
// Right now, there are only two games that use the KidVid
if(rommd5 == "ee6665683ebdb539e89ba620981cb0f6")
myGame = KVBBEARS; // Berenstain Bears
else if(rommd5 == "a204cd4fb1944c86e800120706512a64")
myGame = KVSMURFS; // Smurfs Save the Day
else
myEnabled = false;
// Analog pins are never used by the KidVid controller
// (at least not in this implementation)
myAnalogPinValue[Five] = myAnalogPinValue[Nine] = maximumResistance;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KidVid::~KidVid()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KidVid::update()
{
if(!myEnabled)
return;
/* TODO - tie system reset into the 'rewind' action
if (KeyTable[KeyF1])
{
KidVidTape = 0; // "rewind Kid Vid tape
kv_CloseSampleFile();
}
*/
if(myEvent.get(Event::KeyboardZero1))
{
myTape = 2;
myIdx = myGame == KVBBEARS ? KVBLOCKBITS : 0;
myBlockIdx = KVBLOCKBITS;
myBlock = 0;
openSampleFile();
}
else if(myEvent.get(Event::KeyboardZero2))
{
myTape = 3;
myIdx = myGame == KVBBEARS ? KVBLOCKBITS : 0;
myBlockIdx = KVBLOCKBITS;
myBlock = 0;
openSampleFile();
}
else if(myEvent.get(Event::KeyboardZero3))
{
if(myGame == KVBBEARS) /* Berenstain Bears ? */
{
myTape = 4;
myIdx = KVBLOCKBITS;
}
else /* no, Smurf Save The Day */
{
myTape = 1;
myIdx = 0;
}
myBlockIdx = KVBLOCKBITS;
myBlock = 0;
openSampleFile();
}
// Convert separate pin states into a 'register'
uInt8 IOPortA = 0xf0;
if(myDigitalPinState[One]) IOPortA |= 0x01;
if(myDigitalPinState[Two]) IOPortA |= 0x02;
if(myDigitalPinState[Three]) IOPortA |= 0x04;
if(myDigitalPinState[Four]) IOPortA |= 0x08;
// Is the tape running?
if((myTape != 0) && ((IOPortA & 0x01) == 0x01) && !myTapeBusy)
{
IOPortA = (IOPortA & 0xf7) | (((ourKVData[myIdx >> 3] << (myIdx & 0x07)) & 0x80) >> 4);
// increase to next bit
myIdx++;
myBlockIdx--;
// increase to next block (byte)
if(myBlockIdx == 0)
{
if(myBlock == 0)
myIdx = ((myTape * 6) + 12 - KVBLOCKS) * 8; //KVData00-KVData=12
else
{
if(myGame == KVSMURFS)
{
if(myBlock >= ourKVBlocks[myTape - 1])
myIdx = 42 * 8; //KVData80-KVData=42
else
{
myIdx = 36 * 8;//KVPause-KVData=36
setNextSong();
}
}
else
{
if(myBlock >= ourKVBlocks[myTape + 2 - 1])
myIdx = 42 * 8; //KVData80-KVData=42
else
{
myIdx = 36 * 8;//KVPause-KVData=36
setNextSong();
}
}
}
myBlock++;
myBlockIdx = KVBLOCKBITS;
}
}
// Now convert the register back into separate boolean values
myDigitalPinState[One] = IOPortA & 0x01;
myDigitalPinState[Two] = IOPortA & 0x02;
myDigitalPinState[Three] = IOPortA & 0x04;
myDigitalPinState[Four] = IOPortA & 0x08;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KidVid::openSampleFile()
{
static const char* kvNameTable[6] = {
"KVS3.WAV", "KVS1.WAV", "KVS2.WAV", "KVB3.WAV", "KVB1.WAV", "KVB2.WAV"
};
static uInt32 StartSong[6] = {
44+38, 0, 44, 44+38+42+62+80, 44+38+42, 44+38+42+62
};
// TODO - add code here to immediately return if no sound should be output
if(!myFileOpened)
{
int i = myGame == KVSMURFS ? 0 : 3;
i += myTape - 1;
if(myTape == 4) i -= 3;
mySampleFile = fopen(kvNameTable[i], "rb");
if(mySampleFile != NULL)
{
mySharedSampleFile = fopen("KVSHARED.WAV", "rb");
if(mySharedSampleFile == NULL)
{
fclose(mySampleFile);
myFileOpened = false;
}
else
{
myFileOpened = true;
fseek(mySampleFile, 45, SEEK_SET);
}
}
else
myFileOpened = false;
mySongCounter = 0;
myTapeBusy = false;
myFilePointer = StartSong[i];
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KidVid::closeSampleFile()
{
if(myFileOpened)
{
fclose(mySampleFile);
fclose(mySharedSampleFile);
myFileOpened = false;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KidVid::setNextSong()
{
if(myFileOpened)
{
myBeep = (ourSongPositions[myFilePointer] & 0x80) ? false : true;
uInt8 temp = ourSongPositions[myFilePointer] & 0x7f;
mySharedData = (temp < 10);
mySongCounter = ourSongStart[temp+1] - ourSongStart[temp];
if(mySharedData)
fseek(mySharedSampleFile, ourSongStart[temp], SEEK_SET);
else
fseek(mySampleFile, ourSongStart[temp], SEEK_SET);
myFilePointer++;
myTapeBusy = true;
}
else
{
myBeep = true;
myTapeBusy = true;
mySongCounter = 80*262; /* delay needed for Harmony without tape */
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KidVid::getNextSampleByte()
{
/*
static int oddeven = 0;
if(kv_SongCounter==0) SampleByte = (db) 0x80;
else{
oddeven=oddeven^1;
if(oddeven&1){
kv_SongCounter--;
if((kv_SongCounter>262*48)||(kv_Beep==0)) kv_TapeBusy=1;
else kv_TapeBusy=0;
if(FileOpened){
if(kv_SharedData) SampleByte=getc(SharedSampleFile);
else SampleByte=getc(SampleFile);
}else SampleByte = (db) 0x80;
if((kv_Beep==0)&&(kv_SongCounter==0)) kv_SetNextSong();
}
}
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const uInt8 KidVid::ourKVBlocks[6] = {
2+40, 2+21, 2+35, /* Smurfs tapes 3, 1, 2 */
42+60, 42+78, 42+60 /* BBears tapes 1, 2, 3 (40 extra blocks for intro) */
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const uInt8 KidVid::ourKVData[6*8] = {
/* KVData44 */
0x7b, // 0111 1011b ; (1)0
0x1e, // 0001 1110b ; 1
0xc6, // 1100 0110b ; 00
0x31, // 0011 0001b ; 01
0xec, // 1110 1100b ; 0
0x60, // 0110 0000b ; 0+
/* KVData48 */
0x7b, // 0111 1011b ; (1)0
0x1e, // 0001 1110b ; 1
0xc6, // 1100 0110b ; 00
0x3d, // 0011 1101b ; 10
0x8c, // 1000 1100b ; 0
0x60, // 0110 0000b ; 0+
/* KVData00 */
0xf6, // 1111 0110b
0x31, // 0011 0001b
0x8c, // 1000 1100b
0x63, // 0110 0011b
0x18, // 0001 1000b
0xc0, // 1100 0000b
/* KVData01 */
0xf6, // 1111 0110b
0x31, // 0011 0001b
0x8c, // 1000 1100b
0x63, // 0110 0011b
0x18, // 0001 1000b
0xf0, // 1111 0000b
/* KVData02 */
0xf6, // 1111 0110b
0x31, // 0011 0001b
0x8c, // 1000 1100b
0x63, // 0110 0011b
0x1e, // 0001 1110b
0xc0, // 1100 0000b
/* KVData03 */
0xf6, // 1111 0110b
0x31, // 0011 0001b
0x8c, // 1000 1100b
0x63, // 0110 0011b
0x1e, // 0001 1110b
0xf0, // 1111 0000b
/* KVPause */
0x3f, // 0011 1111b
0xf0, // 1111 0000b
0x00, // 0000 0000b
0x00, // 0000 0000b
0x00, // 0000 0000b
0x00, // 0000 0000b
/* KVData80 */
0xf7, // 1111 0111b ; marks end of tape (green/yellow screen)
0xb1, // 1011 0001b
0x8c, // 1000 1100b
0x63, // 0110 0011b
0x18, // 0001 1000b
0xc0 // 1100 0000b
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const uInt8 KidVid::ourSongPositions[44+38+42+62+80+62] = {
/* kvs1 44 */
11, 12+0x80, 13+0x80, 14, 15+0x80, 16, 8+0x80, 17, 18+0x80, 19, 20+0x80,
21, 8+0x80, 22, 15+0x80, 23, 18+0x80, 14, 20+0x80, 16, 18+0x80,
17, 15+0x80, 19, 8+0x80, 21, 20+0x80, 22, 18+0x80, 23, 15+0x80,
14, 20+0x80, 16, 8+0x80, 22, 15+0x80, 23, 18+0x80, 14, 20+0x80,
16, 8+0x80, 9,
/* kvs2 38 */
25+0x80, 26, 27, 28, 8, 29, 30, 26, 27, 28, 8, 29, 30, 26, 27, 28, 8, 29,
30, 26, 27, 28, 8, 29, 30, 26, 27, 28, 8, 29, 30, 26, 27, 28, 8, 29,
30+0x80, 9,
/* kvs3 42 */
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 34, 42, 36, 43, 40, 39, 38, 37,
34, 43, 36, 39, 40, 37, 38, 43, 34, 37, 36, 43, 40, 39, 38, 37, 34, 43,
36, 39, 40, 37, 38+0x80, 9,
/* kvb1 62 */
0, 1, 45, 2, 3, 46, 4, 5, 47, 6, 7, 48, 4, 3, 49, 2, 1, 50, 6, 7, 51,
4, 5, 52, 6, 1, 53, 2, 7, 54, 6, 5, 45, 2, 1, 46, 4, 3, 47, 2, 5, 48,
4, 7, 49, 6, 1, 50, 2, 5, 51, 6, 3, 52, 4, 7, 53, 2, 1, 54, 6+0x80, 9,
/* kvb2 80 */
0, 1, 56, 4, 3, 57, 2, 5, 58, 6, 7, 59, 2, 3, 60, 4, 1, 61, 6, 7, 62,
2, 5, 63, 6, 1, 64, 4, 7, 65, 6, 5, 66, 4, 1, 67, 2, 3, 68, 6, 5, 69,
2, 7, 70, 4, 1, 71, 2, 5, 72, 4, 3, 73, 6, 7, 74, 2, 1, 75, 6, 3, 76,
4, 5, 77, 6, 7, 78, 2, 3, 79, 4, 1, 80, 2, 7, 81, 4+0x80, 9,
/* kvb3 62 */
0, 1, 83, 2, 3, 84, 4, 5, 85, 6, 7, 86, 4, 3, 87, 2, 1, 88, 6, 7, 89,
2, 5, 90, 6, 1, 91, 4, 7, 92, 6, 5, 93, 4, 1, 94, 2, 3, 95, 6, 5, 96,
2, 7, 97, 4, 1, 98, 6, 5, 99, 4, 3, 100, 2, 7, 101, 4, 1, 102, 2+0x80, 9
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const uInt32 KidVid::ourSongStart[104] = {
/* kvshared */
44, /* Welcome + intro Berenstain Bears */
980829, /* boulders in the road */
1178398, /* standing ovations */
1430063, /* brother bear */
1691136, /* good work */
1841665, /* crossing a bridge */
2100386, /* not bad (applause) */
2283843, /* ourgame */
2629588, /* start the parade */
2824805, /* rewind */
3059116,
/* kvs1 */
44, /* Harmony into 1 */
164685, /* falling notes (into 2) */
395182, /* instructions */
750335, /* high notes are high */
962016, /* my hat's off to you */
1204273, /* 1 2 3 do re mi */
1538258, /* Harmony */
1801683, /* concratulations (all of the Smurfs voted) */
2086276, /* line or space */
2399093, /* hooray */
2589606, /* hear yeeh */
2801287, /* over the river */
3111752, /* musical deduction */
3436329,
/* kvs2 */
44, /* Handy intro + instructions */
778557, /* place in shape */
1100782, /* sailor mate + whistle */
// 1281887,
1293648, /* attention */
1493569, /* colours */
1801682, /* congratulations (Handy and friends voted) */
2086275,
/* kvs3 */
44, /* Greedy and Clumsy intro + instructions */
686829, /* red */
893806, /* don't count your chicken */
1143119, /* yellow */
1385376, /* thank you */
1578241, /* mixin' and matchin' */
1942802, /* fun / colour shake */
2168595, /* colours can be usefull */
2493172, /* hip hip horay */
2662517, /* green */
3022374, /* purple */
3229351, /* white */
3720920,
/* kvb1 */
44, /* 3 */
592749, /* 5 */
936142, /* 2 */
1465343, /* 4 */
1787568, /* 1 */
2145073, /* 7 */
2568434, /* 9 */
2822451, /* 8 */
3045892, /* 6 */
3709157, /* 0 */
4219542,
/* kvb2 */
44, /* A */
303453, /* B */
703294, /* C */
1150175, /* D */
1514736, /* E */
2208577, /* F */
2511986, /* G */
2864787, /* H */
3306964, /* I */
3864389, /* J */
4148982, /* K */
4499431, /* L */
4824008, /* M */
5162697, /* N */
5581354, /* O */
5844779, /* P */
6162300, /* Q */
6590365, /* R */
6839678, /* S */
7225407, /* T */
7552336, /* U */
7867505, /* V */
8316738, /* W */
8608387, /* X */
8940020, /* Y */
9274005, /* Z */
9593878,
/* kvb3 */
44, /* cat */
341085, /* one */
653902, /* red */
1018463, /* two */
1265424, /* dog */
1669969, /* six */
1919282, /* hat */
2227395, /* ten */
2535508, /* mom */
3057653, /* dad */
3375174, /* ball */
3704455, /* fish */
4092536, /* nine */
4487673, /* bear */
5026282, /* four */
5416715, /* bird */
5670732, /* tree */
6225805, /* rock */
6736190, /* book */
7110159, /* road */
7676992
};

View File

@ -0,0 +1,113 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2009 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: KidVid.hxx,v 1.1 2009-03-16 00:23:42 stephena Exp $
//============================================================================
#ifndef KIDVID_HXX
#define KIDVID_HXX
#include <cstdio>
#include "bspf.hxx"
#include "Control.hxx"
#include "Event.hxx"
/**
The KidVid Voice Module, created by Coleco. This class emulates the
KVVM cassette player by mixing WAV data into the sound stream. The
WAV files are located at:
http://www.atariage.com/2600/archives/KidVidAudio/index.html
This code was heavily borrowed from z26.
@author Stephen Anthony & z26 team
@version $Id: KidVid.hxx,v 1.1 2009-03-16 00:23:42 stephena Exp $
*/
class KidVid : public Controller
{
public:
/**
Create a new KidVid controller plugged into the specified jack
@param jack The jack the controller is plugged into
@param event The event object to use for events
@param system The system using this controller
@param md5sum The md5 of the ROM using this controller
*/
KidVid(Jack jack, const Event& event, const System& system,
const string& md5sum);
/**
Destructor
*/
virtual ~KidVid();
public:
/**
Update the entire digital and analog pin state according to the
events currently set.
*/
void update();
private:
// Open/close a WAV sample file
void openSampleFile();
void closeSampleFile();
// Jump to next song in the sequence
void setNextSong();
// Generate next sample byte
// TODO - rework this, perhaps send directly to sound class
void getNextSampleByte();
private:
enum {
KVSMURFS = 0x44,
KVBBEARS = 0x48,
KVBLOCKS = 6, /* number of bytes / block */
KVBLOCKBITS = KVBLOCKS*8 /* number of bits / block */
};
// Whether the KidVid device is enabled (only for games that it
// supports, and if it's plugged into the right port
bool myEnabled;
// The file handles for the WAV files
FILE *mySampleFile, *mySharedSampleFile;
// Indicates if sample files have been successfully opened
bool myFileOpened;
// Is the tape currently 'busy' / in use?
bool myTapeBusy;
// TODO - document the following
uInt32 myFilePointer, mySongCounter;
bool myBeep, mySharedData;
uInt8 mySampleByte;
uInt32 myGame, myTape, myIdx, myBlock, myBlockIdx;
// Number of blocks and data on tape
static const uInt8 ourKVBlocks[6];
static const uInt8 ourKVData[6*8];
static const uInt8 ourSongPositions[44+38+42+62+80+62];
static const uInt32 ourSongStart[104];
};
#endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TIA.cxx,v 1.105 2009-02-21 20:56:08 stephena Exp $
// $Id: TIA.cxx,v 1.106 2009-03-16 00:23:42 stephena Exp $
//============================================================================
//#define DEBUG_HMOVE
@ -565,7 +565,7 @@ inline void TIA::endFrame()
myFrameCounter++;
// Recalculate framerate. attempting to auto-correct for scanline 'jumps'
if(myFrameCounter % 32 == 0 && myAutoFrameEnabled)
if(myFrameCounter % 8 == 0 && myAutoFrameEnabled)
{
myFramerate = (myScanlineCountForLastFrame > 285 ? 15600.0 : 15720.0) /
myScanlineCountForLastFrame;

View File

@ -38,6 +38,7 @@ MODULE_OBJS := \
src/emucore/FSNode.o \
src/emucore/Joystick.o \
src/emucore/Keyboard.o \
src/emucore/KidVid.o \
src/emucore/M6532.o \
src/emucore/MT24LC256.o \
src/emucore/MD5.o \

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GameInfoDialog.cxx,v 1.66 2009-01-20 16:21:28 stephena Exp $
// $Id: GameInfoDialog.cxx,v 1.67 2009-03-16 00:23:42 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -224,6 +224,7 @@ GameInfoDialog::GameInfoDialog(
ctrls.push_back("AmigaMouse", "AMIGAMOUSE" );
ctrls.push_back("AtariVox", "ATARIVOX" );
ctrls.push_back("SaveKey", "SAVEKEY" );
ctrls.push_back("KidVid", "KIDVID" );
myP0Controller = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, ctrls, "", 0, 0);
wid.push_back(myP0Controller);