From 3bdedfd7496c2500fef654df3efe9831b6143e77 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 8 Aug 2017 07:44:46 -0400 Subject: [PATCH] Improved comments. --- Components/8255/i8255.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Components/8255/i8255.hpp b/Components/8255/i8255.hpp index 423fc95c2..d5ec91de9 100644 --- a/Components/8255/i8255.hpp +++ b/Components/8255/i8255.hpp @@ -18,12 +18,15 @@ class PortHandler { uint8_t get_value(int port) { return 0xff; } }; -// TODO: most of the implementation below. Right now it just blindly passes data in all directions, -// ignoring operation mode. But at least it establishes proper ownership and hand-off of decision making. +// TODO: Modes 1 and 2. template class i8255 { public: i8255(T &port_handler) : control_(0), outputs_{0, 0, 0}, port_handler_(port_handler) {} + /*! + Stores the value @c value to the register at @c address. If this causes a change in 8255 output + then the PortHandler will be informed. + */ void set_register(int address, uint8_t value) { switch(address & 3) { case 0: @@ -53,6 +56,10 @@ template class i8255 { } } + /*! + Obtains the current value for the register at @c address. If this provides a reading + of input then the PortHandler will be queried. + */ uint8_t get_register(int address) { switch(address & 3) { case 0: return (control_ & 0x10) ? port_handler_.get_value(0) : outputs_[0];