Skip to content

coldnew/emulator-4917

Repository files navigation

emulator-4917 - 4917 emulator based on clojure/clojurescript

https://img.shields.io/badge/license-Eclipse-blue.svg https://travis-ci.org/coldnew/emulator-4917.svg?branch=master

4917 microprocess is an 4-bit cpu designed for University of New South Wales (UNSW) COMP1917.

This emulator is written by both clojure and clojurescript, I use the Clojure 1.7 new feature Reader Conditionals to reduce code complexity, you can build and running this emulator on JVM or Node.js.

For those interesting how to write 4917 emulator, I write a tutorial here:

使用 Clojure 打造 4917 微處理器的模擬器 (Chinese)

I will update the tutorial in English later.

Usage (JVM)

To execute this emulator on JVM, you can use lein

lein run -- examples/countdown.bin

or compile this application to jar and execute

lein uberjar
java -jar target/emulator-4917-0.1.0-SNAPSHOT-standalone.jar examples/countdown.bin

Usage (Node.js)

To execute on node.js, one muse compile clojurescript to javascript first

lein cljsbuild once

This project use none optimization by default, you can use run.js to execute the application

node run.js examples/countdown.bin

or you also can modify the project.clj for advanced optimization

:optimizations :advanced
:pretty-print false

rebuild to javascript again and start application by node

lein cljsbuild once
node target/emulator-4917.js examples/countdown.bin

Examples

There are four examples in examples folder: (in binary format)

file namedesription
countdown.bincountdown from 5 to 1
countup.bincountup from 0
bell.binring bell three times
calculate_6+3+1.bincalculate 6 + 3 + 1

License

Copyright © 2015 Yen-Chin, Lee <coldnew.tw@gmail.com>

Distributed under the Eclipse Public License either version 1.0 or any later version.

About

4917 microprocess emulator in both clojure and clojurescript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published