Skip to content

Instantly share code, notes, and snippets.

View flamewing's full-sized avatar

flamewing flamewing

View GitHub Profile
@flamewing
flamewing / vdp.cc
Last active December 25, 2021 18:53
Experimental C++20 Mega Drive VDP library
// Overrides for some system files to account for -mshort
using usize = unsigned long;
using ssize = long;
using rsize = usize;
using intptr = long;
using uintptr = unsigned long;
using ptrdiff = long;
using wint = unsigned short;
@flamewing
flamewing / testansi.sh
Last active December 21, 2021 10:33
Public domain script to test ANSI escape codes for styles and colors
#!/bin/bash
# ANSI Escape Codes
# Enable styles
stySetNormal=$'\e[0m'
stySetBright=$'\e[1m'
stySetDim=$'\e[2m'
stySetBold=$'\e[1;2m'
stySetItalic=$'\e[3m'
@flamewing
flamewing / bash-colors.sh
Created July 19, 2021 10:36
Some stuff for bashrc dealing with colors/styles and man page colorization
#-------------------------------------------------------------------------------
# ANSI escape sequences
stySetBold=$(echo -en "\e[1m")
stySetDim=$(echo -en "\e[2m")
stySetUnderline=$(echo -en "\e[4m")
stySetBlink=$(echo -en "\e[5m")
stySetReverse=$(echo -en "\e[7m")
stySetHidden=$(echo -en "\e[8m")
stySetCrossed=$(echo -en "\e[9m")
@flamewing
flamewing / flags,sh
Last active December 16, 2021 15:19
A few terminal flags. Requires one of the Nerd Fonts patched fonts.
#!/bin/bash
chFullBox=$'\u2588'
chStars=$'\u2591'
chStripes=$'\uf0c9'
chMapleLeaf=$'\u2663'
chBigCross=$'\u254b'
chMidStripe=$'\u2501'
chTallBar=$'\u2584'
chSmallCross=$'\u271a'
@flamewing
flamewing / m68k-all-instructions.asm
Last active March 9, 2024 11:31
List of all MC68000 instructions and addressing modes, with cycle counts
CPU 68000
padding off ; We don't want AS padding out dc.b instructions
page 0 ; Don't want form feeds
supmode on ; We don't need warnings about privileged instructions
i3 = 7
i5 = 31
i8 = 126
i16 = 32766
i32 = 131070
xxx = $200
@flamewing
flamewing / gcc-wverything.sh
Last active June 15, 2021 14:26
Bash script to get a GCC equivalent of -Weverything
#!/bin/bash
# Change extension here for the language you want warnings for.
BASEFILE=a.cc
# Option for language standard goes here.
STD=(-std=c++14)
# Create temporary for detection of warnings.
touch ${BASEFILE}
Yacht v1.1
(Yet Another Cycle Hunting Table)
-------------------------------------------------------------------------------
Forewords :
-------------------------------------------------------------------------------
This document is based on :
- 9th Edition of M68000 8-16-32-bit Microporcessor User's Manual
(Motorola, 1993) (laterly refered as M68000UM)
@flamewing
flamewing / s1-loop.cc
Created August 27, 2020 20:41
Pseudo-c++ for Sonic 1 loop code
void Sonic::Handle_Loops() {
if (v_zone != id_SLZ && v_zone != id_GHZ) {
return;
}
uint8_t chunk = get_chunk(obX, obY);
if (chunk == v_256roll1 || chunk == v_256roll2) {
// Roll tunnels, not relevant here
Handle_Roll_Tunnels();
@flamewing
flamewing / m68k-bnf
Created August 6, 2020 20:18
Incomplete m68k grammar
label_preffix: "$$" | '@' | '.' | ε
label: label_preffix R"[A-Za-z_][A-Za-z0-9_]+"
binary_number: '%' R"[0-1]+" | R"0b[0-1]+"
octal_number: R"0o[0-7]+"
decimal_number: R"[0-9]+" | R"0d[0-9]+"
@flamewing
flamewing / vi-unwrapper.md
Created October 9, 2019 13:21
vim unwrap returns

Pattern to search for:

    return\s\+(\_[^;]\+)\s*;

Command to unwrap the parentheses from a return (cursor before the parentheses):

    nf(di(vhp