A portable 32-bit assembler for x86 processors


Jonathan Kraut




(require-extension sassy)




Sassy is a portable assembler for 32-bit or "protected-mode" programming on the x86 architecture. Sassy is based on Henry Baker's COMFY-65 compiler, which he wrote in PDP-10 Maclisp, subsequently ported to GNU Emacs Elisp, and which targeted the MOS 6502 processor.

One of the primary selling points of COMFY-65 (besides its small size and the fact that it employed a syntax based on s-expressions) was its "comfortable set of control primitives", such as seq, while, and if. When the assembly programmer/compiler writer used the structure inherent in these constructs, they didn't have to code up a nest of obscure local labels in order to control the flow of computation. By taking advantage of Lisp's recursive nature, COMFY-65 managed this in one pass.

Sassy works the same way. Its syntax consists of s-expressions and it features the same set of control primitives, and is a (mostly) one-pass assembler written in about 3,000 lines of Scheme. At the same time, Sassy is similar to traditional assemblers for the x86, with directives for separate heap, data, and text sections, the ability to annotate linker-specific relocation types, and support for labels (something COMFY-65 lacked; Baker recommended using jump-tables. Sassy uses back-patching). Sassy has a simple macro system, or programmers may write "escapes" to Scheme in order to take advantage of Scheme's meta-programming facilities. Sassy is a complete 32-bit assembler for the x86 line and recognizes the full 32-bit instruction set, up to and including the SSE3 extensions.

Sassy is also target- and linker-neutral. Sassy generates a record of objects and information, representing, for instance, the text section, or the alignment requirements of the data section. The programmer may pass the record to an output module that in turn creates the final output suitable for linking or loading. Sassy comes with an output module that creates ELF object files for GNU/Linux with dynamic shared library support, or programmers may use Sassy's API to create their own output modules.

For more information, see the sassy manual


Copyright (C) 2005 Jonathan Kraut

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA