captainys / TOWNSEMU

FM Towns Emulator "Tsugaru"
BSD 3-Clause "New" or "Revised" License
247 stars 18 forks source link

Emulator hangs when install Windows 3.1 #69

Open OldMadMan opened 1 year ago

OldMadMan commented 1 year ago

I've compiled Tsugaru to High-Fidelity mode using cmake under Windows, when install Windows 3.1, Just at the last moment before the installer will enter the GUI stage, one of the following two errors will occur:

The first klnd of error is:

Write to CRTC-HST register. VM Aborted! Device:486DX Reason:286 16-bit INT gate not supported Towns TIME (Nano-Seconds): 127222141110 CS:EIP=0053:00000F00 LINEAR:80005890 EFLAGS=00003092 CPL=03 EAX=000002A7 EBX=0002306F ECX=0000FFFF EDX=8000FFEF ESI=000036EC EDI=0000FFE8 EBP=00000000 ESP=000000F8 CS=0053(LIN:80004990) DS=004B(LIN:00020C00) ES=0098(LIN:80009000) FS=0000(LIN:00000000) GS=0000(LIN:00016890) SS=004B(LIN:00020C00) CR0=80000021 CR1=00000000 CR2=00000000 CR3=00452000 CF0 PF0 AF1 ZF0 SF1 TF0 IF0 DF0 OF0 IOPL03 NT0 RF0 VM0 AC0 Default Operand Size=16 Default Address Size=16 Stack Address Size=16 SS+00000000:8B 21 53 00 92 32 83 00 00 44 00 44 00 01 DB 00 SS+00000010:FE 1F A8 02 87 29 98 00 1F 01 70 48 00 80 00 01 0053:00000F00 E89C05 CALL 0000149F

The second kind of error is:

VM Aborted! Device:486DX Reason:Clocks-Passed is not set. Towns TIME (Nano-Seconds): 65444254675 CS:EIP=0000:000000A8 LINEAR:000000A8 EFLAGS=00027293 CPL=03 EAX=000008C0 EBX=0002A303 ECX=0000B90C EDX=00149C61 ESI=0000CA00 EDI=00000E82 EBP=0000531E ESP=00005612 CS=0000(LIN:00000000) DS=2ABE(LIN:0002ABE0) ES=0000(LIN:00000000) FS=0020(LIN:00000200) GS=1675(LIN:00016750) SS=4BAB(LIN:0004BAB0) CR0=80000001 CR1=00000000 CR2=00000000 CR3=007E0000 CF1 PF0 AF1 ZF0 SF1 TF0 IF1 DF0 OF0 IOPL03 NT1 RF0 VM1 AC0 Default Operand Size=16 Default Address Size=16 Stack Address Size=16 SS+00000000:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 SS+00000010:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000:000000A8 DA10 FICOM(m32int)DWORD PTR [BX+SI]

Is there any solution to this problem at present? Thank you so much.

qazmko1029 commented 1 year ago

BRKON FOPEN WIFEMAN.DLL Break On FOPEN is ON.

Passed 0 times. Debugger Enabled. Towns TIME (Nano-Seconds): 10806502240 CS:EIP=0028:80007DB0 LINEAR:80007DB0 EFLAGS=00000006 CPL=00 EAX=00003D80 EBX=00000F32 ECX=00000000 EDX=00000F32 ESI=00000C7A EDI=00000C62 EBP=00000EE8 ESP=80010D9C CS=0028(LIN:00000000) DS=0097(LIN:00053170) ES=0097(LIN:00053170) FS=0000(LIN:00000000) GS=0000(LIN:00000000) SS=0030(LIN:00000000) CR0=80000021 CR1=00000000 CR2=0005C4FC CR3=011FD000 CF0 PF1 AF0 ZF0 SF0 TF0 IF0 DF0 OF0 IOPL00 NT0 RF0 VM0 AC0 Default Operand Size=32 Default Address Size=32 Stack Address Size=32 HOLD IRQ for 1 Instruction SS+00000000:2C 03 00 00 3B 00 00 00 06 02 00 00 D2 0E 00 00 SS+00000010:97 00 00 00 2F 01 00 00 2F 01 00 00 00 00 00 00 Break on FOPEN D:\WINDOWS\SYSTEM\WIFEMAN.DLL 003B:0000032A CD30 INT 30H 0028:80007DB0 83EC04 SUB ESP,04H

