VOGONS


Reply 40 of 87, by Jepael

User metadata
Rank Oldbie
Rank
Oldbie

Well it loads to the top of available memory your int 12h tells it.
If you say you have 640kb of memory available, you don't have EDBA and it loads top of memory.
If you do have EDBA, you have 639kb of memory available, and it leaves the last 1kb with EDBA untouched and that is why it is loaded 1kb earlier.

Reply 41 of 87, by superfury

User metadata
Rank l33t++
Rank
l33t++

OK, so the instructions are doing what they're supposed to do?

It seems to not read anymore sectors when it gets to reading 690:5400 (0x11(=17) sectors).

Anyone knows why (is it looping again)?

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

Reply 42 of 87, by peterferrie

User metadata
Rank Oldbie
Rank
Oldbie

Jepael is correct regarding the int 12h - the high segment might not be exactly what I wrote. I should have been more clear.
There is nothing wrong with the current log, except that it stops too soon. There's a long rep movsw sequence which does not complete before the log ends.

Reply 43 of 87, by superfury

User metadata
Rank l33t++
Rank
l33t++

The new log:

Filename
debuggerlog_20150317_1659.zip
File size
1.18 MiB
Downloads
62 downloads
File comment
Latest debugger log, REP commands merged into 1/2 opcodes.
File license
Fair use/fair dealing exception

It seems to crash on an CO-processor (FPU) opcode, which isn't implemented. This gives a co-processor fault, which is, by default, not installed (just an IRET instruction). This hangs the CPU. Why doesn't MS-DOS install a coprocessor interrupt handler?

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

Reply 44 of 87, by peterferrie

User metadata
Rank Oldbie
Rank
Oldbie

It's not the FPU, it's here:
0:01:06:97.9.0000: 02B7:1537 (871E7C05)XCHGW BX,[DS:057C]
The exchange was not performed. Shortly after it:
0:01:06:98.2.0000: 02B7:153F (36FF167C05)CALL [SS:057C]
Without the memory write, that pointer is garbage, and the call goes somewhere random.

Reply 45 of 87, by superfury

User metadata
Rank l33t++
Rank
l33t++

Fixed the XCHGW bug.

I'm getting the wrong address, what's supposed to be

b72:10 (1)

Is:

0:01:08:42.3.0000: Function 02 called.

0:01:08:51.1.0000: Read 1/1 sectors from drive 00, start 0. Requested: Head: 0, Track: 0, Sector: 1. Start sector: 0, Destination: ES:BX=0070:00000281
Filename
debuggerlog_20150317_2139.zip
File size
1.33 MiB
Downloads
71 downloads
File comment
Latest debugger log.
File license
Fair use/fair dealing exception

For some reason it ends with a short jump to itself?

0:01:17:99.3.0000: 0247:479B (EBFE)JMP 479B

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

Reply 46 of 87, by crazyc

User metadata
Rank Member
Rank
Member
0:01:17:97.3.0000: 0247:4A2F (7415)JZ 4A46
0:01:17:97.3.0000: Registers:
0:01:17:97.3.0000: AX: 0236, BX: 367A, CX: 0003, DX: 0000
0:01:17:97.3.0000: CS: 0247, DS: 0070, ES: 0247, SS: 0247
0:01:17:97.3.0000: SP: 0870, BP: 03E6, SI: 0236, DI: 04E8
0:01:17:97.3.0000: IP: 4A2F, FLAGS: 0016
0:01:17:97.3.0000: FLAGSINFO:c1P0A0zstido0000

This branch is supposed to be taken so the above rep cmpsb is likely not working properly.

Reply 47 of 87, by superfury

User metadata
Rank l33t++
Rank
l33t++

This is my REP instruction handling (executed after the opcode is retrieved and executed. CPU_resetOP sets up CS:(E)IP back to the start of the opcode for running it again.)

Is this correct? It seems to not reset at all in this case (after the REP, CX>0 and ZF=0).

