Skip to content

Instantly share code, notes, and snippets.

Ken Shirriff shirriff

Block or report user

Report or block shirriff

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@shirriff
shirriff / music_1401.txt
Created Sep 7, 2019
Music program for the IBM 1401, along with frequency cards. Courtesy of Ron Mak.
View music_1401.txt
,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
@shirriff
shirriff / music-1403.txt
Created Sep 2, 2019
Disassembly of a vintage program to generate music on an IBM 1403 line printer.
View music-1403.txt
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 / prime1.s
Created Jun 21, 2018
Generate primes up to 255 on the IBM 1401
View prime1.s
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 / fpga-font.py
Created Apr 4, 2018
Generate FPGA code to implement a character set
View fpga-font.py
# 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 Apr 4, 2018
Generate FPGA code to implement a character set
View fpga-font.py
# 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 / edid.py
Created Mar 25, 2018
Parse VGA configuration data (EDID) accessed from I2C device 0x50
View edid.py
# Program to parse VGA data (EDID) accessed from I2C device 0x50
#
# This is a quick demo not a supported program, so don't expect
# correctness from it.
#
# Edid format from:
# https://en.wikipedia.org/wiki/Extended_Display_Identification_Data#EDID_1.4_data_format
#
# Ken Shirriff http://righto.com
@shirriff
shirriff / PRU code
Last active Jan 8, 2018
Fragment of PRU code to output Manchester-encoded data.
View PRU code
for (bit_count = 0; bit_count < 8; bit_count++) {
if (byte & 0x80) {
wait_for_pwm_timer();
__R30 = HIGH << WRITE_PIN;
wait_for_pwm_timer();
__R30 = LOW << WRITE_PIN;
} else {
wait_for_pwm_timer();
__R30 = LOW << WRITE_PIN;
wait_for_pwm_timer();
@shirriff
shirriff / password.c
Created Jan 4, 2018
Use brute force to crack the password on a Xerox Alto disk.
View password.c
#include <stdint.h>
#include <stdlib.h>
#include <strings.h>
#include <stdio.h>
int64_t count = 0;
// Password vector from sys.boot. Must be big-endian.
// Disk 47
uint16_t passvec[] = {0xffff, 0xcfa7, 0x9f3d, 0x669a, 0xf2bb, 0xf193, 0x6d09, 0x4571, 0xe1d1};
@shirriff
shirriff / nopassword.py
Created Jan 4, 2018
Disable password protection on an Alto disk by zeroing out the password flag in sys.boot
View nopassword.py
# 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 / mathcrack.py
Last active Feb 17, 2019
Rapidly crack Xerox Alto disk passwords using a mathematical formula that reverses the password hash
View mathcrack.py
# 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'
You can’t perform that action at this time.