Release 950727
[wine] / miscemu / int26.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "registers.h"
4 #include "msdos.h"
5 #include "ldt.h"
6 #include "wine.h"
7 #include "miscemu.h"
8 #include "dos_fs.h"
9 #include "stddebug.h"
10 /* #define DEBUG_INT */
11 #include "debug.h"
12
13 /**********************************************************************
14  *          INT_Int26Handler
15  *
16  * Handler for int 26h (absolute disk read).
17  */
18 void INT_Int26Handler( struct sigcontext_struct sigcontext )
19 {
20 #define context (&sigcontext)
21         BYTE *dataptr = PTR_SEG_OFF_TO_LIN(DS, BX);
22         DWORD begin, length;
23
24         if(!DOS_ValidDrive(AL))
25         {
26             SetCflag;
27             AX = 0x0101;        /* unknown unit */
28             return;
29         }
30
31         if (CX == 0xffff) {
32                 begin = getdword(dataptr);
33                 length = getword(&dataptr[4]);
34                 dataptr = (BYTE *) PTR_SEG_TO_LIN(getdword(&dataptr[6]));
35                         
36         } else {
37                 begin = DX;
38                 length = CX;
39         }
40                 
41         dprintf_int(stdnimp,"int26: abs diskwrite, drive %d, sector %ld, "
42         "count %ld, buffer %d\n", AL, begin, length, (int) dataptr);
43
44         ResetCflag;
45 #undef context
46 }