Skip to content

Commit 8503db4

Browse files
committed
add parallel port config overlay
1 parent e12b2e1 commit 8503db4

File tree

6 files changed

+67
-6
lines changed

6 files changed

+67
-6
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This provides a few nice things:
3333
- The VHD creator has been updated to support the wide selection of common hard drive geometries that the XTIDE can
3434
support. You'll need to be running a machine with the XTIDE configured to see them.
3535
- It is now possible to take a VHD file from 86Box (assuming you created it as a 'fixed' VHD) and use it in MartyPC
36-
(and vice-versa!).
36+
(and vice versa!).
3737

3838
## New Debugger Features
3939
- You can now edit memory, at last! Double-clicking on byte in the hex view will enter edit mode. Hit enter to accept
@@ -57,6 +57,7 @@ This provides a few nice things:
5757
- The Keyboard menu allows for resetting the keyboard (clearing any stuck keys).
5858

5959
### Core Bug Fixes / Improvements
60+
- Added a parallel port card overlay.
6061
- Added a keyboard reset function to clear stuck keys.
6162
- Improved accuracy of the Programmable Interrupt Timer (PIT)
6263
- Fixed a bug the CPU's DRAM refresh DMA scheduler. Many tests in Acid88 now pass.

crates/lib/frontend/marty_frontend_common/src/machine_manager/mod.rs

+14-5
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@
2929
Machine configuration services for frontends.
3030
*/
3131

