{"id":13472063,"url":"https://github.com/vascofazza/8bit-cpu","last_synced_at":"2025-03-26T15:31:23.683Z","repository":{"id":41121777,"uuid":"244215071","full_name":"vascofazza/8bit-cpu","owner":"vascofazza","description":"Schematics \u0026 code for my 74LS-based 8-bit MK1 CPU","archived":false,"fork":false,"pushed_at":"2022-12-12T06:42:16.000Z","size":22782,"stargazers_count":301,"open_issues_count":6,"forks_count":23,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-10-30T04:12:49.892Z","etag":null,"topics":["74ls","8bit","8bit-cpu","cpu","electronics","homemade","mk1","mk1-computer","mk1-cpu","programming-board","schematics"],"latest_commit_sha":null,"homepage":"https://hackaday.com/2020/12/31/diy-8-bit-computer-knows-all-the-tricks/","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/vascofazza.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}},"created_at":"2020-03-01T20:02:38.000Z","updated_at":"2024-09-17T01:15:44.000Z","dependencies_parsed_at":"2023-01-27T15:15:59.859Z","dependency_job_id":null,"html_url":"https://github.com/vascofazza/8bit-cpu","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vascofazza%2F8bit-cpu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vascofazza%2F8bit-cpu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vascofazza%2F8bit-cpu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vascofazza%2F8bit-cpu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vascofazza","download_url":"https://codeload.github.com/vascofazza/8bit-cpu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245681309,"owners_count":20655167,"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":["74ls","8bit","8bit-cpu","cpu","electronics","homemade","mk1","mk1-computer","mk1-cpu","programming-board","schematics"],"created_at":"2024-07-31T16:00:51.560Z","updated_at":"2025-03-26T15:31:23.677Z","avatar_url":"https://github.com/vascofazza.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# MK1 8bit Computer\n\nSchematics and code for my home-made 8-bit CPU and its companion boards.\n\nArticles about this project:\n\n[Hackaday.com](https://hackaday.com/2020/12/31/diy-8-bit-computer-knows-all-the-tricks/)\n\n[Hackster.io](https://www.hackster.io/news/see-inside-of-a-cpu-with-the-mk1-8bit-computer-14fa9e313c73)\n\n[InformaticaLab.com](https://blog.informaticalab.com/viaggio-allinterno-di-una-cpu-con-il-mk1-8bit-computer/)\n\n## Overview\n\nDuring the past month, I designed and built a programmable 8-bit CPU from scratch, out of basic series 74LS logic ICs.\n\nThis repository contains pictures, schematics, and code for this project and its companion boards.\n\n* V 1.0 assembled:\n\n\u003cimg src=\"MK1_CPU/images/8bit-computer_v1.jpg\" style=\"zoom:15%;\" /\u003e\n\n* V 2.0b assembled:\n\n\u003cimg src=\"MK1_CPU/images/8bit-computer_v2.jpg\" style=\"zoom:15%;\" /\u003e\n\n- Helix Display Interface in action:\n\n\u003cimg src=\"helix_display_interface/images/hello_world.gif\"/\u003e\n\n* V 1.0 in action:\n\n**DEMO VIDEO (YouTube)**\n\n[![MK1 Computer - home-made Programmable 8bit CPU](https://img.youtube.com/vi/qSviFkpLFKI/0.jpg)](https://www.youtube.com/watch?v=qSviFkpLFKI)\n\n## Architecture\n\nThe MK1 CPU is composed of several modules, all connected trough a common 8-bit BUS, the status of each module is shown by dedicated LEDs. \n\n- The clock module is designed to allow step-by-step execution; in automatic mode the clock speed can be adjusted from 1Hz up to 32KHz.\n- The computer programs are stored in RAM and the CPU can be programmed both manually, by inserting binary machine code through dip-switches, and automatically via a USB PC interface. \n  - The Programming interface is designed to be used in conjunction with an **Arduino Nano** or the **Start9** programming board.\n  - The **Start9** programming board allows the loading of multiple programs stored on an on-board flash memory without the aid of an external computer device.\n- The Addressable memory space is 1024 byte, data, stack and code spaces are separated, the code address space is not writable. \n- The instructions are variable-length (see **instruction-set [here](https://github.com/vascofazza/8bit-cpu/tree/master/MK1_CPU/programs/lib/mk1.cpu)**) 1 or 2 bytes long (first byte for the opcode, the second one for the argument), there are 4 general purpose registers (`A`, `B`, `C`, `D`) and a  `stack pointer` register for subroutine calls.\n- The **A**rithmetic **L**ogic **U**nit has a dedicated register for the second operand and supports the following operations:\n  - Addition\n  - Subtraction\n  - OR\n  - AND\n  - NOT\n  - Left/Right Shift\n  - Left/Right Rotation\n- The Control Unit combinatory logic is implemented using EEPROMs (see **microcode [here](https://github.com/vascofazza/8bit-cpu/blob/master/MK1_CPU/code/microcode.txt)**) whilst each instruction is realized through a variable number of micro-instruction for a maximum of 6 micro-steps per instruction, including the fetch cycle. The instruction-set  supports both direct and indirect memory access as well as absolute and conditional jumps on carry (`CF`) and zero (`ZF`) ALU flags.\n- The computation output can be visualized on a 4-digit display, with a dedicated register, able to represent positive and 2-complement negative numbers both in decimal and hexadecimal format.\n- The CPU can be extended thanks to the external BUS interface capable of handling up to 2 peripheral. The communication is bidirectional, the devices can send interrupts to the CPU to notify when new data is available. Interrupts are cleared once the data has been processed.\n  - The only available peripheral at the moment is the **Helix** display interface, an ATmega328-driven 2x16 LCD output display.\n\n## Structure\n\n- **MK1 CPU/**:\n  - **8bit-computer/**: KiCad project, schematics and PCB design of the **MK1 CPU**.\n  - **code/**:\n    - microcode.py: generates the binary EEPROM microcode.\n    - out_display.py: generates the binary output display EEPROM code.\n    - uploader.py: uploads a binary MK1 program to the CPU.\n    - mk1_computer_uploader/: Arduino programmer interface sketch.\n  - **assembler/**: fork of the hlorenzi's assembler, improved and customized for the MK1\n  - **programs/**: a collection of programs for the MK1 CPU plus the assembler definition\n- **start9_programming_interface/**: \n  - **programming_interface/**: KiCad project, schematics and PCB design of the **Start9** programming board.\n  - **code/start9_programming_interface/**: Arduino code for the programming interface.\n- **helix_display_interface/**:\n  - **display_interface/**: KiCad project, schematics and PCB design of the **Helix** display interface board.\n  - **code/helix_display_interface/**: Arduino code for the display interface.\n- **eeprom_programmer/**: KiCad project, schematics and PCB design of a simple Arduino-based eeprom programmer\n- **bus_breakout/**: KiCad project, schematics and PCB design of the external bus connector breakout board.\n\n## Changelog\n\n##### V2.0d:\n\n- minor hardware revision\n- revisited PCB design\n- new memory architecture, code memory section is read-only, stack and data live on separated spaces\n\n##### V2.0b:\n\n- minor hardware revision\n- Variable-length instructions (1 or 2 bytes)\n- new custom assembler, thanks to https://github.com/hlorenzi/customasm\n- few new instructions\n- revisited microcode and instruction-set\n\n##### V2.0:\n\n- 4 general purposes registers (A, B, C, D)\n- Stack Pointer implemented as an up-down counter\n- External interface and interrupt handling\n- Output display decodes HEX and ASCII values\n- Clock speed multipliers\n- Control Unit extended with 4 EEPROMs\n- Variable step microcode counter length (each instruction uses the minimum amount of micro-steps)\n- revisited microcode and instruction-set\n\n##### V1.0:\n\n- Bugfixes.\n- `HL` and `STK` address signals available in the `MAR` dip-switch.\n\n##### V0.1:\n\n- Initial release\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvascofazza%2F8bit-cpu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvascofazza%2F8bit-cpu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvascofazza%2F8bit-cpu/lists"}