Class: C8dasm::Chip8Reader
- Inherits:
-
Object
- Object
- C8dasm::Chip8Reader
- Defined in:
- lib/c8dasm/chip8_reader.rb
Overview
Read a Chip-8 binary file.
Examples
reader = Chip8Reader.new('./MAZE')
p reader.opcodes.first
#=> "a21e"
Instance Attribute Summary collapse
-
#opcodes ⇒ Object
readonly
Returns an Array of String Chip-8 opcodes.
Instance Method Summary collapse
-
#initialize(filename) ⇒ Chip8Reader
constructor
Creates a Chip8Reader instance.
Constructor Details
#initialize(filename) ⇒ Chip8Reader
Creates a Chip8Reader instance.
filename - The String name of the binary file to read.
15 16 17 18 19 20 |
# File 'lib/c8dasm/chip8_reader.rb', line 15 def initialize(filename) @file = File.new(filename, 'rb') @opcodes = [] binaries_to_opcodes @file.close end |
Instance Attribute Details
#opcodes ⇒ Object (readonly)
Returns an Array of String Chip-8 opcodes.
23 24 25 |
# File 'lib/c8dasm/chip8_reader.rb', line 23 def opcodes @opcodes end |