dosbox-wii/src/ints/bios_disk.cpp

81 lines
2.3 KiB
C++
Raw Normal View History

2009-05-02 23:03:37 +02:00
/*
2009-05-02 23:53:27 +02:00
* Copyright (C) 2002-2004 The DOSBox Team
2009-05-02 23:03:37 +02:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "dosbox.h"
#include "callback.h"
#include "bios.h"
#include "regs.h"
#include "mem.h"
2009-05-02 23:27:47 +02:00
#include "dos_inc.h" /* for Drives[] */
2009-05-02 23:03:37 +02:00
static Bitu call_int13;
static BIOS_Disk * Floppys[2];
static BIOS_Disk * Harddisks[BIOS_MAX_DISK];
static Bit8u last_status;
static Bitu INT13_SmallHandler(void) {
switch (reg_ah) {
2009-05-02 23:27:47 +02:00
case 0x0:
reg_ah=0x00;
CALLBACK_SCF(false);
2009-05-02 23:43:00 +02:00
LOG(LOG_BIOS,LOG_NORMAL)("reset disk return succesfull");
2009-05-02 23:27:47 +02:00
break;
2009-05-02 23:03:37 +02:00
case 0x02: /* Read Disk Sectors */
2009-05-02 23:43:00 +02:00
LOG(LOG_BIOS,LOG_NORMAL)("INT13:02:Read Disk Sectors not supported failing");
2009-05-02 23:27:47 +02:00
reg_ah=0x80;
2009-05-02 23:03:37 +02:00
CALLBACK_SCF(true);
break;
2009-05-02 23:27:47 +02:00
case 0x04:
if(Drives[reg_dl]!=NULL) {
reg_ah=0;
CALLBACK_SCF(false);
}
else{
reg_ah=0x80;
CALLBACK_SCF(true);
}
2009-05-02 23:43:00 +02:00
LOG(LOG_BIOS,LOG_NORMAL)("INT 13:04 Verify sector used on %d, with result %d",reg_dl,reg_ah);
2009-05-02 23:27:47 +02:00
break;
2009-05-02 23:03:37 +02:00
case 0x08: /* Get Drive Parameters */
2009-05-02 23:43:00 +02:00
LOG(LOG_BIOS,LOG_NORMAL)("INT13:08:Get Drive parameters not supported failing");
2009-05-02 23:03:37 +02:00
reg_ah=0xff;
CALLBACK_SCF(true);
break;
case 0xff:
default:
2009-05-02 23:43:00 +02:00
LOG(LOG_BIOS,LOG_ERROR)("Illegal int 13h call %2X Fail it",reg_ah);
2009-05-02 23:03:37 +02:00
reg_ah=0xff;
CALLBACK_SCF(true);
}
return CBRET_NONE;
}
void BIOS_SetupDisks(void) {
/* TODO Start the time correctly */
call_int13=CALLBACK_Allocate();
CALLBACK_Setup(call_int13,&INT13_SmallHandler,CB_IRET);
RealSetVec(0x13,CALLBACK_RealPointer(call_int13));
/* Init the Disk Tables */
last_status=0;
/* Setup the Bios Area */
mem_writeb(BIOS_HARDDISK_COUNT,0);
};