PCSPLAY

Discuss PoP1 for DOS here.
Post Reply
User avatar
musa
Vizier
Vizier
Posts: 112
Joined: March 27th, 2011, 2:06 pm
Location: Nairobi, Kenya

PCSPLAY

Post by musa »

I'm releasing a tool for DOS: PCSPLAY!

It can play Prince of Persia 1 PC Speaker sounds & music.

Just type: pcsplay [whatever sound you want to play].

Bugs:
Speed is not very accurate.
Attachments
pcsplay.zip
(6.05 KiB) Downloaded 67 times
-- Michael, the boy who makes Shaw's Nightmare.
Visit here to download Shaw's Nightmare: http://shawsnightmare.ucoz.com
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: PCSPLAY

Post by Norbert »

Should this work under DOSBox?
With, for example, "PCSPLAY.EXE IBM_SND1.DAT"?
I tried that, but it doesn't play anything recognizable; after the second note it's stuck or something. :P
User avatar
musa
Vizier
Vizier
Posts: 112
Joined: March 27th, 2011, 2:06 pm
Location: Nairobi, Kenya

Re: PCSPLAY

Post by musa »

Extract them first and then play them.
-- Michael, the boy who makes Shaw's Nightmare.
Visit here to download Shaw's Nightmare: http://shawsnightmare.ucoz.com
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: PCSPLAY

Post by Norbert »

Ah, yes, that works.
I've attached the .PCS files that can be used with PCSPLAY.
[Edit: (SND54.PCS = intro tune)]
Attachments
pcs.zip
.PCS files for PCSPLAY
(10.61 KiB) Downloaded 63 times
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: PCSPLAY

Post by Norbert »

Hey musa, I have a question.
I checked the code and as I understand it, each tone has a frequency to generate (note.freq) and a delay (note.duration).
I don't understand what is being passed to 0x42... some kind of frequency? But we already have a note.freq for each note...
User avatar
musa
Vizier
Vizier
Posts: 112
Joined: March 27th, 2011, 2:06 pm
Location: Nairobi, Kenya

Re: PCSPLAY

Post by musa »

I was trying set the speed according to the bps to PIT Channel 2.

More information on this can be found here: http://bespin.org/~qz/pc-gpe/pit.txt
-- Michael, the boy who makes Shaw's Nightmare.
Visit here to download Shaw's Nightmare: http://shawsnightmare.ucoz.com
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: PCSPLAY

Post by Norbert »

Can you make a custom version for me that displays the following values while running:
- bps, after being read from the handle
- the two values being passed to 0x42
- while the tones are playing, their note.freq and note.duration

I tried porting your program to GNU/Linux and it almost works, but when I pass the intro tune (SND54.PCS) to it, it doesn't sound right, so I'm wondering what I'm doing wrong. :)
User avatar
musa
Vizier
Vizier
Posts: 112
Joined: March 27th, 2011, 2:06 pm
Location: Nairobi, Kenya

Re: PCSPLAY

Post by musa »

Norbert wrote: - the two values being passed to 0x42
Why would you require that?
Norbert wrote: I tried porting your program to GNU/Linux and it almost works, but when I pass the intro tune (SND54.PCS) to it, it doesn't sound right, so I'm wondering what I'm doing wrong. :)
Does your PC have a PC Speaker? If so, is it properly supported?

I have compiled my program with your suggestions except the second one which I'd like to know why you require it.
BTW you need Turbo C to compile the code.
Attachments
pcsplay.zip
Update of the program
(6.12 KiB) Downloaded 57 times
-- Michael, the boy who makes Shaw's Nightmare.
Visit here to download Shaw's Nightmare: http://shawsnightmare.ucoz.com
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5745
Joined: April 9th, 2009, 10:58 pm

Re: PCSPLAY

Post by Norbert »

musa wrote:Why would you require that?
Not required, I was just curious. :)
musa wrote:Does your PC have a PC Speaker? If so, is it properly supported?
Well, as I wrote before, it almost works, but the port... "it doesn't sound right".
It still doesn't sound right. I've attached what I've got so far to this post.
Anyways, thanks for creating the custom version. At least it confirmed my suspicion about what's wrong with my code.
I'm not going to look into it any further, but it was fun for a while, looking into how this PC speaker stuff works.
Attachments
PCSPLAY.C
GNU/Linux version of PCSPLAY.C; something is still wrong
(1.35 KiB) Downloaded 63 times
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: PCSPLAY

Post by David »

Musa, your player plays snd55.pcs too fast. (That is the music played when the "In the Sultan's absence" text is shown.)
Perhaps the value of "bps" is ignored?
I see you're using it to set the timer, but shouldn't you use it in the call to delay instead?

There is another topic about PCspeaker sounds: viewtopic.php?f=67&t=566

I made a player back in 2006 which is mentioned in that topic. I've attached it to this post.
I made the source more readable, and fixed a bug. The value of "whole" used to be 2000, but then it plays everything too slow. Now it's 1000.
Oddly, I remember listening to all the music with the correct speed.
Attachments
pcsplay_David.zip
(75.37 KiB) Downloaded 64 times
User avatar
musa
Vizier
Vizier
Posts: 112
Joined: March 27th, 2011, 2:06 pm
Location: Nairobi, Kenya

Re: PCSPLAY

Post by musa »

I've released a newer version of PCSPLAY.

Fixed:
The speed is now more accurate.
Attachments
pcsplay.zip
A newer release.
(6.14 KiB) Downloaded 64 times
-- Michael, the boy who makes Shaw's Nightmare.
Visit here to download Shaw's Nightmare: http://shawsnightmare.ucoz.com
Post Reply