Release 941017
[wine/gsoc-2012-control.git] / miscemu / int25.c
blob7f957176ecd1f22cbd123b22ec9433aae958ae21
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "registers.h"
4 #include "msdos.h"
5 #include "wine.h"
6 #include "stddebug.h"
7 /* #define DEBUG_INT */
8 /* #undef DEBUG_INT */
9 #include "debug.h"
11 int do_int25(struct sigcontext_struct *context)
13 BYTE *dataptr = pointer(DS, BX);
14 DWORD begin, length;
16 if (CX == 0xffff) {
17 begin = getdword(dataptr);
18 length = getword(&dataptr[4]);
19 dataptr = (BYTE *) getdword(&dataptr[6]);
21 } else {
22 begin = DX;
23 length = CX;
25 dprintf_int(stdnimp, "int25: abs diskread, drive %d, sector %d, "
26 "count %d, buffer %d\n", EAX & 0xff, begin, length, (int) dataptr);
28 memset(dataptr, 0, length * 512);
30 if (begin == 0 && length > 1)
31 *(dataptr + 512) = 0xf8;
33 if (begin == 1)
34 *dataptr = 0xf8;
36 ResetCflag;
38 /* push flags on stack */
39 SP -= sizeof(WORD);
40 setword(pointer(SS,SP), (WORD) EFL);
42 return 1;