-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paratrooper game missing helicopter/airplane sound #1492
Comments
I wouldn't call it inaudible, basically the game is relying on the speaker making "clicks" whenever it switches position (you know when a sample is cut off away from the middle and there's a pop? exactly the same effect). Now, that's something that should work as-is (assuming PC speaker is properly emulated rather than only when the timer is used)… but this method was also sometimes abused for PWM to play sound with more than 1-bit resolution. Is there any code specifically to handle that case? Because I could see that interfering and failing to account for mere clicks. Also again, not emulating PC speaker when timer is not in use also would do it, but I suppose DOSBox-X does better than that… right? |
It should be emulated, the question is how to implement it, and writing code in DOSLIB to do to the PIT what Paratrooper is doing. Now as far as I know, writing the mode byte of a timer causes it to stop and reset to a known state depending on the mode. So if it is changing between mode 1 and 2, it is relying on the PIT reverting to initial states of each mode and then running. I don't think the design of the 8254 allows switching modes while counting, without resetting the state. I will add debug code to DOSBox-X right now to see what it is writing. |
Paratrooper writes the mode byte only ONCE at startup. 1096783 ERROR PIT:port 43 B6 After that, all sound effects are just 16-bit (two 8-bit) writes to port 42h to change the counter. However what is probably preventing this from working is that DOSBox-X inherits DOSBox SVN's performance optimization of enforcing a minimum counter value (one that is well above audible range) so that very small values do not bog down PC speaker emulation. I see Paratrooper's helicopter noises are made by alternately writing counter=1 and counter=2. 10876253 ERROR PIT:port 42 write:1 state:3 So while either frequency is too high to hear, switching between them should make an audible click. DOSBox-X enforces a minimum count based on the PC speaker sample rate setting in dosbox.conf which these values are limited to, so, no noise. No mode byte writes (to 43h) after startup were noted. |
Hey wait a minute... doesn't mode 3 of the 8254 count down by 2 in order to do each half of the square wave? So... wouldn't count=1 cause a square wave with one cycle counting from 65536? Notice in the video you linked, the helicopter sounds are not just pops, they're intermittent low frequency square waves. Paratrooper keeps the counter at count==2 when silence is intended, alternates between count=1 and count=2 when helicopters are on screen. |
Pulling out the trusty old 486 laptop... PIT timer 2, mode 3, count=1 does indeed generate a low frequency square wave, instead of a 1MHz ultrasonic frequency that mode 2 would cause. That's what Paratrooper is relying on here. |
…ow frequency buzz. Fixes Paratrooper [#1492]
If you can compile from source, try Paratrooper with the latest build. The PC speaker emulation sounds at least very close to the video now. |
I compiled the latest source, and indeed I now get sound. Thanks! |
Is your feature request related to a problem? Please describe.
Paratrooper, a early PC game published in 1982.
https://www.mobygames.com/game/pc-booter/paratrooper
This game when run on an actual IBM PC as shown here:
https://www.youtube.com/watch?v=krb4ave2_Mg
Produces helicopter and airplane sound, but not when played in any emulator.
This was reported on Vogons, and user ripsaw80 had a look at it, and had this to say:
"For the helicopter sound, the game alternates between square wave counter values of 1 and 2, which are not audible frequencies, but just the re-programming of the timer counter value apparently causes a subtle noise. I suppose it could be considered an undesirable artifact, like the "snow" effect seen on old CGA hardware, but the game is making use of it and DOSBox does not emulate it."
https://www.vogons.org/viewtopic.php?t=73347
Describe the solution you'd like
Not sure if emulating this makes sense. If it is to be emulated, perhaps it should be behind an option to prevent unwanted effects on later games.
The text was updated successfully, but these errors were encountered: