Fireship · @fireship
Assembly Language in 100 Seconds
Uploaded April 14, 2022 · Length 2:44
Summary
assembly language basics, its history, and usage in programming, including low-level performance and web assembly.
- assembly language
- low-level programming
- web assembly
- cpu architecture
- programming basics
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
assembly a low-level programming
- 0:02
language designed to simplify the
- 0:03
instructions fed into a computer CPU in
- 0:06
other words it's a human readable
- 0:08
abstraction on top of machine code so
- 0:10
programmers don't have to manually count
- 0:11
ones and zeros the First Assembly
- 0:13
Language was created by Kathleen booth
- 0:15
in 1947 for the allpurpose electronic
- 0:18
computer over the next decade it evolved
- 0:20
into many different formats to power the
- 0:22
supercomputers of the day like the IBM
- 0:24
790 which had a $20 million price tag in
- 0:27
today's dollars writing code in assembly
- 0:29
was standard until the emergence of
- 0:31
highlevel languages like Fortran a few
- 0:33
years later however assembly is still
- 0:35
used today for direct access to the bare
- 0:37
metal hardware and to address low-level
- 0:39
performance issues often on device
- 0:41
drivers and embedded systems and it's
- 0:43
also used to run native software in a
- 0:44
web browser via web assembly what's
- 0:46
tricky is that each Assembly Language
- 0:48
only works on a specific CPU
- 0:50
architecture like arm for Apple silicon
- 0:52
and Raspberry Pi or x86 for Intel chips
- 0:55
to get started you'll first need an
- 0:56
assembler like the netwide assembler for
- 0:58
x86 chips in assembly program is divided
- 1:01
into three sections the text section
- 1:03
contains the actual Logic for the
- 1:04
program by convention it contains an
- 1:06
entry point called start which is where
- 1:08
the code will start executing next we
- 1:10
have the block starting symbol section
- 1:11
which contains variables that might
- 1:13
change throughout the life cycle of the
- 1:14
app and finally the data section is
- 1:16
where we can initialize constants or
- 1:18
data that does not change to declare a
- 1:20
constant like a string we start with a
- 1:21
label then use DB for defined bite to
- 1:24
place the hello world string into memory
- 1:26
by itself it doesn't do anything and to
- 1:28
print it to the standard output we will
- 1:29
will also need its length we can use
- 1:31
equate to convert a symbol into a
- 1:33
constant the dollar sign will subtract
- 1:35
the current position from the hello
- 1:36
label providing the length of the string
- 1:38
and now these constants can be
- 1:39
referenced from the start label in the
- 1:40
main program each line of code contains
- 1:42
an instruction along with one or more
- 1:44
operands and there are hundreds of
- 1:45
instructions built into the language now
- 1:47
to perform operations quickly the CPU
- 1:50
has a limited number of registers which
- 1:51
are like 64-bit chunks of memory built
- 1:54
directly into the CPU instead of the ram
- 1:56
we can insert data into a register with
- 1:58
the move instruction by providing
- 1:59
operands for the register name and the


