EP002 Ones Vs Zeroes
Summary: programs running on CPU: how electrically CPUs work, how CPUs interperet what to do, how we interact with CPUs. Also what makes up a program: structure of programs, variables, and logic (including flawed)
common knowledge computers “speak” in 1&0. Why? How? All comes back to how computers are made.
Electronics are made up of tiny switches (like lights) and can be combined to make decision
‘And’ and ‘Or’ and ‘XOR’
This is where computer math comes from. each switch is a bit. off = 0, on = 1. 1+1=10
This math is built into circuitry, called a half adder. 2 inputs go simultaniously through an AND and an XOR gate. XOR outputs the sum, AND outputs the carry. like adding 1 to nine make 10 in decimal math (decimal means base 10)
bits are base 2, but there’s other counting systems used in computers like octal and hexidecimal.
The half adder also touches on how all computer programs work, data and code segments
– Machine language instruction sets vs Mnemonics in assembler
10110000 00000011 (B0 03) means load 3 onto AL, load 5 onto BL, add AL and BL, 8 goes into AL
Linker turns asm into machine languages
– Structure defines purpose (type strong variables – Integer Overflow)
code or data
making a program that does the same thing over and over again seems like a waste. use variables instead of values
– 8 bit int 01111111 vs 11111111