Sha256: 27bef84b6b27609f872670116a762e1ce25ec851438cb44c2a48345d243783e9
Contents?: true
Size: 434 Bytes
Versions: 2
Compression:
Stored size: 434 Bytes
Contents
module HackAssembler module JumpTranslator def self.translate(jump) bytecode = @@translation_table[jump] raise ParserError if bytecode.nil? bytecode end private @@translation_table = { nil => '000', 'JMP' => '111', 'JGT' => '001', 'JEQ' => '010', 'JGE' => '011', 'JLT' => '100', 'JNE' => '101', 'JLE' => '110' } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hack_assembler-0.2.0 | lib/hack_assembler/jump_translator.rb |
hack_assembler-0.1.0 | lib/hack_assembler/jump_translator.rb |