Skip to content

Instantly share code, notes, and snippets.

@tadglines
tadglines / README.md
Last active August 29, 2015 14:08 — forked from yansal/README.md
@tadglines
tadglines / Read Go
Last active December 17, 2015 06:28
package main
import (
"fmt"
"os"
"unicode/utf16"
)
/*
#include <Windows.h>

There are three result files:

results-for-original: Results for the orignal benchmark

results-for-modified: Resutls for a modified benchmark (see hello.go in this gist)

results-for-modified2: Results for a modified benchmark (same as 2 but where MaxConnectionCount=100)

@tadglines
tadglines / DCPU_DIV_Error.md
Created April 28, 2012 17:58
There's a problem with the current implementation of the DCPI DIV and IDIV instructions.

There appears to be a problem with the way the DCPU rc1 does DIV. The current DCPU RC1 implementation does the following for DIV:

long val = (b << 16) / a;
b = (char)(int)(val >> 16);
this.ex = (char)(int)val;

Given b = 0xFFFF, a = 0x2 the result will be a = 0xFFFF and ex = 0x8000. This is wrong. (0xFFFF << 16) / 0x2 should = 0x7FFF8000. The problem is that given "(b << 16) / a", Java will sign extend it. So, what Java ends up doing is (0xFFFFFFFFFFFF0000 / 0x2) which produces 0xFFFFFFFFFFFF8000 and that's not what is described in the spec. In order for the DCPU to meet the spec it would need to do:

@tadglines
tadglines / USSP_Spec.txt
Created April 28, 2012 17:39
A specification for a Universal Spaceship Bus for the 0x10c DCPU
The Universal Spaceship Bus is a time division multiplexed ship wide communications
medium. On startup each device is assigned an address by the bus master. The bus master
cycles through each device in turn asking it if it has a message to send. If the device
has a message to send, the buss master will obtain the destination address from the source
and then ask the destination device if it is ready to receive a message, if yes, then the
bus master will transfer the message from source to destination. If the destination device
isn't ready, the bus master will move on to the next device on the bus.
The exchange looks like this: