Skip to content

Instantly share code, notes, and snippets.

View cogwheel's full-sized avatar

Matthew Orlando cogwheel

View GitHub Profile
@cogwheel
cogwheel / EEPROM.ino
Last active June 8, 2017 18:29
Second attempt writing data to X28C256 EEPROM using arduino mega2560
/* Address pins */
#define A0 30
#define A1 31
#define A2 32
#define A3 33
#define A4 34
#define A5 35
#define A6 36
#define A7 37
#define A8 38
@cogwheel
cogwheel / eeprom2.ino
Last active June 14, 2017 16:49
Revised programmer with unlock
/* Programmer for Xicor X28C256 EEPROM, using Mega2560 for parallel I/O */
/* Address pins */
#define A0 30
#define A1 31
#define A2 32
#define A3 33
#define A4 34
#define A5 35
#define A6 36
@cogwheel
cogwheel / section_summary.py
Created September 24, 2023 16:31
Read .map file from mos-nes-mmc3 target and summarize RAM/ROM usage
import re
import sys
TOTAL_SYSTEM_RAM = 0x800 # 2kb built into the NES
TOTAL_WORK_RAM = 0x2000 # 8kb of PRG RAM thanks to the mapper TODO: banking?
TOTAL_PRG_BANKS = 64
PRG_BANK_SIZE = 0x2000 # 8KiB banks
TOTAL_CHR_BANKS = 256
@cogwheel
cogwheel / libcxx.md
Created March 20, 2024 14:46
libcxx -> llvm-mos integration notes

Libcxx

(cogwheel)

Our type-safe unit conversions are nice, but the code to implement them is pretty verbose. llvm-mos has support for C++23, but it doesn't include much of the standard library. Here's the story of what's in the libcxx directory:

  1. Include in our source code, to find that it isn't available
  2. Go to llvm's libc++ source code and download the compare header: https://github.com/llvm/llvm-project/tree/main/libcxx
  3. Try compiling. See that it needs , download that, try again
  4. Find it needs a bunch of internal stuff, including entire directories (or at least it's easier to copy entire directories than individual files)
@cogwheel
cogwheel / __config_site
Created March 20, 2024 14:53
quick & dirty site config for using some header-only parts of libcxx in llvm-mos
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP___CONFIG_SITE
#define _LIBCPP___CONFIG_SITE
@cogwheel
cogwheel / files.txt
Created March 20, 2024 14:55
List of things copied from libcxx
LICENSE.TXT
__assert
__availability
__bit
__compare
__concepts
__config
__config_site
__functional
__fwd