From 203a56d9e56364f9272361d9481e3331857c8d71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Mon, 24 Apr 2023 22:17:02 +0100
Subject: [PATCH] docs: better documentation

---
 src/gb.rs | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/gb.rs b/src/gb.rs
index e8611afa..b65aec3d 100644
--- a/src/gb.rs
+++ b/src/gb.rs
@@ -143,18 +143,28 @@ pub struct GameBoy {
     /// The current running mode of the emulator, this
     /// may affect many aspects of the emulation, like
     /// CPU frequency, PPU frequency, Boot rome size, etc.
+    /// This is a clone of the configuration value
+    /// kept for performance reasons.
     mode: GameBoyMode,
 
     /// If the PPU is enabled, it will be clocked.
+    /// This is a clone of the configuration value
+    /// kept for performance reasons.
     ppu_enabled: bool,
 
     /// If the APU is enabled, it will be clocked.
+    /// This is a clone of the configuration value
+    /// kept for performance reasons.
     apu_enabled: bool,
 
     /// If the timer is enabled, it will be clocked.
+    /// This is a clone of the configuration value
+    /// kept for performance reasons.
     timer_enabled: bool,
 
     /// If the serial is enabled, it will be clocked.
+    /// This is a clone of the configuration value
+    /// kept for performance reasons.
     serial_enabled: bool,
 
     /// The current frequency at which the Game Boy
@@ -163,6 +173,8 @@ pub struct GameBoy {
     /// logic to match the current frequency. For example
     /// the APU will adjust its internal clock to match
     /// this hint.
+    /// This is a clone of the configuration value
+    /// kept for performance reasons.
     clock_freq: u32,
 
     /// Reference to the Game Boy CPU component to be
@@ -171,6 +183,12 @@ pub struct GameBoy {
     /// used as reference or the rest of the components.
     cpu: Cpu,
 
+    /// Rhe reference counted and mutable reference to
+    /// Game Boy configuration structure that can be
+    /// used by the GB components to access global
+    /// configuration values on the current emulator.
+    /// If performance is required (may value access)
+    /// the values should be cloned and stored locally.
     gbc: Rc<RefCell<GameBoyConfig>>,
 }
 
-- 
GitLab