Files
86Box/src/cdrom/cdrom_null.c

162 lines
2.5 KiB
C
Raw Normal View History

/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Implementation of the CD-ROM null interface for unmounted
* guest CD-ROM drives.
*
* Version: @(#)cdrom_null.c 1.0.7 2018/03/26
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2008-2016 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
2017-10-17 01:59:09 -04:00
#include "../86box.h"
#include "../scsi/scsi.h"
2017-05-18 14:03:43 -04:00
#include "cdrom.h"
2017-05-18 14:03:43 -04:00
static CDROM null_cdrom;
static int
null_ready(uint8_t id)
2017-05-18 14:03:43 -04:00
{
return(0);
2017-05-18 14:03:43 -04:00
}
2017-05-18 14:03:43 -04:00
/* Always return 0, the contents of a null CD-ROM drive never change. */
static int
null_medium_changed(uint8_t id)
2017-05-18 14:03:43 -04:00
{
return(0);
2017-05-18 14:03:43 -04:00
}
static uint8_t
null_getcurrentsubchannel(uint8_t id, uint8_t *b, int msf)
2017-05-18 14:03:43 -04:00
{
return(0x13);
2017-05-18 14:03:43 -04:00
}
static int
null_readsector_raw(uint8_t id, uint8_t *buffer, int sector, int ismsf, int cdrom_sector_type, int cdrom_sector_flags, int *len)
2017-05-18 14:03:43 -04:00
{
*len = 0;
return(0);
2017-05-18 14:03:43 -04:00
}
static int
null_readtoc(uint8_t id, uint8_t *b, uint8_t starttrack, int msf, int maxlen, int single)
2017-05-18 14:03:43 -04:00
{
return(0);
2017-05-18 14:03:43 -04:00
}
static int
null_readtoc_session(uint8_t id, uint8_t *b, int msf, int maxlen)
2017-05-18 14:03:43 -04:00
{
return(0);
2017-05-18 14:03:43 -04:00
}
static int
null_readtoc_raw(uint8_t id, uint8_t *b, int maxlen)
2017-05-18 14:03:43 -04:00
{
return(0);
2017-05-18 14:03:43 -04:00
}
static uint32_t
null_size(uint8_t id)
2017-05-18 14:03:43 -04:00
{
return(0);
2017-05-18 14:03:43 -04:00
}
static int
null_status(uint8_t id)
2017-05-18 14:03:43 -04:00
{
return(CD_STATUS_EMPTY);
2017-05-18 14:03:43 -04:00
}
void
cdrom_null_reset(uint8_t id)
2017-05-18 14:03:43 -04:00
{
}
2017-05-18 14:03:43 -04:00
void cdrom_set_null_handler(uint8_t id);
int
cdrom_null_open(uint8_t id)
2017-05-18 14:03:43 -04:00
{
cdrom_set_null_handler(id);
return(0);
2017-05-18 14:03:43 -04:00
}
void
null_close(uint8_t id)
2017-05-18 14:03:43 -04:00
{
}
static
void null_exit(uint8_t id)
2017-05-18 14:03:43 -04:00
{
}
static int
null_media_type_id(uint8_t id)
2017-05-18 14:03:43 -04:00
{
return(0x70);
2017-05-18 14:03:43 -04:00
}
void
cdrom_set_null_handler(uint8_t id)
2017-05-18 14:03:43 -04:00
{
cdrom[id]->handler = &null_cdrom;
cdrom_drives[id].host_drive = 0;
memset(cdrom_image[id].image_path, 0, sizeof(cdrom_image[id].image_path));
2017-05-18 14:03:43 -04:00
}
static CDROM null_cdrom = {
null_ready,
null_medium_changed,
null_media_type_id,
NULL,
NULL,
null_readtoc,
null_readtoc_session,
null_readtoc_raw,
null_getcurrentsubchannel,
null_readsector_raw,
NULL,
NULL,
NULL,
null_size,
null_status,
NULL,
null_exit
2017-05-18 14:03:43 -04:00
};