First post, by superfury
I've built a Prefetch Input Queue (6-byte in case of 8086 and 80186 processor emulation) into my CPU emulation:
https://bitbucket.org/superfury/x86emu/src/3e … cpu.c?at=master
CPU_readOP reads byte from the prefetch buffer and reloads it if it's empty during execution.
CPU_exec is the main instruction parsing routine.
CPU_resetOP is called with repeating instructions and by exceptions (REP* prefix and exceptions).
CPU_fillPIQ fills the PIQ using CPU[activeCPU].PIQ_EIP as the execution point (equivalent of EIP register).
CPU_flushPIQ clears the PIQ (called by CPU_resetOP when needed and by control transfers using CS and EIP).
When I try to run most software all runs well. But when trying to run Castlevania (Using MS-DOS 5.0) it seems to go wrong (and end up at some instruction in the BIOS which is essentially a "JMP $-2", or a JMP to the address the JMP is at or effectively an infinite loop in this case).
I'm running the game (Castlevania) from a hard disk image (2GB SFDIMG disk image file) on the 2nd hard disk with the first hard disk image (20MB SFDIMG disk image file) with MS-DOS 5.0. There's the IBM VGA BIOS ROM at C000:0000, XTIDE hard disk BIOS at C800:0000 and Turbo XT BIOS at F800:0000.
Anyone knows why it gets to this point when running the game with the 6-byte prefetch buffer enabled? When I disable the prefetch buffer, the game runs without problems.
If I disable the prefetch buffer (by setting the size of the current CPU to 0 bytes large, effectively disabling it) the game runs without problems.
Anyone knows why the game hangs (looking at it from a fast PC reveals the infinite loop at the Turbo XT BIOS ROM)?
Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io