Fix the #include order for config.h.
[wine] / msdos / int26.c
1 /*
2  * DOS interrupt 26h handler
3  */
4
5 #include <stdlib.h>
6 #include <fcntl.h>
7 #include <unistd.h>
8 #include "msdos.h"
9 #include "miscemu.h"
10 #include "drive.h"
11 #include "debugtools.h"
12
13 DEFAULT_DEBUG_CHANNEL(int);
14
15 /**********************************************************************
16  *          INT_Int26Handler (WPROCS.138)
17  *
18  * Handler for int 26h (absolute disk read).
19  */
20 void WINAPI INT_Int26Handler( CONTEXT86 *context )
21 {
22     BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, context->SegDs, context->Ebx );
23     DWORD begin, length;
24
25     if (!DRIVE_IsValid(LOBYTE(context->Eax)))
26     {
27         SET_CFLAG(context);
28         AX_reg(context) = 0x0201;        /* unknown unit */
29         return;
30     }
31
32     if (LOWORD(context->Ecx) == 0xffff)
33     {
34         begin   = *(DWORD *)dataptr;
35         length  = *(WORD *)(dataptr + 4);
36         dataptr = (BYTE *)CTX_SEG_OFF_TO_LIN( context,
37                                         *(WORD *)(dataptr + 8), *(DWORD *)(dataptr + 6) );
38     }
39     else
40     {
41         begin  = LOWORD(context->Edx);
42         length = LOWORD(context->Ecx);
43     }
44                 
45     TRACE("int26: abs diskwrite, drive %d, sector %ld, "
46                  "count %ld, buffer %p\n",
47                  AL_reg(context), begin, length, dataptr );
48
49     DRIVE_RawWrite(LOBYTE(context->Eax), begin, length, dataptr, TRUE);
50     RESET_CFLAG(context);
51 }