Jean-Claude Batista
[wine/multimedia.git] / msdos / int26.c
blobdf84e6ad4d5b6c4c8939a2b1b674d4fd8e0d14fb
1 /*
2 * DOS interrupt 26h handler
3 */
5 #include <stdlib.h>
6 #include <fcntl.h>
7 #include <unistd.h>
8 #include "msdos.h"
9 #include "ldt.h"
10 #include "miscemu.h"
11 #include "drive.h"
12 #include "debugtools.h"
14 DEFAULT_DEBUG_CHANNEL(int)
16 /**********************************************************************
17 * INT_Int26Handler
19 * Handler for int 26h (absolute disk read).
21 void WINAPI INT_Int26Handler( CONTEXT86 *context )
23 BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EBX_reg(context) );
24 DWORD begin, length;
26 if (!DRIVE_IsValid(AL_reg(context)))
28 SET_CFLAG(context);
29 AX_reg(context) = 0x0201; /* unknown unit */
30 return;
33 if (CX_reg(context) == 0xffff)
35 begin = *(DWORD *)dataptr;
36 length = *(WORD *)(dataptr + 4);
37 dataptr = (BYTE *)CTX_SEG_OFF_TO_LIN( context,
38 *(WORD *)(dataptr + 8), *(DWORD *)(dataptr + 6) );
40 else
42 begin = DX_reg(context);
43 length = CX_reg(context);
46 TRACE("int26: abs diskwrite, drive %d, sector %ld, "
47 "count %ld, buffer %p\n",
48 AL_reg(context), begin, length, dataptr );
50 DRIVE_RawWrite(AL_reg(context), begin, length, dataptr, TRUE);
51 RESET_CFLAG(context);