Skip to content

Instantly share code, notes, and snippets.

View tom-seddon's full-sized avatar

Tom Seddon tom-seddon

View GitHub Profile
@tom-seddon
tom-seddon / WindowPlacement.cs
Created June 16, 2015 23:30
GetWindowPlacement and SetWindowPlacement code
// This code is in the public domain.
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace Utils
{
//////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace minitags
{
/// <summary>
/// ini file reader that can read from list of strings, which
/// unfortunately GetPrivateProfileString etc. won't.
@tom-seddon
tom-seddon / B.CHUNK2
Created July 28, 2016 00:40
Quick'n'dirty BBC Micro linear layout screen demo
10REM>B.CHUNK3
20:
30ONERRORMODE7:REPORT:PRINT" at line ";ERL:END
40:
50REM CLEAR MEMORY
60MODE2
70:
80MODE5
90:
100REM ENGAGE MODE 8
@tom-seddon
tom-seddon / B.ADDRS
Created July 28, 2016 23:00
BBC Micro 6845 address browser
10REM>B.ADDRS
20:
30ONERRORMODE7:REPORT:PRINT" at line ";ERL:END
40:
50MODE6:HIMEM=&2F00
60*FX154 0
70*FX9 0
80*FX10 1
90?&FE00=1:?&FE01=32
100PROCR(0,63)
@tom-seddon
tom-seddon / B.R62
Created July 28, 2016 23:22
BBC Micro split bitmap/linear addressing mode "demo"
10REM>B.R62
20ONERRORMODE7:REPORT:PRINT" at line ";ERL:END
30MODE7
40*TV255 1
50PROCASM
60:
70MODE2:MODE6:HIMEM=&5800
80*FX154 0
90*FX9 0
100*FX10 1
@tom-seddon
tom-seddon / gist:d1ccdb18e3c3d4a2c288a12c1993e4b2
Created January 12, 2017 13:26
State-based 6502 emulator snippet
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//
// Read/Absolute,X
//
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
static void T1_R_ABX(M6502 *);
static void T2_R_ABX(M6502 *);
@tom-seddon
tom-seddon / tom-layout.el
Created March 13, 2017 13:23
how I set up my emacs windows
(defun tom-layout ()
(interactive)
(delete-other-windows)
(mmd-reset-major-mode-window-dedication)
(let (w)
(setq w (selected-window))
(split-window-horizontally)
(split-window-horizontally)
(other-window 1)
@tom-seddon
tom-seddon / x11.cpp
Created April 16, 2017 18:22
Some Xlib junk, vaguely along the lines of GetWindowPlacement/SetWindowPlacement
#include <shared/system.h>
#include "x11.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xinerama.h>
#include <string.h>
#include <shared/log.h>
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@tom-seddon
tom-seddon / README.md
Last active April 29, 2018 22:48
Arrays in C

Growable arrays in C

I don't think there's any objectively good solution to this perennial annoyance, so this is just some random thing that tries to tick the specific boxes I want ticked: simple to look at in the debugger; few/no casts during use; easy interop with existing C arrays; OK performance in an unoptimised build.

How it works

@tom-seddon
tom-seddon / .c
Created May 15, 2018 00:06
b2 6502 simulator snippet
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//
// Read/Absolute
//
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
static void T1_R_ABS(M6502 *);
static void T2_R_ABS(M6502 *);