SASM Cross-assembler

Sasm creates NMAGIC SPARC executables from assembler source code. It will assemble most privileged instructions as well as non-privileged. Privileged code is not supported in ssim and will cause the program being simulated to receive an illegal instruction signal. Comments are enclosed within /* */ delimiters (C-style) or extend from a ! to end of line. Since SASM has no concept of a program extending over multiple source files, all references must be resolved within the file being assembled. The following pseudo-ops are supported in the same fashion as the SUN4 SPARC assembler:

.align -- align location counter; argument is 2, 4, or 8
.ascii -- Generate 1 or more comma-separated strings
.asciz -- Same as .ascii but strings are null terminated
.byte  -- Generate initialized bytes, comma separated
.half  -- Generate initialized halfwords, comma separated
.seg   -- Set current segment to "text", "data", or "bss"
.skip  -- Allocate empty space in current segment
.word  -- Generate initialized words, comma separated

Identifiers must begin with an upper or lower case letter, underscore ('_'), dollar sign ('$') or period ('.'). Additional characters may be digits as well. Numeric labels are not supported by sasm.

The following register names are recognized by sasm. The numeric notation %n (e.g., %22) is not supported. The %hi and %lo operators are not supported either.

%g0  %o0  %l0  %i0  %f0  %f8   %f16  %f24  %c0  %c8   %c16  %c24
%g1  %o1  %l1  %i1  %f1  %f9   %f17  %f25  %c1  %c9   %c17  %c25
%g2  %o2  %l2  %i2  %f2  %f10  %f18  %f26  %c2  %c10  %c18  %c26
%g3  %o3  %l3  %i3  %f3  %f11  %f19  %f27  %c3  %c11  %c19  %c27
%g4  %o4  %l4  %i4  %f4  %f12  %f20  %f28  %c4  %c12  %c20  %c28
%g5  %o5  %l5  %i5  %f5  %f13  %f21  %f29  %c5  %c13  %c21  %c29
%g6  %o6  %l6  %i6  %f6  %f14  %f22  %f30  %c6  %c14  %c22  %c30
%g7  %o7  %l7  %i7  %f7  %f15  %f23  %f31  %c7  %c15  %c23  %c31

%fp  %sp  %fq  %cq  %y   %fsr  %csr  

The following instructions are not supported by sasm. Except for these, all opcodes (and their synonyms) as defined in the Version 7 SPARC Architecture Manual are supported. Additionally, ``b" is allowed as a synonym for ``ba".

coprocessor branch instructions
coprocessor operate instructions
return from trap instruction ("rett")
Instructions using the %psr, %wim and %tbr registers.

Only the following pseudo-instructions are allowed.

nop    cmp   tst    ret
retl   set   inc    inccc
dec    deccc clr    clrb
clrh   mov

Sasm requires the name of the assembler source file on its command line. Other accepted options are:

-g Cause line number and symbol value information to be added to the executable. It can then be debugged with a debugger such as gdb or the interactive mode of ssim.

-n Do not display version and copyright banner.

-o Specify the name of the output file. The default is a.out.

-l Cause lines from the input file to be echoed during the first pass of assembly.

Sasm silently allows the use of set in a delay slot. It does not understand any kind of macros, nor does it understand the ld2 pseudo-instruction sometimes output by the Sun C compiler.