Running 486-era software on modern hardware at the right speed  - Page 1
Forum section: electronics / general

author: ivan747
author_rank: Super Contributor
timestamp: May 26, 2021, 02:03:00 am
content: We have a machine that was bought around the year 2000. It came with an IBM PC/ValuePoint 433dx/s, with an i486 processor and PC-DOS. The original PC is still in use, but I am seriously concerned about its reliability. The PC runs software that came with the machine and talks to it over the serial port (it doesn’t seem like any weird low level stuff is happening).Long story (short story below):The first thing I thought about was making an image of the hard drive with Linux on a mid 2000’s machine (so that I have IDE, floppies and USB). Turns out that the last time someone attempted to do a backup on that hard drive it didn’t go well at all, so we are hesitant to touch it. Fair enough, I’m not in the mood for risks.So, instead found the original install floppies for the software. I made a live USB with Linux, found a 2008 machine with a floppy drive and began making images of all the floppies with ddrescue. It worked perfectly. Then I went to a modern computer and installed Virtualbox. I grabbed a copy of PC-DOS and installed that. Then I installed the software. But when I run it, I get “Runtime Error 200” when trying to execute some functions/programs. Info on the internet says it’s because of the way a library in TurboPascal 7 was programmed. It had to calibrate a delay routine, and this code breaks when ran at over 200MHz because of a division overflow. I need a way to run the software at a consistent speed, and to talk to the serial port.Short story:We have a 486 PC that is about to die, so we need to migrate to modern hardware. I need to run software that was made with TurboPascal 7, which came with a bug that causes a division overflow when it’s run at over 200Mhz. I cannot recompile the software because I don’t have the source (it came with the machine). It needs access to the serial port.What are my options?- Virtualbox: causes runtime error 200 (when the execution cap is set to 1% of the CPU, more code runs, but it’s inconsistent and 1% of 4GHz is not the same as 1% of 2GHz...).- Patch the software: attempted to patch with PatchCRT but it didn’t work on all but one of the executables (there are 20+). The executables may be compressed. I haven’t tried that yet. I’m a bit worried about breaking the executables with the patch (the patch may introduce other issues).- DOSbox: I saw that you can alter the amount of “cycles” the emulation but it’s not clear to me if this is independent of the host CPU frequency. If I set it at 3000 cycles on a 2GHz processor and then change to a 4GHz processors, will it go twice as fast inside DOS? Also, I’d rather run the software in PC-DOS if possible, to be as close as possible to the original. I don’t know how close DOSbox is to DOS for things that aren’t games.- QEMU: I can’t seem to find a way to specify frequency or execution speed in absolute terms. I haven’t looked into serial.- Specialized hardware: is there modern hardware that could handle this? It can be niche hardware, and I guess we could allocate up to a couple of grand on it but not much more than that. If someone makes a 486 system-on-board or something like that I think it would be a solid option, if it’s new stock. I don’t want to get out of a ’93 computer into a ‘98 computer.- Regular hardware: is there a way to make a modern computer run in a legacy mode? 90’s PCs had a turbo button to slow them down, but that isn’t a thing anymore, is it? I am guessing the software would run under FreeDOS for maximum compatibility.I think they all have the pros and cons... what do you think?

author: ivan747
author_rank: Super Contributor
timestamp: May 26, 2021, 02:29:28 am
content: This looks promisingPC104 seems to be a motherboard / system-on-board standard that supports many legacy architectures. I also found a SoC called Vortex86. I’m going to look into it tomorrow. Let me know what you guys think. I think it would be cheaper if I found something like a Vortex86 micro ATX or mini ITX motherboard, because the PC104 is going to need a lot of custom stuff like chassis, power supply and adapters.

author: IanB
author_rank: Super Contributor
timestamp: May 26, 2021, 02:37:43 am
content: One vague idea I can think of is that laptop systems in particular have a way of slowing down the processor to run cooler and save power. Could you find software that can directly set the processor speed on a modern system to make it run really slowly? I have an idea modern systems have power management abilities like this, since if the system is idle the processor really doesn't need to be doing anything, so it can slow down almost to a standstill.

author: BrokenYugo
author_rank: Super Contributor
timestamp: May 26, 2021, 02:41:32 am
content: The config file for dosbox claims if set to 3000 cycles it will run at 3 MIPs, presumably independent of host machine clock.

