Richard Buckland's 4 bit computer

check out his lectures: Lecture 3: Machine Code - Richard Buckland UNSW, Tom Scott's The Fetch-Execute Cycle: What's Your Computer Actually Doing, or Ben Eater's How do CPUs read machine code.
the computer is named: 4917

4917 - The Computer:

This computer has four important components. * Memory also called RAM, for Random Access Memory, because we can read and write into any location. The memory is where we keep our program and its data. * Processor also called CPU, Central Processing Unit, is the piece of the computer that executes the program from the memory * Printer where we can print values * Beeper we can use it to beep

Bits, Nibbles and Bytes:

1 bit is the smallest amount of information we could have, it is either 1 or 0. For example, we can encode the flip of a coin in 1 bit, it is either Heads or Tails. In 4 bits we can have the numbers from 0 to 15: 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 10 1011 11 1100 12 1101 13 1110 14 1111 15 4 bits are called a nibble 8 bits is a byte 1024 bytes is a kilobyte 1024 kilobytes is a megabyte 1024 megabytes is a gigabyte 1024 gigabytes is a terabyte ...

CPU (Processor):

The CPU loads instructions from memory and executes them. You can think of the CPU as an octopus. The octopus can only work with its arms, for example if one arm has 5 coins and the other has 3, it can add them and have one arm with 8 coins. Then you can ask the octopus to put the coins back on the shelf. The CPU just like the octopus can only work with its arms, we call them 'registers'. Our CPU has 4 registers. Modern CPUs have around 32 registers, some have more than 600. ██████████ ████▒▒▒▒▒▒▒▒▒▒████ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ ██▒▒▒▒ ▒▒▒▒▒▒ ▒▒▒▒██ ██▒▒ ▒▒ ▒▒██ ██▒▒ ████ ▒▒ ████ ▒▒██ ██▒▒ ██████████████ ▒▒██ ██▒▒ ██▒▒▒▒▒▒██ ▒▒██ ██▒▒██▒▒██▒▒██████▒▒██▒▒██▒▒██ ██▒▒▒▒██████▒▒██████▒▒██████▒▒▒▒██ ██▒▒██R0▒▒████▒▒▒▒▒▒████▒IS▒██▒▒██ ████R0▒▒██R1██████IP██▒IS▒████ ██R0▒▒████R1▒██▒IP▒████▒IS▒██ ██████▒R1▒██ ██IP▒▒██████ ████ ████ ┌────────┐ ┌────────┐ │ IP: 0 │ │ IS: 0 │ └────────┘ └────────┘ ┌────────┐ ┌────────┐ │ R0: 0 │ │ R1: 0 │ └────────┘ └────────┘ Each of them can hold a 4 bit number from 0 to 15. Registers are actually just memory that the CPU can do stuff with (like the arms of the octopus), e.g. ADD R0 + R1 or INCREMENT R0. IP and IS are a bit special, because the CPU uses them to know which instruction to fetch from memory and what its value is. R0 and R1 are called general purpose registers because we can use them for whatever we want. Once you power on the CPU, it fetches an instruction from the memory address pointed by IP(instruction pointer), and puts it in IS(instruction store) and executes it and then moves IP to the next instruction, or sets it to a specific value if you are JUMPing. It keeps doing that forever and ever until you turn it off.