Skip to content

Instantly share code, notes, and snippets.

@biomood
biomood / MoveSprite.asm
Created May 31, 2011 20:49
A C64 example in assembly that moves a sprite up/down/left/right
;*************************************************
;* Create and move a simple sprite x,y *
;*************************************************
processor 6502
org $1000
;helpful labels
CLEAR = $E544
GETIN = $FFE4
@biomood
biomood / RestSharpPOST.cs
Created June 2, 2011 13:56
POST to restful service using .Net and RestSharp
// create the client
RestClient client = new RestClient();
client.BaseUrl = url;
// create the request
RestRequest request = new RestRequest(Method.POST);
request.Resource = service_method;
request.AddParameter("text/xml", body, ParameterType.RequestBody);
// send the request
@biomood
biomood / dingoo_font.lua
Created June 10, 2011 19:04
Code for nLove that displays user-created fonts correctly
require "string"
---------------------------------------------------------
-- a font library for the dingoo --
-- allows for multiple fonts --
---------------------------------------------------------
-- creates a table of images from a font
-- ImageData source, String char_list, Number char_width, Number seperator_width
@biomood
biomood / GameDuino_HelloWorld.c
Created June 16, 2011 20:30
Hello World for the Gameduino
#include <SPI.h>
#include <GD.h>
void setup() {
// give time for the gameduino splash screen to be displayed
delay(2500);
GD.begin();
// load character set
@biomood
biomood / AddRecordLinq.cs
Created June 22, 2011 11:05
Add a record to a DB using Linq to SQL
DataContext db = new DataContext();
try {
db.table.InsertOnSubmit(obj);
db.SubmitChanges();
}
catch(Exception) {
return false;
}
return true;
@biomood
biomood / ImageToH.py
Created June 22, 2011 20:57
Python script to create a gameduino sprite header from an image
import sys
from PIL import Image
from gameduino import prep
image_path = ""
h_name = ""
# retrieve the command line arguments
if (len(sys.argv) > 2):
@biomood
biomood / Sprite.cpp
Created June 27, 2011 21:44
Displaying a sprite using the Gameduino
#include <SPI.h>
#include <GD.h>
#include "alien_sprite.h"
void setup() {
// allow for setup
delay(250);
GD.begin();
@biomood
biomood / SpriteAnimate.cpp
Created June 29, 2011 15:57
Display an animating sprite using the Gameduino
#include <SPI.h>
#include <GD.h>
#include "alien_sprite.h"
struct sprite {
int no;
int x;
int y;
int anim;
byte rot;
@biomood
biomood / main.c
Created July 4, 2011 16:23
Displays the binary representation of an unsigned char using an MSP430
//
// main.c
// BlinkingLEDs
//
// Created by David Roberts on 30/06/2011.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#include <io.h>
@biomood
biomood / InterruptMSP430.c
Created July 6, 2011 21:13
MSP430 - use an interrupt to set the LEDs on and off using the button
//
// main.c
//
// Use an interrupt to set two LEDs on the MSP430 on and off
// Created by David Roberts on 06/07/2011.
//
#include <io.h>
#include <signal.h>