Class: Zemu::Config::BusDevice
- Inherits:
-
Zemu::ConfigObject
- Object
- Zemu::ConfigObject
- Zemu::Config::BusDevice
- Defined in:
- lib/zemu/config.rb
Overview
Bus Device.
Represents a device connected to the I/O or memory buses, or both.
Direct Known Subclasses
Instance Method Summary collapse
-
#clock(cycles) ⇒ Object
Clock handler.
-
#functions ⇒ Object
FFI functions provided by this device.
-
#initialize ⇒ BusDevice
constructor
Constructor.
-
#interrupt(state) ⇒ Object
Sets state of INT for this device.
-
#interrupt? ⇒ Boolean
Gets state of INT for this device.
-
#io_read(port) ⇒ Object
IO bus read handler.
-
#io_write(port, value) ⇒ Object
IO bus write handler.
-
#mem_read(addr) ⇒ Object
Memory bus read handler.
-
#mem_write(addr, value) ⇒ Object
Memory bus write handler.
-
#memory ⇒ Object
Parameters used for generating C code to implement this bus device.
-
#nmi(state) ⇒ Object
Sets state of the NMI for this device.
-
#nmi? ⇒ Boolean
Gets state of NMI for this device.
-
#params ⇒ Object
Parameters for a bus device.
-
#when_setup ⇒ Object
Setup to be performed on initialising the emulator instance.
Methods inherited from Zemu::ConfigObject
Constructor Details
#initialize ⇒ BusDevice
Constructor.
This object should not be constructed directly.
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/zemu/config.rb', line 88 def initialize if self.class == Zemu::Config::BusDevice raise NotImplementedError, "Cannot construct an instance of the abstract class Zemu::Config::BusDevice." end @nmi = false @interrupt = false super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Zemu::ConfigObject
Instance Method Details
#clock(cycles) ⇒ Object
Clock handler.
Handles a clock cycle for this device. Deriving objects can use the nmi function to set the state of the non-maskable interrupt at each clock cycle.
159 160 |
# File 'lib/zemu/config.rb', line 159 def clock(cycles) end |
#functions ⇒ Object
FFI functions provided by this device.
163 164 165 |
# File 'lib/zemu/config.rb', line 163 def functions [] end |
#interrupt(state) ⇒ Object
Sets state of INT for this device.
178 179 180 |
# File 'lib/zemu/config.rb', line 178 def interrupt(state) @interrupt = state end |
#interrupt? ⇒ Boolean
Gets state of INT for this device.
183 184 185 |
# File 'lib/zemu/config.rb', line 183 def interrupt? @interrupt end |
#io_read(port) ⇒ Object
IO bus read handler.
Handles read access via the IO bus to this device.
Returns the value read from the port, or nil if no value (e.g. port does not correspond to this device).
149 150 151 |
# File 'lib/zemu/config.rb', line 149 def io_read(port) nil end |
#io_write(port, value) ⇒ Object
IO bus write handler.
Handles write access via the IO bus to this device.
138 139 |
# File 'lib/zemu/config.rb', line 138 def io_write(port, value) end |
#mem_read(addr) ⇒ Object
Memory bus read handler.
Handles read access via the memory bus to this device.
Returns the value read, or nil if no value (e.g. if address falls outside range for this device).
128 129 130 |
# File 'lib/zemu/config.rb', line 128 def mem_read(addr) nil end |
#mem_write(addr, value) ⇒ Object
Memory bus write handler.
Handles write access via the memory bus to this device.
117 118 |
# File 'lib/zemu/config.rb', line 117 def mem_write(addr, value) end |
#memory ⇒ Object
Parameters used for generating C code to implement this bus device.
101 102 103 |
# File 'lib/zemu/config.rb', line 101 def memory nil end |
#nmi(state) ⇒ Object
Sets state of the NMI for this device.
168 169 170 |
# File 'lib/zemu/config.rb', line 168 def nmi(state) @nmi = state end |
#nmi? ⇒ Boolean
Gets state of NMI for this device.
173 174 175 |
# File 'lib/zemu/config.rb', line 173 def nmi? @nmi end |
#params ⇒ Object
Parameters for a bus device.
188 189 190 |
# File 'lib/zemu/config.rb', line 188 def params %w(name) end |
#when_setup ⇒ Object
Setup to be performed on initialising the emulator instance.
107 108 109 |
# File 'lib/zemu/config.rb', line 107 def when_setup "" end |