Skip to content

Instantly share code, notes, and snippets.

View flamewing's full-sized avatar

flamewing flamewing

View GitHub Profile
@flamewing
flamewing / dma-macros.asm
Last active October 23, 2024 19:31
Some improved DMA macros, and a couple new DMA macros, for the Mega Drive
dmaSource function addr,((addr>>1)&$7FFFFF)
dmaLength function length,((length>>1)&$7FFF)
dmaCommLength function length,(($9400|((length&$FF00)>>8))<<16)|($9300|(length&$FF))
dmaCommSrcLow function source,(($9600|((source&$FF00)>>8))<<16)|($9500|(source&$FF))
dmaCommSrcHigh function source,$9700|(((source&$FF0000)>>16)&$7F)
; Tells the VDP to copy a region of 68k memory to VRAM or CRAM or VSRAM.
dma68kToVDP macro src,dest,length,type,bswap
if MOMPASS>1
if ((src)&1)<>0
@flamewing
flamewing / btst-microcode.md
Last active September 21, 2018 14:02
Microcode analysis of M68000 btst, including missing "btst dn,#immed" from yacht.txt

From Fig. 21B

Operation           	Bit pattern         	A1   	A2   	A3
btst	dn,dm       	%0000'nnn1'0000'0mmm	BTSR1
btst	dn,am       	%0000'nnn1'0000'1mmm	MPIW1
btst	dn,(am)     	%0000'nnn1'0001'0mmm	ADRW1	     	BTSM1
btst	dn,(am)+    	%0000'nnn1'0001'1mmm	PINW1	     	BTSM1
btst	dn,-(am)    	%0000'nnn1'0010'0mmm	PDCW1	     	BTSM1
btst	dn,d16(am)  	%0000'nnn1'0010'1mmm	ADSW1	     	BTSM1
btst	dn,d8(am,Xl)	%0000'nnn1'0011'0mmm	AIXW0	     	BTSM1
@flamewing
flamewing / m68k_opt.md
Last active September 1, 2024 02:44
Some peephole optimizations for M68000
@flamewing
flamewing / bigendian_io.hh
Last active May 10, 2020 18:32
In-progress update of bigendian_io.hh.
// Godbolt: https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAM1QDsCBlZAQwBtMQBGAJlICsupVs1qhkAUm4AhSVNIBnTO2QE8dSplroAwqlYBXALa1Bm9ABk8tTADkjAI0zEuAFgBsvAA6p5hNbV0DY0FvX1U6S2s7Q0dnTndeRWVw2gYCZmICQKMTTgUlTBV/NIyCSNsHJ0F5dMzs4Lya0vLo2K4ASgVUfWJkDgByAHoAKgBqAFph8dGAWQwOUe1ZZYBmKVGrLHpx9Pt5ccN5kFGCcTXR5HH7Zl9L1CoqRQJjlzP13fGAdzx0AiRRlwTKajYaDcQABgAgiMIZCQYtUJ4AJ7EPDABAEUYQbTtUYAMWEhkw31Eo244M4nHG5M4AA5RmdtFRCcSrMAAHTyOh4ZAAAWAhmYeFY7LQhjO2FhIKlYwAKgg8PJRp5iKhgMRmIYNkqqMRMJhRlyqARPhkFkjuhcRKM9fgaqj7PoCAbCKMROhBiRRod8FQkRtTlD4fotE4TggDc7iIYlfdwwaAOI2ACqo3MmHkimIowTmicbFGAAV9PZWDy0zzNIo3UrPCWy/II%2BgZaN7P6/ga8XqDQx7iazfjulpmClSKNMIQI9mAG5OXx0UYrUZxjsVvq0RRjkgtiAj0YWnrLzwpXEif3CKOjWfEee0dkylvyxXK1XqzXa0Z2ggOp2YdAbWh41GBBEUjBA91db5WFYVsDX0RQqH0Vgx0dQM4TGAB1ABJWUAAkAHlk1lUZIRsABNUYMMhAAlajSNlMi3lGb4/m6TFMFnQDVzwQxPDLP9mIyDV6H9e4WxmbBqO0XD6MhKQsPMHCKK9PEcJsbAGAYfF8Ookiixo2UsO0ZNzBootk2owt8IYbB7yDMYGH1ICk1TdNMzDXNrA1GDi1LctLHXasaGzQ49U/TB0mFeQ7PQlsyMtRtulYf9wNnG1CgnWd/2YC5EVEqhnJTNMMyzHM828ot638ysN0wFs2DoY
@flamewing
flamewing / dumb_ptr.hh
Last active February 20, 2020 13:51
Non-owning version of unique_ptr with identical interface (including array specialization)
/* -*- Mode: C++; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* Copyright (C) Flamewing 2018 <[email protected]>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
@flamewing
flamewing / [dot]clang-format
Last active December 18, 2018 18:42
A .clang-format file with some good default values
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlwaysBreakTemplateDeclarations: Yes
IndentPPDirectives: AfterHash
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
@flamewing
flamewing / [dot]clang-tidy
Last active August 7, 2024 11:00
A .clang-tidy file with some good default checks
Checks: '-*,bugprone-*,cert-dcl21-cpp,cert-dcl50-cpp,cert-env33-c,cert-err34-c,cert-err52-cpp,cert-err60-cpp,cert-flp30-c,cert-msc50-cpp,cert-msc51-cpp,cppcoreguidelines-*,-cppcoreguidelines-macro-usage,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-vararg,google-build-using-namespace,google-explicit-constructor,google-global-names-in-headers,google-readability-casting,google-runtime-int,google-runtime-operator,hicpp-*,-hicpp-vararg,misc-*,modernize-*,performance-*,readability-*,-readability-named-parameter'
CheckOptions:
- key: bugprone-argument-comment.StrictMode
value: 1
- key: bugprone-exception-escape.FunctionsThatShouldNotThrow
value: WinMain,SDL_main
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: 1
FormatStyle: 'file'
@flamewing
flamewing / widgets.moon
Last active January 16, 2019 13:31
Moonscript experiments
--------------------------------------------------------------------------------
-- This file is part of the Lua HUD for TASing Sega Genesis Sonic games.
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as
-- published by the Free Software Foundation, either version 3 of the
-- License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
@flamewing
flamewing / mdtools.readme.md
Last active January 11, 2019 11:00
Badges with logo

Supported logos:

  • appveyor
  • azuredevops
  • bitcoin
  • circleci
  • codeship
  • dependabot
  • discord

To use msys2 bash on VSCode, add the following to settings:

    "terminal.integrated.shell.windows": "C:\\msys64\\usr\\bin\\bash.exe",
    "terminal.integrated.shellArgs.windows": [
        "--login",
    ],
    "terminal.integrated.env.windows": {
        "CHERE_INVOKING": "1",
 "MSYSTEM": "MINGW64",