Giter VIP home page Giter VIP logo

guilekuthmix's Introduction

CXI Knuth MIX Virtual Machine, Assembler and Library

Purpose

Fourth attempt at creating a library for dealing with the fictional machine known as the MIX machine that is explained in the book series “Art of Computer Programming”.

This will be done in the GNU Guile programming language. It is the only language that I know how to program in and written inside of Emacs.

There is another MIX simulator available known as the GNU MDK. It is written in C as far as I can tell and includes an assembler, virtual machine, virtual machine GTK frontend, GNU Guile interpreter that runs on MDK VM, and Emacs lisp code for editing this stuff.

I will only try to match the execution of programins written in the MIX assembly language. I will not try to match whatever their internal implementation is.

Thankfully the MDK manual contain a sort of specification that I can match my own implementation against.

Architecture Brainstorming

There needs to be 3 components. The assembler, virtual machine, and the relevant library. And so there will be 2 scripts in the bin directory. I think I will begin worl on the virtual machine first. Since it is described first in the book.

Assembler

Takes MIX assembly code an generates a binary file that complies with the MIX specification that is described in the books.

Tokenizer

Lexer

Code Generation

Virtual Machine

Load MIX binary files and executes the instructions that are found in those files.

Bytes, Words

In scheme there exists a datatype, bitvector it will be the basis for everything. Words can be a list of bitvectors or a bitvector itself.

  • make-byte generate a valid MIX byte, 6 bits with init argument setting the bits a default value, follow the architecture decisions of GNU Guile
  • make-word generate MIX Word plus the sign bit
  • subfield takes value F, \(F = 8*L + R \) or pair denoting L and R

I have found the existance of some functions that make stuff easier

CPU

Constains registers which are just words.

File Loader

Memory

Registers

Execution Loop

Fetch, load, execute.

Installation/Distribution Notes

A lot of this information can be verified by consulting the Guile Reference Manual. One might as why not use “Guile Hall” or “Akku”. Answer is one is a R7RS package manager and the other I could not get to work no matter what I tried. Also it is barely maintained. Maybe it works inside of GNU Guix system installation.

  • organize the scheme files byte using the information detailed in Installing Site Packages of the Guile Reference Manual
    • scheme files go to $prefix/share/guile where $prefix is install location such as /usr
    • relevant variable is %site-dir
    • compiled go files go to %site-dir/site-ccache
    • relevant variable is %site-ccache-dir

The directories in this repository are

  • src scheme source files, this is the library MIX
  • bin script files that meant for end user
  • cache compiled files, doubt that it will be used

Hall

I have finally figure out how to use Hall build system. It is just that the instructions are not particulary clear. In the scripts section at the top of the file this has to go.

#!@GUILE@ \
-e main -s
!#

and of course any other flags can be added here.

  • BIG NOTE DO NOT USE HALL SCAN and then HALL CLEAN for it deletes bullshit
  • if all else fails there is always git
  • always do a git commit before running hall clean -x

guilekuthmix's People

Contributors

caesarxinsanium avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.