joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.77k stars 381 forks source link

PC-98: Photo Genic hangs playing any PCM sound since 0.82.15 #1022

Closed yksoft1 closed 5 years ago

yksoft1 commented 5 years ago

Describe the bug Sunsoft's Photo Genic is a game which had working INT 33h mouse support before 8255 mouse support was added. Since 0.82.15, The game hangs trying to play any sound effect with DOSBox-X default setting. I didn't touch the game since 0.82.4 and only found this problem checking older archived files.

To Reproduce Steps to reproduce the behavior:

  1. Run pg.bat to start the game
  2. Start a new game using this option. image

Expected behavior The game plays a PCM chime (probably using the SSG channel) and the opening sequence will be shown.

Environment (please complete the following information):

joncampbell123 commented 5 years ago

It may have worked back when the default FM board IRQ was IRQ 3 or 5, before the default became IRQ 12.

joncampbell123 commented 5 years ago

Hold on... it hangs in this loop.

I'll need to look up what I/O port 75h is supposed to return on read.

1A45:00003BD9 EB00                jmp  short 00003BDB ($+0)   (down)
1A45:00003BDB E475                in   al,75
1A45:00003BDD 3C10                cmp  al,10
1A45:00003BDF 73F8                jnc  00003BD9 ($-8)         (up)

EDIT: 71-77h odd belong to the timer chip. 75h is timer 2, which on PC-98 is related to the RS-232 port. So it's using the timer used to drive the RS-232C port as a time source, apparently.

joncampbell123 commented 5 years ago

It writes 94h to port 77h and then DFh to port 75h.

That means timer 2, set to read/write only the LSB of the timer, set to mode 2 (periodic pulse).

It only hangs because the counter value isn't counting down as it should.

joncampbell123 commented 5 years ago

Try the latest commit. RS-232C PIT Timer 2 clock gate on by default to support the game.

guest os_000

joncampbell123 commented 5 years ago

A game that uses the RS-232C baud rate clock (PIT 2) for delay loops isn't entirely unusual by the way.

I know of a few demoscene executables for the IBM PC/AT that use the PC speaker (PIT 2) for delay loops. The PC speaker output is gated off from the speaker while doing this, of course.