Skip to content

Instantly share code, notes, and snippets.

View moonheart08's full-sized avatar
🚀
working on space station 14

Moony moonheart08

🚀
working on space station 14
View GitHub Profile
Write-Output "Moony's upstream merge workflow tool."
Write-Output "This tool can be stopped at any time, i.e. to finish a merge or resolve conflicts. Simply rerun the tool after having resolved the merge with normal git cli."
Write-Output "Pay attention to any output from git!"
$target = Read-Host "Enter the branch you're syncing toward (typically upstream/master or similar)"
$refs = git log --reverse --format=format:%H HEAD.. $target
$cherryPickOption = New-Object System.Management.Automation.Host.ChoiceDescription "&Cherry-pick","Uses git cherry pick to integrate the commit into the current branch. BE VERY CAREFUL WITH THIS."
$mergeOption = New-Object System.Management.Automation.Host.ChoiceDescription "&Merge","Uses git merge to integrate the commit and any of it's children into the current branch."
$skipOption = New-Object System.Management.Automation.Host.ChoiceDescription "&Skip","Skips introducing this commit."
// NOTE: Min C++ lang version is C++20. Make sure your project is set to that!
#include <iostream>
#include <vector>
#include <format>
#include <stdexcept>
#include <string>
#include <cassert>
using std::cout, std::cin, std::endl;
// Standard form 1.
{reg:
[
{bits: 1, name: '0', type: 1},
{bits: 6, name: 'opcode', type: 2},
{bits: 3, name: 'func1', type: 3},
{bits: 3, name: 'dest[2:0]', type: 4},
{bits: 3, name: 'src1[2:0]', type: 5},
{bits: 1, name: '1', type: 1},
{bits: 2, name: 'dest[4:3]', type: 4},
' FLAGS layout: cznhcznhcznhCZNH, where lowercase values are junk data in the form of previous flags values.
' Do not depend on that, it's just how this specific example comes out to work.
MOV INREG1, {...} ' 2
MOV INREG2, {...} ' 2
MOV WRVAL, TMP1 ' 2
ADD WRVAL, TMP2 WZ ' 2 Compute result and Z flag.
TESTB WRVAL, #8 WC ' 2 Compute C flag.
RCZL FLAGS ' 2 Store flags, step 1.
; 14 bytes
bad_rem_by_three:
pull r1 ; 2 Stick r1 onto the queue.
asn r0, -2 ; 2 Assign the return address to r0 so we don't lose it.
psn ; 2 Fill some space in the queue.
.lp: sub -3, #3 ; 2 Subtract 3 from value
ltz -1 ; 2 Check if sub result is less than zero, signed.
bz -1, #.lp, #0 ; 2 If lts result is zero, branch back to .lp. Put #1 into the queue
' All are unrolled, as they are presumably in HUBRAM so branching == bad
' UNTESTED, may contain stupidity and/or nuts
' BAD CODE AHEAD YAY
encode_1b and inp, #$7F
_ret_ getbyte out, inp, #0
encode_2b mov tmp1, inp
and inp, #$7F
getbyte out, inp, #0
sar tmp1, #7
#version 430
//4*4 ray bundle
#define group_size 128
#define buffer_size 256
layout(local_size_x = 1, local_size_y = group_size) in;
layout(rgba32f, binding = 0) uniform image2D blurred_hor1;
layout(rgba32f, binding = 1) uniform image2D blurred_hor2;
layout(rgba32f, binding = 2) uniform image2D bloom;
layout(rgba32f, binding = 3) uniform image2D DE_input;
#bankdef "bootrom" {
#addr 0x0
#size 0x1000
#outp 0x0
}
#bankdef "ram" {
#addr 0x1000
#size 0x8000
}
@moonheart08
moonheart08 / mx08.cpu
Last active February 8, 2020 03:59
A SuperH-alike
#bankdef "bootrom" {
#addr 0x0
#size 0x4000
#outp 0x0
}
#bankdef "invalidaccess_0" {
#addr 0x4000
#size 0xBFFF ; I bet you I messed up at least once here
; and made some banks overlap, or put gaps
; between banks
@moonheart08
moonheart08 / intcode.rs
Created December 2, 2019 20:12
Solution to AoC day 2
pub type IntcodeNum = usize; // assume unsigned until told otherwise
pub struct IntcodeMachine {
instr_ptr: IntcodeNum,
memory: Vec<IntcodeNum>,
initial: Vec<IntcodeNum>,
}
pub struct IntcodePatch(IntcodeNum, IntcodeNum); // offset, val