Release 971221
[wine/multimedia.git] / msdos / int13.c
blob1e86258687de8f5c533930beb463d4f33ee1ba20
1 /*
2 * BIOS interrupt 13h handler
3 */
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include "miscemu.h"
8 #include "stddebug.h"
9 /* #define DEBUG_INT */
10 #include "debug.h"
13 /**********************************************************************
14 * INT_Int13Handler
16 * Handler for int 13h (disk I/O).
18 void WINAPI INT_Int13Handler( CONTEXT *context )
20 switch(AH_reg(context))
22 case 0x00: /* RESET DISK SYSTEM */
23 case 0x04: /* VERIFY DISK SECTOR(S) */
24 AH_reg(context) = 0;
25 break;
27 case 0x05: /* FORMAT TRACK */
28 case 0x06: /* FORMAT TRACK AND SET BAD SECTOR FLAGS */
29 case 0x07: /* FORMAT DRIVE STARTING AT GIVEN TRACK */
30 /* despite of what Ralf Brown says, 0x06 and 0x07 seem to set CFLAG, too (at least my BIOS does that) */
31 AH_reg(context) = 0x0c;
32 SET_CFLAG(context);
33 break;
35 case 0x08: /* GET DRIVE PARAMETERS */
36 AH_reg(context) = (DL_reg(context) & 0x80) ? 0x07 : 0x01;
37 SET_CFLAG(context);
38 break;
40 case 0x09: /* INITIALIZE CONTROLLER WITH DRIVE PARAMETERS */
41 case 0x0c: /* SEEK TO CYLINDER */
42 case 0x0d: /* RESET HARD DISKS */
43 case 0x10: /* CHECK IF DRIVE READY */
44 case 0x11: /* RECALIBRATE DRIVE */
45 case 0x14: /* CONTROLLER INTERNAL DIAGNOSTIC */
46 AH_reg(context) = 0;
47 break;
49 case 0x0e: /* READ SECTOR BUFFER (XT only) */
50 case 0x0f: /* WRITE SECTOR BUFFER (XT only) */
51 case 0x12: /* CONTROLLER RAM DIAGNOSTIC (XT,PS) */
52 case 0x13: /* DRIVE DIAGNOSTIC (XT,PS) */
53 AH_reg(context) = 0x01;
54 SET_CFLAG(context);
55 break;
57 default:
58 INT_BARF( context, 0x13 );