{"id":21065228,"url":"https://github.com/khmelnitskiianton/processor","last_synced_at":"2026-04-17T19:03:28.004Z","repository":{"id":199791700,"uuid":"701037133","full_name":"khmelnitskiianton/Processor","owner":"khmelnitskiianton","description":"My own processor on C that has stack, RAM, and registers","archived":false,"fork":false,"pushed_at":"2024-01-23T12:20:51.000Z","size":14702,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-29T23:00:06.546Z","etag":null,"topics":["cpu-emulator"],"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/khmelnitskiianton.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":"2023-10-05T19:29:30.000Z","updated_at":"2024-05-27T21:16:02.000Z","dependencies_parsed_at":"2023-10-25T16:07:00.632Z","dependency_job_id":"8f68f729-9215-410e-995c-237c674129f5","html_url":"https://github.com/khmelnitskiianton/Processor","commit_stats":null,"previous_names":["khmelnitskiianton/processor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/khmelnitskiianton/Processor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khmelnitskiianton%2FProcessor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khmelnitskiianton%2FProcessor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khmelnitskiianton%2FProcessor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khmelnitskiianton%2FProcessor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khmelnitskiianton","download_url":"https://codeload.github.com/khmelnitskiianton/Processor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khmelnitskiianton%2FProcessor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31941845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cpu-emulator"],"created_at":"2024-11-19T17:54:30.453Z","updated_at":"2026-04-17T19:03:27.981Z","avatar_url":"https://github.com/khmelnitskiianton.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Processor\n\nIts my simple processor!\n\nIt consists of my assembler and my spu and can process many interesting codes!\n\nYou can see 3 example programs on my asm: \n1. `quadratka.txt` - code of quadratic solver\n2. `circle.txt` - code that draw circle in console\n3. `factorial.txt` - code of recursive factorial\n4. `bad_apple.txt` - code that draws BadApple movie in window with SDL\n\n## Running BadApple ##\n\nGit have an edge of file with 100 MB, thats why you need to generate asm code for BadApple with hands(it costs 122 MB and have 10 million commands!)\n\n1. After installation you need to generate asm code and put it in main:\n\n```c\ncd ./bad_apple\nmake start\nmake run\n```\n2. You will have file `bad_apple_asm.txt` in ./bad_apple\n3. Change its name to `input_text.txt` and copy to main folder!\n4. Then start program with `./processor.bat bad_apple.txt`\n\n*Possible Problems:*\n\u003e If running bad apple more than 10 sec - than check in `main_hdr/arrays.h` logs are turn off, turn off and recompile\n\n\u003e Sanitizer of memory after BadApple is OK - it is problem in SDL\n\n\u003e Warnings while compiling from sanitizer\n\n\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Extra programs](#extra-programs)\n- [Using](#using)\n- [Options of compiling](#options-of-compiling)\n- [Logs](#logs)\n\n## Installation\n\nTo start program you need to use CMake and run program\n\n1.  Clone repository\n2.  Compile CMake, write command in main directory in repo\n3.  Run CMake (compile program), write command in main directory in repo\n4.  Run program(before you need to create this file) \n\n```c\ngit clone https://github.com/khmelnitskiianton/Processor.git\ncd ./Processor\ncmake .\nmake\n./processor.bat \u003cname_of_file_where_read_code\u003e\n```\n\n## Extra programs\n\nIf you want to see BadApple movie, you need to install graphic lib - SDL/SDL2\n\n```c\nsudo apt install libsdl2-dev -y\n```\n\n## Using\n\nMy program took code on my asm from text file.\n\nIn processor I have stack, registers(`rax` - `rex`), RAM \n\n\u003e After functions that consist of 1 word, dont write any spaces/comments! (it is feature)\\\n\u003e In another cases, you can write comments after `;` with any spaces\n\n**Functions:** (in `main_hdr/commands.h`)\n\n*push/pop*\n\n+ `push \u003cnumber\u003e` - push number in stack\n+ `push \u003creg\u003e` - push value from register to stack\n+ `push \u003creg\u003e + number` - push value from register to stack\n+ `push [number]` - push number from RAM with index = number to stack \n+ `push [\u003creg\u003e]` - push number from RAM with index = value in register to stack \n+ `push [\u003creg\u003e + number]` - push number from RAM with index = (value in register + number) to stack \n\n==============================================\n\n+ `pop \u003creg\u003e` - push number from stack(last ofc) to register\n+ `pop [number]` - push number from stack to RAM with index = number\n+ `pop [\u003creg\u003e]` - push number from stack to RAM with index = value in register \n+ `pop [\u003creg\u003e + number]` - push number from stack to RAM with index = (value in register + number)\n\n*arifmethic operations*\n\n+ `div` - take 2 numbers from stack and push there division to stack\n+ `add` - take 2 numbers from stack and push there sum to stack\n+ `mul` - take 2 numbers from stack and push there multipling to stack\n+ `sub` - take 2 numbers from stack and push there subtract to stack\n+ `sqrt` - take number from stack and push its square to stack\n+ `cos` - take number from stack and push its cosinus to stack\n+ `sin` - take number from stack and push its sinus to stack\n\n*base operations*\n+ `in` - ask to enter from console number \n+ `out` - take number from stack and print it to console\n+ `outc` - take number from stack and print it char equivalent to console\n+ `draw` - printing with SDL\n+ `drawf` - printing RAM(actually for drawing circle)\n+ `hlt` - end of code!\n\n*labels,jumps and functions*\n\n+ `\u003cname_of_label\u003e:` - put label to jump\n\n==============================================\n\n+ `jmp \u003cname_of_label\u003e` - command that jump your position to indicated label\n+ `ja \u003cname_of_label\u003e` - takes 2 numbers from stack, compares it, and if (last above last_sec)  jump your position to indicated label\n+ `jae \u003cname_of_label\u003e` - takes 2 numbers from stack, compares it, and if (last above or equal last_sec)  jump your position to indicated label\n+ `jb \u003cname_of_label\u003e` - takes 2 numbers from stack, compares it, and if (last below last_sec)  jump your position to indicated label\n+ `jbe \u003cname_of_label\u003e` - takes 2 numbers from stack, compares it, and if (last below or equal last_sec)  jump your position to indicated label\n+ `jne \u003cname_of_label\u003e` - takes 2 numbers from stack, compares it, and if (last not equal last_sec)  jump your position to indicated label\n\n==============================================\n+ `call \u003cname_of_label\u003e` - go to label and do code before `ret` (like function!)\n+ `ret` - stopper for call in label use in pair!\n\n## Options of compiling\n\nLISTING_MEMORY\n\nLISTING_ASM\n\nDEBUG_PRINTING\n\n## Logs\n\nFor debugging I use `listing.txt` - printing asm\n\nFor debugging I use `log.txt` - printing cpu","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhmelnitskiianton%2Fprocessor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhmelnitskiianton%2Fprocessor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhmelnitskiianton%2Fprocessor/lists"}