def test_asm_compiler_scrolling_5(self): cart = Cartridge() cart.path = "fixtures/nesasm/scrolling/" f = open("fixtures/nesasm/scrolling/scrolling5.asm") code = f.read() f.close() tokens = lexical(code) ast = syntax(tokens) opcodes = semantic(ast, cart=cart)
def compile(code, path): cart = Cartridge() cart.path = path tokens = lexical(code) ast = syntax(tokens) opcodes = semantic(ast, True, cart) return opcodes
def test_asm_compiler(self): cart = Cartridge() cart.path = 'fixtures/movingsprite/' opcodes = semantic(self.ast, True, cart=cart) self.assertIsNotNone(opcodes) bin = ''.join([chr(opcode) for opcode in opcodes]) f = open('fixtures/movingsprite/movingsprite.nes', 'rb') content = f.read() f.close() self.assertHexEquals(content, bin)
def assertAsmResults(self, source_file, bin_file): path = 'fixtures/nerdynights/scrolling/' f = open (path + source_file) code = f.read() f.close() tokens = lexical(code) ast = syntax(tokens) cart = Cartridge() cart.path = 'fixtures/nerdynights/scrolling/' opcodes = semantic(ast, True, cart=cart) self.assertIsNotNone(opcodes) bin = ''.join([chr(opcode) for opcode in opcodes]) f = open(path + bin_file, 'rb') content = f.read() f.close() self.assertHexEquals(content,bin)
def assertAsmResults(self, source_file, bin_file): path = 'fixtures/nerdynights/background/' f = open(path + source_file) code = f.read() f.close() tokens = lexical(code) ast = syntax(tokens) cart = Cartridge() cart.path = 'fixtures/nerdynights/background/' opcodes = semantic(ast, True, cart=cart) self.assertIsNotNone(opcodes) bin = ''.join([chr(opcode) for opcode in opcodes]) f = open(path + bin_file, 'rb') content = f.read() f.close() self.assertHexEquals(content, bin)