From 4b7328f06edcb83d3ccf3ef2f658b6898027829a Mon Sep 17 00:00:00 2001 From: SarahW Date: Wed, 17 Apr 2019 20:37:48 +0100 Subject: [PATCH] Add cassette emulation to IBM PCjr. --- src/keyboard_pcjr.c | 11 ++++++++++- src/model.c | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/keyboard_pcjr.c b/src/keyboard_pcjr.c index 13f443b..6799aea 100644 --- a/src/keyboard_pcjr.c +++ b/src/keyboard_pcjr.c @@ -1,5 +1,7 @@ #include "ibm.h" #include "device.h" +#include "cassette.h" +#include "fdd.h" #include "io.h" #include "mem.h" #include "nmi.h" @@ -129,6 +131,8 @@ void keyboard_pcjr_write(uint16_t port, uint8_t val, void *priv) timer_process(); timer_update_outstanding(); + cassette_set_motor((val & 8) ? 0 : 1); + speaker_update(); speaker_gated = val & 1; speaker_enable = val & 2; @@ -171,7 +175,12 @@ uint8_t keyboard_pcjr_read(uint16_t port, void *priv) case 0x62: temp = (keyboard_pcjr.latched ? 1 : 0); temp |= 0x02; /*Modem card not installed*/ - temp |= (ppispeakon ? 0x10 : 0); + if (fdd_get_type(0) == 0) + temp |= 0x04; /*Disc card not installed*/ + if (!(keyboard_pcjr.pb & 8)) + temp |= (cassette_input()) ? 0x10 : 0; + else + temp |= (ppispeakon ? 0x10 : 0); temp |= (ppispeakon ? 0x20 : 0); temp |= (keyboard_pcjr.data ? 0x40: 0); // temp |= 0x04; diff --git a/src/model.c b/src/model.c index 587b6ab..75c17fa 100644 --- a/src/model.c +++ b/src/model.c @@ -325,6 +325,7 @@ void pcjr_init() keyboard_pcjr_init(); device_add(&sn76489_device); nmi_mask = 0x80; + device_add(&cassette_device); } void tandy1k_init()