Skip to content

Instantly share code, notes, and snippets.

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

MooZ BlockoS

💭
🧙⚔️💾
View GitHub Profile
@BlockoS
BlockoS / pcengine.json
Last active August 29, 2015 14:02
Etripator architecture specification (candidate)
architecture pcengine {
include: "pcengine.lua",
wordsize: 8b,
fetchsize: 8b,
endian: LSB,
memory: [
mem_bss: { name: "work ram", size: 8KB, start: 0x1f0200 },
@BlockoS
BlockoS / main.asm
Last active November 29, 2015 17:53
Memory base 128 routines (extracted from Shin Megami Tensei and Tadaima Yuusha Boshuuchuu)
.include "system.inc"
.include "startup.asm"
.include "mb128.asm"
.include "font.inc"
main:
sei
; Upload font.
lda #low(font_8x8)
@BlockoS
BlockoS / aslw.asm
Last active December 21, 2015 21:49
HuC6280 left shift (8bit input, 16bit output)
;----------------------------------------------------------------------
; name : asl.w
;
; description : Left shift 8 bit value, 16 bit result
;
; in : A number of bits to shift [0-f]
; X value
;
; out: A low nibble
; Y high nibble
@BlockoS
BlockoS / gist:4987518
Created February 19, 2013 16:36
unpack 5->8
bbba_aaaa <- 4 lda input | 4 lda input
dccc_ccbb 2 and #$1f | 2 and #$1f
eeee_dddd 4 sta output | 4 sta output
ggff_fffe
hhhh_hggg
bbxx_xxxx 6 asl input 4 lda input+2 | 4 lda input+1 4 sta ouput+3
cccc_cbbb 6 rol input+1 2 and #$1f | 4 sta r0
eeed_dddd <- 6 rol input+2 4 sta output+3 | 4 lda input+2
gfff_ffee 6 rol input+3 | 6 asl r0
@BlockoS
BlockoS / SerialServer.pde
Created December 12, 2012 21:41
A simple serial server for Arduino. It handles some special keys.
const char g_welcomeMsg[] = "Welcome!";
#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 / DataFlashTest.cpp
Created October 16, 2012 11:49
Dataflash Test
#include <SPI.h>
#include "DataFlash.h"
#include "Dummy.h"
class DataFlashFixture
{
public:
static const int8_t CHIP_SELECT = 5;
static const int8_t RESET = 6;
@BlockoS
BlockoS / main.c
Created September 5, 2012 21:36
Fbo creation from hell
CALL_GLPROC(GenFramebuffers)(FRAMEBUFFER_COUNT, framebuffer);
for(i=0, j=0, texId[TEXTURE_COUNT]=0; i<=NORMALIZE;)
{
CALL_GLPROC(BindFramebuffer)(GL_FRAMEBUFFER, framebuffer[i++]);
CALL_GLPROC(FramebufferTexture2D)( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texId[g_fboTexId[j++]], 0 );
CALL_GLPROC(FramebufferTexture2D)( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, texId[g_fboTexId[j++]], 0 );
}
for(i=0; i<SCALE_COUNT; i++)
{
@BlockoS
BlockoS / ed_sd.asm
Last active October 7, 2015 23:18
Turbo Everdrive SD card interface
;;---------------------------------------------------------------------
; Turbo-Everdrive SD card library
;;---------------------------------------------------------------------
SPI_SS = 0
SPI_FULL_SPEED = 1
SPI_AREAD = 2
STATE_SPI = 0
STATE_RY = 1
STATE_FIFO_WR = 2
// Fractional Brownian motion
float fBm(const glm::vec3 pos, const int octaveCount, float lacunarity, float gain )
{
float noiseSum = 0.0;
float amplitude = 1.0;
float amplitudeSum = 0.0;
glm::vec3 sample = pos;
for( int i = 0; i < octaveCount; ++i )
@BlockoS
BlockoS / BufferObject.cpp
Created April 17, 2012 20:52 — forked from StonedXander/Makefile
Some VBO Stuff
#include "BufferObject.h"
BufferObject::BufferObject() :
_id(0),
_target(GL_NONE),
_size(0),
_usage(0)
{}
BufferObject::~BufferObject() {}