Pg. 185ish-238 gives the full detail in how a computer is built
The process of programming computers with punch cards was because previously putting instructions in memory was unfathomable - there was barely any memory available
NOOP an instruction for the processor to perform no operations
Different chips communicate with each other through a bus, which provides signals to every board
This bus also provides power to the different chips
E.g. PCI is a type of bus
EEPROM
ROM - Read only memory
PROM - Programmable read only memory (only programmable once)
EPROM - Erasable programmable read only memory (erase with UV light)
EEPROM - Electrically Erasable read only memory (erase with software)
See the hardware on your system with sudo lshw
For displays only run sudo lshw -C display
See displays your graphics/video card supports with xrandr
HDMI are the HDMI compatible outputs for your graphics card
DP are the display port compatible outputs for your graphics card
Random Acccess Memory - Called random because you can read/write to any address without going sequentially
Can be implemented with a decoder, set of flip-flops, and a selector
The selector selects the memory address…e.g. with 10 inputs it can store 1024 different addressable values
RAM is also volatile - it requires constantly powered transistors to be in their switch states to store the bits of information. If the switches lose power memory is lost!
It will start up again with random memory values
Dyanmic RAM requires refresh cycles to avoid losing its contents, static RAM does not
DRAM is cheaper and easier to build and is thus what is predominant
Operation codes (opcodes) are encoding bytes that tell the computer what operation to perform.
These come with memory addresses indicating the address of the data the operation is to be performed on
“Instruction fetch” - retrieving these opcodes from memory
Jump instruction - tells the computer to start executing instructions at a different memory address
Opcodes are just the software you write to tell the hardware what to do (machine code, assembly is translated into this)
Each instruction in assembly is translated directly into bytes
For example, MOV will translate directly into a hexidecimal opcode
MOV can just be thought of a friendly name for the opcode
MOV can have multiple opcodes associated with it though, as each opcode represents the different parameters it can be called with (e.g. move into register B, C, D, etc.)
The 8080 microprocessor has 63 opcodes for move
MOV1 [destination_address], [source_address]
Opcodes can specify a src and destination address for their operations
A clock signal is just made up of a series of frequency halving circuits. These circuits switch state between 0 and 1 indefinitely because of how they are wired
Thus, the highest frequency osciallator switches the least significant bit between 0 and 1. The next highest frequency toggles the next least significant bit between 0 and 1 at a rate half as fast as the least signficant bit. This ensures the lease significant bit toggles between 0 and 1 before the next bit switches from a 0 to a 1
You can chain as many of these together as you need (one for each bit of the counter/clock you want to build)
The general hardware stack just provides memory where a program can push things onto and pop them off instead of storing memory in a certain address and having to remember where it is stored
With a stack, a program just needs to know the order things should be pushed on or off the stack and it will get the data/addresses it needs
The stack is just a section of normal RAM that isn’t used for anything else
The stack pointer is just a register that points to the address of the top of the stack (when you add something to the stack the computer needs to keep track of where the stack currently is to add the next bit of data/pop off the result)
e.g. if the top of the stack has data at 0xffh the stack pointer will point to 0xffh
Stack overflow: when too many items are pushed onto the stack that the stack gets too big and overflows into overwrite other memory needed by programs
Stack underflow: when the contents of the stack get exhausted prematurely
Generally, the stack pointer is initially set to 0x000 so the first push onto the stack is pushed on at the last memory address (e.g. 0xfff)
Successive stack pushes push on to 0xffh, etc. and decrement the stack pointer
A register the processor uses to retrieve the address of the instructions to execute
The CALL instruction pushes the current address onto the stack, then loads a new address into the program counter for execution
This is how functions are implemented, a CALL instruction pushes the current instruction address onto the stack, loads a new address into the program counter, and when the function returns it pops the address of of the stack to be reloaded into the program counter and continue where it left off
The CALL instruction is essentially a reminder to the program of where it jumped from
You pop off the CALL instruction and load the results into the program counter with the RETURN instruction
Uses one address for a result, one for the multiplier, one for the multiplicand
Loops through, adding the multiplicand to the result, and decrementing the multiplier (counter of how many times the mulitiplicand has been added to the result)
Once the multiplier is decremented to 0 (the program has added the value the proper amount of times to itself) the program no longer jumps to the start of the zoom because of th JNZ (jump if not zero) opcode
Instruction sets differ between chips - this is why one compiled program (which translates to instruction sets/opcodes) cannot be run on different architectures
Note: the instructions covered here are CISC (complex instruction set) computing, while RISC (Reduced instruction set) e.g. from ARM, generally limits the instruction set to load and store instructions
An emulator examines opcodes one by one, essentially translating them, and performing a certain action to convert one instruction set to another for a different chip
In an instruction that lasts 3 bytes, the first byte will be the opcode then the next two bytes be the 16 bit address to operate on
When storing 16 bit addresses in 8 bit blocks of memory Intel stores the low order byte first, then the high order byte. Motorolla does/did the opposite
Thus, knowing the correct address is dependent on the ordering of these high and low order bytes
Low-order first (Intel) is deemed litte-endian and high-order first (Motorolla) is deemed big-endian
When an interrupt occurs, the chip sends a signal to the process to save the current program counter and branch to a certain address to run a program specified by the interrupt
A keyboard for example is just a set of switches. When a key is pressed the switch is closed, and the keyboard hardware generates a code for the key that was pressed.
maskable interrupts -> can be turned off by the CPU prior to executing important instructions
nonmaskable interrupt -> reserved for unrecoverable memory errors or divide by 0, etc.
At boot time, an OS will installs the existing devices’ interrupt service routines into the interrupt vector
traps are software interrupts and are used to request kernel space execution of programs from user space applications
The alternative to interrupts is frequent polling which may only be better in high throughput devices
Upon loading, the computer executes initialization code in its starting memory address
This can configure the stack, enable interrupts, etc.
Normally, the OS is stored on the first part of the disk and loaded into memory on boot
The bootloaded loads this. The bootloaded will load the initially code into memory, and that loaded code will be responsible for loading the rest of the OS.
The source device (e.g. laptop) multiplixes multiple input video streams into one
This is then sent to the branch devices (e.g. a hub or in the display itself) and is de-multiplixed into its composite streams
The combined data rate of all displays cannot exceed the limit of the one display port it is plugged into
Can daisy chain multiple monitors through one cable but there is a bandwidth limit on the single
cable on the host to the displays for handling the multiple video streams
Display port is the more established daisy chain medium
Can chain with USBC too (in alternative mode which allows video over USBC)