class Z80::Program::Condition

Creates jr/jp/ret/call conditions as constants:

NZ Z NC C PO PE P M

Additionally NV = PO and V = PE conditions are aliased.

You must not instantiate this class directly. Use predefined constants instead.

Attributes

name[R]
to_s[R]
to_str[R]

Public Class Methods

[](index) click to toggle source
# File lib/z80/registers.rb, line 170
def [](index)
        @@conditions[index]
end
names() click to toggle source
# File lib/z80/registers.rb, line 173
def names
        @@names.dup
end
new(name, opc) click to toggle source
# File lib/z80/registers.rb, line 178
def initialize(name, opc)
        @name = name
        @opc = opc
end

Public Instance Methods

jr_ok?() click to toggle source
# File lib/z80/registers.rb, line 186
def jr_ok?
        one_of?(@@names[0..3])
end
not() click to toggle source

Inverse the condition, e.g. Z.not becomes NZ and NC.not becomes C, etc.

# File lib/z80/registers.rb, line 190
def not
        @@conditions[@@names.index(name) ^ 1]
end
one_of?(ary) click to toggle source
# File lib/z80/registers.rb, line 185
def one_of?(ary); ary.include?(name); end
to_i() click to toggle source
# File lib/z80/registers.rb, line 182
def to_i
        @opc
end