This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d0 STR-0 Store the next byte (7) in register 0. | |
07 | |
0c SLE Skip two instructions if accumulator <= register 0. | |
03 DED Decrement the accumulator in decimal mode | |
5f NOP No operation | |
d0 STR-0 Store the next byte (0x31) in register 0 | |
31 | |
30 SBZ-0 Skip two instruction bytes if accumulator bit 0 is zero | |
81 JMP-1 Jump to 0x1c9 (end of this code block) | |
c9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
# 8087 tangent algorithm, from Implementing Transcendental Functions, R. Nave | |
atan_table = [math.atan(2 ** -i) for i in range(0, 17)] | |
def cordic_tan(z): | |
# Compute tan of angle z, using CORDIC | |
q = [] | |
# Break down z into sum of angles, where each angle is 0 or atan(2**-i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Demonstration of the BeagleBone's PRU, using a timer. | |
* Ken Shirriff, http://righto.com | |
*/ | |
#include <stdint.h> | |
#define DELAY_NS 100 // Use 500000000 for 0.5 second delay | |
#define WRITE_PIN 15 /* P8_11, Ethernet output data, pr1_PRU0_pru_r30_15 */ | |
// PRU Interrupt control registers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code prints out the melody in the UM66T sound chip's ROM. | |
# The ROM holds Jingle Bells, Santa Claus is Coming to Town, and We Wish You a Merry Christmas. | |
# See this Twitter thread for details: https://twitter.com/kenshirriff/status/1472297415201869831 | |
from collections import defaultdict | |
notes = ['X', 'X', 'G4', 'A5', 'B5', 'C5', 'D5', 'E5', 'F5', 'G5', 'A6', 'B6', 'C6', 'X', 'X', 'X'] | |
# Hard-coded ROM contents. | |
bits = {"24,1":0,"15,0":1,"15,1":0,"15,3":1,"15,4":0,"14,4":1,"13,4":0,"12,4":1,"11,4":0,"10,4":1,"9,4":1,"8,4":0,"7,4":0,"6,4":1,"5,4":1,"4,4":0,"0,4":0,"1,4":1,"2,4":1,"3,4":0,"0,1":1,"0,0":1,"3,0":1,"4,0":1,"7,0":1,"8,0":1,"11,0":1,"12,0":1,"17,0":1,"19,0":1,"20,0":1,"23,0":1,"25,0":1,"26,0":1,"29,0":1,"31,0":1,"30,1":1,"28,1":1,"26,1":1,"25,1":1,"22,1":1,"21,1":1,"18,1":1,"17,1":1,"30,5":1,"31,6":1,"30,8":1,"30,9":1,"30,10":1,"31,11":1,"31,13":1,"31,14":1,"30,15":1,"31,16":1,"30,18":1,"30,19":1,"31,20":1,"31,21":1,"30,23":1,"31,24":1,"31,25":1,"31,26":1,"31,28":1,"30,29":1,"30,28":0,"29, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" Download an IR remote signal from a Rigol DS1052E and | |
analyze it for a NEC protocol signal. | |
Ken Shirriff | |
http://righto.com | |
""" | |
import array | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; blink.p: demonstration of PRU on the BeagleBone Black | |
; blink LED connected to P8_11 ten times | |
.origin 0 | |
.entrypoint TOP | |
TOP: | |
MOV r1, 10 ; blink counter | |
BLINK: | |
SET r30, r30, 15 ; set GPIO output 15 | |
MOV r0, 0x00a00000 ; delay counter | |
DELAY: |
NewerOlder