Skip to content

SVM implements a programmable virtual machine for a fictional 16-bit architecture.

License

Notifications You must be signed in to change notification settings

hexaflex-zz/svm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SVM

note: This project is strictly for personal educational purposes. Don't expect it to be of any practical use.

SVM implements a programmable virtual machine for a fictional 16-bit architecture. It comes with an assembler and the runtime. The runtime contains the CPU and a number of virtual hardware peripherals which one can interact with through a program. These include, among other things, a sprite-based display and a gamepad.

Refer to the documentation in the docs directory for details on the assembly language, the architecture and how to interact with peripherals.

Directory Overview

  • arch: A small, shared package which defines the CPU architecture. Including the instruction set and registers.
  • asm: Implements the assembler.
    • asm/ar: Implements the compiled binary file format. Archives are what the assembler produces.
    • asm/eval: A helper package for the assembler. It evaluates compile-time expressions.
    • asm/parser: The tokenizer and AST builder for the asembler. It reads SVM source files and parses them into an Abstract Syntax Tree.
    • asm/syntax: A helper package for the assembler. It examines a newly parsed AST and ensures it does not contain syntax errors. Additionally performs translations of certain code constructs.
  • cmd: Contains executables. These are assembler/VM front-ends and some useful tools.
    • cmd/svm: Contains the executable VM. This is the one that actually runs your programs.
    • cmd/svm-asm: Contains the executable front-end for the assembler.
    • cmd/svm-fdd: A small program which creates 1.44MB floppy disk images. These are what the VM uses to load your programs.
    • cmd/svm-sprite: A small tool which generates SVM source code from sprite sheets.
  • devices: The root directory for implementations of all the virtual hardware components. As well as defining some common shared interface types.
    • devices/fffe/clock: Implements a simple clock and timer device.
    • devices/fffe/cpu: Implements the CPU that runs the code.
    • devices/fffe/fd35: Implements a virtual 1.44MB floppy disk drive.
    • devices/fffe/gp14: Implements a virtual gamepad. It exposes a real gamepad to VM code.
    • devices/fffe/sprdi: Implements a virtual display. It allows a program to render sprites.
  • docs: Contains text files with documentation for various components.
  • testdata: Contains sample SVM source code and some other testing things.

TODO

  • Add audio support.
    • Create a specification for a audio hardware.
    • Create a device implementation of the specification.
    • Create test code to illustrate use of the device.
  • Add network support?
    • Create a specification for a network adapter.
    • Create a device implementation of the specification.
    • Create test code to illustrate use of the device.

License

Unless otherwise stated, this project and its contents are provided under a 3-Clause BSD license. Refer to the LICENSE file for its contents.

About

SVM implements a programmable virtual machine for a fictional 16-bit architecture.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages