Sampath Balivada
Sampath Balivada

Sampath Balivada

Assemblers - Nand2Tetris

Assemblers - Nand2Tetris

"Avengers... Assemble". Or more like "Symbols... Assemble"

Sampath Balivada's photo
Sampath Balivada

Published on Nov 4, 2021

2 min read

Some of the quotes and information are part of the Nand2Tetris course available on Coursera.

Assemblers

Assemblers are simple. They turn symbolic code (assembly) into machine code (binary). We can also write everything in machine code but it's much easier for us to make a computer do it. But, it is also hard to write an assembler in machine code.

Cross Compilation

So what do we do? We use a different computer to write an assembler in a high-level language like C++, Java or Python and use it to translate our assembly code to binary code.

The assembly code is not the same for every machine as platforms might change and it's the same case with Machine code as well. As the CPU changes, the type of operations it can perform will also change.

Cross Compilation is the process of compiling a piece of code on a computer where the output is compiled to be run on a different platform than the one we are compiling on.

A perfect example of cross-compilation would be mobile apps. Desktop PCs are built on the x86_64 platform whereas mobiles are built on the ARM platform but we compile mobile apps on Desktop and run them on mobile devices.

If you want to try out the assembler that I built for the course, you can find it here.

 
Share this