blob: 9b207a852edf123e0b7f228a698fc8a0d0042312 [file] [log] [blame]
Alexandre Julliard9ea19e51997-01-01 17:29:55 +00001/*
2 * DOS interrupt 26h handler
3 */
4
Alexandre Julliard58199531994-04-21 01:20:00 +00005#include <stdlib.h>
Alexandre Julliard60ce85c1998-02-01 18:33:27 +00006#include <fcntl.h>
7#include <unistd.h>
Alexandre Julliard8d24ae61994-04-05 21:42:43 +00008#include "msdos.h"
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00009#include "ldt.h"
Alexandre Julliard234bc241994-12-10 13:02:28 +000010#include "miscemu.h"
Alexandre Julliard4f8c37b1996-01-14 18:12:01 +000011#include "drive.h"
Alexandre Julliard61fece01999-06-26 19:09:08 +000012#include "debugtools.h"
Alexandre Julliardaca05781994-10-17 18:12:41 +000013
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000014DEFAULT_DEBUG_CHANNEL(int)
15
Alexandre Julliarde2991ea1995-07-29 13:09:43 +000016/**********************************************************************
17 * INT_Int26Handler
18 *
19 * Handler for int 26h (absolute disk read).
20 */
Alexandre Julliard617955d1999-06-26 18:40:24 +000021void WINAPI INT_Int26Handler( CONTEXT86 *context )
Alexandre Julliard8d24ae61994-04-05 21:42:43 +000022{
Alexandre Julliardd8fab2e2000-09-25 23:53:07 +000023 BYTE *dataptr = CTX_SEG_OFF_TO_LIN( context, context->SegDs, context->Ebx );
Alexandre Julliard808cb041995-08-17 17:11:36 +000024 DWORD begin, length;
Alexandre Julliard8d24ae61994-04-05 21:42:43 +000025
Alexandre Julliardd8fab2e2000-09-25 23:53:07 +000026 if (!DRIVE_IsValid(LOBYTE(context->Eax)))
Alexandre Julliard808cb041995-08-17 17:11:36 +000027 {
Alexandre Julliardca22b331996-07-12 19:02:39 +000028 SET_CFLAG(context);
Andreas Mohraa4aca21999-03-27 16:13:18 +000029 AX_reg(context) = 0x0201; /* unknown unit */
Alexandre Julliard808cb041995-08-17 17:11:36 +000030 return;
31 }
Alexandre Julliard594997c1995-04-30 10:05:20 +000032
Alexandre Julliardd8fab2e2000-09-25 23:53:07 +000033 if (LOWORD(context->Ecx) == 0xffff)
Alexandre Julliard808cb041995-08-17 17:11:36 +000034 {
Alexandre Julliard4f8c37b1996-01-14 18:12:01 +000035 begin = *(DWORD *)dataptr;
36 length = *(WORD *)(dataptr + 4);
Ulrich Weigand7129d9f1998-11-25 10:29:22 +000037 dataptr = (BYTE *)CTX_SEG_OFF_TO_LIN( context,
38 *(WORD *)(dataptr + 8), *(DWORD *)(dataptr + 6) );
Alexandre Julliard808cb041995-08-17 17:11:36 +000039 }
40 else
41 {
Alexandre Julliardd8fab2e2000-09-25 23:53:07 +000042 begin = LOWORD(context->Edx);
43 length = LOWORD(context->Ecx);
Alexandre Julliard808cb041995-08-17 17:11:36 +000044 }
Alexandre Julliard58199531994-04-21 01:20:00 +000045
Alexandre Julliard61fece01999-06-26 19:09:08 +000046 TRACE("int26: abs diskwrite, drive %d, sector %ld, "
Andreas Mohrcc0248e1999-01-03 12:31:51 +000047 "count %ld, buffer %p\n",
48 AL_reg(context), begin, length, dataptr );
Alexandre Julliard8d24ae61994-04-05 21:42:43 +000049
Alexandre Julliardd8fab2e2000-09-25 23:53:07 +000050 DRIVE_RawWrite(LOBYTE(context->Eax), begin, length, dataptr, TRUE);
Alexandre Julliardca22b331996-07-12 19:02:39 +000051 RESET_CFLAG(context);
Alexandre Julliard8d24ae61994-04-05 21:42:43 +000052}