Module: Badline::InstructionSet::Branch

Included in:
Badline::InstructionSet
Defined in:
lib/badline/instruction_set/branch.rb

Instance Method Summary collapse

Instance Method Details

#bcc(addr, _value) ⇒ Object

Branch if carry clear (C=0).

Opcodes:

$90 - relative - 2+ cycles


10
11
12
# File 'lib/badline/instruction_set/branch.rb', line 10

def bcc(addr, _value)
  branch(addr) unless status.carry?
end

#bcs(addr, _value) ⇒ Object

Branch if carry set (C=1).

Opcodes:

$B0 - relative - 2+ cycles


18
19
20
# File 'lib/badline/instruction_set/branch.rb', line 18

def bcs(addr, _value)
  branch(addr) if status.carry?
end

#beq(addr, _value) ⇒ Object

Branch if equal (Z=1).

Opcodes:

$F0 - relative - 2+ cycles


26
27
28
# File 'lib/badline/instruction_set/branch.rb', line 26

def beq(addr, _value)
  branch(addr) if status.zero?
end

#bmi(addr, _value) ⇒ Object

Branch if minus (N=1).

Opcodes:

$30 - relative - 2+ cycles


34
35
36
# File 'lib/badline/instruction_set/branch.rb', line 34

def bmi(addr, _value)
  branch(addr) if status.negative?
end

#bne(addr, _value) ⇒ Object

Branch if not equal (Z=0).

Opcodes:

$D0 - relative - 2+ cycles


42
43
44
# File 'lib/badline/instruction_set/branch.rb', line 42

def bne(addr, _value)
  branch(addr) unless status.zero?
end

#bpl(addr, _value) ⇒ Object

Branch if plus (N=0).

Opcodes:

$10 - relative - 2+ cycles


50
51
52
# File 'lib/badline/instruction_set/branch.rb', line 50

def bpl(addr, _value)
  branch(addr) unless status.negative?
end

#bvc(addr, _value) ⇒ Object

Branch if overflow clear (V=0).

Opcodes:

$50 - relative - 2+ cycles


58
59
60
# File 'lib/badline/instruction_set/branch.rb', line 58

def bvc(addr, _value)
  branch(addr) unless status.overflow?
end

#bvs(addr, _value) ⇒ Object

Branch if overflow set (V=1).

Opcodes:

$70 - relative - 2+ cycles


66
67
68
# File 'lib/badline/instruction_set/branch.rb', line 66

def bvs(addr, _value)
  branch(addr) if status.overflow?
end