Skip to content

Instantly share code, notes, and snippets.

View Pinacolada64's full-sized avatar

Ryan Sherwood Pinacolada64

View GitHub Profile
@Pinacolada64
Pinacolada64 / client.py
Last active February 4, 2019 01:37
Understanding lists and dicts in Python3
string = "wELCOME tO cOMMODOREsERVER" # PETSCII has case reversed compared to ASCII
print("PETSCII: ", (string))
print(" ASCII: ", string.swapcase()) # "translate" PETSCII to ASCII
print("") # blank line
# '/roominfo' csip command displays verbose info about room
# '/rooms' csip command lists "'room_name' ['user_count']"
room_names = {'lOBBY', 'C64', 'C128', 'vIC-20', 'aMIGA', 'TED', 'PET', 'SANDBOX'}
@Pinacolada64
Pinacolada64 / remote.asm
Last active December 19, 2019 04:08
Some sort of vector modification for use while running Image v1.3/2.0
orig $c000
; save as "remote.prg" (or "++ remote"?)
; sets usable RAM to $0a01-$4000?
LINNUM = $14 ; Integer Line Number Value
INDEX = $22 ; $22-$25: Misc Temporary Pointers and Save Area
TXTTAB = $2b ; Pointer to the Start of BASIC Program Text
VARTAB = $2d ; start of BASIC variables
ARYTAB = $2f ; Pointer to the Start of the BASIC Array Storage Area
@Pinacolada64
Pinacolada64 / dumpm.bas
Created December 20, 2019 05:48
Dump arrays (?) to disk or screen
{step:2}
{crunch:on}
{alpha:alt}
{number:3000}
rem "+.test dumpm"
rem output arrays to disk/screen
' sa=save .a, sx=save .x, sy=save .y
&"Array Output to Device{f6}":sa=780:sx=781:sy=782
{:device}
&"Q=Quit, [S=Screen], 1-6=Image drive{f6}"
@Pinacolada64
Pinacolada64 / rs232-swift.asm
Created March 10, 2020 08:16
C64 RS232 driver using a SwiftLink cartridge (a real ACIA, not emulated)
; https://www.lemon64.com/forum/viewtopic.php?t=73957
; https://www.c64-wiki.com/wiki/Interrupt
; been trying to follow application notes for the SwiftLink
; terminal code @ $c0b7 (waiting for Shift+C=)
; &,49 getmod $b915
; &,4 getmdm $aab3
; There are a few problems/things I want to improve with with this version of the SwiftLink driver:
@Pinacolada64
Pinacolada64 / diff-tool.asm
Created April 14, 2020 00:21
Add random junk to buffers, test compare routines (line 420)
{ascii:alt}
{number:10}
goto {:screen}
' init:
' TODO: ask from directory or specific track/sector
' TODO: output log: screen, printer, disk
' input any init:
a$="":i%=.
' max file entries on a 1541 disk:
@Pinacolada64
Pinacolada64 / bell.lbl
Created June 4, 2020 23:39
Bell from CCGMS terminal
{number:1}
{crunch:on}
for t8=1 to 5
sys{sym:bell}:for d=1 to 400:next
next t8
{asm}
bell:
ldx #$0f
stx $d418 ; volume
ldx #9
# from "Python 101" pg. 351
import sqlite3
def get_cursor():
conn = sqlite3.connect("library.db")
return conn.cursor()
def select_all_records_by_author(cursor, author):
@Pinacolada64
Pinacolada64 / queries_original.py
Last active February 24, 2021 21:58
testing for an author which does not exist
import sqlite3
def get_cursor():
conn = sqlite3.connect("library.db")
return conn.cursor()
def select_all_records_by_author(cur, author):
sql = "SELECT * FROM books WHERE author=?"
@Pinacolada64
Pinacolada64 / text-experiments.py
Created March 10, 2021 08:41
Word wrap and More prompt
import textwrap
# https://docs.python.org/3/library/textwrap.html#textwrap.TextWrapper.wrap
# https://inventwithpython.com/blog/2014/12/02/why-is-object-oriented-programming-useful-with-a-role-playing-game-example/
# https://python-prompt-toolkit.readthedocs.io/en/master/
class Terminal:
# TODO: make baud_rate and output_count be default arguments, not specified in the call for the function to work:
# TODO: outputCount should be a member of Terminal, I think:
def __init__(self, translation_type, screen_height, screen_width, more_prompt, output_count):
def tada_parser(last_command=None):
logging.info("tada_parser() called")
if last_command is None:
last_command = "help"
print(f"Return: {last_command}")
command_line = input("Command: ")
if not command_line:
logging.info("Empty command line, setting to '{last_command}")
command_line = last_command