XXIIVV

The Utilities are a collection of little tools created solve specific problems.

A collection of small applications that don't quite have a place in the wiki just yet.

Firth, or 1th, is a postfix calculator for fractions.

Firth is a stack based rpn calculator, created to be an improved version of Unix's dc. It supports basic arithmetic and is the perfect companion utility to Fractran.

—Firth session with 6 MHz 286, 2.5MB RAM, DOS 5.0

Examples

The following example, will print the mixed fraction 3&1/6.

clr 11 4 div 5 12 div add mix

To print the decimal value of a fraction.

clr 22 7 div 1 791 div sub dec

To get the floor() of a fraction.

clr 17 4 div dup 1 mod sub .

1th.c

Shim is a utility that converts bytes into midi messages.

Shim is designed to recieve the 3 bytes of midi(channel, note, velocity) and pass it to a selected midi device. It is powered by Portmidi.

This tiny script the ideal companion application to Varvara for sending midi from Orca.

Usage

uxnemu orca.rom | shim

Stopwatch is a terminal utility countdown.

Why the heck did I even have to write this in the first place.

cc sw.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -o sw
#include <stdio.h>
#include <unistd.h>

int
main()
{
int h = -1, m = -1, s = -1, t = 0;
printf("Timeout(HH:MM:SS) | ");
if(!scanf("%d:%d:%d", &h, &m, &s)) {
printf("Invalid timestamp\n");
return 0;
}
if(m == -1 && s == -1) {
s = h;
h = 0;
m = 0;
} else if(s == -1) {
s = m;
m = h;
h = 0;
}
t = h * 3600 + m * 60 + s;
putchar('\n');
do {
if(t > 3600)
printf("\033[A%02d:%02d:%02d\n",
t / 3600,
(t / 60) % 60,
t % 60);
else if(t > 60)
printf("\033[A%02d:%02d\n",
(t / 60) % 60,
t % 60);
else
printf("\033[A%02d\n",
t);
sleep(1);
t--;
} while(t >= 0);
printf("Ended.\n");
return 0;
}