1 // Definitions for X86 bios disks.
3 // Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
5 // This file may be distributed under the terms of the GNU GPLv3 license.
9 #include "ioport.h" // outb
10 #include "biosvar.h" // struct bregs
11 #include "util.h" // set_code_fail
13 #define DISK_RET_SUCCESS 0x00
14 #define DISK_RET_EPARAM 0x01
15 #define DISK_RET_EADDRNOTFOUND 0x02
16 #define DISK_RET_EWRITEPROTECT 0x03
17 #define DISK_RET_ECHANGED 0x06
18 #define DISK_RET_EBOUNDARY 0x09
19 #define DISK_RET_EBADTRACK 0x0c
20 #define DISK_RET_ECONTROLLER 0x20
21 #define DISK_RET_ETIMEOUT 0x80
22 #define DISK_RET_ENOTLOCKED 0xb0
23 #define DISK_RET_ELOCKED 0xb1
24 #define DISK_RET_ENOTREMOVABLE 0xb2
25 #define DISK_RET_ETOOMANYLOCKS 0xb4
26 #define DISK_RET_EMEDIA 0xC0
27 #define DISK_RET_ENOTREADY 0xAA
29 // Bios disk structures.
40 #define GET_INT13EXT(regs,var) \
41 GET_FARVAR((regs)->ds, ((struct int13ext_s*)((regs)->si+0))->var)
42 #define SET_INT13EXT(regs,var,val) \
43 SET_FARVAR((regs)->ds, ((struct int13ext_s*)((regs)->si+0))->var, (val))
45 // Disk Physical Table definition
69 #define GET_INT13DPT(regs,var) \
70 GET_FARVAR((regs)->ds, ((struct int13dpt_s*)((regs)->si+0))->var)
71 #define SET_INT13DPT(regs,var,val) \
72 SET_FARVAR((regs)->ds, ((struct int13dpt_s*)((regs)->si+0))->var, (val))
74 // Floppy "Disk Base Table"
89 struct floppy_ext_dbt_s {
90 struct floppy_dbt_s dbt;
97 // Helper function for setting up a return code.
99 disk_ret(struct bregs *regs, u8 code)
101 SET_BDA(disk_last_status, code);
103 set_code_fail(regs, code);
105 set_code_success(regs);
109 extern struct floppy_ext_dbt_s diskette_param_table2;
110 void floppy_13(struct bregs *regs, u8 drive);
114 void emu_access(struct bregs *regs, u8 device, u16 command);
115 void disk_13(struct bregs *regs, u8 device);
116 void disk_13XX(struct bregs *regs, u8 device);
119 void cdrom_13(struct bregs *regs, u8 device);
120 void cdemu_13(struct bregs *regs);
121 void cdemu_134b(struct bregs *regs);