RUN 011F:00001660 Passed 0 times. Debugger Enabled. Towns TIME (Nano-Seconds): 10854815290 CS:EIP=011F:00001660 LINEAR:80791B60 EFLAGS=00000202 CPL=03 EAX=0000010F EBX=00000F2A ECX=00000000 EDX=0006010F ESI=0000018B EDI=00000183 EBP=00000FD2 ESP=00000F24 CS=011F(LIN:80790500) DS=012F(LIN:00051E00) ES=01CF(LIN:00058D80) FS=0000(LIN:00051E00) GS=0000(LIN:00000000) SS=0097(LIN:00053170) CR0=80000021 CR1=00000000 CR2=0005C4FC CR3=011FD000 CF0 PF0 AF0 ZF0 SF0 TF0 IF1 DF0 OF0 IOPL00 NT0 RF0 VM0 AC0 Default Operand Size=16 Default Address Size=16 Stack Address Size=16 SS+00000000:3E 10 DF 01 2F 01 4B 45 52 4E 45 4C 00 19 44 3A SS+00000010:5C 57 49 4E 44 4F 57 53 5C 53 59 53 54 45 4D 5C 011F:00001660 E8A503 CALL 00001A08

BPPC 011F:00001AD5 2 RUN Passed 1 times. Debugger Enabled. Towns TIME (Nano-Seconds): 10855114915 CS:EIP=011F:00001AD5 LINEAR:80791FD5 EFLAGS=00000296 CPL=03 EAX=00000000 EBX=0000024F ECX=0000FFFF EDX=00060247 ESI=00000040 EDI=00000001 EBP=00000FD2 ESP=00000F14 CS=011F(LIN:80790500) DS=012F(LIN:00051E00) ES=01CF(LIN:00058D80) FS=0000(LIN:00051E00) GS=0000(LIN:00000000) SS=0097(LIN:00053170) CR0=80000021 CR1=00000000 CR2=0005C4FC CR3=011FD000 CF0 PF1 AF1 ZF0 SF1 TF0 IF1 DF0 OF0 IOPL00 NT0 RF0 VM0 AC0 Default Operand Size=16 Default Address Size=16 Stack Address Size=16 SS+00000000:FF FF 47 02 01 00 CF 01 47 02 CF 01 0B 00 63 16 SS+00000010:3E 10 DF 01 2F 01 4B 45 52 4E 45 4C 00 19 44 3A 011F:00001AD5 9A70091701 CALLF 0117:0970 Passed 2 times. Debugger Enabled. Towns TIME (Nano-Seconds): 10857894160 CS:EIP=011F:00001AD5 LINEAR:80791FD5 EFLAGS=00000296 CPL=03 EAX=00000000 EBX=0000024F ECX=0000FFFF EDX=00000247 ESI=0000004A EDI=00000002 EBP=00000FD2 ESP=00000F14 CS=011F(LIN:80790500) DS=012F(LIN:00051E00) ES=01CF(LIN:00058D80) FS=0000(LIN:00051E00) GS=0000(LIN:00000000) SS=0097(LIN:00053170) CR0=80000021 CR1=00000000 CR2=8078EFC0 CR3=011FD000 CF0 PF1 AF1 ZF0 SF1 TF0 IF1 DF0 OF0 IOPL00 NT0 RF0 VM0 AC0 Default Operand Size=16 Default Address Size=16 Stack Address Size=16 SS+00000000:FF FF 47 02 02 00 CF 01 47 02 CF 01 0A 00 63 16 SS+00000010:3E 10 DF 01 2F 01 4B 45 52 4E 45 4C 00 19 44 3A 011F:00001AD5 9A70091701 CALLF 0117:0970

ENA AUTODISASMR Disassemble_Every_Step with Register Dump is ON. Registers are EAX EBX ECX EDX ESI EDI EBP ESP EFLAGS DS ES FS GS SS DBLOG LOG.txt Begin logging.

LOG.txt

cdblog Closed log file.

captainys commented 1 year ago

Thanks! I look into it!

captainys commented 1 year ago

Hi,

Thank you again for helping me the investigation! Looks like a table that is part of WIFEMAN.DLL is corrupted after loaded to the memory, or while being loaded to the memory. I first want to confirm that the table is corrupted, also want to know where in the physical memory the table is loaded.

Can you try BRKON FOPEN WIFEMAN.DLL (Wait until stop) RUN 011F:00001660 (Wait until stop) then:

BPPC 011F:00001AD5 2 RUN

wait until stop and:

MEMDUMP 247:1032 8 36 ADTR 247:1032

? Thank you very much!

qazmko1029 commented 1 year ago

BRKON FOPEN WIFEMAN.DLL Break On FOPEN is ON.

