prog8/tinyvm/main.py

18 lines
496 B
Python
Raw Normal View History

2018-02-25 15:43:00 +00:00
import sys
from .parse import Parser
2018-03-02 23:07:44 +00:00
from .program import Program, Opcode, Block, Instruction
2018-02-25 15:43:00 +00:00
from .vm import VM
source = open(sys.argv[1]).read()
parser = Parser(source)
program = parser.parse()
2018-02-27 21:16:45 +00:00
timerprogram = Program([Block("timer", None, [], [
Instruction(Opcode.RETURN, [], None, None)
], {}, [])])
2018-02-27 19:39:46 +00:00
# zero page and hardware stack of a 6502 cpu are off limits for now
VM.readonly_mem_ranges = [(0x00, 0xff), (0x100, 0x1ff), (0xa000, 0xbfff), (0xe000, 0xffff)]
2018-02-27 21:16:45 +00:00
vm = VM(program)
2018-02-25 15:43:00 +00:00
vm.run()