--CPU.registers->CX; //Decrease the counter!
if (CPU_getprefix(0xF2)) //REPNZ?
{
if (!CPU.registers->SFLAGS.ZF) //To reset the opcode (FLAG_ZF quits the loop)?
{
if (CPU.registers->CX) //Left to run?
{
CPU_resetOP(); //Retry!
}
}
}
else if (CPU_getprefix(0xF3))
{
if (REPZ) //REPZ?
{
if (CPU.registers->SFLAGS.ZF) //To reset the opcode (no FLAG_ZF quits the loop)?
{
if (CPU.registers->CX) //Left to run?
{
CPU_resetOP(); //Retry!
}
}
}
else //REP?
{
if (CPU.registers->CX) //Left to run?
{
CPU_resetOP(); //Retry!
}
}
}

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

Reply 48 of 87, by peterferrie

User metadata
Rank Oldbie
Rank
Oldbie

0:01:16:48.6.0000: 0247:1E27 (AC)LODSB

There might be a problem at this point - the path is empty.
On my image, there is "A:\" here.
The code path differs greatly because of that.

Do you have an autoexec.bat? I don't on my image.

Reply 49 of 87, by peterferrie

User metadata
Rank Oldbie
Rank
Oldbie

Here we go. We start with this:

0:01:14:36.6.0000: 0247:4A97 (8976FA)MOVW [SS:BP-06],SI
0:01:14:36.6.0000: Registers:
0:01:14:36.6.0000: AX: 0003, BX: 0001, CX: 367A, DX: 1C85
0:01:14:36.6.0000: CS: 0247, DS: 9DE1, ES: 0247, SS: 0247
0:01:14:36.6.0000: SP: 086C, BP: 0872, SI: 0000, DI: 0360
and
0:01:14:36.7.0000: 0247:4A9A (8C5EFC)MOVW [SS:BP-04],DS
0:01:14:36.7.0000: Registers:
0:01:14:36.8.0000: AX: 0003, BX: 0001, CX: 367A, DX: 1C85
0:01:14:36.8.0000: CS: 0247, DS: 9DE1, ES: 0247, SS: 0247
so
SS:BP-06=9DE1:0000

Then
0:01:16:44.2.0000: 0247:4B04 (C576FA)LDS SI,[SS:BP-06]
0:01:16:44.4.0000: CS: 0247, DS: 9DE1, ES: 0247, SS: 0247
0:01:16:44.4.0000: SP: 086C, BP: 0872, SI: 0000, DI: 0000

confirmed, but

0:01:16:45.1.0000: 0247:4B25 (C47EFA)LES DI,[SS:BP-06]
0:01:16:45.3.0000: CS: 0247, DS: 9DE1, ES: 8E26, SS: 0247
0:01:16:45.3.0000: SP: 086C, BP: 0872, SI: 0000, DI: 006E

Not anymore. My guess: DS: is being used instead instead of SS:.
[BP+xx] uses SS: implicitly, unless there's a different override.

Reply 50 of 87, by superfury

User metadata
Rank l33t++
Rank
l33t++

A new log, with a bit of fixes in my debugger and CPU:

