Virtual Machine

Assembly Language Teaching Material

NASM

Assembly Virtual Machine

Assembly programming learning using NASM over Linux

NASM (Netwide Assembler) is a multi-platform assembler for x86 CPUs (i.e., the CPUs that power PCs and Apple Macs) in 32 and 64 bit modes. It is a free open source project, gaining popularity and providing a simplified Assembly language syntax. NASM alternatives are either not free or platform-restricted. Like most assemblers and compilers, NASM itself is a command-line tool, so we'll be using it indirectly from the SciTE IDE.

GDB (GNU Project Debugger) and DDD (Data Display Debugger) are GNU software for debugging applications developed in any computer language. GDB is the actual debugger but has a command-line interface that is hard to learn. DDD is the graphical interface to GDB, boasting a very small footprint in terms of disk space and memory — in fact this was a factor in every software choice I made as it increases the chances that you'll be able to use this virtual machine. You can launch it from the obvious desktop shortcuts or with Ctrl+Alt+G.

In past years, this class has evolved from:

  1. telling you to install your own Linux copy — this was unnecessarily difficult and there's always some first-year students who haven't managed to do so by mid-semester: I'm not a fan of leaving students behind but cannot look at every individual installation problem,
  2. giving you an Xfce-based Linux virtual machine taking almost 3Gb in disk space (smallest installation) and 512Mb of memory, and where you typed assembler and linker commands in the command-line and had no debugger, IDE or syntax highlighting text editor,
  3. giving you the present virtual machine where you have all these tools available in a virtual machine taking less than 2Gb of disk space and running in less than 256Mb of memory.
By providing you with this platform I hope you spend less time installing and configuring these tools (that are probably novelty for you) and more time learning about the concepts we care about in class. However, I allow and promote that you install your own Linux copy on your system without using this virtual machine — this will give you some experience with its installation and problem resolution. Unfortunately, due to time constraints, I will not be able to help you much with such problems.

There is a folder in the desktop named "ac" which stands for "Computer Architecture", in Portuguese. If it's empty, this means there have been recent changes to the teaching materials: please visit the page with my teaching materials for this class and load them here. You'll be guided how to proceed from there, in class.

Read also about how to use the Linux virtual machine.

For other teaching materials (in Portuguese), please follow this link.

Máquina Virtual Assembly

Aprendizagem de programação em Assembly usando o NASM sobre Linux

O NASM (Netwide Assembler) é um assembler multi-plataforma para CPUs x86 (i.e., os CPUs que são usados em PCs e Apple Macs) nos modos de 32 e 64 bits. É um projecto de fonte aberta (open source) gratuito que está a ganhar popularidade e permite a utilização de uma sintaxe Assembly simplificada. As alternativas ao NASM ou não são gratuitas ou são restritas em termos de plataforma. Tal como a maior parte dos assemblers e compiladores, o NASM é uma ferramenta de linha de comandos pelo que o vamos usar indirectamente pelo IDE SciTE.

O GDB (GNU Project Debugger) e o DDD (Data Display Debugger) são software da GNU para depuração (debugging) de aplicações desenvolvidas em qualquer linguagem de programação. O GDB é o depurador (debugger) em si, mas tem uma interface de linha de comandos, o que o torna de difícil aprendizagem. O DDD é uma interface gráfica para o GDB que consegue ocupar muito pouco espaço em disco e memória — de facto, este foi um critério importante na escolha de todo o software, pois aumenta a probabilidade de que consigas utilizar esta máquina virtual. Podes correr o DDD a partir dos atalhos óbvios no ambiente de trabalho (desktop) ou com Ctrl+Alt+G.

Em anos anteriores, esta unidade curricular tem vindo a evoluir de:

  1. vos pedir que instalassem a vossa própria cópia do Linux — isto era desnecessariamente difícil e há sempre alunos de 1º ano que a meio do semestre ainda não conseguiram fazer esta instalação: não sou fã de deixar alunos para trás mas não posso tentar resolver cada problema individual de instalação,
  2. vos dar uma máquina virtual Linux baseada em Xfce que ocupava quase 3Gb de espaço em disco (instalação mínima) e 512Mb de memória, e onde vocês escreviam comandos do assembler e do linker na linha de comandos e não tinha depurador, IDE ou editor de texto com realce de sintaxe (syntax highlighting),
  3. vos dar esta máquina virtual onde têm todas estas ferramentas disponíveis em menos de 2Gb de espaço em disco e menos de 256Mb de memória.
Ao vos fornecer esta plataforma, espero que passem menos tempo a instalar e configurar estas ferramentas (que provavelmente serão novidades para vocês) a mais tempo a aprender os conceitos que nos interessam em aula. No entanto permito e incentivo que instales a tua própria cópia do Linux sem usares esta máquina virtual — isto irá dar-te alguma experiência sobre a instalação da mesma e respectiva resolução de problemas. Infelizmente, por questões de tempo, não te poderei ajudar muito com esses problemas.

Está uma pasta no ambiente de trabalho com o nome "ac" que significa "Arquitectura de Computadores". Se estiver vazia, isso significa que têm havido alterações recentes ao material de ensino: visita a página com os meus materiais de ensino para esta unidade curricular e carrega-os para essa pasta. Nas aulas serás guiado em como prosseguir.

Vê também como utilizar a máquina virtual Linux.

Para outros materiais de apoio ao ensino, por favor siga esta hiperligação.

Photography by NASA