Skip to content

Instantly share code, notes, and snippets.

View BlockoS's full-sized avatar
💭
🧙⚔️💾

MooZ BlockoS

💭
🧙⚔️💾
View GitHub Profile
@BlockoS
BlockoS / scanJSR7D98.pl
Created March 11, 2012 21:40
Search for the 2 bytes preceding the jsr 7d98 instruction in a PC Engine rom.
#!/usr/bin/perl -w
use strict;
use File::stat;
die "You must specify a rom name!" unless ($#ARGV == 0);
my $rom = 0;
my $fileSize = stat($ARGV[0])->size;
open(FILE, "<$ARGV[0]") or die $!;
@BlockoS
BlockoS / serialServer.pde
Created February 25, 2012 19:47
Stupid synchronous serial server for Arduino
#include <util/atomic.h>
#define CH_NUL 0x00
#define CH_BACKSPACE 0x08
#define CH_CANCEL 0x18
#define CH_SUBSTITUTE 0x1a
#define CH_ESCAPE 0x1b
#define CH_SPACE 0x20
#define CH_CSI 0x9b
#define CH_ST 0x9c
@BlockoS
BlockoS / itoa10.c
Created December 28, 2011 18:46
itoa base 10
inline int Stringify(int value, char* buffer, int bufferLen)
{
int i = bufferLen-1, tmp;
char *ptr = buffer, c;
for(; value && i; --i)
{
tmp = value;
value/=10;
*ptr++ = "9876543210123456789"[9 + tmp - value*10];
@BlockoS
BlockoS / callback.cpp
Created December 13, 2011 21:06
Callback deluxe
class Callback
{
public:
Callback() {}
virtual ~Callback();
virtual void onMouseMove(int x, int y) = 0;
};
template <typename T>
@BlockoS
BlockoS / clearColor.asm
Created November 29, 2011 16:33
glClearColor call
; 426 : glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
fldz
sub esp, 16 ; 00000010H
fst DWORD PTR [esp+12]
fst DWORD PTR [esp+8]
fst DWORD PTR [esp+4]
fstp DWORD PTR [esp]
call DWORD PTR __imp__glClearColor@16
@BlockoS
BlockoS / vao_test.c
Created November 14, 2011 15:04
Vao Example
// init
glGenVertexArrays(1, &fullscreenTriangleVAO);
glBindVertexArray(fullscreenTriangleVAO);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER, fullscreenTriangleFBO);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (GLvoid*)(6*sizeof(GLfloat)));
glBindBuffer(GL_ARRAY_BUFFER, 0);
gl.BindVertexArray(0);
@BlockoS
BlockoS / gl_init.c
Created October 28, 2011 20:42
gl init
union
{
struct
{
PFNGLATTACHSHADERPROC AttachShader;
PFNGLCOMPILESHADERPROC CompileShader;
PFNGLCREATEPROGRAMPROC CreateProgram;
PFNGLCREATESHADERPROC CreateShader;
PFNGLDELETEPROGRAMPROC DeleteProgram;
PFNGLDELETESHADERPROC DeleteShader;
@BlockoS
BlockoS / SectorEraseTest.pde
Created September 28, 2011 14:26
DataFlash sector erase test
#include <SPI.h>
#include "DataFlash.h"
DataFlash dataflash;
uint8_t currentSector;
void setup()
{
uint8_t status;
DataFlash::ID id;
#ifndef NETWORK_H
#define NETWORK_H
#include "Config.h"
// [todo] enum for error?
class Network
{
public:
mpr 0: ff
mpr 1: f8
mpr 2: 80
mpr 3: 81
mpr 4: 82
mpr 5: 83
mpr 6: 77
mpr 7: 00
5439: ; start of vram "print"