Journey from Assembly Code to Machine Code

Something I can't quite wrap my head around is how what we type into a computer and read from the screen is turned into something a computer can utilize and execute. Even in the lowest of languages such as assembly, I read that "Assembly is the bridge between high level languages and the actual machine code itself". But REALLY how does this work. if computers can only operate off high and low signals, how are we able to write a compiler that operates off of letters numbers and symbols. How do these strings of code actually BECOME the high and low signals that are fired through the transistor gates? when you type a key, is that actually a series of signals stored in a register somewhere among the computer's circuitry? does that also send the signal for that character to the screen or is that a completely separate process that takes course when you press a key?

Answers


You actually asked many (albeit related) questions there..

I'd suggest delving into assembly. Processors operate on something called "machine code", which are really just numbers, where something like "0x1234 0x001A 0x0002" could mean "add 2 to the contents of register X". Most assembly instructions translate directly to their machine code counterparts, so you will get a feel of how a processor executes instructions one by one. After that, you can go a step further and read up on processor architecture (as TheZ suggested), where you will learn how those machine code instructions actually translate into different transistors being toggled and bits being stored.

CPUs also have something called "interrupts", which are (very simplistically said) lines on which e.g. a keyboard outputs a high voltage, and the CPU is triggered to execute a certain subroutine for processing e.g. a keypress. From this interrupt to a letter appearing on screen though it's still quite a trip.

Don't just dive head into this as it will only confuse you, learn things step by step.


Need Your Help

Preloading animation for React webpack bundle

reactjs webpack preload

I have a single page webapp, which is about 300Kb big. It gets bundled with webpack and uses React/Redux.