joncampbell123 / dosbox-x

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

Emulating specific video cards #291

Open WhiteMagicRaven opened 7 years ago

WhiteMagicRaven commented 7 years ago

in long posts: http://www.vogons.org/viewtopic.php?f=9&t=41495&p=610999#p610130 in short: There is some games that depends on real hardware (video card): Matrox Impression Plus (RenderWare 3D): (Doc on registers exist, will have card soon) 1 Creep Clash 2 IceHawk 3 Sento

3D Blaster (CGL): (Not found anything, but found verite v2200 registers, have that card v2100, all games except Euro 96 work on Rendition Verite cards) 4 Euro 96 (exist on sega saturn, and some source tells about source code existance, however PC version superior, and emulators of sega saturn currently can't do bilinear filtering, forcing like pete opengl for ps1 emulator) 5 IndyCar Racing II / CART Racing 6 Rebel Moon 7 SODA Off-Road Racing

Paradise Tasmania 3D (RenderWare, Brender, RenderMorphics): (found registers) 8 Tank Commander

PowerVR (PowerSGL): (Tuxality works on wrapper and emulation, long time no updates, hope project alive) 9 Moon Racer 10 PureVex

http://www.vogons.org/viewtopic.php?f=63&t=33483

Games that i listed here is Exclusive absolutely (it means you can find only!!! PC version, and only using software or respective video card acceleration which make games much more graphically better, PowerVR games even not works without PowerVR video card)

Have you working on them or any plans?

joncampbell123 commented 7 years ago

I have plans to extend DOSBox-X's architecture so that you or anyone else (or I) can add emulation of those cards. That is very specific work that I have no way to test even if I do develop it.

WhiteMagicRaven commented 7 years ago

Ok, i have specific cards, on win98 pc, if i organize remote access, so it can be developed than, right? Tested on . Its very good news.

joncampbell123 commented 7 years ago

I recommend developing it in two parts.

First, develop your own code to control the cards from the MS-DOS mode where you're free to talk to the cards without OS interference. I assume your cards use memory mapped I/O, so you will also want to disable EMM386.EXE in that test environment.

If the win98 PC has a serial port (which I recommend) I have a remote control program in DOSLIB that allows you to remote control DOS from another PC over the serial port. You can do the compile + upload + run dev cycle over the serial port this way (ignoring cases where pushing the reset button is required if your code hangs, of course).

If the register specs are good enough, you should be able to write code that initializes the card and controls it.

As I try to do in DOSLIB, I recommend writing copious comments in the source code explaining what the code is doing, and referring to the registers by name and number, and the document you're reading.

As you write this code, also write the code in DOSBox-X to mirror your development based on what you find. As you develop the DOS code, it should work on both DOSBox-X and your real hardware. Use the LOG_MSG() and LOG() functions in DOSBox-X to note any case where the guest program does something unusual, so you can catch anything odd that Windows 98 does.

This is more or less the process I use when developing new hardware emulation or verifying existing emulation.

Have fun!

WhiteMagicRaven commented 7 years ago

heh unfortunately i am novice in development, knowing something asm, c, c++ for windows only, this is so advanced to me =( if you ever can help me, to do remote access, and any developers can connect to my pc for tests, or if someone can guide what to do.

For example how s3 virge emulation archieved?

joncampbell123 commented 7 years ago

I didn't write the S3 emulation, but, I would find any information online describing the card, the registers, and how to access them, and then begin writing code to locate the card and it's resources.

The cards you're interested in are PCI type cards, correct?

So the first step is easy: PCI enumeration to locate the card or cards, and it's resources.

One example of this kind of code in DOSLIB can be seen in the hw/usb/ohci code that I started. That code is designed to play around with OHCI USB host controllers, but it can server as an example to build on.

To simplify things a lot, you might consider ignoring 16-bit build targets when playing with the code and stick with 32-bit DOS builds only.

WhiteMagicRaven commented 7 years ago

yes interested in PCI.

joncampbell123 commented 7 years ago

Perhaps I can provide a DOSLIB-based boilerplate that locates the PCI device.

Which card would you like to work on first? Provide the PCI vendor and device IDs of the card and I'll incorporate them into the sample code. Also provide what resources it uses (memory and I/O ports). The sample code will enumerate the PCI bus and pick out which PCI device contains the card. Then pick a name for the project and I'll create a repository for it. It will have DOSLIB as a submodule.

joncampbell123 commented 7 years ago

Here you go:

https://github.com/joncampbell123/doslib-examples

WhiteMagicRaven commented 7 years ago

i have and want emulate Diamond Stealth S220 (which is Rendition Verite v2100) i found detail specifications for v2200 only i think it will no be a problem? hardwares is very close to each other i think.

Also i looked in source code, that you prepared for me, and it uses watcom? its dos compiler for c? right, i never compiled anything for dos, ok except turbo pascal. offtop qbasic, and bat files.

and i should use linux?

for examle i think i can provide pci vendor and deviceID, how? i can patch game designed for v1000 (v2dosfix) this patch changes two places in exe, pcivendor and deviceid, by comparing files i can provide these numbers, but i think its not accuracy on developing?

joncampbell123 commented 7 years ago

You'll need Linux, and Open Watcom 2.0 to compile it.

I provided global variables that control which PCI device it looks for (by vendor and device ID).

In Windows, you can get this information from the Device Manager, from the card's properties dialog box, under one of the tabs that lists (I think) the "device ID" that looks something like VEN_XXXX&DEV_XXXX.

In Linux, you can get the device numbers using 'lspci -vn'.

The DOSLIB + DOSBox-X development pattern is to first practice writing code against the real hardware, if possible. By doing so you learn what it's supposed to do, how it responds, and where the datasheets are wrong or omitting data. In doing so, you also produce a program that you can run in DOSBox-X during emulation development to confirm whether emulation is working like the real hardware.

WhiteMagicRaven commented 7 years ago

Linux - Ubuntu is capable for this task? And i need install it REAL or i can use VIRTUAL machine? i installed Ubuntu before several times is not a problem. And it compiles dos exe? which i run on real hardware to get some infos?

Well i can't find VEN_XXXX&DEV_XXXX in windows 98 in windows XP it exist (its other PC with nVidia)

joncampbell123 commented 7 years ago

You can install Linux in a virtual machine for compile. It will generate a DOS EXE that you can run on real hardware.

The sample I wrote scans for a specific video card.

I don't remember much about how to look it up in Windows 98 I was thinking of Windows XP.

You could compile the hw/pci test program and run that on your target machine to get the PCI device IDs of your Rendition Verite v2100. It can be identified as VGA class PCI hardware. All you need from it's output are the vendor and device IDs of the Rendition Verite v2100.

joncampbell123 commented 7 years ago

@WhiteMagicRaven Any luck? The next sample I need to provide is how to access the MMIO registers of the VGA card. My sample will use the Flat Real Mode library of DOSLIB, and you'll need to run it from a DOS bootdisk that does not use EMM386.EXE to allow this to work.

EDIT: Better yet, it might be simpler for your sake if I just make a 32-bit DOS sample that lets you touch the MMIO directly from 32-bit protected mode, so long as paging is not enabled by EMM386.EXE and you could develop it from there.

WhiteMagicRaven commented 7 years ago

i am here, need some pause, i will return to this, need to setup everything for linux, and troubleshoot some real life issues.

joncampbell123 commented 6 years ago

@WhiteMagicRaven I found a link to an online reference (including datasheet) to the Matrox card you mentioned:

http://vgamuseum.info/index.php/companies/item/203-matrox-is-athena-mga-impression-plus

Torinde commented 6 months ago

PowerVR: Dreamcast emulators, https://github.com/powervr-graphics/PowerVR-Series1, https://github.com/Vita3K/Vita3K/releases Rendition Verite: https://github.com/dosbox-staging/dosbox-staging/discussions/3156 Related discussion: https://github.com/86Box/86Box/discussions/1933, https://github.com/86Box/86Box/discussions/4555