Lesson 1 · Hardware

⚙️ Assembly Language & Bit Manipulation

Beneath every Python program is the language the processor really speaks. Here you get as close to the hardware as most programmers ever go.

📟 Assembly language

Assembly language uses short mnemonics that map closely to machine code. An instruction has an opcode and an operand. Addressing modes say how to find the operand: immediate, direct, indirect, indexed.

LDM #5 load the number 5 into ACC (immediate) ADD 200 add the contents of address 200 (direct) STO 201 store ACC at address 201 END

🧱 Bit manipulation

Logical shifts move bits and fill the gap with zeros: a left shift multiplies by 2, and a right shift divides by 2. A mask tests or changes bits: AND clears, OR sets, XOR flips.

00000110 LSL 1 = 00001100 (6 → 12) 1011 AND 0011 = 0011 (keep the right two bits) 1000 OR 0001 = 1001 (set the last bit) 1010 XOR 1111 = 0101 (flip every bit)
✏️ Quick check · 1 of 6
Mnemonic

A mnemonic in assembly language is:

Easy to remember.
✏️ Quick check · 2 of 6
Immediate

In immediate addressing, the operand is:

The value itself.
✏️ Quick check · 3 of 6
Mask

To clear chosen bits, use a mask with:

AND with zeros.
✏️ Quick check · 4 of 6
Flip

To flip chosen bits, use a mask with:

Exclusive.
✍️ Type your answer · 5 of 6

00000110 is shifted left by 1 place.

What denary value results?

Enter an exact answer, without rounding.
Left shift doubles.
✍️ Type your answer · 6 of 6

00001100 is shifted right by 2 places.

What denary value results?

Enter an exact answer, without rounding.
Each shift halves.
📝 Lesson quiz · 5 questions
0 / 5
Re-read the lesson, then give it another go.
Question 1 of 5

An assembler translates:

Question 2 of 5

In indirect addressing, the operand gives:

Question 3 of 5

1100 AND 1010 equals:

Question 4 of 5

1100 OR 1010 equals:

Question 5 of 5

A two-pass assembler builds a:

Lesson 2 · Logic

🔣 Boolean Algebra & Karnaugh Maps

A simpler circuit is cheaper and faster. Boolean algebra and Karnaugh maps let you shrink logic to its smallest form.

➕ Boolean laws

Use the laws to simplify expressions. De Morgan’s laws are especially useful.

A + 0 = A A . 1 = A A + 1 = 1 A . 0 = 0 A + A = A A . A = A A + Ā = 1 A . Ā = 0 De Morgan: NOT(A . B) = Ā + B̄ De Morgan: NOT(A + B) = Ā . B̄ A . B + A . B̄ = A . (B + B̄) = A

🗺️ Karnaugh maps

In a Karnaugh map, adjacent cells differ by one bit. Group 1s in blocks of 1, 2, 4 or 8, using the largest groups you can. Each group gives one simplified term. Groups may wrap around edges.

2 inputs, A and B, with 1s at A=1,B=0 and A=1,B=1 both cells have A = 1, and B changes so the group simplifies to A
A half adder gives S = A XOR B and C = A AND B. A flip-flop stores one bit.
✏️ Quick check · 1 of 6
Law

A + Ā simplifies to:

Something or not it.
✏️ Quick check · 2 of 6
De Morgan

NOT(A . B) is equal to:

Change the sign.
✏️ Quick check · 3 of 6
K-map

K-map groups must contain:

Powers of two.
✏️ Quick check · 4 of 6
Simplify

A . B + A . B̄ simplifies to:

Take out A.
✍️ Type your answer · 5 of 6

A half adder has A = 1 and B = 1.

What is its sum output S?

Enter an exact answer, without rounding.
XOR.
✍️ Type your answer · 6 of 6

A half adder has A = 1 and B = 1.

What is its carry output C?

Enter an exact answer, without rounding.
AND.
📝 Lesson quiz · 5 questions
0 / 5
Re-read the lesson, then give it another go.
Question 1 of 5

A . 0 equals:

Question 2 of 5

A + 1 equals:

Question 3 of 5

Adjacent K-map cells differ by:

Question 4 of 5

A flip-flop stores:

Question 5 of 5

A full adder has how many inputs?

Lesson 3 · Systems

🖥️ Virtual Machines, Data Integrity & Exceptions

Good systems plan for things to go wrong: corrupted data, crashed programs and even running one computer inside another.

🧰 Processors and virtual machines

RISC processors have simple instructions, often run in one cycle, and suit pipelining. CISC processors have complex instructions. A virtual machine is software that behaves like a separate computer, so one host can run several guest operating systems.

VM benefits: run several OSs, safe testing, easy backups VM drawbacks: slower performance, host resources are shared

🛡️ Data integrity and exceptions

Parity and checksums detect errors in transmission. Validation checks data is reasonable. An exception is an error at run time, handled with try/except so that a program does not crash. Parity cannot detect two flipped bits.

even parity: 1011000 has three 1s, so add 1: 10110001 try: n = int(input()) except ValueError: print("Please enter a number")
✏️ Quick check · 1 of 6
RISC

RISC processors typically have:

Reduced set.
✏️ Quick check · 2 of 6
VM

A virtual machine allows:

A computer in a computer.
✏️ Quick check · 3 of 6
Parity

Parity can fail when:

Even number of errors.
✏️ Quick check · 4 of 6
Exception

An exception is handled by:

Try it, then catch it.
✍️ Type your answer · 5 of 6

A byte uses even parity. Seven data bits contain three 1s.

What should the parity bit be?

Enter an exact answer, without rounding.
Make the total even.
✍️ Type your answer · 6 of 6

A pipeline has 5 stages, each 1 clock cycle, and is already full.

How many instructions complete in 10 further cycles?

Enter an exact answer, without rounding.
One per cycle.
📝 Lesson quiz · 5 questions
0 / 5
Re-read the lesson, then give it another go.
Question 1 of 5

Pipelining means:

Question 2 of 5

A checksum is used to:

Question 3 of 5

Which would raise an exception?

Question 4 of 5

A drawback of a virtual machine is:

Question 5 of 5

Handshaking is used in:

Final Challenge

🏆 6-Question Challenge Quiz

Questions from every topic in this course. Pick an answer for each one, then hit Check My Answers.

0 / 6
💪 Keep practicing — go back through the lessons and retake the quiz!
Q1 · Assembly Language & Bit Manipulation

A logical left shift by 3 multiplies by:

Q2 · Assembly Language & Bit Manipulation

1111 XOR 0101 equals:

Q3 · Boolean Algebra & Karnaugh Maps

NOT(A + B) equals:

Q4 · Boolean Algebra & Karnaugh Maps

Larger groups on a K-map give:

Q5 · Virtual Machines, Data Integrity & Exceptions

Even parity makes the number of 1s:

Q6 · Virtual Machines, Data Integrity & Exceptions

CISC processors have: