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, a few forth primitives 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;
}

Theme files are the interface customization standard for Uxn software.

A .theme file contains 6 bytes equal to 4 colors, divided into 3 shorts corresponding to the RGB channels.

0a6f 05cf 0caf

The previous theme data corresponds to the following 4 colors:

#000000 #aa55cc #66ccaa #ffffff

Uxn Routine

A routine to load a local theme file in Uxn:

( theme )

@theme-txt ".theme $1

@load-theme ( -- )

	;theme-txt .File/name DEO2 
	#0006 .File/length DEO2 
	#fffa .File/load DEO2

	.File/success DEI2 #0006 NEQ2 ,&ignore JCN
		#fffa LDA2 .System/r DEO2
		#fffc LDA2 .System/g DEO2
		#fffe LDA2 .System/b DEO2
		&ignore
	;redraw JSR2

RTN

Applications supporting the format include Orca, Left, Nasu, and Noodle. Nasu is able to export a .theme file with ctrl+p.

Four colors should be more than enough for any interface.

The operation is not to copy but to snarf. It's called snarf because snarf is what it does. There is no design document.

Snarf is the term for Copy on the Plan9 operating system.

The cut operation deletes the selected text from the screen and puts it in the snarf buffer, snarf copies the selected text to the buffer without deleting it, paste replaces the selected text with the contents of the buffer.

The term has made its way into the Uxn ecosystem as the name for the clipboard buffer, programs will handle clipboard operations by writing to an external file called .snarf. The applications Left, Nasu, Noodle, Dexe, and Orca will create snarf files.