Various small changes and fixes.

Added the cassette interface to the system (initial dev version.)
This commit is contained in:
waltje
2019-02-14 01:34:54 -05:00
parent b2d7b102c8
commit 031cc9f4cf
11 changed files with 94 additions and 68 deletions

View File

@@ -11,13 +11,13 @@
* NOTE: Several changes to disable Mode1 for now, as this breaks
* the TSX32 operating system. More cleanups needed..
*
* Version: @(#)keyboard_at.c 1.0.16 2018/10/05
* Version: @(#)keyboard_at.c 1.0.17 2019/02/12
*
* 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 2017-2019 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
@@ -1768,7 +1768,7 @@ do_command:
speaker_gated = val & 1;
speaker_enable = val & 2;
if (speaker_enable)
was_speaker_enable = 1;
speaker_was_enable = 1;
pit_set_gate(&pit, 2, val & 1);
if ((kbd->flags & KBC_VEN_MASK) == KBC_VEN_XI8088) {

View File

@@ -8,7 +8,7 @@
*
* Implementation of the XT-style keyboard.
*
* Version: @(#)keyboard_xt.c 1.0.12 2019/02/12
* Version: @(#)keyboard_xt.c 1.0.13 2019/02/12
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -500,7 +500,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
}
if (speaker_enable)
was_speaker_enable = 1;
speaker_was_enable = 1;
pit_set_gate(&pit, 2, val & 1);
if (val & 0x80) {

View File

@@ -8,7 +8,7 @@
*
* Implementation of the PC-Speaker device.
*
* Version: @(#)snd_speaker.c 1.0.5 2019/02/10
* Version: @(#)snd_speaker.c 1.0.6 2019/02/12
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -50,11 +50,10 @@
int speaker_mute = 0,
speaker_gated = 0,
speaker_enable = 0,
was_speaker_enable = 0;
speaker_was_enable = 0;
int gated,
speakval,
speakon;
int speaker_val,
speaker_on;
static int32_t speaker_buffer[SOUNDBUFLEN];
@@ -70,18 +69,18 @@ speaker_update(void)
return;
for (; speaker_pos < sound_pos_global; speaker_pos++) {
if (speaker_gated && was_speaker_enable) {
if (speaker_gated && speaker_was_enable) {
if (!pit.m[2] || pit.m[2] == 4)
val = speakval;
val = speaker_val;
else if (pit.l[2] < 0x40)
val = 0x0a00;
else
val = speakon ? 0x1400 : 0;
val = speaker_on ? 0x1400 : 0;
} else
val = was_speaker_enable ? 0x1400 : 0;
val = speaker_was_enable ? 0x1400 : 0;
if (! speaker_enable)
was_speaker_enable = 0;
speaker_was_enable = 0;
speaker_buffer[speaker_pos] = val;
}
@@ -116,6 +115,6 @@ speaker_reset(void)
sound_add_handler(get_buffer, NULL);
speaker_mute = speaker_gated = 0;
speaker_enable = was_speaker_enable = 0;
speaker_enable = speaker_was_enable = 0;
speaker_pos = 0;
}

View File

@@ -8,13 +8,13 @@
*
* Definitions for the PC-Speaker driver.
*
* Version: @(#)snd_speaker.h 1.0.2 2018/09/22
* Version: @(#)snd_speaker.h 1.0.3 2019/02/12
*
* 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 2017-2019 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
@@ -43,11 +43,10 @@
extern int speaker_mute;
extern int speaker_gated;
extern int speaker_enable,
was_speaker_enable;
speaker_was_enable;
extern int gated,
speakval,
speakon;
extern int speaker_val,
speaker_on;
extern void speaker_reset(void);

View File

@@ -13,7 +13,7 @@
* B4 to 40, two writes to 43, then two reads
* - value _does_ change!
*
* Version: @(#)pit.c 1.0.8 2019/02/10
* Version: @(#)pit.c 1.0.9 2019/02/12
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -429,9 +429,9 @@ pit_write(uint16_t addr, uint8_t val, void *priv)
/* PIT latches are in fractions of 60 ms, so convert to sample using the formula below. */
sv = (((double) dev->l[2]) / 60.0) * 16384.0;
speakval = ((int) sv) - 0x2000;
if (speakval > 0x2000)
speakval = 0x2000;
speaker_val = ((int) sv) - 0x2000;
if (speaker_val > 0x2000)
speaker_val = 0x2000;
break;
}
}
@@ -444,7 +444,7 @@ pit_read(uint16_t addr, void *priv)
uint8_t temp = 0xff;
int t;
switch (addr&3) {
switch (addr & 3) {
case 0: /*Timers*/
case 1:
case 2:
@@ -523,9 +523,9 @@ pit_speaker_timer(int new_out, int old_out)
l = pit.l[2] ? pit.l[2] : 0x10000LL;
if (l < 25LL)
speakon = 0;
speaker_on = 0;
else
speakon = new_out;
speaker_on = new_out;
ppispeakon = new_out;
}

View File

@@ -32,13 +32,13 @@
* BIOSES: I need to re-do the bios.txt format so we can load non-BIOS
* ROM files for a given machine, such as font roms here..
*
* Version: @(#)m_amstrad.c 1.0.19 2018/10/05
* Version: @(#)m_amstrad.c 1.0.20 2019/02/12
*
* 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 2017-2019 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
@@ -1003,7 +1003,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
speaker_gated = val & 0x01;
speaker_enable = val & 0x02;
if (speaker_enable)
was_speaker_enable = 1;
speaker_was_enable = 1;
pit_set_gate(&pit, 2, val & 0x01);
if (val & 0x80) {

View File

@@ -8,13 +8,13 @@
*
* Emulation of the Olivetti M24.
*
* Version: @(#)m_olivetti_m24.c 1.0.12 2018/10/05
* Version: @(#)m_olivetti_m24.c 1.0.13 2019/02/12
*
* 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 2017-2019 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
@@ -632,7 +632,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
speaker_gated = val & 1;
speaker_enable = val & 2;
if (speaker_enable)
was_speaker_enable = 1;
speaker_was_enable = 1;
pit_set_gate(&pit, 2, val & 1);
break;
}

View File

@@ -8,13 +8,13 @@
*
* Emulation of the IBM PCjr.
*
* Version: @(#)m_pcjr.c 1.0.10 2018/11/02
* Version: @(#)m_pcjr.c 1.0.11 2019/02/12
*
* 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 2017-2019 Fred N. van Kempen.
* Copyright 2016-2018 Miran Grca.
* Copyright 2008-2018 Sarah Walker.
*
@@ -576,7 +576,7 @@ kbd_write(uint16_t port, uint8_t val, void *priv)
speaker_gated = val & 1;
speaker_enable = val & 2;
if (speaker_enable)
was_speaker_enable = 1;
speaker_was_enable = 1;
pit_set_gate(&pit, 2, val & 1);
sn76489_mute = speaker_mute = 1;
switch (val & 0x60) {

View File

@@ -8,7 +8,7 @@
*
* Implementation of standard IBM PC/XT class machine.
*
* Version: @(#)m_xt.c 1.0.13 2019/02/12
* Version: @(#)m_xt.c 1.0.14 2019/02/13
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -48,30 +48,12 @@
#include "../devices/input/keyboard.h"
#include "../devices/floppy/fdd.h"
#include "../devices/floppy/fdc.h"
#ifdef USE_CASSETTE
# include <cassette.h>
#endif
#include "machine.h"
static const device_config_t pcxt_config[] = {
{
"rom_basic", "ROM BASIC", CONFIG_SELECTION, "", 0,
{
{
"Disabled", 0
},
{
"Enabled", 1
},
{
""
}
}
},
{
"", "", -1
}
};
/* Generic PC/XT system board with just the basics. */
void
machine_pc_common_init(const machine_t *model, void *arg)
@@ -103,6 +85,10 @@ machine_pc_init(const machine_t *model, void *arg)
machine_pc_common_init(model, arg);
device_add(&keyboard_pc_device);
#ifdef USE_CASSETTE
device_add(&cassette_device);
#endif
}
@@ -113,6 +99,10 @@ machine_pc82_init(const machine_t *model, void *arg)
machine_pc_common_init(model, arg);
device_add(&keyboard_pc82_device);
#ifdef USE_CASSETTE
device_add(&cassette_device);
#endif
}
@@ -136,6 +126,27 @@ machine_xt86_init(const machine_t *model, void *arg)
}
static const device_config_t pcxt_config[] = {
{
"rom_basic", "ROM BASIC", CONFIG_SELECTION, "", 0,
{
{
"Disabled", 0
},
{
"Enabled", 1
},
{
""
}
}
},
{
"", "", -1
}
};
const device_t m_pc_device = {
"IBM PC",
0, 0,

View File

@@ -8,7 +8,7 @@
#
# Makefile for Windows systems using the MinGW32 environment.
#
# Version: @(#)Makefile.mingw 1.0.75 2019/02/12
# Version: @(#)Makefile.mingw 1.0.76 2019/02/13
#
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
#
@@ -152,6 +152,9 @@ endif
ifndef HOSTCD
HOSTCD := n
endif
ifndef CASSETTE
CASSETTE := n
endif
# Name of the executable.
@@ -571,6 +574,11 @@ ifeq ($(DEV_BRANCH), y)
OPTS += -DUSE_HOST_CDROM
endif
ifeq ($(CASSETTE), y)
OPTS += -DUSE_CASSETTE
DEVBROBJ += cassette.o
endif
endif

View File

@@ -8,7 +8,7 @@
#
# Makefile for Windows using Visual Studio 2015.
#
# Version: @(#)Makefile.VC 1.0.61 2019/02/12
# Version: @(#)Makefile.VC 1.0.62 2019/02/13
#
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
#
@@ -147,11 +147,14 @@ endif
ifndef WONDER
WONDER := n
endif
ifndef PRINTER
PRINTER := n
endif
ifndef HOSTCD
HOSTCD := n
endif
ifndef PRINTER
PRINTER := n
ifndef CASSETTE
CASSETTE := n
endif
# Name of the executable.
@@ -541,14 +544,20 @@ ifeq ($(DEV_BRANCH), y)
OPTS += -DUSE_WONDER
endif
ifeq ($(HOSTCD), y)
OPTS += -DUSE_HOST_CDROM
endif
ifeq ($(PRINTER), y)
OPTS += -DUSE_PRINTER
DEVBROBJ += prt_parallel.obj
endif
ifeq ($(HOSTCD), y)
OPTS += -DUSE_HOST_CDROM
endif
ifeq ($(CASSETTE), y)
OPTS += -DUSE_CASSETTE
DEVBROBJ += cassette.obj
endif
endif