Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdint.h>
#include <malloc.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdarg.h>
#define MAX_WORDS 13000 // leave room for some tinkering
#define LENGTH 5
from __future__ import print_function
import sys
LENGTH = 5
RIGHT_LETTER_RIGHT_PLACE = 1
RIGHT_LETTER_WRONG_PLACE = 2
SCORE_NONE = 0
void getSpecialWord(uint16_t _n, char* buffer) {
static uint16_t w;
w = 0;
const uint8_t* b = answers;
static uint16_t n;
n = _n + 1;
static uint8_t additionTable[256];
static uint8_t tableReady = 0;
static uint8_t c;
static uint8_t mask;
@arpruss
arpruss / sargon.py
Last active December 16, 2021 03:30
GRAPHICS = True # uses cv2 to display board
import z80 # pip3 --install z80, but modified to make af visible
import binascii
import time
if GRAPHICS:
import cv2
import numpy as np
zoom = 5
function finder(obj, keyToFind, level=7, soFar='', searched=new Set) {
if (level<=0 || typeof obj != 'object' || obj === null || searched.has(obj)) return;
searched.add(obj)
if (keyToFind in obj) {
console.log(soFar + '.' + keyToFind)
}
for (let key in obj) {
try {
@arpruss
arpruss / tobin.py
Last active July 11, 2021 00:06
convert a hex dump to binary
# Public Domain / CC0 license
import sys
import re
import zlib
infile = sys.argv[1]
outfile = sys.argv[1].replace(".txt",".bin")
data = [0 for i in range(32768)]
// simply read a 32k Gameboy cartridge
// public domain / CC0
#define CHUNK_SIZE 16
uint16_t address;
uint16_t globalChecksum;
uint16_t correctGlobalChecksum;
uint8_t headerChecksum;
uint8_t correctHeaderChecksum;
// try to read a badly damaged 32k Gameboy Cartridge
const uint32_t aPins[16] = { PB8, PB9, PC13, PB7, PA0, PA1, PA2, PA3,
PA4, PA5, PA6, PA7, PB0, PB1, PB10, PB11 };
const uint32_t dPins[8] = { PB4, PB3, PA9, PA8, PB15, PB14, PB13, PA10 };
// all 5V tolerant: PB4, PB3, PA9, PA8, PB15, PB14, PB13, PA10
uint16_t address;
uint16_t RD = PB5;
document.body.style.backgroundColor="rgb(255,250,196)";
@arpruss
arpruss / reader.js
Last active June 6, 2021 14:57
Reader
(function(){
function getColor(tag) {
m = tag.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
if ( m )
return [parseInt(m[1]),parseInt(m[2]),parseInt(m[3]),255];
m = tag.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
return m ? [parseInt(m[1]),parseInt(m[2]),parseInt(m[3]),parseInt(m[4])] : null;
}
function realBackgroundColor(elem) {