class Zemu::Config::Memory
Memory
object.
This is an abstract class from which all other memory objects inherit.
Public Class Methods
new()
click to toggle source
Constructor.
Do not use, as this is an abstract class. Use one of the subclasses instead.
Calls superclass method
Zemu::ConfigObject::new
# File lib/zemu/config.rb, line 85 def initialize if self.class == Zemu::Config::Memory raise NotImplementedError, "Cannot construct an instance of the abstract class Zemu::Config::Memory." end @contents = [] super # Pad contents with 0x00 bytes. (@size - @contents.size).times do @contents << 0x00 end end
Public Instance Methods
contents(*args)
click to toggle source
Gets or sets an array of bytes representing the initial state of this memory block.
# File lib/zemu/config.rb, line 102 def contents(*args) if args.size.zero? return @contents else @contents = args[0] end end
from_binary(file)
click to toggle source
Reads the contents of a file in binary format and returns them as an array.
# File lib/zemu/config.rb, line 123 def from_binary(file) return File.open(file, "rb") do |f| bin = [] f.each_byte { |b| bin << b } bin end end
params()
click to toggle source
Valid parameters for this object. Should be extended by subclasses but NOT REPLACED.
# File lib/zemu/config.rb, line 117 def params return %w(name address size) end
readonly?()
click to toggle source
@return [Boolean] true if this memory section is readonly, false otherwise.
# File lib/zemu/config.rb, line 111 def readonly? return false end