Here is the source code for the program just for the record
/* Roller-Ball PC Interface
* compiled with Borland C++ version 5.22 under Windows XP Pro
* Copyright (c) 2005 by Brad P. Wilson, Austell GA - USA
*/
#include <stdio.h>
#include <pc.h>
#include <bios.h>
#include <conio.h>
#include <unistd.h>
#include <allegro.h>
#define DELAY 3000000 // Increase to slow down score counting
void delay(void);
int main(void)
{
if (allegro_init()) {
allegro_message("Cannot initalize Allegro.\n");
return 1;
}
install_timer();
if(install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL)) {
allegro_message("Sound Error: %s", allegro_error);
return 1;
}
set_volume(255, 255); //digital and music to max levels
install_keyboard();
set_keyboard_rate(0,0);
int roll;
int ball=0;
int skbscore=0;
printf("------------------------------------------\n");
printf("- Brad Wilson's Roller Ball PC Interface -\n");
printf("------------------------------------------\n");
/*Initialize Skeeball**/
// 0x00 ALL OFF
// 0x01 DS0 ON
// 0x04 DS2 ON
// 0x05 DS0 & DS2 ON
(outportb)(0x378,0x00); //Everything off
bool score1 = false;
bool score2 = false;
bool score3 = false;
int bkey=0;
SAMPLE *SndFx;
do
{
roll = readkey();
printf("Key - %d\n",roll);
switch(roll)
{
case 353: printf(" Ring 10\n");
SndFx = load_wav("10ring.wav"); // or .voc
play_sample(SndFx, 255, 128, 1000, 0);
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
skbscore += 10;
clear_keybuf();
break;
case 4979: printf(" Ring 20\n");
SndFx = load_wav("20ring.wav"); // or .voc
play_sample(SndFx, 255, 128, 1000, 0);
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
delay();
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
skbscore += 20;
break;
case 4465: printf(" Ring 30\n");
SndFx = load_wav("30ring.wav"); // or .voc
play_sample(SndFx, 255, 128, 1000, 0); (outportb)(0x378,0x00);
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
delay();
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
delay();
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
skbscore += 30;
break;
case 6007: printf(" Ring 40\n");
SndFx = load_wav("40ring.wav"); // or .voc
play_sample(SndFx, 255, 128, 1000, 0); (outportb)(0x378,0x00);
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
delay();
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
delay();
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
delay();
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
skbscore += 40;
break;
case 2409: printf(" Ring 50\n");
SndFx = load_wav("50ring.wav"); // or .voc
play_sample(SndFx, 255, 128, 1000, 0);
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
delay();
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
delay();
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
delay();
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
delay();
(outportb)(0x378,0x01); //Score Count
(outportb)(0x378,0x00);
skbscore += 50;
break;
case 2666: printf(" Ball Count\n");
// PlaySound("gutter.wav", NULL, SND_ASYNC);
(outportb)(0x378,0x04); //Ball Count
(outportb)(0x378,0x00);
ball +=1;
break;
case 5750: printf("Program Exit.\n");
break;
default: break;
}
if(skbscore >= 240 && score1 == false)
{
//PlaySound("240score.wav", NULL, SND_ASYNC);
SndFx = load_wav("240score.wav"); // or .voc
play_sample(SndFx, 255, 128, 1000, 0);
score1 = true;
}
if(skbscore >= 450 && score2 == false)
{
SndFx = load_wav("450score.wav"); // or .voc
play_sample(SndFx, 255, 128, 1000, 0);
score2 = true;
}
if(skbscore >= 900 && score3 == false)
{
//PlaySound("900score.wav", NULL, SND_ASYNC);
score3 = true;
}
if(ball == 9)
{
// PlaySound("gameover.wav", NULL, SND_ASYNC);
ball = 1;
skbscore = 0;
score1 = false;
score2 = false;
score3 = false;
}
printf("Score: %d", skbscore);
printf(" Ball: %d\n", ball);
}
while(roll != 5750); // Key M is EXIT - Switch to start later.
(outportb)(0x378,0x00);
destroy_sample(SndFx);
remove_keyboard();
allegro_exit();
return 0;
}
void delay( void )
{
long x;
for ( x = 0; x < DELAY; x++ );
}
Brad