diff --git a/requirements.txt b/requirements.txt index c109b2627..22ff5ae30 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ attrs ply git+https://github.com/irmen/cbmcodecs.git@master - diff --git a/tinyvm/main.py b/tinyvm/main.py index 1356437bf..267ef98d4 100644 --- a/tinyvm/main.py +++ b/tinyvm/main.py @@ -1,6 +1,12 @@ +""" +Simplistic 8/16 bit Virtual Machine to execute a stack based instruction language. +Main entry point to launch a VM to execute the given programs. + +Written by Irmen de Jong (irmen@razorvine.net) - license: GNU GPL 3.0 +""" + import sys from .parse import Parser -# from .program import Program, Opcode, Block, Instruction from .vm import VM mainprogram = None @@ -20,7 +26,7 @@ if len(sys.argv) not in (2, 3): raise SystemExit("provide 1 or 2 program file names as arguments") # 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)] +VM.readonly_mem_ranges = [(0x00, 0xff), (0x100, 0x1ff)] vm = VM(mainprogram, timerprogram) vm.enable_charscreen(0x0400, 40, 25) vm.run() diff --git a/tinyvm/parse.py b/tinyvm/parse.py index f7ad545d1..179a07907 100644 --- a/tinyvm/parse.py +++ b/tinyvm/parse.py @@ -1,3 +1,10 @@ +""" +Simplistic 8/16 bit Virtual Machine to execute a stack based instruction language. +Parser for the simplistic text based program representation + +Written by Irmen de Jong (irmen@razorvine.net) - license: GNU GPL 3.0 +""" + import array from typing import Optional, List, Tuple, Dict, Any from .program import DataType, Opcode, Program, Block, Variable, Instruction, Value diff --git a/tinyvm/program.py b/tinyvm/program.py index aa948e1a2..2b6090111 100644 --- a/tinyvm/program.py +++ b/tinyvm/program.py @@ -1,3 +1,10 @@ +""" +Simplistic 8/16 bit Virtual Machine to execute a stack based instruction language. +These are the program/instruction definitions that make up a program for the vm + +Written by Irmen de Jong (irmen@razorvine.net) - license: GNU GPL 3.0 +""" + import enum import array import operator diff --git a/tinyvm/vm.py b/tinyvm/vm.py index ff62bd470..ee887dbfb 100644 --- a/tinyvm/vm.py +++ b/tinyvm/vm.py @@ -1,3 +1,10 @@ +""" +Simplistic 8/16 bit Virtual Machine to execute a stack based instruction language. +This is the VM itself (execution engine) + +Written by Irmen de Jong (irmen@razorvine.net) - license: GNU GPL 3.0 +""" + # 8/16 bit virtual machine # machine specs: