First post, by EricWinter
Note on AI use:
I'm Chinese, English is not my first language. This post was originally
written in Chinese and translated with AI assistance (exact translation only,
no content generation).
Regarding the project itself: the reverse engineering, disassembly analysis,
and validation were done manually. AI was used for code translation and
structural assistance, and this is disclosed in the project README.
OK so I've been reverse-engineering NEC's NECOPN.DRV (the Windows 95 OPNA
MIDI driver for the PC-9821) for the past few weeks, and I'm at a point
where I can't figure out what's wrong anymore.
I reimplemented the driver's behavior in Python, and most of it
actually works. The voices sound right, the drum routing is right, the LFO
is right. 56 self-tests pass. But when I play back a real track, some
instruments just disappear at certain points, and it's the same spots every
time. I've compared it against a recording from the real driver, and the
difference is obvious.
What I've tried:
- Reworking the channel allocation logic (seg1:0x0058)
- Different ref_count implementations for key-on
- LFO tick timing (seg3:0x0D59)
- Checking ALG6 mask (found and fixed a real bug there)
- A bunch of other stuff that made zero difference
I don't have a way to trace I/O ports on my setup. NP2's debug build doesn't
have trace. I've tried MAME but couldn't get Win95 running well enough.
If anyone here has a working MAME PC-9821 setup with port tracing, I'd
really appreciate a short trace — like 30-50 writes around one missing note.
Or if you know OPNA well enough to spot what I might have misunderstood,
that would help even more.
Details and audio: https://github.com/EriczjrWinter/necopn-drv-reverse
Thanks.