Skip to content

Instantly share code, notes, and snippets.

View gabonator's full-sized avatar
👨‍🏭
at work

Gabriel Valky gabonator

👨‍🏭
at work
View GitHub Profile
@gabonator
gabonator / makefs.sh
Created February 14, 2023 10:04
make fat12/fat16/fat32 fs image
set -e
set -x
# FAT12 - min 64KB:
# dd if=/dev/zero of=test.img count=64 bs=1K
# mkfs.vfat -v -F 12 -S 512 -s 4 test.img
# FAT16 - min 9MB:
# dd if=/dev/zero of=test.img count=9 bs=1M
# mkfs.vfat -v -F 16 -S 512 -s 4 test.img
# FAT32 - min 256MB (cannot allocate):
# dd if=/dev/zero of=test.img count=256 bs=1M
@gabonator
gabonator / code.cpp
Created February 11, 2023 14:46
Novation mini mk3 hack - image editor
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
extern "C" uint32_t LED_BUFFER[];
extern "C" uint8_t MODE;
extern "C" int32_t TICKMS;
enum {Width = 32};
uint32_t image[Width][8] = {0};
uint32_t color = 0xab00cd;
@gabonator
gabonator / code.c
Created February 8, 2023 17:27
Novation mini mk3 hack - simple editor
#include <stdint.h>
#define LED_BUFFER ((uint32_t*)0x20000304)
#define REFRESH_BUFFER ((uint32_t*)0x20006754)
uint8_t buttonMap[8][8];
uint8_t image[8][8];
uint32_t getPixel(int x, int y)
{
@gabonator
gabonator / code.c
Created February 7, 2023 20:14
Novation mini mk3 hack
#include <stdint.h>
#define LED_BUFFER ((uint32_t*)0x20000304)
#define REFRESH_BUFFER ((uint32_t*)0x20006754)
#define draw(p) { \
uint8_t f = (9 - p / 10) * 10 + p % 10; \
LED_BUFFER[f] = c; \
REFRESH_BUFFER[f] = REFRESH_BUFFER[f] & 0xF8; \
}
@gabonator
gabonator / convert.js
Created February 6, 2023 07:12
novation mini mk3 disassembly
var fs=require("fs");
var input = fs.readFileSync("input.s").toString().split("\n");
var re = new RegExp("^ ([0-9a-f]{7}):\t(.*?)\t(.*)$")
var undef32 = new RegExp("; <UNDEFINED> instruction: 0x([0-9a-f]{8})$");
var comment = new RegExp("^(.+\t.+\t);( .*)$")
var wrong = ["vrev64.32", "stmia", "movs r0, r0", "lsrs",
"vshr.u32", "illegal", "UNDEFINED", "<und>", ".s", ".u", "hlt ",
"vst2", "mrrc2", ".f", "cdp2", "bhi.n", "vtbl.8", "mrc", "mcr", "undefined",
@gabonator
gabonator / uefiprint.c
Created January 26, 2023 11:26
uefi debug print, debug anywhere or in release
#include <Library/SerialPortLib.h>
#include <Library/PrintLib.h>
VOID EFIAPI InternalPrintMessage(IN CONST CHAR8 *Format, ...)
{
CHAR8 Buffer[1024];
VA_LIST Marker;
VA_START (Marker, Format);
AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);
VA_END (Marker);
@gabonator
gabonator / shizzolator.c
Created January 25, 2023 23:06
kvartus
int _ZN11CPT_MANAGER16determine_statusEv(int *param_1)
{
char cVar1;
byte bVar2;
int iVar3;
int **ppiVar4;
int iVar5;
int *piVar6;
undefined4 uVar7;
@gabonator
gabonator / literal.sh
Created January 11, 2023 17:16
raw string literal is evil!
# Raw string literals is evil! All types of line endings (\x0d\x0a, \x0d, \x0a) are
# converted into native line ending character (on linux "\x0a"). Contrary to this fact
# the documentation https://en.cppreference.com/w/cpp/language/string_literal says:
#
# ...Used to avoid escaping of any character. Anything between the delimiters
# becomes part of the string.
#
# Here is a proof, lets create 3 strings using various line ending characters/sequences
# inside raw string literal constant. Print out the length and contents for each
# The first is using \r\n sequence, second \x0d, third \x0a. So we would expect
@gabonator
gabonator / cicoemu.h
Created December 30, 2022 16:34
titus the fox - cicojit
#pragma once
#include <stdint.h>
#include <assert.h>
namespace CicoContext
{
class cicocontext_t {
public:
struct register_t
@gabonator
gabonator / cico.diff
Created December 29, 2022 22:43
cicoparser-jit test1
diff --git a/CicoJit/cicodis/cicodis/main.cpp b/CicoJit/cicodis/cicodis/main.cpp
index 8b93219..910b2b4 100644
--- a/CicoJit/cicodis/cicodis/main.cpp
+++ b/CicoJit/cicodis/cicodis/main.cpp
@@ -1,3 +1,12 @@
+/*
+ /Users/gabrielvalky/Documents/git/Projects/CicoJit/games/fox/GAME.EXE
+ start,1020:5dce,1020:476c,1020:4dfd,1020:4e87,1020:63f1,1020:63bf,1020:4d0b,1020:4748,1020:47b7,1020:47fa,1020:4df9,1020:47b7,1020:47d3,1020:5a04,1020:4e88,1020:4d0c,1020:4dc9,1020:4d10,1020:4db1,1020:4826,1020:4f03,1020:4e2e,1020:495b,1020:48cc,1020:48d6,1020:622e,1020:4833,1020:14e5,1020:157c,1020:147a,1020:147d,1020:1585,1020:14dd,1020:158c,1020:1591
+
+