Class: GBRb::CPU::Instruction
- Inherits:
-
Object
- Object
- GBRb::CPU::Instruction
- Defined in:
- lib/gbrb/cpu/instruction.rb
Direct Known Subclasses
AddHl, Arithmetic, Bit, Boolean, Call, Ccf, Cpl, Dec, DisableInterrupts, EnableInterrupts, Inc, Jump, Ld, Ldhlsp, Pop, Push, Res, Ret, Rl, Rr, Rst, Scf, Set, Stop, Swap
Instance Attribute Summary collapse
-
#i ⇒ Object
readonly
Returns the value of attribute i.
-
#m ⇒ Object
readonly
Returns the value of attribute m.
-
#t ⇒ Object
readonly
Returns the value of attribute t.
Instance Method Summary collapse
- #call(r, mem) ⇒ Object
- #carry?(left, right, mask) ⇒ Boolean
- #immediate_count ⇒ Object
-
#initialize(m = 1, t = 4, immediates = 0, *extra) ⇒ Instruction
constructor
A new instance of Instruction.
Constructor Details
#initialize(m = 1, t = 4, immediates = 0, *extra) ⇒ Instruction
Returns a new instance of Instruction.
7 8 9 10 11 |
# File 'lib/gbrb/cpu/instruction.rb', line 7 def initialize m=1, t=4, immediates=0, *extra @m = m @t = t @immediates = immediates end |
Instance Attribute Details
#i ⇒ Object (readonly)
Returns the value of attribute i.
5 6 7 |
# File 'lib/gbrb/cpu/instruction.rb', line 5 def i @i end |
#m ⇒ Object (readonly)
Returns the value of attribute m.
5 6 7 |
# File 'lib/gbrb/cpu/instruction.rb', line 5 def m @m end |
#t ⇒ Object (readonly)
Returns the value of attribute t.
5 6 7 |
# File 'lib/gbrb/cpu/instruction.rb', line 5 def t @t end |
Instance Method Details
#call(r, mem) ⇒ Object
17 18 19 |
# File 'lib/gbrb/cpu/instruction.rb', line 17 def call r, mem nil end |
#carry?(left, right, mask) ⇒ Boolean
21 22 23 |
# File 'lib/gbrb/cpu/instruction.rb', line 21 def carry? left, right, mask (mask-1 & left).public_send(@op, mask-1 & right) & mask == mask end |
#immediate_count ⇒ Object
13 14 15 |
# File 'lib/gbrb/cpu/instruction.rb', line 13 def immediate_count @immediates end |