def METHOD_NAME(filename, instructions):
    log_message(f"writing to {filename}...")
    with open(filename, "w") as script:
        script.write("import {AssemblyInstructionInfo} from '../base.js';\n")
        script.write("\n")
        script.write("export function getAsmOpcode(opcode: string | undefined): AssemblyInstructionInfo | undefined {\n")
        script.write("    if (!opcode) return;\n")
        script.write("    switch (opcode.toUpperCase()) {\n")
        for inst in instructions.values():
            script.write(f"        case \"{inst.mnemonic}\":\n")
            if inst.mnemonic_2:
                script.write(f"        case \"{inst.mnemonic_2}\":\n")
            script.write("            return {\n")
            html = f"{16 * ' '}\"html\": \"<p>"
            html += inst.description.replace("\n\n", "</p><p>")
            html += "</p>\",\n"
            script.write(html)
            script.write(f"{16 * ' '}\"tooltip\": \"{inst.name}\",\n")
            script.write(f"{16 * ' '}\"url\": \"{FILE}#page={inst.page}\",\n")
            script.write(12 * " " + "};\n\n")
        script.write("    }\n}")