VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've written myself an ATA-1 controller I'm using with my emulator:
https://bitbucket.org/superfury/x86emu/src/75 … ide.c?at=master

I can boot from a floppy and format, parition, add files, execute files and read files from it (I'm using the XT-IDE BIOS in 8-bit mode, set by the autodetect).

When I try to boot it(any mounted harddisk), I'm getting an error 80h (after which it tries to boot a floppy which also gives a 80h error resulting in a full reboot of the system). Anyone knows why this happens (It shouldn't timeout according to my logs?)

It's logging:

0:00:10:58.7.0304: Set features:0,0=01

0:00:10:58.8.0418: IDENTIFY:0,0=EC

0:00:12:90.5.0344: Set features:0,0=01

0:00:12:90.6.0139: Set features:0,0=82

0:00:12:90.6.0931: SEEK:0,0=70

0:00:12:90.6.0933: Seeked!

Edit: While debugging I notice that the hard drive isn't read when executing a hard disk read request (AH=2, DL=0x80). It's firing interupt 13h with AH=02h and DL=02h? It seems to try to load a 'third floppy drive' instead of the hard disk? Anyone knows why this happens?

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

Reply 1 of 3, by superfury

User metadata
Rank l33t++
Rank
l33t++

When backtracing the disassembly given by my emulator I find this:

0:00:14:62.6.0699: C600:0AB7 (B480)MOVB AH, 80

0:00:14:62.6.0700: Registers:

0:00:14:62.6.0703: AX: A000, BX: 7C00, CX: 0001, DX: 0000

0:00:14:62.6.0705: CS: C600, DS: 9FC0, ES: 0000, SS: 0000

0:00:14:62.6.0707: SP: 7ED2, BP: 7ED4, SI: 00F8, DI: 0201

0:00:14:62.6.0709: IP: 0AB7, FLAGS: F246

0:00:14:62.6.0714: FLAGSINFO:c1P0a0ZstIdo1111



0:00:14:62.6.0746: Read from memory: 0009FC0D=80 (€)

0:00:14:62.6.0750: C600:0AB9 (A00D00)MOVB AL,[DS:000D]

0:00:14:62.6.0751: Registers:

0:00:14:62.6.0753: AX: 8000, BX: 7C00, CX: 0001, DX: 0000

0:00:14:62.6.0756: CS: C600, DS: 9FC0, ES: 0000, SS: 0000

0:00:14:62.6.0758: SP: 7ED2, BP: 7ED4, SI: 00F8, DI: 0201

0:00:14:62.6.0760: IP: 0AB9, FLAGS: F246

0:00:14:62.6.0764: FLAGSINFO:c1P0a0ZstIdo1111



0:00:14:62.6.0797: C600:0ABC (84E2)TESTB AH,DL

0:00:14:62.6.0799: Registers:

0:00:14:62.6.0801: AX: 8080, BX: 7C00, CX: 0001, DX: 0000

0:00:14:62.6.0804: CS: C600, DS: 9FC0, ES: 0000, SS: 0000

0:00:14:62.6.0806: SP: 7ED2, BP: 7ED4, SI: 00F8, DI: 0201

0:00:14:62.6.0808: IP: 0ABC, FLAGS: F246

0:00:14:62.6.0812: FLAGSINFO:c1P0a0ZstIdo1111



0:00:14:62.6.0866: C600:0ABE (7504)JNZ 0AC4

0:00:14:62.6.0868: Registers:

0:00:14:62.6.0870: AX: 8080, BX: 7C00, CX: 0001, DX: 0000

0:00:14:62.6.0872: CS: C600, DS: 9FC0, ES: 0000, SS: 0000

0:00:14:62.6.0875: SP: 7ED2, BP: 7ED4, SI: 00F8, DI: 0201

Show last 85 lines
0:00:14:62.6.0877: IP: 0ABE, FLAGS: F246

0:00:14:62.6.0881: FLAGSINFO:c1P0a0ZstIdo1111



0:00:14:62.6.0924: Read from memory: 0009FC0C=02 ()

0:00:14:62.6.0928: C600:0AC0 (A00C00)MOVB AL,[DS:000C]

