{"id":25239148,"url":"https://github.com/denver-code/pc_simulation_rs","last_synced_at":"2025-04-05T19:38:05.804Z","repository":{"id":258830200,"uuid":"874983665","full_name":"denver-code/pc_simulation_rs","owner":"denver-code","description":"Basic Rust app that will simulate some of the flows on computer like CPU, RAM, BIOS and ASM-like instructions","archived":false,"fork":false,"pushed_at":"2024-10-30T11:37:50.000Z","size":57,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-11T18:13:51.936Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","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/denver-code.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-10-18T20:44:32.000Z","updated_at":"2024-10-30T11:37:53.000Z","dependencies_parsed_at":"2024-10-22T00:29:18.962Z","dependency_job_id":null,"html_url":"https://github.com/denver-code/pc_simulation_rs","commit_stats":null,"previous_names":["denver-code/pc_simulation_rs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denver-code%2Fpc_simulation_rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denver-code%2Fpc_simulation_rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denver-code%2Fpc_simulation_rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denver-code%2Fpc_simulation_rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denver-code","download_url":"https://codeload.github.com/denver-code/pc_simulation_rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393555,"owners_count":20931809,"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":[],"created_at":"2025-02-11T18:13:54.978Z","updated_at":"2025-04-05T19:38:05.785Z","avatar_url":"https://github.com/denver-code.png","language":"Rust","readme":"# PC Simulation  \nBasic Rust app that will simulate some of the flows on computer, including: \n- RAM  (`256 bytes`) - can be read, written and dumped for inspection.    \n  \n  Addressed via hexadecimal addressed. \n\n  Each memory cell is 8 bits (1 byte) wide\n- CPU  - Supports basic arithmetic and logic operations (`ADD, AND, OR, NAND, NOR, XOR, NOT`).  \n  \n  ATM asm-like code directly executed by the CPU, I'm not sure how it supposed to be.   \n\n  CPU supports `8 general-purpose 8-bit` registers to hold data during execution.  \n- More on the way, but it's still area for a research.  \n\nSimulation has option to write simple assembly-like programs with small set of instructions:  \n- `VER` - Toggle verbosity to enable/disable detailed execution logs.\n- `MOV QMOV` - Assingning RAM/Another Register's/Immediate Value to the register\n- `INIT` - Initialize memory addresses with values.\n- `LOAD` -  Load a value from memory into a register.\n- `ADD SUB MUL DIV` -  basic arythemitcs\n- `STORE` - Store a value from a register into memory.\n- `OUT` - Output register or memory/values.\n- `CLEAR` - Clear the register or memory\n- `HALT` - Stop the execution.\n- `IF/ELSE` -  If and else statement that supports basic operations between registers, memory and values.\n\nWhile I'm aiming to make it as low-level and realistic as possible - some of the features jsut could't be realisied due to number of reasons, one of them - I'm still researching about flows and how everything is working.  \n\n### Run asm-like code  \n```bash\nBIOS\u003e filename.asm\n```  \nYou can play around with some example programs:  \n- `calculator.asm` - Addition calculator program\n- `gates.asm`  - Test of the Logic Gates\n- `if_test.asm` - Simple IF ELSE logic\n- `program.asm` - Simple collection of different instructions\n- `mov_test.asm` - Test of MOV instruction\n- `div.asm` - Division Program\n- `incdec.asm` - Increment and Decrement Register\n- `mul.asm` - Multiplication Program\n- `qmov.asm` - QMOV Test\n- `sub.asm` - Substract Instruction\n\n### Program example  \n```assembly\n; Example program\nVER = 1                    ; Enable debug (VERBOSE) prints of execution\nINIT [0x08] = 0b00000101   ; Initialize memory at address 0x08 with binary 5\nINIT [0x10] = 0b00001010   ; Initialize memory at address 0x10 with binary 10\nINIT [0x1F] = 0b00001010\n\nLOAD R1, [0x08]            ; Load value from address 0x08 into register R1\nLOAD R2, [0x10]            ; Load value from address 0x10 into register R2\nADD R1, R2, R3             ; Add R1 and R2, store result in R3\n\nSTORE R3, [0x20]           ; Store the result in memory address 0x20\n\nOUT R3                     ; Display the register R3\n\nCLEAR [0x20]               ; Clear the value in memory address 0x20\nCLEAR [0x08]               ; Clear the value in memory address 0x08\nCLEAR [0x10]               ; Clear the value in memory address 0x10\nCLEAR [0x1F]               ; Clear the value in memory address 0x1F\n\nVER = 0                    ; Disable debug (VERBOSE) prints of execution\nHALT                       ; Stop execution\n```\n\n## Getting Started  \n1. Make sure you have rust installed  \n2. Clone the repo:  \n   ```bash\n    git clone https://github.com/denver-code/pc_simulation_rs\n    cd pc_simulation_rs\n   ```\n3. Run or Build the project:  \n   ```bash\n    # Build\n    cargo build --release (Optional)\n    # Run\n    cargo run\n   ```\n\n### Usage\n#### BIOS Commands\n\nOnce the simulator is powered on, you can use the following commands in the BIOS prompt:\n```\n- address [hex]: View the value stored in memory at the given address (in hexadecimal in square brackets).\n\n- memory_dump: Display the entire contents of the RAM.\n    \n- exit: Quit the BIOS.\n\n- [filename].asm: Load and run an assembly-like program from a file.\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenver-code%2Fpc_simulation_rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenver-code%2Fpc_simulation_rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenver-code%2Fpc_simulation_rs/lists"}