{"id":24719541,"url":"https://github.com/vihlancevk/cpu","last_synced_at":"2026-05-05T11:33:24.472Z","repository":{"id":192414076,"uuid":"451449060","full_name":"vihlancevk/CPU","owner":"vihlancevk","description":"Processor simulator implemented in the C programming language","archived":false,"fork":false,"pushed_at":"2022-01-31T19:48:59.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T11:48:05.395Z","etag":null,"topics":["c","cpu","learning-task","student-project","system"],"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/vihlancevk.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}},"created_at":"2022-01-24T12:08:40.000Z","updated_at":"2022-01-31T19:49:49.000Z","dependencies_parsed_at":"2023-09-04T18:45:57.131Z","dependency_job_id":null,"html_url":"https://github.com/vihlancevk/CPU","commit_stats":null,"previous_names":["vihlancevk/cpu"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vihlancevk/CPU","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vihlancevk%2FCPU","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vihlancevk%2FCPU/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vihlancevk%2FCPU/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vihlancevk%2FCPU/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vihlancevk","download_url":"https://codeload.github.com/vihlancevk/CPU/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vihlancevk%2FCPU/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268027974,"owners_count":24183739,"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-07-31T02:00:08.723Z","response_time":66,"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":["c","cpu","learning-task","student-project","system"],"created_at":"2025-01-27T11:18:10.322Z","updated_at":"2026-05-05T11:33:24.224Z","avatar_url":"https://github.com/vihlancevk.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CPU\n## Program description\nTo use this program, you need to write code to a file asm.txt, in this case, the code must be written using a specific syntax:\n1) CRT (create) is a command that should be written at the beginning of the program code, it creates a stack for the processor;  \n2) IN - command to enter a number from the keyboard (the number is put on the processor stack);  \n3) - PUSH 0 - puts the number 0 on the processor stack;  \n   - PUSH ax - puts a number from the ax register on the processor stack;  \n   - PUSH [1] - puts a number from RAM at address 1 on the processor stack;  \n   - PUSH [ax] - puts a number from RAM to the address ax;  \n4) ADD - adds two numbers from the processor stack and puts the result back;  \n5) SUB - subtraction;  \n6) MUL - multiplication;  \n7) DIV - division;  \n8) OUT - takes an element from the processor stack and displays it on the screen;  \n9) HLT is a command that is written at the end of the program, it clears the memory that the processor stack occupied;  \n10) POP - command is an analog of PUSH, which takes an element from the processor stack and puts it in a register or RAM;  \n11) :label - label;  \n12) JMP label - switch to label label;  \n13) JA label - switch to label label if the penultimate number in the processor stack is greater than the last one;  \n14) JAE label (\u003e=);  \n15) JB label (\u003c);  \n16) JBE label (\u003c=);  \n17) JE label (==);  \n18) JNE label (!=);  \n19) CALL nameFunction - the command switches to the nameFunction label, and the execution of the function code begins;  \n20) RET is a command that is written inside a function that starts with the nameFunction label and returns the execution of the program to the command following the CALL nameFunction command;  \n21) SQRT is a square root command that takes the last number from the processor stack and returns the result of the operation in its place;\n22) DRAW - command to draw the contents of RAM;  \n23) MOVE - movement command (experimental command that needs improvement);  \n24) P_CDOT - is a command that displays the character '*';  \n25) P_SPACE - a command that displays the symbol ' ';  \n26) NEW_LINE - a command that moves the cursor to a new line.  \n  \nAssembler/main.cpp - a file that converts code from a file asm.txt in binary code and writes it to a file code.txt.  \n  \nCPU/main.cpp - a file that executes code from a file code.txt and displays the result of the program on the screen.  \n  \nDisassembler/main.cpp - a file that converts binary code from a code file.txt into the program text and writes it to a file asm.txt (the code of this program is proposed to be written to the reader as a training task).  \n## Using the program\nYou can only call the execution of a file CPU/main.cpp , since programs are called inside this program Assembler/main.cpp and Disassembler/main.cpp using the system() function, which is done for the convenience of the user.  \n### Additional information\ninclude/ is a folder with header files *.h that are used inside programs.  \ntestPrograms/ is a folder with examples of programs written using the syntax described above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvihlancevk%2Fcpu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvihlancevk%2Fcpu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvihlancevk%2Fcpu/lists"}