Skip to content

Instantly share code, notes, and snippets.

View milesrout's full-sized avatar

Miles Rout milesrout

View GitHub Profile
@milesrout
milesrout / mroutbot.js
Created January 28, 2015 02:29
mroutbot. Written in node.js
var irc = require('irc');
var readline = require('readline');
var util = require('util');
var config = {
channels: ['#project-trillek'],
server: 'irc.freenode.net',
botName: 'mroutbot'
};
set nocompatible
set number
set tildeop
" Windows GUI options
set guioptions-=m
set guioptions-=T
set guioptions-=r
set guioptions-=L
set guifont=Source_Code_Pro_Bold:h11b
The built in firmware of the Trillek computer could:
1) Do a quick check of how much RAM the computer has.
2) Search for devices and store their info in RAM.
3) Set up a monitor and keyboard, getting by default the monitor and keyboard with the lowest slot number.
In future, it could try to get from NVRAM which monitor and keyboard to use.
4) Print basic information about the computer such as total RAM, CPU speed, number of devices found and
hardware info.
5) If there is a floppy drive with a floppy disk, try to boot from it. It there are many, it would use the
floppy drive with the lowest slot.
int wcsArrayAdd(wchar_t ***array, int *cur_size, wchar_t *item)
{
int new_size = (*cur_size) + 1;
size_t len = wcslen(item);
wchar_t *tmp1 = NULL;
wchar_t **tmp2 = NULL;
/* alloc memory for item */
tmp1 = malloc((len + 1) * sizeof(wchar_t));
if (tmp1 == NULL) {
return ERROR_MEMORY;
namespace trillek {
namespace util {
namespace logging {
namespace detail {
std::unique_ptr<logger> global_logger;
}
}
}
}
#include <wchar.h>
int main()
{
mbstate_t mbstate;
wchar_t const wcs[] = "\U00000055\U0000006E\U00000069\U00000063\U0000006F\U00000064\U00000065";
wchar_t const* wcsptr = wcs;
char mbs[256];
memset(&mbstate, 0, sizeof mbstate);
@milesrout
milesrout / 1.dfpu17.txt
Last active November 1, 2017 12:14
DFPU-17
A Floating Point Unit for the DCPU-16
This is a short document describing the DFPU-17 (D17), a
floating-point coprocessor for the DCPU-16 (D16). Despite its
simplicity, the DCPU-16 provides significant
functionality. However, a significant problem is its lack of
high-throughput floating-point support. The D17 exists to solve
this problem.
DCPU-16 Hardware Info:
@milesrout
milesrout / fpu.md
Last active August 29, 2015 14:08

In the following, $xxx represents a memory location and %xxx represents a register. dst represents a destination, src represents a source, lft represents the left-hand argument of a binary operation, rgt represents the right-hand argument of a binary operation, arg represents the only argument of a unary operation,

l          $addr, %reg
st         %reg, $addr

add        %lft, %rgt, %dst
sub        %lft, %rgt, %dst
mul        %lft, %rgt, %dst

div %lft, %rgt, %dst

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <pthread.h>
#include "html.h"
@milesrout
milesrout / gist:6a3a2d2a1a569d5c8073
Last active January 8, 2017 21:46
My vision document for Trillek
Vision for Trillek
==================
This is my vision for Trillek. This is intentionally brief: it's not a
design document.
Pillar #1: Multiplayer
----------------------
Trillek is primarily a multiplayer game. It will have a singleplayer