From 26ea6e0c761ab1df561a18dd8828ec116368f844 Mon Sep 17 00:00:00 2001 From: Sam M W Date: Mon, 30 Oct 2023 19:47:44 +0000 Subject: [PATCH] some doc comments --- src/instruction.rs | 6 ++++++ src/lib.rs | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/instruction.rs b/src/instruction.rs index 94f17fd..b579c6d 100644 --- a/src/instruction.rs +++ b/src/instruction.rs @@ -156,6 +156,7 @@ impl AddressingMode { pub type DecodedInstr = (Instruction, OpInput); +/// The NMOS 6502 variant. This one is present in the Commodore 64, early Apple IIs, etc. pub struct Nmos6502; impl crate::Variant for Nmos6502 { @@ -421,6 +422,8 @@ impl crate::Variant for Nmos6502 { } } +/// The Ricoh variant which has no decimal mode. This is what to use if you want to emulate the +/// NES. pub struct Ricoh2a03; impl crate::Variant for Ricoh2a03 { @@ -446,6 +449,9 @@ impl crate::Variant for Ricoh2a03 { } } } + +/// Emulates some very early 6502s which have no ROR instruction. This one is used in very early +/// KIM-1s. pub struct RevisionA; impl crate::Variant for RevisionA { diff --git a/src/lib.rs b/src/lib.rs index 53ac5a8..2f432ea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,6 +41,8 @@ pub mod instruction; pub mod memory; pub mod registers; +/// Trait for 6502 variant. This is the mechanism allowing the different 6502-like CPUs to be +/// emulated. It allows a struct to decode an opcode into its instruction and addressing mode. pub trait Variant { fn decode( opcode: u8,