Derrick Gold

  • Home
  • Albums
    • Alberta
    • Arizona
    • Berlin
    • Blink-182
    • Cambodia
    • Default
    • Indiana Jones
    • Italy
    • Japan
    • New York
    • Nova Scotia
    • Peru
    • Quebec
    • Shanghai
    • South Korea
    • Vancouver
  • Projects
    • AlexaSkillNodeLambdaSkeleton
    • Arkanoid-SCDS2
    • Atari-Boxing-NDS
    • BAGASMI
    • BAGPlug-SCDS2
    • Botty-McBotFace
    • BrainFuck-2600
    • Brickfall-NDS
    • CLinkedListExample
    • CMPT491Proj1
    • Cpgsql
    • CPUMemStats
    • CStuff
    • DeerFactValidator
    • DiskUsageDisplay
    • Dividends-2-Year-Trend
    • DownFall
    • DSTwoPong
    • Etch-NDS
    • fdshooter
    • MacEwanTeenyPascal
    • MarioPaintComposer-NDS
    • OpenPlugClientPy
    • OpenPlugServer
    • petulant-octo-spice
    • Pi-Doodle-Board
    • PyBot
    • Remote-Image-Browser
    • Remote-Music-Player
    • RemoteIndicator
    • Simple-File-Transfer
    • Simple-Virtual-Machine-Assembler
    • SmartReflectServer
    • SnowWars
    • SpaceInvaders-SCDS2
    • StaticWebpage
    • SysInfo
    • Tiny-Maze-Solver
    • UAPaint-NDS
    • XKCDComic
    • YoutubePlaylist
  • Music

Simple-Virtual-Machine-Assembler

An assembler for a simple virtual machine, an assignment for a computing class.

This page was programmatically generated from GitHub

ReadMe.md

An assignment for a class in C. I was already pretty competent in C, so I decided to over engineer this code.

To Build: -Run 'make' in the same directory as the make file

To Assemble a source file:

Source files are .svm files. These are found in asmBuilds/srcFiles

    run:
        ./sasm < asmBuilds/srcFiles/Test1.svm > Test1.out

Running the assembled file: The source for that binary wasn't included with the assignment, so it only runs in 64 bit linux environment.

Run the .out file like this:
    asmBuilds/svm < Test1.out

All the documenting included was part of the assignment specifications. =========================Documents========================= -README: See README for more details.

-docs/design.txt: Design doc on data and code structure.

-docs/testing.txt: Program testing details and explanations.

========================Source Files======================== -source/main.c: Main program logic. Creates the assembler, and uses it to assemble any input file.

-includes/main.h: Contains common libraries for each module. Defines constants used throughout the source files. Defines opcode and register values for assembler.

-source/btree.c --includes/btree.h: Binary tree implementation for holding misc data.

-source/keyvalue.c --includes/keyvalue.h: A keyvalue structure, links a string to an integer value

-source/keyvNode.c --includes/keyvNode.h: Glue code that glues the keyvalue structure to the supplied BTree implementation.

-source/myString.c --includes/myString.h: My own dynamically allocated string structure.

-source/debug.c --includes/debug.h: Functions for error and debug printing

-source/fileBuf.c --includes/fileBuf.h: Data structure and methods for parsing and containing an input .svm file

-source/asmData.c --includes/asmData.h: Initializes the data structures required by the assembler with the proper data values. This includes assigning registers their values, and opcodes with their values.

Also glues keyvalue interface with one to interact
with individual opcodes.

Finally, it includes the actual function for encoding an instruction when
given the required parameters.

-source/assembler.c --includes/asmData.h: Data structure and methods for creating an assembler. Utilizes the glue code from keyvNode.c to interact with BTrees and keyvalue structures to parse data from a fileBuf structure and actually assemble an input file.

-source/test.c --includes/test.h: Visual (text based) tests Btrees (by traversing, printing, retrieving), myString (creating and destroying strings), operation encoding, and file reading using the fileBuf structure (reads and tokenizes each line).

========================Makefile======================== ./Makefile Includes build ruiles for the programs Also includes testing rules for building the .svm files ^ "make test" ^

========================External FIles======================== -asmBuilds/. Root directory for test builds of .svm files

-asmBuilds/finalBins/. Directory contains known working assembled .svm files using the assignment provided sasm binary.

-asmBuilds/myBins/. Directoy will contain assembled .svm files generated by MY assembler when "make test" is called.

-asmBuilds/srcFiles/. Directory contains the plain text .svm files to assemble

-asmBuilds/sasm Assignment provided assembler.

-asmBuilds/svm Assignment provided virtual machine for testing assembled svm code.

Project information

  • Project URL Github
© Copyright Derrick Gold. All Rights Reserved
Designed by BootstrapMade