Skip to main content

Assembler

Software responsible for translating assembly language instructions into their corresponding binary code for execution on the FPGA board.

For example:

; Prints "Hello Mom" to the top left of the screen and ends.

jmp main

hello: string "Hello Mom"

main:
loadn r0, #0 ; r0 = 0
loadn r1, #hello ; r1 = Pointer to the string to be printed.
loadn r2, #0 ; r2 = Index for the position on the screen

printLoop:
loadi r3, r1 ; Load the character to be printed
cmp r0, r3 ; and check if it's the terminal character.
jeq endLoop ; End if it is or,
outchar r3, r2 ; otherwise, print it and continue.
inc r1 ; Increment the pointer to the string.
inc r2 ; Increment the index for the position on the screen.
jmp printLoop
endLoop:
halt

Installation​

The assembler is available in two versions:

  • v1.0.0 stable (recommended)
  • v2.1.0 beta

To install them, run the following commands:

wget https://github.com/de-abreu/Processador-ICMC/raw/master/assembler/assembler-stable.zip
unzip assembler-stable.zip
cd stable
gcc *.c -o assembler

This will give you the executable assembler. Take it to the directory where you are working, as convenient.

Usage​

Without loss of generality, consider an assembly file game.asm. If there are no syntax errors, running the following command will produce the binary file game.mif:

./montador game.asm game.mif

Otherwise, if there are syntax errors, a corresponding error message will be issued.

TODO
  1. Find and detail the installation for Windows users
  2. Detail more assembler usage options