<commit_before>#!/usr/bin/env python
# encoding: utf-8

from sys import exit, argv
import re
import struct

stores = {
    0x8d: "sta %s",
    0x8e: "stx %s",
    0x8c: "sty %s",
    0x9d: "sta %s, x",
    0x99: "sta %s, y",
}

sid_store_re = re.compile(r"""
    (?P<opcode>[\x8d\x9d\x99\x8e\x8c])
    (?P<operand>[\x00-\x20]\xd4)
""", re.X)

jsr_opcode = 0x20
jsr_routine_asm = """
    %s
    %s
    rts
    nop
"""
jsr_routine_size = 8        # Routine size in bytes

# TODO: This should be command-lne options
jsr_base_addr = 0xc500
sidregs_base_addr = 'SID_regs_base'


def main():
    # TODO: Use optparse for command-line options
    if len(argv) != 4:
        print("Usage: %s FILE NEW_FILE GEN_ASM_FILE" % argv[0])
        return 1

    _, src, dst, gen_asm = argv

    jsr_routines = []

    with open(src, 'rb') as f:<commit_msg>Writable SID registers range from $d400 to $d418<commit_after>#!/usr/bin/env python
# encoding: utf-8

from sys import exit, argv
import re
import struct

stores = {
    0x8d: "sta %s",
    0x8e: "stx %s",
    0x8c: "sty %s",
    0x9d: "sta %s, x",
    0x99: "sta %s, y",
}

sid_store_re = re.compile(r"""
    (?P<opcode>[\x8d\x9d\x99\x8e\x8c])
    (?P<operand>[\x00-\x18]\xd4)
""", re.X)

jsr_opcode = 0x20
jsr_routine_asm = """
    %s
    %s
    rts
    nop
"""
jsr_routine_size = 8        # Routine size in bytes

# TODO: This should be command-lne options
jsr_base_addr = 0xc500
sidregs_base_addr = 'SID_regs_base'


def main():
    # TODO: Use optparse for command-line options
    if len(argv) != 4:
        print("Usage: %s FILE NEW_FILE GEN_ASM_FILE" % argv[0])
        return 1

    _, src, dst, gen_asm = argv

    jsr_routines = []

    with open(src, 'rb') as f:
{'fraction_non_alphanumeric': 0.15178050204319907, 'fraction_numerical': 0.04319906596614127, 'mean_word_length': 2.7753303964757707, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4375200', 'n_tokens_mistral': 778, 'n_tokens_neox': 731, 'n_words': 182}