blob: 8901b7d4b2a99a8e016f8f75ba0ad44dd6747c58 [file] [log] [blame]
Kevin O'Connorf076a3e2008-02-25 22:25:15 -05001// 16bit code to access hard drives.
2//
3// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
4// Copyright (C) 2002 MandrakeSoft S.A.
5//
6// This file may be distributed under the terms of the GNU GPLv3 license.
7
8#include "disk.h" // floppy_13
9#include "biosvar.h" // struct bregs
10#include "util.h" // debug_enter
11
12static void
13disk_13(struct bregs *regs, u8 drive)
14{
15 set_cf(regs, 1);
16}
17
18static void
19handle_legacy_disk(struct bregs *regs, u8 drive)
20{
21 if (drive < 0x80) {
22 floppy_13(regs, drive);
23 return;
24 }
25#if BX_USE_ATADRV
26 if (drive >= 0xE0) {
27 int13_cdrom(regs); // xxx
28 return;
29 }
30#endif
31
32 disk_13(regs, drive);
33}
34
35void VISIBLE
36handle_40(struct bregs *regs)
37{
38 debug_enter(regs);
39 handle_legacy_disk(regs, regs->dl);
40 debug_exit(regs);
41}
42
43// INT 13h Fixed Disk Services Entry Point
44void VISIBLE
45handle_13(struct bregs *regs)
46{
47 debug_enter(regs);
48 u8 drive = regs->dl;
49#if BX_ELTORITO_BOOT
50 if (regs->ah >= 0x4a || regs->ah <= 0x4d) {
51 int13_eltorito(regs);
52 } else if (cdemu_isactive() && cdrom_emulated_drive()) {
53 int13_cdemu(regs);
54 } else
55#endif
56 handle_legacy_disk(regs, drive);
57 debug_exit(regs);
58}
59
60// record completion in BIOS task complete flag
61void VISIBLE
62handle_76(struct bregs *regs)
63{
64 debug_enter(regs);
65 SET_BDA(floppy_harddisk_info, 0xff);
66 eoi_both_pics();
67}