aboutsummaryrefslogtreecommitdiff
path: root/src/disk.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-02-25 22:25:15 -0500
committerKevin O'Connor <kevin@koconnor.net>2008-02-25 22:25:15 -0500
commitf076a3eeb9a0185b06a2abbba8c798a7761b2bdf (patch)
treec4a56a0d43fc683678e91ab10a9fe561f9ef65ca /src/disk.c
downloadseabios-hppa-rel-0.1.0.zip
seabios-hppa-rel-0.1.0.tar.gz
seabios-hppa-rel-0.1.0.tar.bz2
Initial checkin.rel-0.1.0
Diffstat (limited to 'src/disk.c')
-rw-r--r--src/disk.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/disk.c b/src/disk.c
new file mode 100644
index 0000000..8901b7d
--- /dev/null
+++ b/src/disk.c
@@ -0,0 +1,67 @@
+// 16bit code to access hard drives.
+//
+// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2002 MandrakeSoft S.A.
+//
+// This file may be distributed under the terms of the GNU GPLv3 license.
+
+#include "disk.h" // floppy_13
+#include "biosvar.h" // struct bregs
+#include "util.h" // debug_enter
+
+static void
+disk_13(struct bregs *regs, u8 drive)
+{
+ set_cf(regs, 1);
+}
+
+static void
+handle_legacy_disk(struct bregs *regs, u8 drive)
+{
+ if (drive < 0x80) {
+ floppy_13(regs, drive);
+ return;
+ }
+#if BX_USE_ATADRV
+ if (drive >= 0xE0) {
+ int13_cdrom(regs); // xxx
+ return;
+ }
+#endif
+
+ disk_13(regs, drive);
+}
+
+void VISIBLE
+handle_40(struct bregs *regs)
+{
+ debug_enter(regs);
+ handle_legacy_disk(regs, regs->dl);
+ debug_exit(regs);
+}
+
+// INT 13h Fixed Disk Services Entry Point
+void VISIBLE
+handle_13(struct bregs *regs)
+{
+ debug_enter(regs);
+ u8 drive = regs->dl;
+#if BX_ELTORITO_BOOT
+ if (regs->ah >= 0x4a || regs->ah <= 0x4d) {
+ int13_eltorito(regs);
+ } else if (cdemu_isactive() && cdrom_emulated_drive()) {
+ int13_cdemu(regs);
+ } else
+#endif
+ handle_legacy_disk(regs, drive);
+ debug_exit(regs);
+}
+
+// record completion in BIOS task complete flag
+void VISIBLE
+handle_76(struct bregs *regs)
+{
+ debug_enter(regs);
+ SET_BDA(floppy_harddisk_info, 0xff);
+ eoi_both_pics();
+}