A good Youtube video about binary numbers:

https://www.youtube.com/watch?v=PMpNhbMjDj0&t=665s

What they Words Mean (Week 1)

Boolean Algebra

It comes from some dude named George Bool…

It’s about doin math with bits; numbers in base 2 (1s and 0s!)

BUT all arithmetic is done with bitwise logical operations!

Bit

A singular store of state, e.g. on/off, yes/no, in/out and…errrr oh ya 1/0

Bitwise Logical Operation

An operation done on 2 or more series of bits by each bits position.

Basic Logical Operators:

  • AND
  • NOT
  • OR
  • XOR

Example:

A0110
B1010
A AND B0010

Truth Table

A table that shows all possible input and outputs for the given logical operations

Example: aiya go check the slides

Number Bases

Base 2 (binary)

Has 2 digits: 0 or 1

Represented with the prefix “0b”

Base 8 (octal)

Has 8 digits: 0-7

Represented with the prefix “0o”

Base 10 (decimal)

Has 10 digits: 0-9

Base 16 (Hexadecimal)

Has 16 digits: 0-9,A,B,C,D,E,F

Represented with the prefix “0x”

Conversion between the non-decimal bases

flowchart LR
Hexadecimal <--"Direct"--> Binary
Binary <--"Direct"--> Octal
Hexadecimal <--"Binary"--> Octal

Computer Memory

Central Processing Unit (CPU)

It’s the brainz of the computer! does them calculations.

okay if u don’t know what this is pls message me HAHA

Byte

A byte is the smallest addressable chunk of bits

Usually 8 bits in most modern CPUs

Word Length

Maximum number of bits a CPU can deal with at a time.

The largest register size of a CPU:

  • 8-bit CPU = 8-bit word length
  • 64-bit CPU = 64-bit word length

Addressable Memory

Memory the CPU is able to directly access!

The cpu can go: “I want the byte in address ‘0xFF’! Give it nowwww”

And the whole byte will b transferred to the CPU

Primary Memory/Random Access Memory(RAM)

  • One of the types of memory in a computer system.
  • It is a form of addressable memory

Its role is kinda like what short-term memory is for us humans. It keeps information about the stuff the CPU is doing/‘thinking’ about atm.

You can imagine it to work like a drawer of a filing cabinet! The memory address being the name of the folders in the cabinet, and the byte is all the information in the folder.

You gotta take out the whole folder(byte) to retrieve whatever information u need inside! You cannot take out half a byte!

Memory Address (index)Byte
0x010100 0110
0x020101 0101
0xFE0100 0011
0xFF0100 1011

It’s called “Random Access” as reading and writing to any address/part of the memory takes equal time!

So you are able to randomly access different addresses with no performance hit!

Data Type

A series of bits can mean anything.

For example, here are 2 different interpretations of the byte at “0x01” in the table above:

  • As a UTF-8 Character: F
  • As an integer: 70

So, the data type is needed to know what the byte actually is. It tells you how to interpret the bits!

Examples of Data Types:

  • UTF-8: Characters
  • Unsigned Integer: Whole numbers with no + or - sign
  • Signed Integer: Positive and Negative whole numbers

Most Significant Bit

If u treated a series of bits as an integer, the most significant bit is the bit that is in the most significant place.

Like the decimal number 158, the digit 1 has the largest value, it is in the most significant place.

In the binary number 011, the most significant bit is 0. It is in the most significant place. (Assuming that the binary number is in big-endian(if you don’t know what this means, just ignore it for now))

Signed/Unsigned Integers

Integers are just any real whole number

A signed integer is an integer where the most significant bit denotes the “sign” of the integer, positive or negative.

Unsigned just means all the bits are used to store the number.

Given a byte that is 8-bits long:

  • A signed INT has 1 bit that stores the sign, and 7 bits to store the number
  • An unsigned INT has 8 bits to store the number

Two’s Complement

A way of representing negative numbers in a signed integer.

Please go research more on this. The people who think of this shit fr had wrinkly ass brains.

Friendly reminder that this should NOT be your notes. I missed out some stuff. Please take the time to make notes, it will help you learn much better!