#include "stdafx.h"
#include 
#include 
using namespace std;
// define the intonations:
enum Intonations : unsigned char
{
   I_1 =0x40,
   I_2 =0x80,
   I_3 =0xC0
};
unsigned char END=0xFF;
// define the Phonemes numbers
enum Phonemes : unsigned char
{
	EH3 =0, EH2, EH1, PA0, DT, A1,  A2,  ZH,
	AH2,    I3,  I2,  I1,  M,  N,   B,   V,
	CH,     SH,  Z,   AW1, NG, AH1, OO1, OO,
	L,      K,   J,   H,   G,  F,   D,   S,
	A,      AY,  Y1,  UH3, AH, P,   O,   I,
	U,      Y,   T,   R,   E,  W,   AE,  AE1,
	AW2,    UH2, UH1, UH,  O2, O1,  IU,  U1,
	THV,    TH,  ER,  EH,  E1, AW,  PA1, STOP
};

// define the Phonemes text
static const char *PhonemeTable[65] =
{
	"EH3","EH2","EH1","PA0","DT" ,"A1" ,"A2" ,"ZH",
	"AH2","I3" ,"I2" ,"I1" ,"M"  ,"N"  ,"B"  ,"V",
	"CH" ,"SH" ,"Z"  ,"AW1","NG" ,"AH1","OO1","OO",
	"L"  ,"K"  ,"J"  ,"H"  ,"G"  ,"F"  ,"D"  ,"S",
	"A"  ,"AY" ,"Y1" ,"UH3","AH" ,"P"  ,"O"  ,"I",
	"U"  ,"Y"  ,"T"  ,"R"  ,"E"  ,"W"  ,"AE" ,"AE1",
	"AW2","UH2","UH1","UH" ,"O2" ,"O1" ,"IU" ,"U1",
	"THV","TH" ,"ER" ,"EH" ,"E1" ,"AW" ,"PA1","STOP",
	0
};



// define a class to hold one phrase
class phrase
{
	char * name;
	unsigned int size;
	unsigned char* phn;
	static int pos;
public:
   phrase(char* pName, unsigned char* pPhn)
   {
       name = pName;
	   unsigned char* ptrPhn=pPhn;
	   while(*ptrPhn!=END) { ++ptrPhn; }
       size = ptrPhn-pPhn;
	   phn = pPhn;
   }
   const char* get_name() { return name; }
	ostream& print_phrase(ostream& stream) {
		stream << "<" << name << ">";
		return stream;
	}
	ostream& print_phrase_and_byte(ostream& stream)
	{
	   unsigned char* ptrPhn=phn;
       char buffer[16];

	   stream << name << "\n";
		while(*ptrPhn != END)
		{
           sprintf(buffer, "%02.02x", *ptrPhn);
           stream << buffer;
		   ++ptrPhn;
		}
		stream << "\n";

		return stream;
	}

	ostream& out_part_of_roms(ostream& stream);
};
ostream& phrase::out_part_of_roms(ostream& stream)
{
   char buffer[16];
	if(pos>15)
	{
		stream << endl;
		pos=0;
	}
	//stream << hex << size << " ";
   sprintf(buffer, "%02.02x", size);
   stream << buffer<< ' ';
	pos++;
	unsigned int i=0;
	while(i15)
		{
			stream << endl;
			pos=0;
		}
		//stream << hex << phn[i] << ' ';
      sprintf(buffer, "%02.02x", phn[i]);
      stream << buffer << ' ';
		pos++;
		i++;
	}
	return stream;
}

// steam print
ostream& operator<<(ostream& stream, phrase& obj)
{
	return obj.print_phrase(stream);
}


int phrase::pos = 6;
/* 
Shows how to match this program with the roms:

C:>copy/b wow.x1+wow.x2+wow.x3+wow.x4+wow.x5+wow.x6+wow.x7 wow.all
C:>debug wow.all
-d 4C60
11AF:5C60  34 11 FD 02 34 8B 1D 83-19 27 09 18 03 2D 26 35
11AF:5C70  2B 18 33 19 03 1D 35 2B-1E 33 0E 23 18 1F 19 26
11AF:5C80  35 2B 3E 83 31 27 1D 22-09 36 28 1C 3B 00 2A 2A
11AF:5C90  28 37 25 15 2D 3A 1D 32-18 3E 83 15 00 09 29 18
11AF:5CA0  2A 20 19 19 3B 2B 32 0F-22 36 28 03 0C 15 09 29
11AF:5CB0  1F 3B 18 1D 3E 83 0A 83-22 36 28 33 2B 27 0D 3E
11AF:5CC0  83 14 83 38 33 03 1E 33-0D 1A 02 0D 12 33 0F 2D
11AF:5CD0  26 35 2B 2B 3E BE 08 15-23 09 29 2F 00 0C 3E 11
-

Sample output of this program (should match):
		                            1d 83 19 27 09 18 03 2d 26 35
			  2b 18 33 19 03 1d 35 2b 1e 33 0e 23 18 1f 19 26
			  35 2b 3e 83 31 27 1d 22 09 36 28 1c 3b 00 2a 2a
			  28 37 25 15 2d 3a 1d 32 18 3e 83 15 00 09 29 18
			  2a 20 19 19 3b 2b 32 0f 22 36 28 03 0c 15 09 29
			  1f 3b 18 1d 3e 83 0a 83 22 36 28 33 2b 27 0d 3e
			  83 
*/
// (debug adds 100h to addresses)
// starts at 4B66h that is 19302 dec


class wowPhrases
{
	static phrase wowPhrase[];
	static int size;

public:
	//wowPhrases() {
		//size = sizeof(wowPhrase)/sizeof(phrase);
	//}
    void yoyo();
	ostream& print_hex_codes(ostream& stream);
	ostream& print(ostream& stream);
};
ostream& wowPhrases::print_hex_codes(ostream& stream)
{
	for(int i=0;i

    Source: geocities.com/mot505