Passed 0 times. Debugger Enabled. Towns TIME (Nano-Seconds): 12576779630 CS:EIP=0028:80007DB0 LINEAR:80007DB0 EFLAGS=00000006 CPL=00 EAX=00003D80 EBX=00000F32 ECX=00000000 EDX=00000F32 ESI=00000C7A EDI=00000C62 EBP=00000EE8 ESP=80010D9C CS=0028(LIN:00000000) DS=0097(LIN:00053170) ES=0097(LIN:00053170) FS=0000(LIN:00000000) GS=0000(LIN:00000000) SS=0030(LIN:00000000) CR0=80000021 CR1=00000000 CR2=0005C4FC CR3=011FD000 CF0 PF1 AF0 ZF0 SF0 TF0 IF0 DF0 OF0 IOPL00 NT0 RF0 VM0 AC0 Default Operand Size=32 Default Address Size=32 Stack Address Size=32 HOLD IRQ for 1 Instruction SS+00000000:2C 03 00 00 3B 00 00 00 06 02 00 00 D2 0E 00 00 SS+00000010:97 00 00 00 2F 01 00 00 2F 01 00 00 00 00 00 00 Break on FOPEN D:\WINDOWS\SYSTEM\WIFEMAN.DLL 003B:0000032A CD30 INT 30H 0028:80007DB0 83EC04 SUB ESP,04H

RUN 011F:00001660 Passed 0 times. Debugger Enabled. Towns TIME (Nano-Seconds): 12622139940 CS:EIP=011F:00001660 LINEAR:80791B60 EFLAGS=00000202 CPL=03 EAX=0000010F EBX=00000F2A ECX=00000000 EDX=0006010F ESI=0000018B EDI=00000183 EBP=00000FD2 ESP=00000F24 CS=011F(LIN:80790500) DS=012F(LIN:00051E00) ES=01CF(LIN:00058D80) FS=0000(LIN:00051E00) GS=0000(LIN:00000000) SS=0097(LIN:00053170) CR0=80000021 CR1=00000000 CR2=0005C4FC CR3=011FD000 CF0 PF0 AF0 ZF0 SF0 TF0 IF1 DF0 OF0 IOPL00 NT0 RF0 VM0 AC0 Default Operand Size=16 Default Address Size=16 Stack Address Size=16 SS+00000000:3E 10 DF 01 2F 01 4B 45 52 4E 45 4C 00 19 44 3A SS+00000010:5C 57 49 4E 44 4F 57 53 5C 53 59 53 54 45 4D 5C 011F:00001660 E8A503 CALL 00001A08

BPPC 011F:00001AD5 2 RUN Passed 1 times. Debugger Enabled. Towns TIME (Nano-Seconds): 12622439565 CS:EIP=011F:00001AD5 LINEAR:80791FD5 EFLAGS=00000296 CPL=03 EAX=00000000 EBX=0000024F ECX=0000FFFF EDX=00060247 ESI=00000040 EDI=00000001 EBP=00000FD2 ESP=00000F14 CS=011F(LIN:80790500) DS=012F(LIN:00051E00) ES=01CF(LIN:00058D80) FS=0000(LIN:00051E00) GS=0000(LIN:00000000) SS=0097(LIN:00053170) CR0=80000021 CR1=00000000 CR2=0005C4FC CR3=011FD000 CF0 PF1 AF1 ZF0 SF1 TF0 IF1 DF0 OF0 IOPL00 NT0 RF0 VM0 AC0 Default Operand Size=16 Default Address Size=16 Stack Address Size=16 SS+00000000:FF FF 47 02 01 00 CF 01 47 02 CF 01 0B 00 63 16 SS+00000010:3E 10 DF 01 2F 01 4B 45 52 4E 45 4C 00 19 44 3A 011F:00001AD5 9A70091701 CALLF 0117:0970 Passed 2 times. Debugger Enabled. Towns TIME (Nano-Seconds): 12624740170 CS:EIP=011F:00001AD5 LINEAR:80791FD5 EFLAGS=00000296 CPL=03 EAX=00000000 EBX=0000024F ECX=0000FFFF EDX=00000247 ESI=0000004A EDI=00000002 EBP=00000FD2 ESP=00000F14 CS=011F(LIN:80790500) DS=012F(LIN:00051E00) ES=01CF(LIN:00058D80) FS=0000(LIN:00051E00) GS=0000(LIN:00000000) SS=0097(LIN:00053170) CR0=80000021 CR1=00000000 CR2=8078EFC0 CR3=011FD000 CF0 PF1 AF1 ZF0 SF1 TF0 IF1 DF0 OF0 IOPL00 NT0 RF0 VM0 AC0 Default Operand Size=16 Default Address Size=16 Stack Address Size=16 SS+00000000:FF FF 47 02 02 00 CF 01 47 02 CF 01 0A 00 63 16 SS+00000010:3E 10 DF 01 2F 01 4B 45 52 4E 45 4C 00 19 44 3A 011F:00001AD5 9A70091701 CALLF 0117:0970

