Improve workflow and docs somewhat, make minifb optional

This commit is contained in:
2023-04-14 22:20:30 -05:00
parent 674af62465
commit 43fa623da3
12 changed files with 77 additions and 40 deletions

View File

@@ -1,10 +1,15 @@
//! A disassembler for Chip-8 opcodes
#![allow(clippy::bad_bit_mask)]
use super::Disassembler;
use imperative_rs::InstructionSet;
use owo_colors::{OwoColorize, Style};
use std::fmt::Display;
/// Disassembles Chip-8 instructions
pub trait Disassembler {
/// Disassemble a single instruction
fn once(&self, insn: u16) -> String;
}
#[allow(non_camel_case_types, non_snake_case, missing_docs)]
#[derive(Clone, Copy, Debug, InstructionSet, PartialEq, Eq)]
/// Implements a Disassembler using imperative_rs

View File

@@ -1,8 +1,8 @@
//! Represents flags that aid in implementation but aren't a part of the Chip-8 spec
//! Represents [Flags] that aid in implementation but aren't a part of the Chip-8 spec
use super::{Mode, Quirks};
/// Represents flags that aid in operation, but aren't inherent to the CPU
/// Represents flags that aid in implementation but aren't a part of the Chip-8 spec
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Flags {
/// Set when debug (live disassembly) mode enabled
@@ -55,4 +55,9 @@ impl Flags {
pub fn pause(&mut self) {
self.pause = !self.pause
}
/// Gets whether the CPU is paused for any reason
pub fn is_paused(&self) -> bool {
self.pause || self.draw_wait || self.keypause
}
}

View File

@@ -1,7 +1,7 @@
// (c) 2023 John A. Breaux
// This code is licensed under MIT license (see LICENSE.txt for details)
//! Contains implementations for each instruction defined in [super::disassembler]
//! Contains implementations for each [Insn] as private member functions of [CPU]
use super::*;

View File

@@ -1,4 +1,7 @@
//! Selects the memory behavior of the [super::CPU]
//!
//! Since [super::Quirks] implements [From<Mode>],
//! this can be used to select the appropriate quirk-set
use crate::error::Error;
use std::str::FromStr;

View File

@@ -1,4 +1,4 @@
//! Controls the authenticity behavior of the CPU on a granular level.
//! Controls the [Quirks] behavior of the CPU on a granular level.
use super::Mode;
/// Controls the authenticity behavior of the CPU on a granular level.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]