Compaq Deskpro 386 CPU emulation issues?

Emulation of old PCs, PC hardware, or PC peripherals.

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-5-29 @ 12:58

I'm trying to find out the entry address of CS:IP when running the DOTT.EXE(Day of the Tentacle). I've looked at the exe file through a hex editor, but I can't seem to make any sense of the address that's stored? According to https://github.com/libyal/libexe/blob/master/documentation/Executable%20(EXE)%20file%20format.asciidoc , offset 20(hex offset 14h) should contain an value relative to the start of the file, which is AC 19 16 12, so that means it's loading at *:19AC? Is that the address I should point UniPCemu to for debugging this app?

I notice that the command line somehow seems to be ignored? Anything put on the command line is ignored, always printing the information and then crashing on a NULL load?

It does say
Code: Select all
Unknown flag: 'by 0
'


Anyone knows anything about this?

Finally, it ends with:
Code: Select all
run-time error R6001
- null pointer assignment
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-5-31 @ 19:30

Strange that the test386.asm testsuite tests and validates so many instructions(except 80-83, 00-3F and 0F00-0F01 ranges) in real and protected mode, but still UniPCemu fails pretty much all protected-mode software in one way or another? EMM386, as well as unreal mode seems to wotk without visible problems, but DOTT, Windows 3.0(all 286+ protected mode software I know of atm), Jazz Jackrabbit, Windows 95 setup, Doom, Microsoft Flight Simulator 5.1 all crash in one way or another, either returning to the command line(DOTT does that as well as ignoring it's parametersOhelp is printed on the screen) before crashing on a NULL pointer load), not working properly(MSFS5.1 missing output on screen) or hanging the CPU in one way or another(all other cases). Windows 95 setup is even observed jumping to junk memory, executing 0000h instructions forever!

Edit: Although CheckIt Diagnostics runs out of EMS memory when running the EMS memory check using EMM386.EXE(From MS-DOS 6.22).
The EMS test suite from the Lo-tech EMS 2MB board checks the EMS RAM out correctly, oddly enough. So it's probably some error executing CheckIt! Diagnostics?

Edit: The new breakpoint functionality for breaking on reaching an IP(ignoring CS for said address) seems to work. Each time I execute the tentacle.exe file, the debugger triggers on said address:D So that's at least a starting point for the executable.
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-6-01 @ 14:11

I've managed to make a little(common log format) log detailing what happens when I execute tentacle.exe without any parameters:

debugger_DOTTfailingtorun_UniPCemu_20180529_1555.7z
TENTACLE.EXE running without parameters.
(2.5 MiB) Downloaded 56 times


Can anyone see what's going wrong there?
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-6-10 @ 17:46

Just managed to fix the IBM AT Diagnostics disks to check out the CMOS correctly. There was a problem with setting any date in BCD format earlier than 19th century. I've modified it to now enable the binary format both when selecting a century earlier than the minimal date it's able to handle(1970/1/1 00:00 to be exact). When it detects a program is trying to set a date earlier than 1970, it will automatically patch to and from 1970-2069 and set it to binary mode. Binary mode is also enabled when a non-BCD value is loaded into the century byte.

Binary century mode simply disables updating of the century byte, to keep it's contents unchanging, allowing for normal data storage in the century byte without it being overwritten when time is updated based on emulated/real time.

This seems to fix the CMOS checks the diagnostics disk does to verify the CMOS RAM.

Edit: After the time is asked, it somehow still ends up back at said error when setting the time(directly after entering a new date to initialize the clock)?
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-6-12 @ 14:53

Just managed to fix some bugs that were producing doubled ModR/M displacement instead of only adding the displacement once. Now stuff like Pinball Illusions continues onward(Pinball Illusions crashes after the intro, while not changing the video after displaying the horizontal stretching effect during the intro(sound continues though))?

Edit: Odd that even with those changes, Micrsoft Flight Simulator 5.1 still doesn't give any output?

Edit: The Windows 95 setup now crashes on a 8E8F1400 MOV CS instruction, which is invalid from 80186 onwards?
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-6-13 @ 07:12

Just found some more bugs in the ModR/M calculations and checks. 16-bit memory writes through the BIU were using the ModR/M object instead of the offset(strange that the whole thing runs somewhat correctly in that case at all). The same problem applies to 16-bit and 32-bit memory access checks(the parameter object being loaded into the offset instead of the offset within the parameter object). Odd that the compilers didn't see that bug.
The same problem also applies to direct access to ModR/M referenced memory(used with protected-mode only instructions).
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-6-13 @ 13:44

Now trying to boot Windows 3.0 in 80386 extended mode(no command line parameters on 80386 CPU). I see it page faulting to 0028:80005EE4 some times, then it's back at the command prompt?

Edit: I see the page fault handler looking at bit 1 of something, then jump somewhere, exchange some registers and execute a INT 20h, which faults and returns to the MS-DOS prompt?
Edit: It seems to fault on address 0x06F4011E? It's faulting on a "MOVZX EAX, dword [ESI]" instruction?

Edit: I seem to get a double Page fault when executing a INT 0x20 from the Page Fault handler of Windows 3.0?

debugger.log
INT 0x20 reached during Page fault handler?
(30.29 KiB) Downloaded 51 times


Anyone?
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-6-13 @ 21:52

Hmmm.... According to Ralf Brown's interrupt list, that final INT 20h that's executed might be a kernel VxD call? But since UniPCemu doesn't directly support breakpoints breaking past 2 dwords after the current instruction, I'll need to set another breakpoint immediately past the call, so 10 bytes after the EIP of INT 20h that's called by the page fault handler, if I understand correctly?

Of course a simple memory dump would make clear what service is called(Although I'll need to use the Paging TLB cache from within Visual Studio to find out it's physical address, since RAM dumps using UniPCemu are physical RAM dumps of emulated RAM after all, although I'll need to take the RAM remapping used by UniPCemu into account).
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-6-14 @ 17:42

Currently the Page faults happen at the following locations(all being caused by non-present NULL PTE/PDE):
0028:802000BD, error code 0. Cause: Linear address 06f4011e. Page fault handler at 0028(32-bit mode flat descriptor):80005EE4. Cause Opcode: 0FB706h MOVZX instruction.
0028:80007FDC, error code 0. Cause: Linear address 0782002f. Page fault handler at 0028(32-bit mode flat descriptor):80005EE4. Cause Opcode: 32-bit 830B08h OR instruction.

It then returns to the MS-DOS prompt?

debugger_Windows3.0_faultingtwice_exittoMSDOS5prompt.7z
Common emulator log from the first page fault until reaching the MS-DOS prompt(visible on the screen and usable).
(1.3 MiB) Downloaded 48 times


Edit: It seems to look for bit 2 of a byte that's at the address 2Eh bytes above the bottom of the stack, but the stack of the fault(Page fault after all) only contains 10h bytes pushed by the interrupt handler(the kernel is the cause of the page fault after all)?

Edit: Currently using https://defuse.ca/online-x86-assembler.htm to help me disassemble the instructions UniPCemu fetches to verify them. Originally used ODA, but that website seems to keep giving 500 errors?

Can you tell me something about this, crazyc? It seems to return to real mode, even though it's a protected-mode kernel???

Edit: Hmmm.... Some problems seem to have arisen booting Minix somewhere after the commit of 2018/05/29 15:55... Guess it's checking time to find out said bug(booting Minix 2.0.4 until it crashes, at which point the causative commit should have been found)...

Edit: In essence, a few big changes have been made since then: fixing stack problems with privilege level switch using RETF/IRET to lower privilege level(as well as fixing hardware to time properly in small ammounts, e.g. CD-ROM emulation problems) at commit 2016/06/05 13:42, REP fix at 2018/06/07 11:43, small updates until 2018/06/10 19:23, start of modr/m fixes and 8086 undefined opcodes at 2018/06/11 14:50, then the 32-bit ModR/M and relative JUMP/SET fixes in the most recent commits.

Edit: The privilege level switch commit checks out.
Edit: Still running until the REP(Z/NZ) fix. All that's left until the start of the ModR/M fixes are the RETF/IRET conditional clearing(when invalid at the lower privilege level) of the segment registers, the CMOS fixes and the saving of the CMOS when entering the Settings menu, at which point it's back to the last ModR/M fixes.
Edit: Whoops. The checks used when returning to a lower privilege level using RETF/IRET were clearing/zeroing the segment register when the present bit was set(so with valid segments instead of invalid segments) or the system bit was set(thus a valid code/data segment), instead of cleared. Thus clearing the segment registers even when not supposed to. :S

Edit: Having fixed the privilege lowering RETF/IRET bug, Minix boots again :D
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-6-17 @ 11:46

That latest RETF/IRET bugfix combined with the fix of EBP as an index defaulting to DS somehow hangs Pinball Illusions now?

Edit: The cause seems to have been incorrect audio card configuration when starting the game.

Now I'm getting a GP(0) due to MOVSW with the code segment descriptor in ES, which is illegal? What could be the cause?
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-6-22 @ 22:02

With the latest fixes, top-down data segment limits are now also checked against a max offset of 0xFFFF(FFFF), depending on the D/B-bit in the descriptor. Also, offsets are now wrapped to 16/32-bits for the base offset(from modr/m and immediate addresses, as well as (e)sp values), then after wrapping have up to 0(byte), 1(word) or 3(dword) added for each byte in the access to result in a 17/33-bit number which is then checked against the limit normally(as 64-bit numbers, since no 33-bit numbers exist in c). Thus a word at address 0xFFFF/0xFFFFFFFF(depending on address size) or dword at 0xFFFD+/0xFFFFFFFD+ will now check for accesses to 0x10000+ or 0x100000000+, thus properly faulting according to 80286+ specifications(wrapping after the protection phase during execution is still to 32-bits or 16-bits, depending on address size). So accessing a word at base 16-bit offset 10000+ will properly wrap to offset 0(the same with 32-bits base offset 100000000+).

So the specification and the wrap is now properly being applied(always wrapping after the check phase, though, during execution of the actual memory reads/writes).

Somehow Windows 3.0 triple faults on it's very first INT 0x20 VxD driver call during a page fault handling on a non-present page?
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-8-29 @ 15:23

Now, the Compaq BIOS tells me the setup hasn't run yet(in other words: uninitialized settings), even though GSETUP already configured the system?

POST codes:
Code: Select all
00:00:17:90.02526: POST Code: 00 Initialize flags, MSW,IDTLIN
00:00:17:90.02998: POST Code: 01 I/O ROM error
00:00:17:91.09900: POST Code: 02 System memory board failure
00:00:17:92.00108: POST Code: 03 No response from 8042
00:00:17:92.00260: POST Code: 04 Look for ROM at E000
00:00:17:92.00496: POST Code: 05 Look for ROM at C800
00:00:17:92.00684: POST Code: 06 Normal CMOS reset code
00:00:17:92.00844: Shutdown status: 00
00:00:17:92.01012: POST Code: 08 Initialize 8259,80287
00:00:17:92.01732: POST Code: 09 Reset code in CMOS byte
00:00:17:92.02072: POST Code: 0F Warm boot
00:00:17:92.02380: POST Code: 10 PPI disabled, test 8254 PIT's 0 and 1
00:00:17:92.02704: POST Code: 11 Initialize (blast) VDU controller
00:00:17:92.05676: POST Code: 12 System option error
00:00:18:07.03020: POST Code: 13 Time and date not set
00:00:18:07.06502: POST Code: 14 Memory size error
00:00:18:07.06758: POST Code: 15 Check battery power
00:00:18:07.07042: POST Code: 17 Clear CMOS Diags.
00:00:18:07.07268: POST Code: 18 Test base memory (First 128K)
00:00:18:07.07468: POST Code: 40 Save RESETWD value
00:00:18:07.07810: POST Code: 2F Write to diagnostic byte
00:00:18:07.08108: POST Code: 41 Printer error
00:00:18:07.08588: POST Code: 42 Monochrome adapter failure
00:00:18:78.06892: POST Code: 43 Reset parity checks
00:00:18:78.07236: POST Code: 44 Start verify of 128K RAM test
00:00:19:59.08304: POST Code: 45 Check for parity errors
00:00:21:08.04210: POST Code: 43 Reset parity checks
00:00:21:08.04538: POST Code: 44 Start verify of 128K RAM test
00:00:21:88.00854: POST Code: 45 Check for parity errors
00:00:22:67.03528: POST Code: 46 NO RAM errors
00:00:22:67.03830: POST Code: 19 Initialize base memory
00:00:22:67.04034: POST Code: 30 Clear first 128K bytes of RAM
00:00:23:24.07340: POST Code: 31 Load interrupt vectors 70-77
00:00:23:24.07834: POST Code: 32 Load interrupt vectors 00-1F
00:00:23:24.08736: POST Code: 33 Keyboard controller error
00:00:23:24.08944: POST Code: 34 Keyboard or system unit error
00:00:23:25.01376: POST Code: 36 Check battery power
00:00:23:25.01592: POST Code: 38 Check for Serial ports
00:00:23:25.01950: POST Code: 39 Check for parallel printer ports
00:00:23:25.02488: POST Code: 3A Initialize port and comm time-outs
00:00:23:25.02846: POST Code: 3B Flush keyboard buffer
00:00:23:25.03514: POST Code: 52 Start VDU ROM search
00:00:23:71.06652: POST Code: 53 Vector to VDU option ROM's
00:03:03:20.05792: POST Code: 8C Got result, check it
00:03:03:20.06480: POST Code: 1A Initialize VDU adapters
00:03:03:20.06784: POST Code: 50 Check for dual frequency in CMOS
00:03:03:20.07008: POST Code: 51 Display adapter failure
00:03:03:20.07440: POST Code: 52 Start VDU ROM search
00:03:03:81.06704: POST Code: 1B The system ROM
00:03:04:62.04656: POST Code: 1C CMOS checksum
00:03:04:62.05056: POST Code: 90 Start of CMOS test
00:03:04:62.05264: Shutdown status: 00
00:03:04:62.05552: Shutdown status: AA
00:03:04:62.05824: Shutdown status: 55
00:03:04:62.06160: Shutdown status: 01
00:03:04:62.06432: Shutdown status: 02
00:03:04:62.06704: Shutdown status: 04
00:03:04:62.06960: Shutdown status: 08
00:03:04:62.07216: Shutdown status: 10
00:03:04:62.07520: Shutdown status: 20
00:03:04:62.07792: Shutdown status: 40
00:03:04:62.08064: Shutdown status: 80
00:03:04:62.08336: Shutdown status: FF
00:03:04:62.08640: Shutdown status: 00
00:03:04:62.09056: POST Code: 91 CMOS seems to be OK
00:03:04:62.09296: POST Code: 1D DMA controller/page registers
00:03:04:62.09632: POST Code: 93 Start of DMA controller test
00:03:04:63.01104: POST Code: 94 Page registers seem to be OK
00:03:04:65.05120: POST Code: 95 DMA controller is OK
00:03:04:65.05680: POST Code: 96 8237 initialization is complete
00:03:04:65.05936: POST Code: 2D Test timer 2
00:03:04:65.06160: POST Code: 0D Test #2 8254 PIT counter 0
00:03:04:65.06560: POST Code: 0E Test #2 8254 PIT counter 2
00:03:04:65.06960: POST Code: 1E Test keyboard controller
00:03:04:65.07312: POST Code: 80 Start of 8042 test
00:03:04:67.06688: POST Code: 81 Do 8042 self test
00:03:04:70.06640: POST Code: 82 Check result received
00:03:04:70.06992: POST Code: 84 OK 8042, Init mode=5D
00:03:04:72.06544: POST Code: 1F Test 286 protected mode
00:03:04:72.06912: POST Code: 75 Start protected mode test
00:03:04:72.07280: POST Code: 76 Prepare to enter protected mode
00:03:04:80.06912: POST Code: 77 Test software exceptions
00:03:04:80.07344: POST Code: 78 Prepare to return to real mode
00:03:04:84.06224: Shutdown status: 06
00:03:04:87.06896: POST Code: 00 Initialize flags, MSW,IDTLIN
00:03:04:87.07376: POST Code: 07Completes EGA ROM replacement
00:03:04:87.07600: Shutdown status: 00
00:03:04:87.07824: POST Code: 08 Initialize 8259,80287
00:03:04:87.08768: POST Code: 09 Reset code in CMOS byte
00:03:04:87.09168: POST Code: 79 Back in real mode-successful
00:03:04:87.09648: POST Code: 7B Exit protected mode
00:03:04:87.09968: POST Code: 20 Test real and extended memory
00:03:04:88.00304: POST Code: 60 Start of memory tests
00:03:04:88.00576: POST Code: 61 Diskette controller failure
00:03:04:94.02432: POST Code: 18 Test base memory (First 128K)
00:03:04:94.03216: POST Code: 62 Diskette boot recorder error
00:03:04:95.04496: POST Code: 63 Get CMOS size
00:03:04:95.06768: POST Code: 70 Display XXXXXKB OK
00:03:04:95.08096: POST Code: 71 Test each RAM segment
00:03:07:11.00128: POST Code: 73 Exit MEMTEST
00:03:07:11.00864: POST Code: 6D Initialize KB OK string
00:03:07:11.01184: POST Code: 6E Determine size to test
00:03:07:11.01520: POST Code: 6F Start MEMTEST
00:03:07:11.01872: POST Code: 70 Display XXXXXKB OK
00:03:07:11.03264: POST Code: 71 Test each RAM segment
00:03:16:03.02000: POST Code: 73 Exit MEMTEST
00:03:16:03.02544: POST Code: 65 Ext. FDC failed got to internal F
00:03:16:03.03264: POST Code: 6D Initialize KB OK string
00:03:16:03.03616: POST Code: 6E Determine size to test
00:03:16:03.03984: POST Code: 6F Start MEMTEST
00:03:16:03.04352: POST Code: 70 Display XXXXXKB OK
00:03:16:03.05760: POST Code: 71 Test each RAM segment
00:04:13:78.03184: POST Code: 73 Exit MEMTEST
00:04:13:78.04000: POST Code: 70 Display XXXXXKB OK
00:04:13:78.05408: POST Code: 71 Test each RAM segment
00:04:18:43.01168: POST Code: 73 Exit MEMTEST
00:04:18:43.02784: POST Code: 72 Coprocessor detection
00:04:18:53.05440: POST Code: 66 Save size memory (base, ext)
00:04:18:53.06320: POST Code: 67 128K-option installed CMOS bit
00:04:18:53.06672: Shutdown status: 02
00:04:18:53.06992: POST Code: 68 Prepare to return to real mode
00:04:18:61.05680: POST Code: 00 Initialize flags, MSW,IDTLIN
00:04:18:61.06224: POST Code: 07Completes EGA ROM replacement
00:04:18:61.06496: Shutdown status: 00
00:04:18:61.06736: POST Code: 08 Initialize 8259,80287
00:04:18:61.07760: POST Code: 09 Reset code in CMOS byte
00:04:18:61.08144: POST Code: 69 Back in real mode-successful
00:04:18:62.03040: POST Code: 6C End of memory test
00:04:18:62.03568: POST Code: D0 Entry to clear memory routine
00:04:18:62.03984: POST Code: D1 Ready to go to protected mode
00:04:18:68.09424: POST Code: D2 Ready to clear extended memory
00:04:31:36.01408: POST Code: 7F Copy system ROM to high RAM
00:04:32:55.03056: POST Code: D3 Ready to reset back to real mode
00:04:32:55.03664: POST Code: D4 Back in real mode
00:04:34:43.01456: POST Code: 7D Entered cache controller test
00:04:34:43.01968: POST Code: 7E Programming memory cache
00:04:34:43.02384: POST Code: 21 Memory error
00:04:36:18.01056: POST Code: 23 Memory address error
00:04:36:18.01472: POST Code: 8B Test keyboard interface
00:04:36:20.01216: POST Code: 8C Got result, check it
00:04:36:20.01632: POST Code: 86 Start test, reset keyboard
00:04:36:26.01088: POST Code: 87 Got acknowledge, read result
00:04:53:54.08768: POST Code: 88 Got result, check it
00:04:53:54.09504: POST Code: 89 Test for stuck keys
00:04:53:84.05248: POST Code: 8D End of test, no errors
00:04:53:84.05568: POST Code: 22 Initialize 287 coprocessor
00:04:53:86.02496: POST Code: 24 Reset A20, set default CPU speed
00:04:53:89.07216: POST Code: 25 Memory error
00:04:53:89.08272: POST Code: A0 Start of diskette tests
00:04:53:89.08624: POST Code: A1 FDC reset active (3F2h Bit 2)
00:04:56:65.02640: POST Code: A2 FDC reset inactive (3F2h Bit 2)
00:04:59:40.08352: POST Code: A3 FDC motor on
00:05:13:19.05232: POST Code: A6 FDC passed reset
00:05:13:19.05712: POST Code: A8 Start to determine drive type
00:06:10:63.01136: POST Code: AF Diskette tests complete
00:06:10:63.02416: POST Code: 26 Keyboard error
00:06:10:63.02832: POST Code: B0 Start of fixed drive tests
00:06:10:63.03280: POST Code: B1 Combo board not found-exit
00:06:10:63.03600: POST Code: B8 Fixed drive tests complete
00:06:10:63.03856: POST Code: 27 Initialize parallel printer
00:06:10:63.04112: POST Code: 28 Perform search for optional ROM's
00:06:10:65.09168: POST Code: 29 Test valid system configuration
00:06:43:31.06384: POST Code: 8C Got result, check it


Anyone can tell me what's the problem? The messages after each code are added by means of a simple translation file(ROM/POSTCODES.COMPAQ.TXT). I've taken the translations from the combined Compaq and Compaq and Compaq 386 tables on http://ryan.servehttp.com/tech/hardware ... aqbios.htm .
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Compaq Deskpro 386 CPU emulation issues?

Postby superfury » 2018-8-30 @ 12:55

Yay:/ With the latest bugfixes, now Windows 95 setup preparing to copy files(before copying the final windows files before reboot) gives a INI parse(r) error?
superfury
l33t
 
Posts: 2569
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Previous

Return to PC Emulation

Who is online

Users browsing this forum: No registered users and 1 guest