class Zemu::Config
Configuration object.
An object which represents the configuration of a Zemu
emulator.
@param [String] name The name of the configuration. @param [String] compiler The path to the compiler to be used for compiling the emulator executable.
Attributes
The IO devices of this configuration object.
The memory sections of this configuration object.
Public Class Methods
Constructor.
Takes a block in which parameters of the configuration can be initialized.
All parameters can be set within this block. They become readonly as soon as the block completes.
@example
Zemu::Config.new do name "my_config" add_memory Zemu::Config::ROM.new do name "rom" address 0x0000 size 0x1000 end end
@raise [Zemu::ConfigError] Raised if the name
parameter is not set, or contains whitespace.
Zemu::ConfigObject::new
# File lib/zemu/config.rb, line 527 def initialize @memory = [] @io = [] super if @name.empty? raise ConfigError, "The name parameter of a Zemu::Config configuration object cannot be empty." end if /\s/ =~ @name raise ConfigError, "The name parameter of a Zemu::Config configuration object cannot contain whitespace." end end
Public Instance Methods
Adds a new IO device to this configuration.
@param [Zemu::Config::IOPort] io The IO device to add.
# File lib/zemu/config.rb, line 552 def add_io(io) @io << io end
Adds a new memory section to this configuration.
@param [Zemu::Config::Memory] mem The memory object to add.
# File lib/zemu/config.rb, line 545 def add_memory(mem) @memory << mem end
Gets a binding for this object.
# File lib/zemu/config.rb, line 481 def get_binding return binding end
Parameters accessible by this configuration object.
# File lib/zemu/config.rb, line 492 def params return %w(name compiler output_directory clock_speed serial_delay) end
Initial value for parameters of this configuration object.
# File lib/zemu/config.rb, line 497 def params_init return { "compiler" => "clang", "output_directory" => "bin", "clock_speed" => 0, "serial_delay" => 0 } end