Skip to content

daknuett/py_register_machine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py_register_machine

a register machine written in python3

WARNING:

PyRegisterMachine is deprecated and no longer supported. Use PyRegisterMachine2 instead!

PyRegisterMachine2 PyRegisterMachine2 docs

You can write programs for the machine using the KASM assembly language. Compile it using the assembler.py package.

(C) 2015 Daniel Knuettel

See the GNU AGPL V3 for further Information about copyright and warranty, as there IS NO WARRANTY PERMITTED BY THE AUTHOR.

The complete engine is as extensible as possible, so adding more features should be easy.

NOTE: it is important, to use the assembler with the correct processor definitions, the result would be unpredictable, if you won't.

NOTE: the programm is usually executed directly from the flash drive, but you also can load it into the ram. In addition to this, Flash, Ram and registers are handled completly the same way: you can make memory operations without using a register! (but it is not really recommended.)

NOTE: usually the only symbolic names are jump marks. You can specify register names in an .inc file and include them using the #include statement.
( use #include<new_stddef.inc> for some definitions )

Predefined routines can be included using the #import statement. This means, that no linking and/or memory rearrangement is supported, but you are welcome to add a better compiler/assembler/linker. The commands st or ld are not yet implemented.

The engine is not designed for a fix usage, but for expansion from the user, so no assembly directive/mnemonic definition is provided, as everybody may add his very own directives and mnemonics.

Installation

  • in-a-folder

  • Make the directory you want to work in using mkdir -p /home/<you>/path/to/folder

  • Go to that directory cd /home/<you>/path/to/folder

  • Get the source using git clone https://github.com/daknuett/py_register_machine --single-branch -b current

  • under the $PYTHONPATH

  • Go to a path in $PYTHONPATH `cd /home//.local/lib/python3.5/site-packages/

  • Get the source using git clone https://github.com/daknuett/py_register_machine --single-branch -b current

Usage

Run a sample

  • in-a-folder

  • Go to your directory cd /home/<you>/path/to/folder

  • Assemle the sample: python3 -m py_register_machine.assemle -f py_register_machine/assemblys/interrupt_test.asm -p py_register_machine/procdefs/new_processor.def

  • Run the sample: python3 -m py_register_machine.main a.flash py_register_machine/procdefs/new_processor.def

  • under $PYTHONPATH

  • Go to any directory

  • Get the Sample and a processor definition:

  • cp /home/<you>/.local/lib/python3.5/site-packages/py_register_machine/assemblys/interrupt_test.asm ./

  • cp /home/<you>/.local/lib/python3.5/site-packages/py_register_machine/procdefs/new_processor.def ./

  • Assemble: python3 -m py_register_machine.assemle -f interrupt_test.asm -p new_processor.def

  • Run: python3 -m py_register_machine.main a.flash new_processor.def

See the project's wiki < https://github.com/daknuett/py_register_machine/wiki > page for more info about usage.

See also the tutorial/documentation project < https://github.com/daknuett/py_register_machine_tutorials > for further interesting infos

Plans

  • Use more pythonic definitions for Register Machines
  • Generate a more module-conformable interface
  • A complete rewrite with a slightly modified architecture, removing all the bad debts

Daniel Knuettel