Skip to content

Instantly share code, notes, and snippets.

View shirriff's full-sized avatar

Ken Shirriff shirriff

View GitHub Profile
@shirriff
shirriff / nopassword.py
Created January 4, 2018 02:31
Disable password protection on an Alto disk by zeroing out the password flag in sys.boot
# Disable password protection on an Alto disk by zeroing out the password flag in sys.boot
import sys
import subprocess
diskContents = None
# Get word at the word offset in the disk file
def getWord(wordOffset):
return ord(diskContents[2 * wordOffset]) + ord(diskContents[2 * wordOffset + 1]) * 256
@shirriff
shirriff / fpga-font.py
Created April 4, 2018 03:36
Generate FPGA code to implement a character set
# Process font file to generate FPGA code
# Font from https://github.com/dhepper/font8x8/blob/master/font8x8_basic.h
import re
chars = []
for line in open('font8x8_basic.h').readlines():
m = re.search('{([\s0-9A-Fa-fx,]*)}', line)
if m:
@shirriff
shirriff / fpga-font.py
Created April 4, 2018 03:36
Generate FPGA code to implement a character set
# Process font file to generate FPGA code
# Font from https://github.com/dhepper/font8x8/blob/master/font8x8_basic.h
import re
chars = []
for line in open('font8x8_basic.h').readlines():
m = re.search('{([\s0-9A-Fa-fx,]*)}', line)
if m:
@shirriff
shirriff / card.s
Created December 7, 2017 20:04
IBM 1401 assembly code to print a Christmas card
job card.s
ctl 6641
org 087
X1 dcw 000 * Index 1, pointer to text
dc 00
org 333
start sw 1
sbr x1, buf+80
rloop r * Read cards into page buffer
bce rhs, 1, -
@shirriff
shirriff / prime1.s
Created June 21, 2018 05:06
Generate primes up to 255 on the IBM 1401
job prime1.s
* Compute primes 2-255 for toggle challenge
* Ken Shirriff http://righto.com
ctl 6641
org 201 * Start of print buffer
num dcw 002 * Current number
org 333 * Start of code memory
outer mcw @002@, factor * Start with factor 2
@shirriff
shirriff / mathcrack.py
Last active February 17, 2019 17:42
Rapidly crack Xerox Alto disk passwords using a mathematical formula that reverses the password hash
# Crack Xerox Alto disk passwords using math.
import sys
def findPasswd(passvec):
# a and b are the salt values
a = (passvec[1] << 16) + passvec[2]
b = (passvec[3] << 16) + passvec[4]
if a == 0 or b == 0:
print 'No password'
@shirriff
shirriff / loader.c
Created August 23, 2016 06:09
Loads a PRU text.bin (and optionally data.bin) file, executes it, and waits for completion.
// Loads a PRU text.bin (and optionally data.bin) file,
// executes it, and waits for completion.
//
// Usage:
// $ ./loader text.bin [data.bin]
//
// Compile with:
// gcc -o loader loader.c -lprussdrv
//
// Based on https://credentiality2.blogspot.com/2015/09/beaglebone-pru-gpio-example.html
@shirriff
shirriff / blink.p
Last active May 15, 2019 12:58
Assembly code to demonstrate the PRU on the BeagleBone Black. This code blinks an LED 10 times.
@shirriff
shirriff / music-1403.txt
Created September 2, 2019 16:21
Disassembly of a vintage program to generate music on an IBM 1403 line printer.
87 00000 # X0
92 00000 # X1
97 000 # X2
100 ,001 set wordmark 1 # Start
104 /000 clear storage 0 # Wraps to top of memory?
108 H099 store B* 99 # Top of memory - 100? into X2
112 L/49089 load 1149 89 # X1 = 0
119 L/49094 load 1149 94 # X2 = 0
126 1 read # READNOTE: Read first card
127 C003/53 compare 3 1153 # Card has END?
@shirriff
shirriff / music_1401.txt
Created September 7, 2019 21:24
Music program for the IBM 1401, along with frequency cards. Courtesy of Ron Mak.
,008015,022033L067135,1050291001/099H104C104135B101/,0011/001199199 0001MUSIC
,109116,121125,126133/101099 0002MUSIC
,008015,022029,036040,047054,061068,072/061039 ,00100110400003MUSIC
0000000000000,001/000H099L/49089 L032118,092097,100104,10811210400004MUSIC
L/490941C003/53B334SM0996J5B165DL/54354L039157,126127,134139,14615110400005MUSIC
M0756J1A/56094M0660?0H0991L0660?0H099 L037194,165172,179183,18419110400006MUSIC
A/57089C089/59B126U.100 L023217,202209,214040,04004010400007MUSIC
M585099/332/,0052011N372M002005 L031364,341345,346353,35435810400008MUSIC
M/60002B564001XB353001 B503001RL/49089 L038402,372380,388396,04004010400009MUSIC
C0036/1B438SA/56089C089094B403U.100 L035437,410415,422429,43404010400010MUSIC