Class: GBRb::CPU::Rst

Inherits:
Instruction show all
Defined in:
lib/gbrb/cpu/instruction.rb

Instance Attribute Summary

Attributes inherited from Instruction

#i, #m, #t

Instance Method Summary collapse

Methods inherited from Instruction

#carry?, #immediate_count

Constructor Details

#initialize(offset) ⇒ Rst



523
524
525
526
# File 'lib/gbrb/cpu/instruction.rb', line 523

def initialize offset
  @offset = offset
  super 1, 16
end

Instance Method Details

#call(r, mem) ⇒ Object



528
529
530
531
532
# File 'lib/gbrb/cpu/instruction.rb', line 528

def call r, mem
  r.sp.store r.sp.read - 2
  mem.write_word r.sp.read, r.pc.read
  r.pc.store 0x0000 + @offset
end