Class: C8dasm::Asm8

Inherits:
AsmBase show all
Defined in:
lib/c8dasm/assemblies/asm8.rb

Instance Method Summary collapse

Methods inherited from AsmBase

#initialize, #kk, #nnn, #x, #y

Constructor Details

This class inherits a constructor from C8dasm::AsmBase

Instance Method Details

#last_opcodeObject



17
18
19
# File 'lib/c8dasm/assemblies/asm8.rb', line 17

def last_opcode
  @opcode[3]
end

#to_sObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/c8dasm/assemblies/asm8.rb', line 5

def to_s
  case last_opcode
  when '0' then "LD V#{x}, V#{y}"
  when '2' then "AND V#{x}, V#{y}"
  when '3' then "XOR V#{x}, V#{y}"
  when '4' then "ADD V#{x}, V#{y}"
  when '5' then "SUB V#{x}, V#{y}"
  when '6' then "SHR V#{x}, V#{y}"
  when 'e' then "SHL V#{x}, V#{y}"
  end
end