MEMDUMP 247:1032 8 36 0247:00001032 03 00 4E 09 FF 00 0E 00| N 0247:0000103A 03 00 A0 09 FF 00 0F 00| 0247:00001042 03 01 FC 0D 01 00 7F 00|  0247:0000104A 03 01 5D 0B 01 00 80 00| ] 0247:00001052 03 00 CC 04 FF 00 12 00| 0247:0000105A 03 01 4F 0C 01 00 84 00| O 0247:00001062 03 01 40 0C 01 00 04 00| @ 0247:0000106A 03 01 D9 0F 01 00 05 00| 0247:00001072 03 00 1D 0B FF 00 16 00| 0247:0000107A 03 01 18 10 01 00 07 00| 0247:00001082 03 01 E5 0F 01 00 08 00| 0247:0000108A 03 01 12 10 01 00 09 00| 0247:00001092 03 00 00 05 FF 00 99 00| 0247:0000109A 03 01 F6 0F 01 00 0A 00| 0247:000010A2 03 00 83 0C FF 00 9A 00| 0247:000010AA 03 00 34 0B FF 00 9B 00| 4 0247:000010B2 03 01 E4 01 01 00 0D 00| 0247:000010BA 03 00 02 10 FF 00 1F 00| 0247:000010C2 03 00 A8 01 FF 00 21 00| ! 0247:000010CA 03 00 D2 01 FF 00 22 00| " 0247:000010D2 03 00 A5 0F FF 00 23 00| # 0247:000010DA 03 00 24 10 FF 00 00 00| $ 0247:000010E2 00 00 00 00 00 00 00 00| 0247:000010EA 00 00 00 00 00 00 00 00| 0247:000010F2 00 00 00 00 00 00 00 00| 0247:000010FA 00 00 00 00 00 00 00 00| 0247:00001102 00 00 00 00 00 00 00 00| 0247:0000110A 00 00 00 00 00 00 00 00| 0247:00001112 00 00 00 00 00 00 00 00| 0247:0000111A 00 00 00 00 00 00 00 00| 0247:00001122 00 00 00 00 00 00 00 00| 0247:0000112A 00 00 00 00 00 00 00 00| 0247:00001132 00 00 00 00 00 00 00 00| 0247:0000113A 00 00 00 00 00 00 00 00| 0247:00001142 00 00 00 00 00 00 00 00| 0247:0000114A 00 00 00 00 00 00 00 00| ADTR 247:1032 00000247:00001032 LINE:0005E212H Page Info Not Cached Page Directory Index :00000000H Page Directory Pointer:011FD000H Page Directory Info :011FE267H Page Table Index :0000005EH Page Table Pointer:011FE000H Page Pointer :011FE178H Page Table Info :01235007H PHYS:01235212H

qazmko1029 commented 1 year ago

Actually you can have my set and see the result yourself, it'd be forever asking and replying just for certain commands...download this and run the .bat Feel free to tell me anything helpful, thanks. :)

captainys commented 1 year ago

Thanks! I almost pin-pointed the source. I'm 99% sure it was my DMAC implementation. I'll let you know.

captainys commented 1 year ago

Hi,

Looks like it's not my problem. Windows 3.1 L10's problem. If you reduce your RAM size to 16MB, it should start.

Here's what's happening. Windows tries to load WIFEMAN.DLL to to physical address 012352C0H. However, Windows's SCSI driver only writes low 3-bytes of the physical address to DMAC. Therefore, the file is loaded to physical address 002352C0H instead of 012352C0H.

The reason why I say it is Windows problem is how it is writing to the DMAC address. Windows's SCSI driver is doing:

0028:800164DA EE OUT DX,AL 0028:800164DA Write IO8:[00A6] 23(DMAC_ADDRESS_MIDHIGH)

It is supposed to use OUT DX,AX, or write to DMAC-address high-byte separately. Neither is happening.

If you limit the memory size to 16MB, RAM does not extend to that high physical address. Therefore, the highest-byte is not required.

16MB was luxury, and 32MB was unthinkable back then :-)

Thank you very much for your tremendous help!

qazmko1029 commented 1 year ago

OK I'll momorize it, thanks troubleshooting. Next should be win3.0 L14, the problem in latest commit just shows the same as before, i have changed memsize to 16mb and nothing changed, continue the topic or stop here?

captainys commented 1 year ago

This thread got quite long. Also the title of this thread says Windows 3.1, which I believe is now pretty well supported.

Let's make it another thread. Can you create one? Windows 3.0 must be full of 80286. Probably I am not implementing something related to 80286 correctly.