Release 961013
[wine/multimedia.git] / miscemu / int25.c
blobf1b8052f172ad073c3ec5554591d4e5abf285560
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include "msdos.h"
5 #include "ldt.h"
6 #include "miscemu.h"
7 #include "drive.h"
8 #include "stddebug.h"
9 /* #define DEBUG_INT */
10 #include "debug.h"
12 /**********************************************************************
13 * INT_Int25Handler
15 * Handler for int 25h (absolute disk read).
17 void INT_Int25Handler( SIGCONTEXT *context )
19 BYTE *dataptr = PTR_SEG_OFF_TO_LIN( DS_reg(context), BX_reg(context) );
20 DWORD begin, length;
22 if (!DRIVE_IsValid(AL_reg(context)))
24 SET_CFLAG(context);
25 AX_reg(context) = 0x0101; /* unknown unit */
26 return;
29 if (CX_reg(context) == 0xffff)
31 begin = *(DWORD *)dataptr;
32 length = *(WORD *)(dataptr + 4);
33 dataptr = (BYTE *)PTR_SEG_TO_LIN( *(SEGPTR *)(dataptr + 6) );
35 else
37 begin = DX_reg(context);
38 length = CX_reg(context);
40 dprintf_int( stdnimp, "int25: abs diskread, drive %d, sector %ld, "
41 "count %ld, buffer %d\n",
42 AL_reg(context), begin, length, (int) dataptr);
44 memset(dataptr, 0, length * 512);
46 if (begin == 0 && length > 1) *(dataptr + 512) = 0xf8;
48 if (begin == 1) *dataptr = 0xf8;
50 RESET_CFLAG(context);