2017-09-02 20:39:57 +02:00
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
|
|
|
|
* Handling of the emulated machines.
|
|
|
|
|
*
|
2017-11-08 16:27:10 -05:00
|
|
|
* Version: @(#)machine.c 1.0.27 2017/11/08
|
2017-09-02 20:39:57 +02:00
|
|
|
*
|
|
|
|
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
|
|
|
|
* Miran Grca, <mgrca8@gmail.com>
|
2017-10-07 22:18:30 -04:00
|
|
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
|
|
|
|
*
|
2017-09-02 20:39:57 +02:00
|
|
|
* Copyright 2008-2017 Sarah Walker.
|
|
|
|
|
* Copyright 2016,2017 Miran Grca.
|
2017-10-07 22:18:30 -04:00
|
|
|
* Copyright 2017 Fred N. van Kempen.
|
2017-09-02 20:39:57 +02:00
|
|
|
*/
|
|
|
|
|
#include <stdio.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <wchar.h>
|
2017-10-17 01:59:09 -04:00
|
|
|
#include "../86box.h"
|
2017-11-08 16:27:10 -05:00
|
|
|
#include "../dma.h"
|
|
|
|
|
#include "../pic.h"
|
|
|
|
|
#include "../pit.h"
|
2017-09-25 04:31:20 -04:00
|
|
|
#include "../mem.h"
|
|
|
|
|
#include "../rom.h"
|
2017-11-08 16:27:10 -05:00
|
|
|
#include "../lpt.h"
|
|
|
|
|
#include "../serial.h"
|
2017-09-04 01:52:29 -04:00
|
|
|
#include "../floppy/floppy.h"
|
|
|
|
|
#include "../floppy/fdd.h"
|
2017-11-08 16:27:10 -05:00
|
|
|
#include "../floppy/fdc.h"
|
2017-09-02 20:39:57 +02:00
|
|
|
#include "machine.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int machine;
|
2017-11-05 01:57:04 -05:00
|
|
|
int AT, PCI;
|
2017-09-02 20:39:57 +02:00
|
|
|
int romset;
|
|
|
|
|
|
|
|
|
|
|
2017-09-25 04:31:20 -04:00
|
|
|
void
|
|
|
|
|
machine_init(void)
|
2017-09-02 20:39:57 +02:00
|
|
|
{
|
2017-09-25 04:31:20 -04:00
|
|
|
pclog("Initializing as \"%s\"\n", machine_getname());
|
2017-09-02 20:39:57 +02:00
|
|
|
|
2017-10-13 02:41:17 -04:00
|
|
|
/* Set up the architecture flags. */
|
|
|
|
|
AT = IS_ARCH(machine, MACHINE_AT);
|
|
|
|
|
PCI = IS_ARCH(machine, MACHINE_PCI);
|
2017-09-02 20:39:57 +02:00
|
|
|
|
2017-10-07 00:46:54 -04:00
|
|
|
/* Load the machine's ROM BIOS. */
|
|
|
|
|
rom_load_bios(romset);
|
|
|
|
|
mem_add_bios();
|
2017-09-25 04:31:20 -04:00
|
|
|
|
2017-11-05 20:43:01 -05:00
|
|
|
/* All good, boot the machine! */
|
|
|
|
|
machines[machine].init(&machines[machine]);
|
2017-09-02 20:39:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-11-08 16:27:10 -05:00
|
|
|
void
|
|
|
|
|
machine_common_init(machine_t *model)
|
2017-09-02 20:39:57 +02:00
|
|
|
{
|
2017-11-08 16:27:10 -05:00
|
|
|
/* System devices first. */
|
|
|
|
|
dma_init();
|
|
|
|
|
pic_init();
|
|
|
|
|
pit_init();
|
2017-09-02 20:39:57 +02:00
|
|
|
|
2017-11-08 16:27:10 -05:00
|
|
|
if (lpt_enabled)
|
|
|
|
|
lpt_init();
|
2017-09-02 20:39:57 +02:00
|
|
|
|
2017-11-08 16:27:10 -05:00
|
|
|
if (serial_enabled[0])
|
|
|
|
|
serial_setup(1, SERIAL1_ADDR, SERIAL1_IRQ);
|
2017-09-02 20:39:57 +02:00
|
|
|
|
2017-11-08 16:27:10 -05:00
|
|
|
if (serial_enabled[1])
|
|
|
|
|
serial_setup(2, SERIAL2_ADDR, SERIAL2_IRQ);
|
2017-09-02 20:39:57 +02:00
|
|
|
|
2017-11-08 16:27:10 -05:00
|
|
|
fdc_add();
|
2017-09-02 20:39:57 +02:00
|
|
|
}
|