Edit: You're right about DS being used. The LDS/LES instructions just take the offset and read it using default segment DS instead of SS. I'm fixing that now (maybe I need to rewrite the ModR/M handling a bit, since it only supports normal 16-bit reads. So I need to add 2 to the ModR/M offset, need to add it to the parameters...

Edit: It's been adjusted and should be working properly now:

Filename
debuggerlog_20150319_1940.zip
File size
3.01 MiB
Downloads
68 downloads
File comment
Latest debugger log, with memory reads&writes enabled and LXS instruction fixed.
File license
Fair use/fair dealing exception

It keeps looping it seems. Is there a wrongly loaded INT13 destination?

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

Reply 51 of 87, by peterferrie

User metadata
Rank Oldbie
Rank
Oldbie

There's doesn't seem to be anything wrong with the log, apart from it stopping too soon.
The loop is a search for config.sys, and then autoexec.bat. Finding neither, it will eventually execute date and time instead.

Reply 52 of 87, by superfury

User metadata
Rank l33t++
Rank
l33t++

It continues running and now gives me a "Bad or missing Command Interpreter" message.

The latest log:

Filename
debuggerlog_20150320_1351.zip
File size
3.36 MiB
Downloads
70 downloads
File comment
Latest debugger log, with "Bad or missing Command Interpreter" written on the screen.
File license
Fair use/fair dealing exception

So it can't find the COMMAND.COM executable now? Why? It should be in the root directory, which is read again (sector 19). It's the third entry in the root directory.

Also, I seem to get a strange output to ports 0x2F2-0x2F7, all outputting 0xFF.

0:02:24:66.1.0000: 9DFD:0A4E (B0FF)MOVB AL, FF

0:02:24:66.1.0000: Registers:

0:02:24:66.1.0000: AX: A0C0, BX: 0004, CX: 0000, DX: A0C0

0:02:24:66.2.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:66.2.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:66.2.0000: IP: 0A4E, FLAGS: 0282

0:02:24:66.2.0000: FLAGSINFO:c1p0a0zStIdo0000



0:02:24:66.2.0000: 9DFD:0A50 (BAF202)MOVW DX, 02F2

0:02:24:66.3.0000: Registers:

0:02:24:66.3.0000: AX: A0FF, BX: 0004, CX: 0000, DX: A0C0

0:02:24:66.3.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:66.3.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:66.3.0000: IP: 0A50, FLAGS: 0282

0:02:24:66.3.0000: FLAGSINFO:c1p0a0zStIdo0000



0:02:24:66.4.0000: 9DFD:0A53 (EE)OUT DX,AL

0:02:24:66.4.0000: Registers:

0:02:24:66.4.0000: AX: A0FF, BX: 0004, CX: 0000, DX: 02F2

0:02:24:66.5.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:66.5.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:66.5.0000: IP: 0A53, FLAGS: 0282

0:02:24:66.5.0000: FLAGSINFO:c1p0a0zStIdo0000



0:02:24:66.5.0000: 9DFD:0A54 (42)INC DX

0:02:24:66.6.0000: Registers:

0:02:24:66.6.0000: AX: A0FF, BX: 0004, CX: 0000, DX: 02F2

0:02:24:66.6.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:66.6.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:66.6.0000: IP: 0A54, FLAGS: 0282

Show last 161 lines
0:02:24:66.6.0000: FLAGSINFO:c1p0a0zStIdo0000



0:02:24:66.7.0000: 9DFD:0A55 (EE)OUT DX,AL

0:02:24:66.7.0000: Registers:

0:02:24:66.7.0000: AX: A0FF, BX: 0004, CX: 0000, DX: 02F3

0:02:24:66.7.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:66.8.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:66.8.0000: IP: 0A55, FLAGS: 0206

0:02:24:66.8.0000: FLAGSINFO:c1P0a0zstIdo0000



0:02:24:66.8.0000: 9DFD:0A56 (42)INC DX

0:02:24:66.8.0000: Registers:

0:02:24:66.9.0000: AX: A0FF, BX: 0004, CX: 0000, DX: 02F3

0:02:24:66.9.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:66.9.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:66.9.0000: IP: 0A56, FLAGS: 0206

0:02:24:66.9.0000: FLAGSINFO:c1P0a0zstIdo0000



0:02:24:67.0.0000: 9DFD:0A57 (EE)OUT DX,AL

0:02:24:67.0.0000: Registers:

0:02:24:67.0.0000: AX: A0FF, BX: 0004, CX: 0000, DX: 02F4

0:02:24:67.0.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:67.1.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:67.1.0000: IP: 0A57, FLAGS: 0202

0:02:24:67.1.0000: FLAGSINFO:c1p0a0zstIdo0000



0:02:24:67.1.0000: 9DFD:0A58 (42)INC DX

0:02:24:67.1.0000: Registers:

0:02:24:67.2.0000: AX: A0FF, BX: 0004, CX: 0000, DX: 02F4

0:02:24:67.2.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:67.2.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:67.2.0000: IP: 0A58, FLAGS: 0202

0:02:24:67.2.0000: FLAGSINFO:c1p0a0zstIdo0000



0:02:24:67.3.0000: 9DFD:0A59 (EE)OUT DX,AL

0:02:24:67.3.0000: Registers:

0:02:24:67.3.0000: AX: A0FF, BX: 0004, CX: 0000, DX: 02F5

0:02:24:67.3.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:67.4.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:67.4.0000: IP: 0A59, FLAGS: 0206

0:02:24:67.4.0000: FLAGSINFO:c1P0a0zstIdo0000



0:02:24:67.4.0000: 9DFD:0A5A (42)INC DX

0:02:24:67.4.0000: Registers:

0:02:24:67.5.0000: AX: A0FF, BX: 0004, CX: 0000, DX: 02F5

0:02:24:67.5.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:67.5.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:67.5.0000: IP: 0A5A, FLAGS: 0206

0:02:24:67.5.0000: FLAGSINFO:c1P0a0zstIdo0000



0:02:24:67.6.0000: 9DFD:0A5B (EE)OUT DX,AL

0:02:24:67.6.0000: Registers:

0:02:24:67.6.0000: AX: A0FF, BX: 0004, CX: 0000, DX: 02F6

0:02:24:67.6.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:67.7.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:67.7.0000: IP: 0A5B, FLAGS: 0206

0:02:24:67.7.0000: FLAGSINFO:c1P0a0zstIdo0000



0:02:24:67.7.0000: 9DFD:0A5C (42)INC DX

0:02:24:67.7.0000: Registers:

0:02:24:67.8.0000: AX: A0FF, BX: 0004, CX: 0000, DX: 02F6

0:02:24:67.8.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:67.8.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:67.8.0000: IP: 0A5C, FLAGS: 0206

0:02:24:67.8.0000: FLAGSINFO:c1P0a0zstIdo0000



0:02:24:67.9.0000: 9DFD:0A5D (EE)OUT DX,AL

0:02:24:67.9.0000: Registers:

0:02:24:67.9.0000: AX: A0FF, BX: 0004, CX: 0000, DX: 02F7

0:02:24:67.9.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:68.0.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:68.0.0000: IP: 0A5D, FLAGS: 0202

0:02:24:68.0.0000: FLAGSINFO:c1p0a0zstIdo0000



0:02:24:68.0.0000: 9DFD:0A5E (B800F0)MOVW AX, F000

0:02:24:68.0.0000: Registers:

0:02:24:68.1.0000: AX: A0FF, BX: 0004, CX: 0000, DX: 02F7

0:02:24:68.1.0000: CS: 9DFD, DS: 9DFD, ES: 098E, SS: 9DFD

0:02:24:68.1.0000: SP: 0962, BP: 7440, SI: FFFF, DI: 0195

0:02:24:68.1.0000: IP: 0A5E, FLAGS: 0202

0:02:24:68.1.0000: FLAGSINFO:c1p0a0zstIdo0000

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

Reply 53 of 87, by peterferrie

User metadata
Rank Oldbie
Rank
Oldbie

There seems to be a problem between here:

0:02:09:93.9.0000: 9DFD:0B56 (AB)STOSW
0:02:09:93.9.0000: Registers:
0:02:09:93.9.0000: AX: 3A41, BX: 0210, CX: 0005, DX: 0000
0:02:09:93.9.0000: CS: 9DFD, DS: 0247, ES: 0B75, SS: 9DFD
0:02:09:93.9.0000: SP: 0966, BP: 7440, SI: 7420, DI: 0000

0:02:09:94.2.0000: 9DFD:0B5B (AB)STOSW
0:02:09:94.2.0000: Registers:
0:02:09:94.3.0000: AX: 005C, BX: 0210, CX: 0005, DX: 0000
0:02:09:94.3.0000: CS: 9DFD, DS: 0247, ES: 0B75, SS: 9DFD
0:02:09:94.3.0000: SP: 0966, BP: 7440, SI: 7420, DI: 0002

0:02:09:94.3.0999: Registers:
0:02:09:94.5.0000: SP: 0966, BP: 7440, SI: 7420, DI: 0004

and here:

0:02:42:72.5.0000: 0247:1E3A (F2AE)REPNZSCASB
0:02:42:72.5.0000: Registers:
0:02:42:72.5.0000: AX: 0000, BX: 0362, CX: FFFF, DX: 0000
0:02:42:72.5.0000: CS: 0247, DS: 0247, ES: 0B75, SS: 0247
0:02:42:72.5.0000: SP: 0854, BP: 03E6, SI: 0360, DI: 0000
0:02:42:72.6.0000: IP: 1E3A, FLAGS: 0046
0:02:42:72.6.0000: FLAGSINFO:c1P0a0Zstido0000

0:02:42:72.6.0000: 0247:1E3C (F7D1)NOTW CX
0:02:42:72.6.0000: Registers:
0:02:42:72.6.0000: AX: 0000, BX: 0362, CX: FFFE, DX: 0000
0:02:42:72.7.0000: CS: 0247, DS: 0247, ES: 0B75, SS: 0247
0:02:42:72.7.0000: SP: 0854, BP: 03E6, SI: 0360, DI: 0001

because the memory was erased. Without the drive letter, DOS can't find any file.
If you watch for writes to B75:0000, it might be obvious what's going wrong, but I doubt that I'll see it in the log.

Reply 54 of 87, by superfury

User metadata
Rank l33t++
Rank
l33t++

This seems to cause the override:

0:08:51:39.7.0000: Read from memory: 000007B4=00

0:08:51:39.8.0000: Read from memory: 000007B5=01

0:08:51:39.8.0000: Writing to memory: 00002C9C=70

0:08:51:39.9.0000: Writing to memory: 00002C9D=00

0:08:51:39.9.0000: Writing to memory: 00002C9A=D8

0:08:51:40.0.0000: Writing to memory: 00002C9B=0F

0:08:51:40.0.0999: Read from memory: 000007B4=00

0:08:51:40.0.0999: Read from memory: 000007B5=01

0:08:51:40.2.0000: Read from memory: 000007B6=00

0:08:51:40.2.0000: Read from memory: 000007B7=F0

0:08:51:40.3.0000: ModR/M address: 0070:00B4=000007B4

0:08:51:40.3.0000: 0070:0FD3 (2EFF1EB400)CALL [CS:00B4]

0:08:51:40.4.0000: Registers:

0:08:51:40.4.0000: AX: 0201, BX: 0010, CX: 0002, DX: 0100

0:08:51:40.5.0000: CS: 0070, DS: 0070, ES: 0B54, SS: 0247

0:08:51:40.5.0000: SP: 082E, BP: 0005, SI: 0522, DI: 0482

0:08:51:40.5.0999: IP: 0FD3, FLAGS: 0097

0:08:51:40.5.0999: FLAGSINFO:C1P0A0zStido0000



0:08:51:40.7.0000: Writing to memory: 00002C98=00

0:08:51:40.8.0000: Writing to memory: 00002C99=F0

0:08:51:40.9.0000: Writing to memory: 00002C96=05

0:08:51:40.9.0000: Writing to memory: 00002C97=01

0:08:51:40.9.0999: F000:0100 (9A060100F0)CALL f000:0106

0:08:51:40.9.0999: Registers:

0:08:51:41.0.0999: AX: 0201, BX: 0010, CX: 0002, DX: 0100

0:08:51:41.0.0999: CS: F000, DS: 0070, ES: 0B54, SS: 0247

0:08:51:41.2.0000: SP: 082A, BP: 0005, SI: 0522, DI: 0482

0:08:51:41.2.0000: IP: 0100, FLAGS: 0097

0:08:51:41.3.0000: FLAGSINFO:C1P0A0zStido0000

Show last 18 lines


0:08:51:41.4.0000: ModR/M address: 0070:0532=00000C32

0:08:51:41.4.0000: F000:0106 (FE380800)<INTERNAL CALLBACK> 0008

0:08:51:41.4.0999: Registers:

0:08:51:46.0.0000: AX: 0201, BX: 0010, CX: 0002, DX: 0100

0:08:51:46.1.0000: CS: F000, DS: 0070, ES: 0B54, SS: 0247

0:08:51:46.2.0000: SP: 0826, BP: 0005, SI: 0522, DI: 0482

0:08:51:46.2.0000: IP: 0106, FLAGS: 0097

0:08:51:46.2.0999: FLAGSINFO:C1P0A0zStido0000

The final byte of the final sector overwrites the drive letter (A):

0:08:52:09.9.0000: Writing to memory: 0000B750=00

0:08:52:10.0.0000: Read from memory: 0000B750=00

This starts from B550 up to and including B750 (a difference of 512 bytes, or 1 sector read). Shouldn't this be 1 byte less? So B550-B74F=512 bytes written to memory)?

I've changed the INT13 handler to read a byte from disk until (!--left), where left starts with 512, instead of until (!left--), so:

left = 512; //We have read 512 bytes from disk.
for (;;)
{
read byte from disk
write byte to RAM (@ES:offset++)
if (!--left) break;
++sectorindex; //Next sector byte!
}

It kept running now, even getting undefined opcodes (0F00).

This was caused by an error because the INT13 didn't read 512 byte sectors into memory, but 513 bytes (512 bytes sector data plus 1 byte junk).
It reads 512 byte sectors into memory correctly now and reads multiple sectors OK too.

It now seems to go and try load COMMAND.COM correctly:

0:04:47:36.3.0000: Read from memory: 000027D3=43 C

0:04:47:36.3.0000: Read from memory: 000027D4=4F O

0:04:47:36.4.0000: Read from memory: 000027D5=4E N

0:04:47:36.4.0000: Read from memory: 000027D6=46 F

0:04:47:36.5.0000: Read from memory: 000027D7=49 I

0:04:47:36.5.0000: Read from memory: 000027D8=47 G

0:04:47:36.5.0000: Read from memory: 000027D9=2E .

0:04:47:36.6.0000: Read from memory: 000027DA=53 S

0:04:47:36.6.0000: Read from memory: 000027DB=59 Y

0:04:47:36.7.0000: Read from memory: 000027DC=53 S

0:04:47:36.7.0000: Read from memory: 000027DD=00
0:06:15:14.0.0000: Read from memory: 00002CDC=43 C

0:06:15:14.0.0000: Read from memory: 00002CDD=4F O

0:06:15:14.1.0000: Read from memory: 00002CDE=4D M

0:06:15:14.1.0000: Read from memory: 00002CDF=4D M

0:06:15:14.2.0000: Read from memory: 00002CE0=41 A

0:06:15:14.2.0000: Read from memory: 00002CE1=4E N

0:06:15:14.3.0000: Read from memory: 00002CE2=44 D

0:06:15:14.3.0000: Read from memory: 00002CE3=2E .

0:06:15:14.3.0000: Read from memory: 00002CE4=43 C

0:06:15:14.4.0000: Read from memory: 00002CE5=4F O

0:06:15:14.4.0000: Read from memory: 00002CE6=4D M

0:06:15:14.5.0000: Read from memory: 00002CE7=00

0:06:15:14.5.0000: 0247:1E3A (F2AE)REPNZSCASB

0:06:15:14.6.0000: Registers:

0:06:15:14.6.0000: AX: 0000, BX: 0362, CX: FFF4, DX: 0000

0:06:15:14.6.0000: CS: 0247, DS: 0247, ES: 0247, SS: 0247

0:06:15:14.7.0000: SP: 085C, BP: 0862, SI: 04F1, DI: 0877

0:06:15:14.7.0000: IP: 1E3A, FLAGS: 0006

0:06:15:14.8.0000: FLAGSINFO:c1P0a0zstido0000

After that it executes an infinite loop?

The log has become too big to upload here, so I've uploaded it at my own site:
http://superfury.heliohost.org/cplusplus/debu … 150321_1853.zip

As far as I can see, it's the final B30:10 read in the sector list.

Why does it keep looping back to the same point? It never executes the final INT13 call to read COMMAND.COM into memory.

Anyone knows what's going wrong?

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

Reply 56 of 87, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've made a new log, the CPU hasn't changed, but some bugsfixes in the VGA memory window (atm all modes except 256 color mode work, but this is probably a problem in rendering, not a problem from the CPU's perspective) and ASCII characters of MMU writes and reads have been added to the debugger log. You now can see that the CPU actually finds COMMAND.COM, but after that I don't know what it's trying to do, except looping infinitely?

I've compressed it into a 7-zip file, which seems to do a better job at it than the default Windows ZIP compression. Now I can upload it here again:

Filename
debuggerlog_20150327_1123.7z
File size
3.24 MiB
Downloads
63 downloads
File comment
Latest debugger log with an infinite loop and character log added.
File license
Fair use/fair dealing exception

Anyone knows what's going wrong?

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

Reply 57 of 87, by peterferrie

User metadata
Rank Oldbie
Rank
Oldbie

There appears to be some memory corruption.
The loop that spans 0247:42bd ... 430b never exits, because it can't find the end of the segment list.
The 13th entry value (0b33) is wrong - should be 0b54, and the 14th entry (0b54) points to itself instead of holding 0ffff.

0:02:15:04.0.0000: 9DFD:0D97 (803E3F08FF)CMPB [DS:083F],FF
The value here depends on the BIOS. Since our BIOS files differ, execution diverges significantly, and I can't investigate further.
I'm using the BIOS from Bochs. It's freely available, and then we might be able to pinpoint the cause of the problem.

Reply 58 of 87, by superfury

User metadata
Rank l33t++
Rank
l33t++

The value is overwritten at 048D:043A (REP MOVSW) as far as I can see (simply looking for the address). It writes 0xFF to the memory location you gave at DS:083F. Is this supposed to happen?

Btw I'm using my own BIOS (written for my emulator). The INT10 handler is partly copied from dosbox (adjusted video mode set from Dosbox-X, text mode fonts and font set from Dosbox SVN). For the rest handlers in my BIOS is a combination of my own internal calls and Dosbox's IRQ1&keyboard handler. The entry points for compatibility in the BIOS is filled too, as are the other compatibility entry points. I'll post a dump of my BIOS image for reference, although it won't work on other emulators because the internal calls aren't the same on other emulators. I do believe the final byte of the BIOS is set to 0xFF (IBM PC) when the BIOS ROM memory is generated, which explains the 0xFF?

Also will the BIOS even work? I can mount and POST from it, but will it run on my 8086/80186 processor with only IBM PC hardware (plus Adlib and MPU)? I do have a floppy disk controller with only read and write track&sector commands implemented atm (No seek or other command yet. Those other commands will just give an invalid command error).

Filename
SYSROM.zip
File size
1.11 KiB
Downloads
56 downloads
File comment
System BIOS rom mounted at 0xF000:0000.
File license
Fair use/fair dealing exception

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

Reply 59 of 87, by superfury

User metadata
Rank l33t++
Rank
l33t++

Here's the latest version of my emulator, all set up to run. I've added the latest ROMS from Bochs for comparision. Just extract the files into a directory and run the emulator to get the full log.

The ROMS/BIOSROM.BIN (mapped at F000:(0000-FFFF)) is the latest BIOS-bochs-legacy and the ROMS/OPTROM.1 (mapped at C000:(0000-8000)) is the latest legacy VGA BIOS image for Bochs (VGABIOS-elpin-2.40).

It seems to fail/crash (although it's not crashing, as it keeps running): it runs dummy data commands (0x00) at the end.

When run, it creates a log directory with the full log of executed commands and memory addresses in logs/debugger.log.

It seems the legacy BIOS uses a 0F opcode, which doesn't exist on 80186 and is POP CS on a 8086 and #UD on 80186. It's currently running as a 80186.

Filename
x86EMU_20150410_1502.zip
File size
434.41 KiB
Downloads
59 downloads
File comment
Latest build. Some bugs fixed in undefined opcode debugging and all required files to run added. Also configuration set ready to debug with Bochs BIOS&VGA ROMs (both legacy roms).
File license
Fair use/fair dealing exception

If you want to run it the way I do, just enter the BIOS when starting the program and in the advanced menu change the execution mode to normal mode to run my own BIOS (BIOS will be dumped, when booting, to BIOSROM.DMP. This is FOR THIS EMULATOR ONLY. It's incompatible with other emulators, like Bochs and Dosbox. It will run, but all Internal Commands opcodes will have strange results, since they apply to my emulator only, and call different functions, nothing or strange functions when applied in Bochs or Dosbox (e.g. internal command #0 is the BIOS INT19/POST handler in my case, but can be anything in Bochs/Dosbox. DON'T USE IT WITH OTHER EMULATORS!)).

Simple usage manual:

Input buttons are mapped for the PSP and PC:
Mouse has no effect.
PC: PSP buttons.
Up/Down/Left/Right: Same buttons as the PSP.
4/8/6/2 (NUM PAD): SQUARE, TRIANGLE, CIRCLE, CROSS.
I,J,K,L: Analog Up, Analog Left, Analog Down, Analog Right.
Q,W: L trigger, R trigger.
Backspace: Select.
Enter: Start.
Ctrl: Home.
F12: Toggle fullscreen (PC only).

To enter the BIOS, press SELECT when on-screen (Both when the Normal mode is running it's POST and when starting execution (yellow text is showing).
Left/LTRIGGER and Right/RTRIGGER switch between menus.
Up/Down switch between options.
Cross confirms, Circle cancels, Triangle loads defaults, Square on disk toggles the readonly flag.
Place ROMS in the ROMS directory and disk images in the executable directory.

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