2 * DOS interrupt 25h handler
15 /**********************************************************************
18 * Handler for int 25h (absolute disk read).
20 void WINAPI
INT_Int25Handler( CONTEXT
*context
)
22 BYTE
*dataptr
= CTX_SEG_OFF_TO_LIN( context
, DS_reg(context
), EBX_reg(context
) );
26 if (!DRIVE_IsValid(AL_reg(context
)))
29 AX_reg(context
) = 0x0101; /* unknown unit */
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) );
42 begin
= DX_reg(context
);
43 length
= CX_reg(context
);
45 TRACE(int, "int25: abs diskread, drive %d, sector %ld, "
46 "count %ld, buffer %d\n",
47 AL_reg(context
), begin
, length
, (int) dataptr
);
49 if ((fd
= DRIVE_OpenDevice( AL_reg(context
), O_RDONLY
)) != -1)
51 lseek( fd
, begin
* 512, SEEK_SET
);
52 /* FIXME: check errors */
53 read( fd
, dataptr
, length
* 512 );
58 memset(dataptr
, 0, length
* 512);
59 if (begin
== 0 && length
> 1) *(dataptr
+ 512) = 0xf8;
60 if (begin
== 1) *dataptr
= 0xf8;