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
@moonheart08
moonheart08 / keybase.md
Created May 26, 2017 01:25
keybase verif

Keybase proof

I hereby claim:

  • I am moonheart08 on github.
  • I am moonheart08 (https://keybase.io/moonheart08) on keybase.
  • I have a public key ASBHQXFUqfSKd3epMLv160Ee0IfBLhiU7-4fTgPZdDwpkgo

To claim this, I am signing this object:

void print_backtrace() {
unw_cursor_t cursor; unw_context_t uc;
unw_word_t ip, sp, offset;
char buffer[1024]; // Lets make sure there's lots of space.
unw_getcontext(&uc);
unw_init_local(&cursor, &uc);
while (unw_step(&cursor) > 0) {
unw_get_reg(&cursor, UNW_REG_IP, &ip);
unw_get_reg(&cursor, UNW_REG_SP, &sp);
#include "simulation/Elements.h"
//#TPT-Directive ElementClass Element_DRIL PT_DRIL 186
Element_DRIL::Element_DRIL()
{
Identifier = "DEFAULT_PT_DRIL";
Name = "DRIL";
Colour = PIXPACK(0xFFE0A0);
MenuVisible = 1;
MenuSection = SC_NUCLEAR;
use std::fmt::Debug;
use std::fmt;
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct WFuncID(u32);
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct WTableID(u32);
#[allow(non_snake_case)]
#[derive(Debug, Copy, Clone, PartialEq)]
@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
@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
#bankdef "bootrom" {
#addr 0x0
#size 0x1000
#outp 0x0
}
#bankdef "ram" {
#addr 0x1000
#size 0x8000
}
#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;
' 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
; 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