joncampbell123 / dosbox-x

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

PC-98 BIOS disk change notification not implemented #936

Open joncampbell123 opened 5 years ago

joncampbell123 commented 5 years ago

Describe the bug Some PC-98 booter games rely on specific error codes or certain BIOS data area flags to detect disk change. None of these methods work currently in DOSBox-X.

To Reproduce Steps to reproduce the behavior:

  1. Boot a game, such as Crimson III
  2. When the game asks to change disks, observe that it fails to detect the change or indicates disk I/O error

Expected behavior Triggering floppy disk swap will eventually give the game the disk it wants.

Disk change notification, and emulation of INT 13h disk change notification in IBM PC/XT/AT mode is already in place.

I am not certain how to implement the same for PC-98 mode (INT 1Bh), but behavior may be similar: First read of the floppy after swapping fails with an error code that tells the game or DOS kernel the disk changed. Game/DOS kernel retries, and read succeeds.

I noticed another PC-98 game reading a bit from the BIOS data area ("not ready" according to undocumented PC-98). Not sure exactly how to implement that yet.

hdk1983 commented 5 years ago

According to https://archive.org/details/PC9800TechnicalDataBookBIOS1992/page/n247 the BIOS data area contains status which is updated when a command is completed.

I am not sure about disk change notification, but I remember that a drive indicator behavior is different between IBM PC and PC-98. On IBM PC, the indicator is on while the drive is selected. On PC-98, it is on while the drive is transferring data. While the drive is seeking or no disk is inserted, it is off on PC-98 normally. So some games show notification about changing a disk but keyboard or button input is not requested after changing the disk. I think such games poll the drive, maybe using SENSE command, to detect a new disk is inserted.

cracyc commented 5 years ago

The 9801 uses upd765 ready line polling for disk change indication.

joncampbell123 commented 5 years ago

Until proper disk change notification is implemented, some games can be tricked into working through the debugger.

"Mad - Paradox" can be tricked into reading INT 1Bh on disk swap by starting the game, and then in the debugger, enter the command "SM 0 56C 08". This sets the "not ready" bit of the second floppy drive (second drive status at byte 0000:056C). The game will loop polling that byte until set and will not call INT 1Bh to read the disk otherwise.