0:00:14:62.6.0930: Registers:

0:00:14:62.6.0932: AX: 8080, BX: 7C00, CX: 0001, DX: 0000

0:00:14:62.6.0934: CS: C600, DS: 9FC0, ES: 0000, SS: 0000

0:00:14:62.6.0937: SP: 7ED2, BP: 7ED4, SI: 00F8, DI: 0201

0:00:14:62.6.0939: IP: 0AC0, FLAGS: F246

0:00:14:62.6.0943: FLAGSINFO:c1P0a0ZstIdo1111



0:00:14:62.6.0984: C600:0AC3 (98)CBW

0:00:14:62.6.0986: Registers:

0:00:14:62.6.0988: AX: 8002, BX: 7C00, CX: 0001, DX: 0000

0:00:14:62.6.0990: CS: C600, DS: 9FC0, ES: 0000, SS: 0000

0:00:14:62.6.0993: SP: 7ED2, BP: 7ED4, SI: 00F8, DI: 0201

0:00:14:62.6.0994: IP: 0AC3, FLAGS: F246

0:00:14:62.6.0999: FLAGSINFO:c1P0a0ZstIdo1111



0:00:14:62.7.0031: C600:0AC4 (38D4)CMPB AH,DL

0:00:14:62.7.0033: Registers:

0:00:14:62.7.0036: AX: 0002, BX: 7C00, CX: 0001, DX: 0000

0:00:14:62.7.0038: CS: C600, DS: 9FC0, ES: 0000, SS: 0000

0:00:14:62.7.0040: SP: 7ED2, BP: 7ED4, SI: 00F8, DI: 0201

0:00:14:62.7.0042: IP: 0AC4, FLAGS: F246

0:00:14:62.7.0046: FLAGSINFO:c1P0a0ZstIdo1111



0:00:14:62.7.0079: C600:0AC6 (7406)JZ 0ACE

0:00:14:62.7.0081: Registers:

0:00:14:62.7.0083: AX: 0002, BX: 7C00, CX: 0001, DX: 0000

0:00:14:62.7.0085: CS: C600, DS: 9FC0, ES: 0000, SS: 0000

0:00:14:62.7.0088: SP: 7ED2, BP: 7ED4, SI: 00F8, DI: 0201

0:00:14:62.7.0089: IP: 0AC6, FLAGS: F246

0:00:14:62.7.0094: FLAGSINFO:c1P0a0ZstIdo1111



0:00:14:62.7.0126: C600:0ACE (88C2)MOVB DL,AL

0:00:14:62.7.0128: Registers:

0:00:14:62.7.0131: AX: 0002, BX: 7C00, CX: 0001, DX: 0000

0:00:14:62.7.0133: CS: C600, DS: 9FC0, ES: 0000, SS: 0000

0:00:14:62.7.0135: SP: 7ED2, BP: 7ED4, SI: 00F8, DI: 0201

0:00:14:62.7.0137: IP: 0ACE, FLAGS: F246

0:00:14:62.7.0142: FLAGSINFO:c1P0a0ZstIdo1111

So the boot disk to be booted at 0009FC0C is incorrect (it contains 2 instead of 80h). Anyone can tell me why?

Edit: Found the problem: The BIOS detects 4 floppy drives (The BIOS Equipment word has bits 7&6 set to 1, so it detected 4 floppy drives (two times two floppy drives)). Now I just need to find out why the BIOS detects 4 floppy drives instead of 2 (actually installed floppy drives).

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

Reply 2 of 3, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've fixed the problem: The PPI ports 0x62 and 0x63 needed to be added to properly detect the 2 floppy drives (instead of detecting 4 floppy drives and confusing the hard disk BIOS (drives A,B,C,D are floppy, drives E,F,G,H hard disk/cdrom in that case. It tries to boot the C drive (floppy #3) which doesn't exist, so it gives a timeout even through it's supposed to boot the harddisk.

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

Reply 3 of 3, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've just found out another problem: For some reason the BIOS seems to detect 4 floppy drives instead of the 2 floppy drives installed. Anyone knows how the Turbo XT BIOS detects the amount of floppy drives installed (0,1,2,3 or 4 drives)?

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