class Zemu::Config::Timer
Non-Maskable Interrupt Timer
Represents a timer device, the period of which can be controlled by the CPU through an IO port. The timer generates an NMI once this period has expired. The timer can be reset via a control port.
Public Class Methods
new()
click to toggle source
Calls superclass method
Zemu::Config::IOPort::new
# File lib/zemu/config.rb, line 448 def initialize super when_setup do "zuint8 io_#{name}_count;\n" + "zuint8 io_#{name}_running = 0;\n" end when_read do end when_write do "if (port == #{count_port}) io_#{name}_count = value;\n" + "else if (port == #{control_port}) io_#{name}_running = value;\n" end when_clock do "if (io_#{name}_running)\n" + "{\n" + " if (io_#{name}_count > 0) io_#{name}_count--;\n" + " else zemu_io_nmi(instance);\n" + "}\n" end end
Public Instance Methods
params()
click to toggle source
Valid parameters for a Timer
, along with those defined in [Zemu::Config::IOPort].
Calls superclass method
Zemu::Config::IOPort#params
# File lib/zemu/config.rb, line 475 def params super + %w(count_port control_port) end