Class: GBRb::InstructionSet::Instruction
- Inherits:
-
Object
- Object
- GBRb::InstructionSet::Instruction
- Defined in:
- lib/gbrb/instruction_set/instruction.rb
Direct Known Subclasses
AddHl, AddSpR8, Arithmetic, Bit, Boolean, Call, Ccf, Cpl, Daa, Dec, DisableInterrupts, EnableInterrupts, Halt, Inc, Jump, Ld, LdD16, LdD8, Lda16a, Lda16sp, Ldaa16, Ldac, Ldahld, Ldahli, Ldann, Ldca, Ldh, LdhlD8, Ldhlda, Ldhlia, Ldhln, Ldhlsp, Ldnhl, Ldnna, Ldsphl, Pop, Push, Res, Ret, Rl, Rr, Rst, Scf, Set, Sla, Sra, Srl, Stop, Swap
Instance Attribute Summary collapse
-
#i ⇒ Object
Returns the value of attribute i.
-
#m ⇒ Object
Returns the value of attribute m.
-
#t ⇒ Object
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.
5 6 7 8 9 |
# File 'lib/gbrb/instruction_set/instruction.rb', line 5 def initialize m=1, t=4, immediates=0, *extra @m = m @t = t @immediates = immediates end |
Instance Attribute Details
#i ⇒ Object
Returns the value of attribute i.
3 4 5 |
# File 'lib/gbrb/instruction_set/instruction.rb', line 3 def i @i end |
#m ⇒ Object
Returns the value of attribute m.
3 4 5 |
# File 'lib/gbrb/instruction_set/instruction.rb', line 3 def m @m end |
#t ⇒ Object
Returns the value of attribute t.
3 4 5 |
# File 'lib/gbrb/instruction_set/instruction.rb', line 3 def t @t end |
Instance Method Details
#call(r, mem) ⇒ Object
15 16 17 |
# File 'lib/gbrb/instruction_set/instruction.rb', line 15 def call r, mem nil end |
#carry?(left, right, mask) ⇒ Boolean
19 20 21 |
# File 'lib/gbrb/instruction_set/instruction.rb', line 19 def carry? left, right, mask (mask-1 & left).public_send(@op, mask-1 & right) & mask == mask end |
#immediate_count ⇒ Object
11 12 13 |
# File 'lib/gbrb/instruction_set/instruction.rb', line 11 def immediate_count @immediates end |