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