# Falk Joensson'sLearning Programming with Eas(Easy Application Script Tutorial)

## How the Computer Works:05. Memory Addresses

How does the computer know which bits/bytes to set, clear or read, out of the zillions it can store in its RAM, on physical drives, and so on? Every single memory flip-flop is connected to the computer's output line through a circuit network, and it sets this output to its bit-state when its read-input bit is activated. Imagine you had a computer with only 2 bits of RAM. Then you could select which bit to read by a control bit that either activates RAM bit A if 0, or RAM bit B if 1, using a bit-inverter circuit before A: control bit = 0 → read-input A = 1 → output line reads bit A read-input B = 0 control bit = 1 → read-input A = 0 read-input B = 1 → output line reads bit B As this works a little bit like postal codes, one can say that bit A has the address "0" and bit B has the address "1". The address control bit tells the computer which flip-flop to read, set or clear. With two more control bits and some simple circuitry one can realize all three flip-flop operations: read/write control bit = 0 on/off control bit = 0 = "read: off" (does nothing, idle state) read/write control bit = 0 on/off control bit = 1 address control bit = 0 = "read: on" from cell "0" read/write control bit = 0 on/off control bit = 1 address control bit = 1 = "read: on" from cell "1" read/write control bit = 1 on/off control bit = 0 address control bit = 0 = "write: off" to cell "0" (clears the bit) read/write control bit = 1 on/off control bit = 0 address control bit = 1 = "write: off" to cell "1" (clears the bit) read/write control bit = 1 on/off control bit = 1 address control bit = 0 = "write: on" to cell "0" (sets the bit) read/write control bit = 1 on/off control bit = 1 address control bit = 1 = "write: on" to cell "1" (sets the bit) Now just add a second address bit, and we can read from, clear and set four memory cells (flip-flops). With a 3-bit address, we can access eight flip-flops, a byte. In reality, though, computers do not only have one single data output line and one single on/off control line, but use the read/write control bit to read from, set or clear whole groups of flip-flops in parallel all at the same time. The address then does not refer to individual bits or flip-flops but, depending on the microcontroller or computer type: 8 bit: one byte at a time 16 bit (2 bytes): one word at a time 32 bit (4 bytes): a double word at a time 64 bit (8 bytes): a quad word at a time There are always as many write lines as there are read lines in a computer. An 8-bit computer, for instance, has an 8-bit write port (bit write on/off lines) and an 8-bit read port (memory output lines). An 8-bit computer can use a 3-byte address (256×256×256 = 16,777,216 = 16×1024^2) to access up to 16 megabytes of RAM, a 16-bit computer can use twice as much, 32 MB. A 4-byte address for a 16-bit PC suffices for 8 GB RAM, while a 64-bit PC can use it to access up to 32 GB RAM, to just give a few examples.
05. Memory Addresses
Esc Search / Table of Contents