Skip to content

Instantly share code, notes, and snippets.

View Pinacolada64's full-sized avatar

Ryan Sherwood Pinacolada64

View GitHub Profile
# c64list clone in python 2.7
# heavily based on https://ruslanspivak.com/lsbasi-part6/
petscii = """ !"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[~]^_ ABCDEFGHIJKLMNOPQRSTUVWXYZ"""
keywords = (' ', 'end', 'for', 'next', 'input#', 'print')
tokens = (0x20, 0x80, 0x81, 0x82, 0x83, 0x99)
ignore_whitespace = False
@Pinacolada64
Pinacolada64 / claude_basic.py
Last active April 3, 2022 06:30
Claude BASIC
import math
import random
import re
import time
import sys
line = ""
matched = None
cursor = 0
class CodeParser:
keywords = ('if', 'then', 'for', 'next', 'print')
txtptr = 0
line = ''
debug = True
def find_keyword(self):
if self.debug:
self.display_pointer
if self.line[self.txtptr:self.txtptr + 1] == ' ':
@Pinacolada64
Pinacolada64 / rewrite-tables.py
Last active November 16, 2017 10:36
An attempt to automatically generate HTML tables from markdown
from __future__ import print_function
import re
import os
### clear; python rewrite-tables.py > list.html
# print("cwd:", os.getcwd())
# os.chdir("/home/ryan/now")
# print("cwd:", os.getcwd())
# with file = open('classes', 'r'): # This is a big file
@Pinacolada64
Pinacolada64 / hex.py
Created November 17, 2017 05:17
Hexadecimal display routines for 6510
def hex_16(value):
# format 16-bit 4-digit hex value
# return ('{:04x}'.format(value)) # returns 'xxxx', 16-bit hex value
return("%04X" % (value))
def hex_8(value):
# format 8-bit 2 digit hex value
# return ('{:02x}'.format(value))
return("%02X" % (value))
@Pinacolada64
Pinacolada64 / brk2.asm
Last active December 5, 2017 05:53
6510 BRK handler
' break2.s - updated 12/4/2017
' display information (current address, stack pointer, $00, $01) when BRK encountered
' translated from compute!s fast assembler to c64list3.05:
' <http://www.commodoreserver.com/Downloads.asp>
' perhaps xa would work better:
' <http://www.floodgap.com/retrotech/xa/>
{number:10}
sys{sym:setup}
@Pinacolada64
Pinacolada64 / cursor-blink-3kr.asm
Created March 27, 2018 19:24
Cursor blink with CIA timer delay
{asm}
{undef:basic}
; gzchat
; scratch above screen
ox = $07e8 ; x pos for output
ix = $07e9 ; x pos for input line
inlen = $07ea ; # chars in input buf
inpos = $07eb ; char pos in input buf
kbflag = $07ec ; input flags:
@Pinacolada64
Pinacolada64 / Makefile
Last active May 11, 2018 05:35
BBS makefile
DISKIMAGE = test-disk.d64
DISKNAME = ud-backport
DISKID = rs
WINE = wine
C64LIST = c64list3_05.exe
C64LISTFLAGS = -ovr -verbose
CASM = casm.exe
C1541 = c1541
@Pinacolada64
Pinacolada64 / Makefile
Created June 29, 2018 23:08
Trying to understand foreach() and info() functions in "make test" stub.
# % is a wildcard
# $< is the first dependency
# $@ is the target
# $^ is all dependencies
C1541 = c1541
OUTPUT_DISK = test.d81
OUTPUT_PATH = ../text-listings
OBJECTS = $(OUTPUT_PATH)/boot.prg \