{"id":15060093,"url":"https://github.com/ortanav2/custom-assembly-compiler","last_synced_at":"2026-04-07T19:31:40.202Z","repository":{"id":250031924,"uuid":"833281482","full_name":"ortanaV2/Custom-Assembly-Compiler","owner":"ortanaV2","description":"Compiles TIICBC Assembly Code into an 8x12bit Binary Instruction-Set .rc File.","archived":false,"fork":false,"pushed_at":"2024-07-25T00:23:08.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T21:09:19.129Z","etag":null,"topics":["assembly","assembly-language","compiler","compiling","instruction-set","instruction-set-architecture","python"],"latest_commit_sha":null,"homepage":"https://github.com/ortanaV2/TIICBC-Controller-Emulator","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ortanaV2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-24T18:02:32.000Z","updated_at":"2024-07-25T00:23:11.000Z","dependencies_parsed_at":"2024-07-24T20:59:57.914Z","dependency_job_id":null,"html_url":"https://github.com/ortanaV2/Custom-Assembly-Compiler","commit_stats":null,"previous_names":["ortanav2/custom-assembly-compiler"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ortanaV2%2FCustom-Assembly-Compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ortanaV2%2FCustom-Assembly-Compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ortanaV2%2FCustom-Assembly-Compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ortanaV2%2FCustom-Assembly-Compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ortanaV2","download_url":"https://codeload.github.com/ortanaV2/Custom-Assembly-Compiler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685584,"owners_count":20330982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assembly","assembly-language","compiler","compiling","instruction-set","instruction-set-architecture","python"],"created_at":"2024-09-24T22:52:37.566Z","updated_at":"2025-12-29T19:35:16.383Z","avatar_url":"https://github.com/ortanaV2.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Custom Assembly Compiler\n\n## Overview\n\nThe Custom Assembly Compiler is engineered to transform TIICBC .casm assembly code into a precise binary .rc machine code file. This machine code is subsequently loaded into the instruction register of the TIICBC-8Bit CPU, facilitating the CPU's execution of the provided instructions.\n\n## Purpose\n\nThis compiler serves to bridge the gap between human-readable assembly instructions and machine code executable by the TIICBC-8Bit CPU. By converting assembly language into the binary format required by the CPU, the compiler enables the development and execution of complex instructions and programs on the TIICBC-8Bit architecture.\n\n## Features\n\n- **Assembly to Binary Compilation**: Converts .casm assembly code into an 8x12bit binary instruction set.\n- **Error Handling**: Provides clear error messages for invalid file types, functions, values, missing or extra arguments, syntax errors, and instruction length overflow.\n- **Supports Various Instructions**: Handles a range of assembly instructions including arithmetic operations, logical operations, jumps, and register manipulations.\n\n## How It Works\n\n### Supported Registers\n\n- **ACC**: Accumulator, used for operational output from logic and arithmetic operations.\n- **B**: General-purpose cache register.\n- **CIN**: Operational input A for logic and arithmetic operations.\n- **DIN**: Operational input B for logic and arithmetic operations.\n- **OUT**: Display output register, used to display register values.\n\n### Supported Instructions\n\n- **ADD**: Adds values in CIN and DIN.\n- **SUB**: Subtracts DIN from CIN.\n- **AND**: Performs a logical AND between CIN and DIN.\n- **OR**: Performs a logical OR between CIN and DIN.\n- **NOT (anyREGISTER)**: Performs a logical NOT on the specified register.\n- **JMP (lineADDRESS)**: Jumps to the specified line.\n- **JZ (anyREGISTER, lineADDRESS)**: Jumps to the specified line if the register value is 0.\n- **JNZ (anyREGISTER, lineADDRESS)**: Jumps to the specified line if the register value is not 0.\n- **MOV (anyREGISTER, anyREGISTER)**: Copies the value from one register to another.\n- **SET (anyREGISTER, value)**: Sets the specified register to an integer value (HEX).\n\n### Example Assembly Code\n\n```txt\n; Set registers to value \nSET B, 0x4\nSET DIN, 0xB\n\n; Move register B value to register CIN\nMOV B, CIN\n\n; Adding value from CIN with value from DIN (4 + 11)\nADD\n\n; Move result from Accumulator to Output Display\nMOV ACC, OUT\n```\n### Example Compiled Code\n```txt\n1001 0001 0100 \n1001 0011 1011 \n1000 0001 0010 \n0000 \n1000 0000 0100 \n```\n## Usage\n### Prerequisites\n- Python 3.x\n- A .casm file containing the assembly code to be compiled\n### Running the Compiler\nTo compile a .casm file, use the following command in the terminal:\n```txt\npython compiler.py \u003cfilename\u003e.casm\n```\nReplace `\u003cfilename\u003e` with the name of your .casm file. The compiler will generate a corresponding .rc file containing the binary machine code.\n\n### Output\nThe compiler produces two main outputs:\n\n1) Raw Binary Instructions: Printed to the console in binary format.\n2) Hexadecimal Representation: Printed to the console in hexadecimal format for easier reading.\n3) Compiled .rc File: Saved in the same directory with the same name as the .casm file but with an .rc extension.\n\n## Error Handling\nThe compiler includes robust error handling to manage various issues that may arise during compilation:\n\n- **InvalidFileType**: Triggered if the input file is not a .casm file.\n- **InvalidFunction**: Triggered if an unsupported function is used in the assembly code.\n- **ValueOutOfRange**: Triggered if a value exceeds the allowable range of 0x0 to 0xF.\n- **MissingArguments**: Triggered if required arguments for a function are missing.\n- **TooManyArguments**: Triggered if too many arguments are provided for a function.\n- **AnySyntaxError**: Triggered for general syntax errors.\n- **InstructionLoadOverflow**: Triggered if the instruction length exceeds the maximum of 8 lines.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fortanav2%2Fcustom-assembly-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fortanav2%2Fcustom-assembly-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fortanav2%2Fcustom-assembly-compiler/lists"}