Bump to 0.2.0

This commit is contained in:
Seth Morabito 2018-12-09 18:38:47 -08:00
parent 4816d3cdc0
commit 680df17903
7 changed files with 39 additions and 19 deletions

View File

@ -1,9 +1,19 @@
[package]
name = "dmd_core"
version = "0.1.0"
description = "AT&T / Teletype DMD 5620 Terminal Emulator - Core Library"
version = "0.2.0"
authors = ["Seth Morabito <web@loomcom.com>"]
homepage = "https://github.com/sethm/dmd_core"
repository = "https://github.com/sethm/dmd_core"
readme = "README.md"
edition = "2018"
license = "MIT"
categories = ["simulation"]
[dependencies]
lazy_static = "^1.2.0"
log = "0.4"
[badges]
travic-ci = { repository = "https://github.com/sethm/dmd_core", branch = "master" }
maintenance = { status = "actively-developed" }

View File

@ -204,6 +204,10 @@ impl Bus {
pub fn rx_ready(&self) -> bool {
self.duart.rx_ready()
}
pub fn duart_output(&self) -> u8 {
self.duart.output_port()
}
}
#[cfg(test)]

View File

@ -1622,7 +1622,6 @@ impl Cpu {
self.set_v_flag_op(result, 2);
}
_ => {
trace!("Unhandled opcode: {:?}", self.ir);
return Err(CpuError::Exception(CpuException::IllegalOpcode));
}
};

View File

@ -143,6 +143,13 @@ impl Dmd {
pub fn mouse_up(&mut self, button: u8) {
self.bus.mouse_up(button);
}
///
/// Return the current state of the DUART's Output Port
///
pub fn duart_output(&self) -> u8 {
self.bus.duart_output()
}
}
#[cfg(test)]

View File

@ -49,6 +49,8 @@ const CSRB: u8 = 0x27;
const CRB: u8 = 0x2b;
const THRB: u8 = 0x2f;
const IP_OPCR: u8 = 0x37;
const OPBITS_SET: u8 = 0x3b;
const OPBITS_RESET: u8 = 0x3f;
//
@ -110,6 +112,7 @@ pub struct Duart {
acr: u8,
ipcr: u8,
inprt: u8,
outprt: u8,
istat: u8,
imr: u8,
ivec: u8,
@ -151,6 +154,7 @@ impl Duart {
acr: 0,
ipcr: 0x40,
inprt: 0xb,
outprt: 0,
istat: 0,
imr: 0,
ivec: 0,
@ -212,6 +216,11 @@ impl Duart {
}
}
pub fn output_port(&self) -> u8 {
// The output port always returns a complement of the bits
!self.outprt
}
pub fn tx_poll(&mut self) -> Option<u8> {
self.tx_queue.pop_back()
}
@ -510,6 +519,12 @@ impl Device for Duart {
IP_OPCR => {
// Not implemented
}
OPBITS_SET => {
self.outprt |= val;
}
OPBITS_RESET => {
self.outprt &= !val;
}
_ => {}
};

View File

@ -1,6 +1,3 @@
#[macro_use]
mod macros;
pub mod bus;
pub mod cpu;
pub mod dmd;
@ -13,10 +10,4 @@ pub mod rom_hi;
pub mod rom_lo;
#[macro_use]
extern crate lazy_static;
use std::time::Instant;
lazy_static! {
pub static ref START_TIME: Instant = Instant::now();
}
extern crate lazy_static;

View File

@ -1,6 +0,0 @@
#[macro_export]
macro_rules! trace {
($($arg:expr),*) => {{
println!("[{:?}] {}", $crate::START_TIME.elapsed(), format!($($arg),*));
}};
}