Skip to content

Instantly share code, notes, and snippets.

@shadwork
shadwork / vsfparser.py
Last active July 10, 2025 22:46
Python script to open vice 64 emulator snapshot with vsf extension, based on v2 specification
import sys
import os
import struct
ram_dump = bytearray()
def dword(byte_array):
return struct.unpack('I',byte_array)[0]
def word(byte_array):
@shadwork
shadwork / sinclair_basic2ascii.py
Created May 14, 2024 10:41
Python script to decompile ZX-Spectrum BASIC to text using tzxtools library
#!/usr/bin/env python3
import argparse
import sys
from tzxlib.convert import convertToBasic
def main():
parser = argparse.ArgumentParser(description='Convert Sinclair Basic code representation into Text')
parser.add_argument('file',
@shadwork
shadwork / zx_spectrum_sys_var_header.h
Created May 3, 2024 09:48
ZX-Spectrum System variables C header for Ghidra
struct SYS_VAR { /* STANDARD 48K SPECTRUM SYSTEM VARIABLES */
byte KSTATE[8]; /* Used in reading the keyboard. */
byte LASTK; /* Stores newly pressed key. */
byte REPDEL; /* Time (in 50ths of a second that a key must be held down before it repeats. This starts off at 35,but you can POKE in other values. */
byte REPPER; /* Delay (in 50ths of a second between successive repeats of a key held down - initially 5. */
word DEFADD; /* Address of arguments of user defined function (if one is being evaluated), otherwise 0. */
byte K_DATA; /* Stores 2nd byte of colour controls entered from keyboard. */
word TVDATA; /* Stores bytes of colour,AT and TAB controls going to TV. */
word STRMS[19]; /* Addresses of channels attached to streams &FD to &0F. */
word CHARS; /* 256 less than address of character set (which starts with space and carries on to (C)). Normally in ROM,but you can set up your own in RAM and make CHARS point to it. */