32+
use std::{
33+
collections::{BTreeMap, HashSet},
34+
ffi::OsString,
35+
};
36+
3237
use crate::resource_manager::ResourceManager;
33-
use anyhow::Error;
3438
use marty_core::{
3539
device_traits::videocard::VideoType,
3640
machine_config::{
@@ -43,6 +47,7 @@ use marty_core::{
4347
MachineConfiguration,
4448
MediaConfig,
4549
MemoryConfig,
50+
ParallelControllerConfig,
4651
SerialControllerConfig,
4752
SerialMouseConfig,
4853
SoundDeviceConfig,
@@ -51,11 +56,8 @@ use marty_core::{
5156
machine_types::{HardDiskControllerType, MachineType},
5257
};
5358

59+
use anyhow::Error;
5460
use serde_derive::Deserialize;
55-
use std::{
56-
collections::{BTreeMap, HashSet},
57-
ffi::OsString,
58-
};
5961

6062
#[derive(Clone, Debug, Deserialize)]
6163
pub struct MachineConfigFile {
@@ -84,6 +86,7 @@ pub struct MachineConfigFileEntry {
8486
fdc: Option<FloppyControllerConfig>,
8587
hdc: Option<HardDriveControllerConfig>,
8688
serial: Option<Vec<SerialControllerConfig>>,
89+
parallel: Option<Vec<ParallelControllerConfig>>,
8790
video: Option<Vec<VideoCardConfig>>,
8891
sound: Option<Vec<SoundDeviceConfig>>,
8992
keyboard: Option<KeyboardConfig>,
@@ -101,6 +104,7 @@ pub struct MachineConfigFileOverlayEntry {
101104
fdc: Option<FloppyControllerConfig>,
102105
hdc: Option<HardDriveControllerConfig>,
103106
serial: Option<Vec<SerialControllerConfig>>,
107+
parallel: Option<Vec<ParallelControllerConfig>>,
104108
video: Option<Vec<VideoCardConfig>>,
105109
sound: Option<Vec<SoundDeviceConfig>>,
106110
keyboard: Option<KeyboardConfig>,
@@ -404,6 +408,10 @@ impl MachineConfigFileEntry {
404408
log::debug!("Applying serial overlay: {:?}", serial);
405409
self.serial = Some(serial);
406410
}
411+
if let Some(parallel) = overlay.parallel {
412+
log::debug!("Applying parallel overlay: {:?}", parallel);
413+
self.parallel = Some(parallel);
414+
}
407415
if let Some(video) = overlay.video {
408416
log::debug!("Applying video overlay: {:?}", video);
409417
self.video = Some(video);
@@ -439,6 +447,7 @@ impl MachineConfigFileEntry {
439447
serial: self.serial.clone().unwrap_or_default(),
440448
video: self.video.clone().unwrap_or_default(),
441449
sound: self.sound.clone().unwrap_or_default(),
450+
parallel: self.parallel.clone().unwrap_or_default(),
442451
keyboard: self.keyboard.clone(),
443452
serial_mouse: self.serial_mouse.clone(),
444453
game_port: self.game_port.clone(),

crates/marty_core/src/bus.rs

+22
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,28 @@ impl BusInterface {
19771977
add_io_device!(self, parallel, IoDeviceType::Parallel);
19781978
self.parallel = Some(parallel);
19791979
}
1980+
else if machine_config.parallel.len() > 0 {
1981+
if machine_config.parallel.len() > 1 {
1982+
log::warn!(
1983+
"Support for multiple parallel controllers is not implemented. Only the first parallel controller will be created."
1984+
);
1985+
}
1986+
1987+
if let Some(controller) = machine_config.parallel.get(0) {
1988+
log::debug!("Creating parallel port...");
1989+
1990+
if let Some(port) = controller.port.get(0) {
1991+
let parallel = ParallelController::new(Some(port.io_base as u16));
1992+
1993+
// Add Parallel Port ports to io_map
1994+
add_io_device!(self, parallel, IoDeviceType::Parallel);
1995+
self.parallel = Some(parallel);
1996+
}
1997+
}
1998+
else {
1999+
log::error!("Parallel controller was specified with no ports!");
2000+
}
2001+
}
19802002

19812003
// Create a Serial card if specified
19822004
if let Some(serial_config) = machine_config.serial.get(0) {

crates/marty_core/src/machine_config.rs

+14
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ use crate::machine_types::{
3737
HardDiskControllerType,
3838
HardDriveFormat,
3939
MachineType,
40+
ParallelControllerType,
4041
SerialControllerType,
4142
SerialMouseType,
4243
SoundType,
@@ -196,6 +197,18 @@ pub struct SerialControllerConfig {
196197
pub port: Vec<SerialPortConfig>,
197198
}
198199

200+
#[derive(Clone, Debug, Deserialize)]
201+
pub struct ParallelControllerConfig {
202+
#[serde(rename = "type")]
203+
pub lpt_type: ParallelControllerType,
204+
pub port: Vec<ParallelPortConfig>,
205+
}
206+
207+
#[derive(Clone, Debug, Deserialize)]
208+
pub struct ParallelPortConfig {
209+
pub io_base: u32,
210+
}
211+
199212
#[derive(Clone, Debug, Deserialize)]
200213
pub struct FloppyControllerConfig {
201214
#[serde(rename = "type")]
@@ -254,6 +267,7 @@ pub struct MachineConfiguration {
254267
pub video: Vec<VideoCardConfig>,
255268
pub sound: Vec<SoundDeviceConfig>,
256269
pub serial: Vec<SerialControllerConfig>,
270+
pub parallel: Vec<ParallelControllerConfig>,
257271
pub game_port: Option<GamePortConfig>,
258272
pub fdc: Option<FloppyControllerConfig>,
259273
pub hdc: Option<HardDriveControllerConfig>,

crates/marty_core/src/machine_types.rs

+5
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@ pub enum SerialMouseType {
249249
Microsoft,
250250
}
251251

252+
#[derive(Copy, Clone, Debug, Deserialize, Eq, PartialEq)]
253+
pub enum ParallelControllerType {
254+
Standard,
255+
}
256+
252257
#[derive(Copy, Clone, Debug, Deserialize, Eq, PartialEq)]
253258
pub enum EmsType {
254259
LoTech2MB,

install/configs/machines/config_overlays.toml

+10
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ name = "us_modelf_keyboard"
6464
# Delay in milliseconds between each scancode during typematic repeat.
6565
typematic_rate= 50.0
6666

67+
[[overlay]]
68+
name = "parallel_port"
69+
# Parallel port card
70+
[[overlay.parallel]]
71+
bus_type = "ISA"
72+
type = "Standard"
73+
[[overlay.parallel.port]]
74+
# 3BC will typically be LPT1. May conflict with MDA.
75+
io_base = 0x3BC
76+
6777
[[overlay]]
6878
name = "pcxt_2_serial_ports"
6979
# Serial card

0 commit comments

Comments
 (0)