02-07-2012, 02:04 PM
GASM MANUAL
GASM MANUAL.pdf (Size: 52.36 KB / Downloads: 35)
INTRODUCTION
Gasm is a simple assembler for the Gumnut soft-core processor described
in Digital Design: An Embedded Systems Approach. The Gumnut is a simple
8-bit processor with separate instruction and data memories. Gasm
translates a program written in assembly language into the binary encoding
required by the Gumnut core. The program text (the instructions) are
encoded and written to a text memory image file, and the initial values for
the program data are binary encoded and written to a data memory image
file. The contents of these files can be loaded into simulated memories in
a simulation of the Gumnut core, or can be programmed into physical
memories in a real hardware system.
Gasm is a simple multi-pass assembler. It first parses the source file for
syntax errors, with very rudimentary error checking. It then performs two
passes over the program. On the first pass, Gasm works out the storage
requirement for each instruction and directive and defines the values of labels.
On the second pass, it translates each instruction and writes the output
files.
ASSEMBLY PROGRAM FORMAT
A Gumnut assembly language program consists of a sequence of lines,
each of which is a Gumnut instruction or an assembler directive. An Gumnut
instruction is translated into its binary representation and written to
the text memory image file. A directive controls how Gasm translates the
program, or specifies data for the data memory image file.
Each line of a program can contain a comment, starting with a semicolon
(‘;’) character and extending to the end of the line. Comments serve
as documentation for the human reader. They are ignored by the assembler.
A line can contain just a comment (without an instruction or directive).