{"id":22021893,"url":"https://github.com/knightchaser/knightzcpu","last_synced_at":"2025-09-08T14:35:19.321Z","repository":{"id":234473133,"uuid":"788970402","full_name":"KnightChaser/knightzcpu","owner":"KnightChaser","description":"A small and simple CPU simulation code. (Writing code when I have some time)","archived":false,"fork":false,"pushed_at":"2024-04-19T14:16:08.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T10:25:43.516Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KnightChaser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-04-19T12:56:54.000Z","updated_at":"2024-04-19T14:21:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"9ba7b0d6-4d09-4900-abb4-43d07d59938b","html_url":"https://github.com/KnightChaser/knightzcpu","commit_stats":null,"previous_names":["knightchaser/knightzcpu"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KnightChaser/knightzcpu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnightChaser%2Fknightzcpu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnightChaser%2Fknightzcpu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnightChaser%2Fknightzcpu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnightChaser%2Fknightzcpu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KnightChaser","download_url":"https://codeload.github.com/KnightChaser/knightzcpu/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnightChaser%2Fknightzcpu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274198974,"owners_count":25239739,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-30T06:15:51.887Z","updated_at":"2025-09-08T14:35:19.245Z","avatar_url":"https://github.com/KnightChaser.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# knightzcpu\n\u003e A simple **CPU** simulation on C++\n\nThis Simple CPU Simulator **will be** (is) designed as an educational tool for computer engineering students to understand the basic workings of a CPU. This project is implemented in C++, and it simulates the essential operations of a CPU, including fetching, decoding, and executing instructions. It is kept deliberately simple to make it fun and accessible while providing substantial learning opportunities.\n\n## Todos\n\n- **Basic CPU Operations**: Simulate the fetch, decode, and execute cycles of a CPU.\n- **Registers and Memory**:\n  - Registers: Accumulator (A), Index Register (X), Stack Pointer (SP), and Program Counter (PC), etc.\n  - 256n bytes of memory, etc.\n- **Status Flags**: Carry (C), Zero (Z), Interrupt Disable (I), Decimal Mode (D), Break Command (B), Overflow (V), and Negative (N).\n- **Interactive Input**: Users can input instructions or programs via the console or by loading files.\n- **Visual Output**: The state of the CPU (registers, memory, flags) can be printed out after each cycle for educational purposes.\n\n## Components\n\n### Classes\n\n- **CPU Class**: Encapsulates all operations of the simulated CPU, including the execution cycle.\n- **Memory Class**: Manages operations related to memory access.\n\n### Main Functions\n\n- **fetch()**: Retrieves an instruction from memory based on the current value of the Program Counter (PC).\n- **decode(uint8_t instruction)**: Identifies the operation to be performed based on the fetched instruction.\n- **execute()**: Executes the decoded instruction.\n- **run()**: Initiates and controls the execution cycle until a halt condition is met.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknightchaser%2Fknightzcpu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknightchaser%2Fknightzcpu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknightchaser%2Fknightzcpu/lists"}