VOGONS


Minimal hardware/peripherals to emulate for Windows

Topic actions

Reply 60 of 66, by superfury

User metadata
Rank l33t++
Rank
l33t++

One thing I've managed to do so far:
- Install Windows NT 4.0 (on the last release the GUI part of setup manages to reboot, on the current commit is somehow manages to hang itself waiting for a TEST instruction flag on CPU #0 (dual-CPU configuration)) to clear (it checks some bit 0 of a variable). Basically performing "for (;x&1;);" in C/C++, but using a simple test, jnz instruction loop.

Forcing the system to reboot (by closing the emulator and restarting it) properly boots into Windows NT 4 it seems. I'm now running it's error checking from the GUI to verify if the C drive isn't 'damaged' (in other words, the NTFS filesystem is left intact by the 'reboot').
So far the GUI seems stable though. Managed to open "My computer", right click C, properties, tab tools and error checking, then to start it. The progress bar is filling up.
Also made a recovery disk using a blank IMD disk image (unformatted). That seems to have been performed successfully at least before the reboot part (it crashes after clicking the reboot button and the screen becoming light cyan-ish (the mouse works, until the hang point is reached, at which point it becomes unresponsive)).
I see the first emulated CPU executing inside a vector 50h and 70h handler (according to the ISR's set bits). The second CPU is in a HLT state, apparently last having sent an interrupt to self. It's APIC is in disabled state (using the APIC's enable bit inside it's Spurious Interrupt Vector register).
The first CPU has last sent an interrupt to all CPUs (interrupt vector 50h, delivery mode 2). The second CPU has last sent an interrupt to itself (interrupt 3Dh, delivery mode 1). Both aren't sending anymore and have sent interrupts to all CPUs (0&1) and CPU 1 for the second CPU's APIC Interrupt Command Register.

Edit: NT 4.0 seems to be running properly after the forced reboot. Opened up chkdsk, no errors reported. Opened up media player, very slow but loading. It seems to be stable, although the mouse can hang when loading stuff (like with windows media player loading itself) it seems. I see it executing a very long RDTSC instruction loop, waiting for some 32-bit timer to overflow it seems (4G ticks to be spent. Even at 333MHz emulated (just for timing TSC and APIC timer, the CPU itself is only running at 3MIPS configured speed, which is itself running at an abysmal 8% emulation speed, which I suspect is due to fetching in IPS clocking mode mostly (high RAM mapped read bottleneck for instruction fetching and a bit for normal reads, although writes are slow due to cache invalidation (a single entry read cache being implemented for 128-bits data aligned blocks)).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 61 of 66, by xsaveopt

User metadata
Rank Newbie
Rank
Newbie
superfury wrote on 2025-07-26, 15:19:

One thing I've managed to do so far:
- Install Windows NT 4.0 (on the last release the GUI part of setup manages to reboot, on the current commit is somehow manages to hang itself waiting for a TEST instruction flag on CPU #0 (dual-CPU configuration)) to clear (it checks some bit 0 of a variable). Basically performing "for (;x&1;);" in C/C++, but using a simple test, jnz instruction loop.

Is there any reason you're running in a dual core configuration? If I remember correctly, up until Windows XP the APIC is optional, so if you ran just a single core you could also try booting without APIC to see if that's causing any issues.

superfury wrote on 2025-07-26, 15:19:

Edit: NT 4.0 seems to be running properly after the forced reboot. Opened up chkdsk, no errors reported. Opened up media player, very slow but loading. It seems to be stable, although the mouse can hang when loading stuff (like with windows media player loading itself) it seems. I see it executing a very long RDTSC instruction loop, waiting for some 32-bit timer to overflow it seems (4G ticks to be spent. Even at 333MHz emulated (just for timing TSC and APIC timer, the CPU itself is only running at 3MIPS configured speed, which is itself running at an abysmal 8% emulation speed, which I suspect is due to fetching in IPS clocking mode mostly (high RAM mapped read bottleneck for instruction fetching and a bit for normal reads, although writes are slow due to cache invalidation (a single entry read cache being implemented for 128-bits data aligned blocks)).

Nice!

I've noticed the slowness as well with XP. Windows 98 is usable after ~200k instructions, but XP is still loading after 200 million instructions.

Reply 62 of 66, by superfury

User metadata
Rank l33t++
Rank
l33t++

How did you get XP to recognise the ATA/ATAPI controllers? For some reason 2000 and XP both refuse to even use the drives at all (when it says that setup is starting windows and it executes the kernel from CD-ROM, I get a 7B bsod)? Not a single read/write from the ATA/ATAPI controllers on my i440fx emulated motherboard?

All that multi cores add is improved bus locking, which should be fixed now. Perhaps an issue in APIC interrupt commands?
What does the APIC do with interrupt commands when the other APIC can't receive it (HLT with interrupt flag cleared)?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 63 of 66, by xsaveopt

User metadata
Rank Newbie
Rank
Newbie
superfury wrote on 2025-07-27, 08:00:

How did you get XP to recognise the ATA/ATAPI controllers? For some reason 2000 and XP both refuse to even use the drives at all (when it says that setup is starting windows and it executes the kernel from CD-ROM, I get a 7B bsod)? Not a single read/write from the ATA/ATAPI controllers on my i440fx emulated motherboard?

I don't recall having to do anything special. I only had to disable the support for DMA in the drive identifier because I had not implemented Bus Mastering DMA yet. Windows 98 never used the DMA even if available, but Windows XP does.

Reply 64 of 66, by xsaveopt

User metadata
Rank Newbie
Rank
Newbie

What are the best practices for implementing x87 in an emulator? Is there a library that's commonly used for the floating point operations, or does everyone write their own implementation? It seems like a *lot* of work to implement it all.

Reply 66 of 66, by xsaveopt

User metadata
Rank Newbie
Rank
Newbie

Thanks!