PIT rewrite.

This commit is contained in:
OBattler
2019-12-02 07:05:12 +01:00
parent 573246a353
commit a838e8548f
25 changed files with 887 additions and 635 deletions

View File

@@ -29,7 +29,7 @@
* All models: The internal mouse controller does not work correctly with
* version 7.04 of the mouse driver.
*
* Version: @(#)m_amstrad.c 1.0.20 2019/03/09
* Version: @(#)m_amstrad.c 1.0.21 2019/11/15
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -2153,7 +2153,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
speaker_enable = val & 0x02;
if (speaker_enable)
was_speaker_enable = 1;
pit_set_gate(&pit, 2, val & 0x01);
pit_ctr_set_gate(&pit->counters[2], val & 0x01);
if (val & 0x80) {
/* Keyboard enabled, so enable PA reading. */

View File

@@ -8,15 +8,15 @@
*
* Standard PC/AT implementation.
*
* Version: @(#)m_at.c 1.0.10 2018/10/06
* Version: @(#)m_at.c 1.0.11 2019/11/15
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2017,2018 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
* Copyright 2017-2019 Fred N. van Kempen.
* Copyright 2016-2019 Miran Grca.
* Copyright 2008-2019 Sarah Walker.
*
* 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
@@ -63,7 +63,7 @@ machine_at_common_init_ex(const machine_t *model, int is_ibm)
{
machine_common_init(model);
pit_set_out_func(&pit, 1, pit_refresh_timer_at);
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_at);
pic2_init();
dma16_init();

View File

@@ -68,7 +68,7 @@
*
* WARNING THIS IS A WORK-IN-PROGRESS MODULE. USE AT OWN RISK.
*
* Version: @(#)europc.c 1.0.11 2019/09/27
* Version: @(#)europc.c 1.0.12 2019/11/15
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -717,7 +717,7 @@ machine_europc_init(const machine_t *model)
return ret;
machine_common_init(model);
pit_set_out_func(&pit, 1, pit_refresh_timer_xt);
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
nmi_init();

View File

@@ -8,7 +8,7 @@
*
* Emulation of the Olivetti M24.
*
* Version: @(#)m_olivetti_m24.c 1.0.20 2018/10/08
* Version: @(#)m_olivetti_m24.c 1.0.21 2019/11/15
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -658,7 +658,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
speaker_enable = val & 2;
if (speaker_enable)
was_speaker_enable = 1;
pit_set_gate(&pit, 2, val & 1);
pit_ctr_set_gate(&pit->counters[2], val & 1);
break;
}
}

View File

@@ -8,7 +8,7 @@
*
* Emulation of the IBM PCjr.
*
* Version: @(#)m_pcjr.c 1.0.13 2019/10/11
* Version: @(#)m_pcjr.c 1.0.14 2019/11/15
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -621,7 +621,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
speaker_enable = val & 2;
if (speaker_enable)
was_speaker_enable = 1;
pit_set_gate(&pit, 2, val & 1);
pit_ctr_set_gate(&pit->counters[2], val & 1);
sn76489_mute = speaker_mute = 1;
switch (val & 0x60) {
case 0x00:
@@ -636,7 +636,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
case 0xa0:
nmi_mask = val & 0x80;
pit_set_using_timer(&pit, 1, !(val & 0x20));
pit_ctr_set_using_timer(&pit->counters[1], !(val & 0x20));
break;
}
}
@@ -821,8 +821,7 @@ machine_pcjr_init(const machine_t *model)
pcjr->composite = (display_type != PCJR_RGB);
pic_init_pcjr();
pit_init();
pit_set_out_func(&pit, 0, pit_irq0_timer_pcjr);
pit_common_init(0, pit_irq0_timer_pcjr, NULL);
cpu_set();

View File

@@ -22,7 +22,7 @@
* The reserved 384K is remapped to the top of extended memory.
* If this is not done then you get an error on startup.
*
* Version: @(#)m_ps1.c 1.0.16 2019/11/01
* Version: @(#)m_ps1.c 1.0.17 2019/11/15
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -515,7 +515,7 @@ ps1_common_init(const machine_t *model)
mem_remap_top(384);
pit_set_out_func(&pit, 1, pit_refresh_timer_at);
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_at);
dma16_init();
pic2_init();

View File

@@ -58,7 +58,7 @@ static uint8_t ps2_read(uint16_t port, void *p)
case 0x190:
return ps2_190;
#ifdef FIXME
#ifdef FIXME
case 0x322:
temp = ps2_hd.status;
break;
@@ -67,7 +67,7 @@ static uint8_t ps2_read(uint16_t port, void *p)
ps2_hd.int_status &= ~0x02;
break;
#endif
default:
temp = 0xff;
break;
@@ -118,8 +118,8 @@ static void ps2_write(uint16_t port, uint8_t val, void *p)
case 0x190:
ps2_190 = val;
break;
#ifdef FIXME
#ifdef FIXME
case 0x322:
ps2_hd.ctrl = val;
if (val & 0x80)
@@ -146,7 +146,7 @@ static void ps2board_init(void)
io_sethandler(0x0322, 0x0001, ps2_read, NULL, NULL, ps2_write, NULL, NULL, NULL);
io_sethandler(0x0324, 0x0001, ps2_read, NULL, NULL, ps2_write, NULL, NULL, NULL);
#endif
device_add(&port_92_device);
ps2_190 = 0;
@@ -173,9 +173,12 @@ machine_ps2_m30_286_init(const machine_t *model)
return ret;
machine_common_init(model);
mem_remap_top(384);
device_add(&fdc_at_ps1_device);
pit_set_out_func(&pit, 1, pit_refresh_timer_at);
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_at);
dma16_init();
device_add(&keyboard_ps2_ps2_device);
device_add(&ps_nvr_device);

View File

@@ -22,7 +22,7 @@ machine_xt_common_init(const machine_t *model)
{
machine_common_init(model);
pit_set_out_func(&pit, 1, pit_refresh_timer_xt);
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
device_add(&fdc_xt_device);
nmi_init();
@@ -52,10 +52,10 @@ machine_pc_init(const machine_t *model)
if (bios_only || !ret)
return ret;
machine_xt_common_init(model);
device_add(&keyboard_pc_device);
machine_xt_common_init(model);
return ret;
}
@@ -85,11 +85,11 @@ machine_pc82_init(const machine_t *model)
if (bios_only || !ret)
return ret;
machine_xt_common_init(model);
device_add(&keyboard_pc82_device);
device_add(&ibm_5161_device);
machine_xt_common_init(model);
return ret;
}
@@ -97,9 +97,9 @@ machine_pc82_init(const machine_t *model)
static void
machine_xt_init_ex(const machine_t *model)
{
machine_xt_common_init(model);
device_add(&keyboard_xt_device);
machine_xt_common_init(model);
}
@@ -166,11 +166,11 @@ machine_xt86_init(const machine_t *model)
if (bios_only || !ret)
return ret;
machine_xt_common_init(model);
device_add(&keyboard_xt86_device);
device_add(&ibm_5161_device);
machine_xt_common_init(model);
return ret;
}
@@ -178,9 +178,9 @@ machine_xt86_init(const machine_t *model)
static void
machine_xt_clone_init(const machine_t *model)
{
machine_xt_common_init(model);
device_add(&keyboard_xt86_device);
machine_xt_common_init(model);
}

View File

@@ -8,14 +8,14 @@
*
* Emulation of various Compaq XT-class PC's.
*
* Version: @(#)m_xt_compaq.c 1.0.4 2018/03/18
* Version: @(#)m_xt_compaq.c 1.0.5 2019/11/15
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* TheCollector1995, <mariogplayer@gmail.com>
*
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2019 Miran Grca.
*/
#include <stdio.h>
#include <stdint.h>
@@ -50,7 +50,7 @@ machine_xt_compaq_init(const machine_t *model)
machine_common_init(model);
pit_set_out_func(&pit, 1, pit_refresh_timer_xt);
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
device_add(&keyboard_xt_compaq_device);
device_add(&fdc_xt_device);

View File

@@ -166,7 +166,7 @@ machine_xt_lxt3_init(const machine_t *model)
machine_common_init(model);
pit_set_out_func(&pit, 1, pit_refresh_timer_xt);
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
device_add(&keyboard_xt_lxt3_device);
device_add(&fdc_xt_device);

View File

@@ -51,15 +51,15 @@
* NOTE: Still need to figure out a way to load/save ConfigSys and
* HardRAM stuff. Needs to be linked in to the NVR code.
*
* Version: @(#)m_xt_t1000.c 1.0.13 2018/10/22
* Version: @(#)m_xt_t1000.c 1.0.14 2019/11/15
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2018 Fred N. van Kempen.
* Copyright 2018 Miran Grca.
* Copyright 2018 Sarah Walker.
* Copyright 2018,2019 Fred N. van Kempen.
* Copyright 2018,2019 Miran Grca.
* Copyright 2018,2019 Sarah Walker.
*
* 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
@@ -917,7 +917,7 @@ machine_xt_t1000_init(const machine_t *model)
read_ctl,NULL,NULL, write_ctl,NULL,NULL, &t1000);
machine_common_init(model);
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
device_add(&keyboard_xt_device);
t1000.fdc = device_add(&fdc_xt_device);
@@ -985,7 +985,7 @@ machine_xt_t1200_init(const machine_t *model)
read_t1200_nvram, NULL, NULL,
write_t1200_nvram, NULL, NULL,
NULL, 0, &t1000);
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
device_add(&keyboard_xt_device);
t1000.fdc = device_add(&fdc_xt_t1x00_device);

View File

@@ -9,14 +9,14 @@
* Emulation of various Zenith PC compatible machines.
* Currently only the Zenith Data Systems Supersport is emulated.
*
* Version: @(#)m_xt_compaq.c 1.0.0 2019/01/13
* Version: @(#)m_xt_compaq.c 1.0.1 2019/11/15
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* TheCollector1995, <mariogplayer@gmail.com>
*
* Copyright 2008-2018 Sarah Walker.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2019 Sarah Walker.
* Copyright 2016-2019 Miran Grca.
*/
#include <stdarg.h>
#include <stdint.h>
@@ -124,7 +124,7 @@ machine_xt_zenith_init(const machine_t *model)
device_add(&i8250_device);
serial_set_next_inst(2); /* So that serial_standalone_init() won't do anything. */
device_add(&zenith_scratchpad_device);
pit_set_out_func(&pit, 1, pit_refresh_timer_xt);
pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt);
device_add(&keyboard_xt_compaq_device);
nmi_init();

View File

@@ -8,7 +8,7 @@
*
* Handling of the emulated machines.
*
* Version: @(#)machine.c 1.0.37 2018/11/12
* Version: @(#)machine.c 1.0.38 2019/11/15
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -128,5 +128,5 @@ machine_common_init(const machine_t *model)
cpu_set();
pit_init();
pit_common_init(!!AT, pit_irq0_timer, NULL);
}