Skip to content

Instantly share code, notes, and snippets.

View agrif's full-sized avatar

agrif agrif

View GitHub Profile
assemble :: Line -> AsmAct Word8 Word16 ()
assemble (Line labels Nothing) = sequence_ $ do
l <- labels
return $ (getPtr >>= setLabel l)
assemble (Line labels (Just (Instruction inst rawargs))) = do
assemble (Line labels Nothing)
args <- runListT $ do
arg <- ListT $ return rawargs
import ctypes
import ctypes.util
import asyncore
import sys
import atexit
import code
import readline as pyreadline
import rlcompleter
readline = ctypes.CDLL(ctypes.util.find_library("readline"))
;;; useful addresses
INT_VBLANK: equ 0x0040
INT_LCDC: equ 0x0048
INT_TIMER: equ 0x0050
INT_SERIAL: equ 0x0058
INT_P1THRU4: equ 0x0060
ROM_HEADER: equ 0x0100
;;; 15 ascii bytes
ROM_TITLE: equ ROM_HEADER + 0x034
;;; 2 bytes
@agrif
agrif / gameboy-putln.asm
Created April 11, 2013 17:35
gameboy-putln.asm
strlen:
;; string address is in hl, output is in bc
ld bc, 0
.loop:
ld a, (hli)
cp 0
ret z
inc bc
jr .loop
#include <stdio.h>
int x = 0;
int main() {
printf("%d ", (x = 3) + (x = 4));
printf("%d\n", x);
return 0;
}
/* carl -- C Asynchronous Readline
* Copyright (C) 2010 Dawid Ciężarkiewicz
*
* Originally part of xmppconsole <http://github.com/dpc/xmppconsole>
* as io.c and io.h, but repackaged for general-purpose use, and with
* a different namespace, by Aaron Griffith.
*
* For documentation, see carl.h.
*
* This program is free software: you can redistribute it and/or modify
static void carl_async_print(print_func func, void* data)
{
char* saved_line;
int saved_point;
struct readline_state rlstate;
//saved_point = rl_point;
//saved_line = rl_copy_text(0, rl_end);
//rl_save_prompt();
@agrif
agrif / projects.txt
Created May 13, 2013 11:58
current project list (as of May 2013)
./tier2/carl
./tier2/Myst.inform
./tier2/libvaht
./tier2/tamra
./tier2/copper
./tier2/botnames
./tier2/carnivorg
./tier2/geegaw
./tier2/mpd-python
./tier2/4julia
from collections import namedtuple
import yaml
from annotations import Annotation, AnnotatedValue
from parser import Parser
class YAMLParser(Parser):
def parse(self):
tree = yaml.compose(self.fileobj)
self._constructor = yaml.constructor.SafeConstructor()
import parseyaml
import validators
import annotations
class WidgetValidator(validators.ObjectValidator):
foo = validators.StringValidator()
bar = validators.StringValidator()
def validate_object(self):
if self.bar != "racuda":