-
Notifications
You must be signed in to change notification settings - Fork 379
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
NEC PC-98 (and compatible) emulation #106
Comments
Info: http://people.freebsd.org/~kato/pc98-arch.html Video chipset: (Aybe) some more info: GeneralDocumentsIndex of /docs/content/computing/NEC <- BIOS docs, Japanese X) To translate with Chrome: http://hackipedia.org/browse/Computer/Platform/PC%2c%20NEC%20PC%2d98 Emulators |
I have my doubts that the PC-98 is really that close enough. I mean, there are nearly perfect ports of Rusty and Totsugeki Mix, and I know Windows was ported to the PC-98 too (using dedicated drivers), but besides the CPU I have my doubts of it having enough in common to make it trivial. Just warning. That said, having an easy to use PC-98 emulator on Linux would be nice :P (no need to rely on Wine anymore) |
True, however I am making some architectural changes that would better allow alternate PC-98 emulation to coexist with the DOS emulation we have now. |
I really need this feature :) |
Would be cool, yes. The changes are going to take a lot of time to work in by myself. Basically 99% of DOSBox-X assumes PC/AT hardware. Conditional code needs to be added so that if machine=pc98 is given it emulates PC-9821 hardware. Lesser changes need to be made for the DOS kernel, since DOS is the only thing common between PC-98 and IBM PC. Pick something small to work on and submit patches for me to integrate. I do have a life to live. I will help too, since I just got a PC-98 laptop to test against. I have been gathering PC-98 software and whatever bits of information I have. Most of it is in Japanese so I'll need help with translating it. I can provide that as well to help. |
Isn't the DOS actually quite diferent? I mean, if I recall correctly it has extensions in order to draw Shift-JIS text for the sake of kanji support (for the record, there's a DOS extender for the same purpose for IBM PCs). Of course one could probably just use a disk image in the meanwhile. The only thing in common is pretty much the CPU, albeit the bitmap support meant that Windows could be ported to it (that's a whole story on its own). |
From what I understand, it's MS-DOS with modifications for the PC-98 BIOS, a proprietary PC-98 partition table, and support for SHIFT-JIS, with all text in Japanese. If that weren't true, I would not have been able to run PKUNZIP on an old PC-98 last night to transfer files over floppy. Everything else is proprietary to PC-98. In the long run PC-98 emulation will have to affect the BIOS interrupt vectors, PIC mapping, I/O ports, etc. but in the meantime it might help to add minor things like DOS/V emulation, a SHIFT-JIS font and rendering, and modifications to the DOS kernel to emulate more PC-98-ish things if machine=pc98. I know DOS/V is Microsoft MS-DOS for IBM PC, the point is that would be one way to add, test, and develop SHIFT-JIS console rendering at the start. I don't expect DOSBox-X to run something like Touhou Project for a long while, but you do have to take steps to get there. I could do my part if I were to add support for the D88 disk image format that the PC-98 world seems to like to use. The D88 format's representation of the physical tracks and sectors would also help emulate MS-DOS games that use intentional bad sectors or funny sectors as a form of copy protection. One thing I will want to do on my end to keep the code working is add test cases and self-testing code to make sure things work properly despite these modifications, in order not to break anything as we proceed. That's what I'll be doing with DOSBox-X in the coming months. Patches are welcome, though they will be applied to branches off of master to keep master stable, then eventually merged into master. I will be able to help with emulation as I have just recently acquired an old NEC PC-98 Lt2 486DX laptop which I will be able to poke at now from the DOSLIB project. Contrary to what I've heard about 3.5" 3-mode it takes the IBM 1.44MB format just fine. |
I have been able to collect some documentation so far on PC-98: http://www.hackipedia.org/browse/Computer/Platform/PC,%20NEC%20PC-98 I will add to this collection as I find more. All of it is in Japanese, but that's all I can find. |
I can speak (sorta) Japanese but I don't have much time (and translation takes a lot of time, I'm not particularly fluent to be fair) so I can't help much :/ Thankfully tech docs tend to be reasonably easy to guess if you have a vague idea of what to look for (unlike most text). I'd suggest to just machine translate it and then maybe ask for help if a particular part doesn't seem clear. |
Machine translation is.... okayish... so far, though it doesn't help with some of the PDFs that were scanned from manuals (no text to copy-paste). |
It's not feasible to rewrite the DOSBox-X bootup process to emulate machine=pc98. So to develop it gradually, machine=pc98 boots up into IBM PC/AT vgaonly mode, and the Z:\ drive contains a GOTOPC98.COM that replaces interrupt vectors and signals emulation to relocate I/O ports to emulate NEC PC-9821. Interrupts and I/O ports can be implemented gradually this way, until full emulation is complete and machine=pc98 can eventually boot up entirely in PC-98 mode. |
Ack. Some PDF readers do OCR on the fly to select text, but yeah OK that sounds like an issue :/ |
At the risk of stating the blindingly obvious - have you considered peering at the nekoproject II source for clues? It's a completely different project than DOSBox, but the source is fairly well organised. If anything it might help with hardware details that may not be documented well, even in Japanese. |
I definitely have! It's one of my major references to PC-98 hardware and documentation, even if many parts aren't all that well commented. |
Also, recently I've managed to acquire actual PC-9821 hardware to test against to confirm whether or not the documentation is correct. It is thanks to Neko Project II and some PC-9821 laptops that I have been able to test and develop DOSLIB on PC-98 as far as I have right now! |
Fantastic job. I've been smiling into my coffee all morning at the Pentium Pro CHANGELOG entry too. Emulate ALL the things! |
The latest commit adds 8255 emulation, and hacks the timer and interrupt emulation to move to different I/O ports when you run GOTOPC98.COM to switch into PC-98 mode. It's very minimal at this stage but it works so far. I've tried to make comments comprehensive enough to explain what I'm doing and why. As a side effect of that development, there is now a RE-DOS.COM command that exits and restarts the DOS kernel (without rebooting the whole system). |
Self notes for further development:
|
I just added code to emulate the text VRAM of the GDC. I added code to use ANEX86.BMP from the Anex86 emulator for the character ROM, which works great though it doesn't quite cover the odd unusual and non-JIS character bitmaps seen on real hardware (outside normal shift-JIS range). I have an important question about ANEX86.BMP. Is it legal to build it into DOSBox-X or should I just leave it as a file you have to pick up elsewhere off the internet? |
I've done a lot of work on the video emulation lately that some games are even playable. Even, surprisingly, Touhou Project (though you need a cycles count of at least 30000 to avoid flickering sprites, and the scoreboard on the right doesn't show for some reason). I'm not sure what to make of the various INT 18h calls yet, so things are still iffy and this is where I need help.
Considering the sparse and even a bit contradictory documentation I have I appreciate any inputs or corrections on the emulation as it progresses and it might help to playtest as many PC-98 games as possible. |
Update:
|
Update:
Yet to resolve:
Findings on real hardware:
I've gone as far as I can developing this code, so I will be moving on to other things now. A lot of what I've done is guesswork and a few hacks. The code assumes 16-color mode at all times at this moment, the switch between 8-color, 16-color, and 256-color is not implemented at this time (nor analog/digital mode). Have fun and throw your PC-98 library at DOSBox-X to see what works and what doesn't. Post your results here, with screenshots if desired. |
Additional information:
|
One more thing to know:
|
Good to know that PC-98 is just as messy as its IBM counterpart. I'm assuming many old games just plain won't work on newer machines for touching things they weren't supposed to touch. |
Hello. Speaking of the PC-98, there's a quite active Discord server (of which I am a part of) in which people there can provide help. I do own a real machine (a PC-9821Xb10/J8), but I need to do some things to it first (such as adding a soundboard and replacing the floppy drive (which is dead) with a HxC or a Gotek flashed with the HxC firmware). |
I honestly was under the impression that FM was never onboard, just that it was so common among gamers that games expected it if you wanted sound. But I'm not an expert on PC-98, admittedly. This actually doesn't seem to be that far off from what happened in the West (where many PCs still didn't have sound cards and hence games would be stuck to either PC speaker beeps or outright no sound altogether… playing Half-Life 1 and not knowing what people were saying wasn't fun). Not surprising either, computers were still expensive at the time and not the norm at homes yet. |
From what I've found so far, you generally needed an addon card to get the FM synth. However some documentation suggests there was a short-lived "CanBe" series that had some sort of FM emulation built-in (though the sources suggest it wasn't 100% compatible). Of course I could be confusing a few things, recalling off the top of my head like this. Need to verify the sources. |
This site has a list of models with built-in sound hardware: http://hp.vector.co.jp/authors/VA004562/ray/tips.htm Although the CanBe models use an YMF288 (OPN3) with a Windows-compatible PCM chip - a Crystal one IIRC. The PC-9801-118 is basically the CanBe sound hardware on a card, and for it to work in DOS, you need to disable plug and play, but again, some games will not sound properly due to incompatible PCM hardware, among other things... |
No, the 118 is an opl3+opn3 chip called the ymf297 |
Seems I also found those glyphs in Neko Project II's fontdata.res file. |
Does VEMM486.EXE / VEMM386.EXE implement any additional function calls beyond the base Expanded Memory Manager interface? I've already noted that Briganty crashes with EMM386.EXE loaded, both in DOSBox-X and on real hardware, however it doesn't seem to have any problems with VEMM386.EXE on real hardware (I'll check again to make sure). However DOOM, DOOM II, Wolf98, Sim City 2000, and anything else involving a DOS extender crashes when VEMM386.EXE is loaded. DOSBox-X already has an ems=emm386 setting, is it going to need a ems=vemm386 or ems=vemm486 setting too? According to the original spec, function calls only go up to AH=5Dh. http://hackipedia.org/browse.cgi/Computer/Operating%20Systems/MS%2dDOS/EMS%2c%20Expanded%20Memory/Expanded%20Memory%20Specification%20%28Lotus%2c%20Intel%2c%20Microsoft%29%20v4%2e0%20%281987%2d10%29%5b2%5d%2etxt |
What does EMS function AH=70h do? Touhou Project 4 seems to call it at level start. It doesn't prevent the game from running but I am curious what that EMS function is supposed to do. |
Good news. If PC-98 FM board emulation is enabled, and SOUND.ROM is in the current directory at startup, DOSBox-X will load that into memory instead of installing it's own stub routines. At least one game, Sente Hisshou, requires a working SOUND BIOS to play music and will only play silence with the stub routines provided without SOUND.ROM. Of course said game will display nothing on screen without also working LIO BIOS routines... |
Thank you! Site snapshotting in progress: wget --mirror --progress=bar --timestamping --connect-timeout=5 --read-timeout=15 --limit-rate=250K --wait=10 --random-wait --continue --dns-timeout=10 --force-directories --recursive --no-parent --wait=2 http://pc98.pulsethread.com/ |
I found a list of graphics cards that are compatible with NEC PC-9821. |
there is more listed in http://hamlin.html.xdomain.jp/VGA/VGA98SE/VGA98SE.htm |
There is now a PC-98 draft Wiki page here which explains DOSBox-X’s PC-98 system and how to use it to run PC-98 games or applications in DOSBox-X: https://github.com/Wengier/dosbox-x-wiki/wiki/Guide:PC%E2%80%9098-emulation-in-DOSBox%E2%80%90X If there are any suggestions please feel free to let me know. |
I have something about the PEGC: |
I used Unifont-JP 13.0.06 to remake FREECG98.BMP. "1 June 2019 Release (Unifont 12.1.02)
(Unifont-JP [on https://unifoundry.com/unifont/index.html] uses proper Japanese forms of the relevant ideographs, and thus is more accurate than the old FREECG98.BMP which was made by me well before Unifont-JP even existed. The later releases of Unifont-JP added further improvements to Japanese characters) Please replace FREECG98.BMP with this more-accurate version. |
@stgiga Note that @roytam1 uploaded a new FREECG98.BMP earlier this year in #2132, and the updated BMP file is available from: https://github.com/joncampbell123/dosbox-x/blob/master/contrib/fonts/FREECG98.BMP (The original FREECG98.BMP file is still available here: https://github.com/joncampbell123/dosbox-x/blob/master/contrib/fonts/FREECG98_OLD.BMP) Can you both check if there is any difference between the current FREECG98.BMP and the new FREECG98.BMP @stgiga posted and decide which one to use? Thanks! |
The part about "HyperSnap" and replacement has me worried, which is why I did this. If those improvements by @roytam1 matter they can be done again on the version generated from the same tool I used to generate the original FREECG98.BMP, just to be safe. Because I generated FREECG98.BMP using a version of NP2 that had TTF support that it would then output to a BMP with the filename "font.tmp". I did this same process on Unifont-JP for this new version. My advice is for roytam1 to do the same improvements as before but to this known-good Unifont-JP version. |
I am adding support for Japanese EGA mode (machine=jega) in #2576, and this also makes use of converted fonts from FREECG98.BMP. So improving FREECG98.BMP will improve the default fonts in Japanese EGA mode too. |
it contains improvements from unifont-jp already. using non-free tool doesn't affect the status of my freecg98.bmp since it is generated from free font(s). |
@roytam1 I wasn't concerned about tool status. I was concerned about accuracy in regards to the Kanji, and also whether or not your workflow involving HyperSnap could have caused any issues, because HyperSnap is a screenshot program. My regeneration of FREECG98.BMP was done via the same lossless process (NP2's generator mode) as my first FREECG98.BMP. You are welcome to port your improvements to that. I just wanted to be certain that there wasn't any Kanji errors, since a complaint in the original FREECG98 was that some Kanji were the Simplified Chinese forms. Unifont-JP guarantees fixes of the affected instances. A contributor is planning on doing Japanese EGA, which the dev says would benefit from better FREECG98.BMP glyphs, which in combination with the fact that Kanji form accuracy is often important, makes it a good idea to unify Roytam's improvements into the regenerated FREECG98.BMP to ensure maximum accuracy. |
@stgiga the font I use is Izumi Gothic 16 which is the font that unifont-jp adapts, while unifont-jp doesn't make use Izumi Gothic 16 fully and my freecg98.bmp used every glyph from Izumi Gothic 16 to generate, including half-width forms. |
With the latest code DOSBox-X will first try to load FONT.ROM and FREECG98.BMP, and if both are not available DOSBox-X will fallback to builtin DBCS font used by DOS/V and pre-generated SBCS font from FREECG98.BMP for PC-98 mode. Thus an external font file is no longer required for PC-98 support, but is still recommended if you want to use the original PC-98 fonts for rendering in PC-98 emulation.. |
So has anybody here seen this thing yet? Aparently it will allow you to upgrade an internal YM2203 to a YM288-M, basically giving you soundboard 86 compatibility. Links: http://offgao.net/pcb/001/?fbclid=IwAR0WJIstJGjhKCfu7KLz-VAlI5KIiLP88U7uTW3C_yVezSxnT93eF0ZSZRM https://www.facebook.com/groups/179691252054199/posts/6641649715858288/?comment_id=6642563712433555 |
Such machines are said to be similar to IBM PC, though with different video hardware and proprietary bus, but with DOS just the same. Would be a nice feature to add to the DOSBox-X codebase.
The text was updated successfully, but these errors were encountered: