Skip to content

Instantly share code, notes, and snippets.

View bit-hack's full-sized avatar

Aidan Dodds bit-hack

View GitHub Profile
@bit-hack
bit-hack / sidexplore.cpp
Created August 28, 2021 11:58
sid register explorer
#include <cstdio>
#include <thread>
#include <set>
#include <string>
#include <GLFW/glfw3.h>
#include "imgui.h"
#include "backends/imgui_impl_glfw.h"
#include "backends/imgui_impl_opengl2.h"
@bit-hack
bit-hack / curve_6581.hex
Created August 26, 2021 20:10
6581 SID filter curve to SVF coef
005a
005a
005a
005a
005a
005a
005a
005a
005a
005a
@bit-hack
bit-hack / svf.v
Created August 23, 2021 20:38
*untested* state variable filter for icesid
module mult(input CLK,
input [15:0] iSig,
input signed [15:0] iCoef,
output signed [15:0] oOut);
wire signed [31:0] product; // 16x16 product
assign oOut = product[31:16];
SB_MAC16 mac(
@bit-hack
bit-hack / spi_slave.v
Created August 10, 2021 20:53
spi slave
module spi_slave(input CLK, // system clock
input SPI_CLK, // spi clock
input SPI_MOSI, // spi mosi
input SPI_CS, // spi chip select
output [7:0] DATA, // data out
output RECV); // data received
reg [2:0] sclk;
reg [2:0] smosi;
reg [2:0] scs;
@bit-hack
bit-hack / gbapu.v
Created July 14, 2021 16:46
Gameboy APU basis
module pulse_t(
input CLK12,
input TICK,
input [10:0] PERIOD,
output BIT);
reg [10:0] counter;
always @(posedge CLK12) begin
if (TICK) begin
@bit-hack
bit-hack / SN76489.V
Last active June 22, 2021 21:29
An SN76489 verilog model with uart input and I2S output
`default_nettype none
// moving average filter
// filter 222222Hz to ~27777Hz
module filter_t(
input CLK12,
input TICK,
input signed [15:0] IN,
output signed [15:0] OUT);
@bit-hack
bit-hack / sram.v
Created November 28, 2020 23:49
Simple sram verilog model
`default_nettype none
`timescale 1ns / 1ps
//
// simple sram model (IS61WV25616EDBLL)
//
module sram(input [3:0] addr, // address bus
input ce, // chip enable (act. low)
input we, // write enable (act. low)
input oe, // output enable (act. low)
@bit-hack
bit-hack / sdram.v
Created November 26, 2020 00:03
32bit SDRAM interface controller
//
// sdram.v
//
// sdram controller implementation for the MiST board adaptation
// of Luddes NES core
// http://code.google.com/p/mist-board/
//
// Copyright (c) 2020 René Rebe <[email protected]>
// Copyright (c) 2013 Till Harbaum <[email protected]>
//
@bit-hack
bit-hack / bitmask.h
Created September 28, 2020 20:37
Generate bit mask
// generate a bitmask between lo and hi bits inclusive
#define BIT_MASK(hi, lo) ((~0u >> (31-(hi))) & (~0u << (lo)))
@bit-hack
bit-hack / sram_23lc1024.cpp
Last active November 22, 2020 22:32
Arduino 23LC1024 SRAM object
#pragma once
#include <Arduino.h>
#include <SPI.h>
// 23lc1024 pin mapping
//
// 1 CS
// 2 MISO
// 3 (tie gnd)
// 4 GND