svm

module
v0.0.0-...-a3a69d7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2020 License: BSD-3-Clause

README

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.

Directories

Path Synopsis
Package arch defines the system's instruction set along with some related helper functions.
Package arch defines the system's instruction set along with some related helper functions.
asm
Package asm implements an assembler which turns a module and its dependencies into a binary program, ready for use on a VM.
Package asm implements an assembler which turns a module and its dependencies into a binary program, ready for use on a VM.
ar
Package ar defines the compiled archive.
Package ar defines the compiled archive.
eval
Package eval facilitates compile-time evaluation of expressions.
Package eval facilitates compile-time evaluation of expressions.
syntax
Package syntax performs syntax verification on an AST to ensure it is in a sane state.
Package syntax performs syntax verification on an AST to ensure it is in a sane state.
cmd
svm
fffe/clock
Package clock implements a simple clock and timer mechanism.
Package clock implements a simple clock and timer mechanism.
fffe/cpu
Package cpu implements the SVM CPU
Package cpu implements the SVM CPU
fffe/fd35
Package fd35 implements a generic 3.5" floppy disk drive.
Package fd35 implements a generic 3.5" floppy disk drive.
fffe/gp14
Package gp14 implements the gp14 gamepad.
Package gp14 implements the gp14 gamepad.
fffe/sprdi
Package sprdi implements the Sprite Display Mk I
Package sprdi implements the Sprite Display Mk I

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL