Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 469c10ed4fac24045a9d04382017a6e763863494 @totallymike committed Apr 6, 2012
Showing with 410 additions and 0 deletions.
  1. +13 −0 Makefile
  2. +16 −0 README.md
  3. +17 −0 maketest.c
  4. +364 −0 vm.c
@@ -0,0 +1,13 @@
+all: vm test.0x
+
+vm: vm.c
+ gcc vm.c -o vm
+
+test.0x: maketest
+ ./maketest
+
+maketest: maketest.c
+ gcc maketest.c -o maketest
+
+clean:
+ rm maketest vm test.0x
@@ -0,0 +1,16 @@
+Mike's DCPU-16 Emulator.
+========================
+
+The DCPU-16 is a fictional CPU, designed by Markus Persson, aka Notch. The spec is located at http://0x10c.com, along with further information about it and the game it is designed for.
+
+This project comes with one test binary, written by Notch and available in the spec located above. To build the test binary, run
+
+```
+make test_bin
+```
+
+To run,
+
+```
+./vm --help
+```
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+int main() {
+ unsigned short data[36] =
+ {0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d,
+ 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463,
+ 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a,
+ 0x9037, 0x61c1, 0x7dc1, 0x001a, 0x0000, 0x0000, 0x0000, 0x0000};
+ int i, len = 36;
+ FILE *fdata;
+ fdata = fopen("test.0x", "wb");
+ for (i = 0; i < len; i++) {
+ fwrite(&data[i], 2, 1, fdata);
+ }
+ fclose(fdata);
+ return 0;
+}
Oops, something went wrong.

0 comments on commit 469c10e

Please sign in to comment.