author: retiredfeline
author_rank: Frequent Contributor
timestamp: May 26, 2021, 03:00:08 am
content: I had an inkling I'd read about this bug before and there's a patch for binaries. Maybe this will help?https://retrocomputing.stackexchange.com/questions/12111/why-did-ms-dos-applications-built-using-turbo-pascal-fail-to-start-with-a-divisi

author: ivan747
author_rank: Super Contributor
timestamp: May 26, 2021, 11:23:22 pm
content: Quote from: retiredfeline on May 26, 2021, 03:00:08 amI grabbed a copy of that patch, but I am yet to test it. I’ll let you guys know how it goes.Quote from: IanB on May 26, 2021, 02:37:43 amI haven’t tried it on hardware yet. I suspect I’d have to underclock the computer very severely. I don’t know if they go down to the 200MHz level. A processor like the Vortex86 might do it?Quote from: BrokenYugo on May 26, 2021, 02:41:32 amIt does seem independent, reading the documentation closely. This looks like a good option. We’ll see how well it handles the software.

author: NiHaoMike
author_rank: Super Contributor
timestamp: May 28, 2021, 01:27:17 am
content: Might this be one place where FPGA emulation would make sense?

author: ivan747
author_rank: Super Contributor
timestamp: May 28, 2021, 02:37:48 am
content: Quote from: NiHaoMike on May 28, 2021, 01:27:17 amTurns out they already have ASICs for thishttps://en.wikipedia.org/wiki/List_of_x86_manufacturers#x86-processors_for_embedded_designs_onlyand also an FPGA implementation called ao486Update:I tried the patches, they didn’t work. Also tried “slowdown”, a DOS program that slows down the system artificially. Also didn’t work.Then I tried DosBox. Turns out it has a boot command, so I can literally install and boot PC-DOS from it. Here’s how I did it:Create a blank image file or download one. Mount it to letter C using the imgmount command.Now, you have to install PC-DOS from five floppies. The trick is as follows,Copy disk 1 and name it something like diskX.imgMount diskX.img to letter A using imgmount.On the DosBox prompt, typeboot -l A. This will boot the first floppy.Begin the install.When the install asks for disk 2, you will copy disk2 to diskX. What I did is that I opened the Windows command prompt and didcopy disk2.img diskX.img. Then you return to DosBox and tell the installer you inserted disk 2. (I’m amazed this works...)Repeat until disk 5.The installer will then shut down DosBox.Start DosBox again.Mount drive letter C again.Boot from drive C by typingboot -l CYou should now be in PC-DOS.To install any software, it’s more or less similar:Mount the installer to letter A.Start the installerDon’t boot into PC-DOS, just run the installer directly from the DosBox prompt. Remember you can do the copying trick to swap disks.In my case, the installer assumed it should install into drive C, so I had no issues. DosBox is in drive Z, maybe some installers will install into there. In that case, I don’t know what you should do. When I tried to load A: from the PC-DOS file manager it gave me some errors (I also can’t format disks, it might have to do with the emulation). I didn’t try loading from the shell directly.When the install is done, you can boot from letter C.I now have the software running. No errors. It even emulates the PC speaker. I haven’t tested the serial port yet but I’m hopeful.Last hint, the config file for DosBox has an auto exec section where you can add all your mount commands. I mount drive C and drive A automatically and also i boot from C. This is very neat. The program I’m running has a backup functionality that copies all profiles into a floppy. I could have a script on Windows that backs up drive A every time the file changes, and gives it a date and time.Next steps: back up the current profiles from the physical machine into a floppy and make an image of that floppy.Let’s hope the serial port works and the delays are accurate

author: james_s
author_rank: Super Contributor
timestamp: May 28, 2021, 05:02:58 am
content: I've been using dosbox for years to run old software, it works great. It even works with the software to control my modded scanner radio, which was written for a PC/XT and interfaces via the serial port.

author: PKTKS
author_rank: Super Contributor
timestamp: May 28, 2021, 05:37:04 pm
content: Quote from: retiredfeline on May 26, 2021, 03:00:08 am*IF* your are talking about the "runtime error 200"when running programs on a machine clocked fasterthan 200M...YES I confirm you that the tppatch worked just finewhenever I needed it wo the sources to recompile..The BUG is caused by DIV instruction w/numbersbigger than registry available and the patch changesthe Delay() routine to cope w/that bug..Available on the NET or I can post the patcher here..Paul

author: fzabkar
author_rank: Super Contributor
timestamp: May 30, 2021, 01:24:35 am
content: You can get a report of the physical state of the original HDD with SMARTUDM:http://sysinfolab.com/download.htmThe tool is tiny enough to fit on a 360KB floppy diskette.