Skip to content

Instantly share code, notes, and snippets.

@pathawks
pathawks / snd_to_wav.py
Last active August 1, 2026 23:28
Desk Mate Song to MIDI
#!/usr/bin/env python3
"""Convert DeskMate 3 Sound Editor .SND files to 8-bit mono WAV files.
The bundled DeskMate 3 files use the 2500-series .SND container: a 114-byte
header followed by linked 46-byte sample descriptors. Uncompressed samples
are unsigned 8-bit PCM. Music-compressed samples are decoded from the native
COMPRESS.RES codebook and nibble stream.
"""
from __future__ import annotations
@pathawks
pathawks / extract_music.py
Created August 1, 2026 18:09
Lakers versus Celtics and the NBA Playoffs - VGM
#!/usr/bin/env python3
"""Extract the "Lakers versus Celtics and the NBA Playoffs" title music and sound effects as Tandy VGM.
The selected Tandy sound resource is the game's ``T`` file. BBALL.EXE
decodes it in place and then uses it for both the title-screen score in ``S``
and ten embedded effect-command entries. This script models both sides of
that driver and records its SN76489-compatible port writes in VGM 1.71 files.
The game does not attach names to the effect entries, so those outputs keep
their stable command indices (00 through 09).
@pathawks
pathawks / extract_tandy_vgm.py
Last active August 1, 2026 17:04
Extract Fire Hawk
#!/usr/bin/env python3
"""Extract Fire Hawk's Tandy/PCjr and Sound Blaster soundtracks as VGM files.
The DOS release stores each song as an LSB-first Sierra LZW resource named
SSnnn. Every unpacked sound resource contains several hardware-specific
tracks. This converter selects track 0x13 for the three-voice PCjr/Tandy
versions and track 0x08 for the nine-voice Sound Blaster OPL2 versions. It
uses the matching PATCH.101 and PATCH.003 data and models the respective
Sierra music-driver register writes.
(set-info :smt-lib-version 2.6)
(set-logic QF_LIA)
(set-option :produce-models true)
(set-info :status sat)
(declare-const board11 Int)(assert (= 1 board11))
(declare-const board12 Int)(assert (= 9 board12))
(declare-const board13 Int)(assert (and (<= 1 board13)(<= board13 9)))
(declare-const board14 Int)(assert (and (<= 1 board14)(<= board14 9)))
(declare-const board15 Int)(assert (and (<= 1 board15)(<= board15 9)))
(declare-const board16 Int)(assert (and (<= 1 board16)(<= board16 9)))
@pathawks
pathawks / index.js
Last active April 9, 2016 04:28
Slack Google slash command
const qs = require('querystring');
const https = require('https');
const url = require('url');
const googleLink = function (text) {
const query = encodeURIComponent(text).replace(/%20/g,'+');
return "<https://www.google.com/search?q=" + query + "|google.com/search?q=" + query + ">";
}
const qrCode = function (url) {
@pathawks
pathawks / Swift.md
Last active February 19, 2016 22:09
I ❤️ Swift

I ❤️ Swift

📜 View The Slides

About Swift Philosophy

Swift is friendly to new programmers. It is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.

The compiler is optimized for performance, and the language is optimized for development, without compromising on either. It’s designed to scale from “hello, world” to an entire operating system.

@pathawks
pathawks / 99Bottles.s
Last active October 5, 2015 00:23
99 Bottles of Beer in MIPS
# filename: 99Bottles.s
# author: Pat Hawks <pat@pathawks.com>
.data
Lyric1:
.asciiz " bottles of beer on the wall\n"
Lyric2:
.ascii " bottles of beer\n"
.asciiz "Take one down, Pass it around\n"
Lyric3:
@pathawks
pathawks / ieeefloat.c
Last active September 30, 2015 03:47
IEEE 754 Explore
/**
* Shows how a number is represented as IEEE 754
*
* @author Pat Hawks
* Course: COMP B13
* Created: Sept 29, 2015
* Source File: ieeefloat.c
*/
#include <stdio.h>
@pathawks
pathawks / Challenge2.S
Last active August 29, 2015 14:16
Challenge 2
/**
* @author: Pat Hawks
* Created on: Mar 06, 2015
* Source File: Challenge2.s
*
* To compile:
* gcc Challenge2.s -o Challenge2
*/
.code32
@pathawks
pathawks / Test.cpp
Last active August 29, 2015 14:16
Test Framework
/**
* @author: Pat Hawks
* Created on: Feb 26, 2015
* Source File: Test.cpp
*/
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;