New in 20020728: There are quite a few new features in this release — probably because it's been over three years since the last release:
Split I&D executables (JMAGIC) are now supported, allowing up to twice as much code and data in executable files as was possible previously. This executable format keeps code and data in two separate 16-bit address spaces. The linker 'ld' generates split I&D executables when given the '-j' option.
The assembler 'as' now supports multi-word "aliased" instructions which automatically assemble into the proper sequence of single-word instructions:
The data movement and long jump/call instructions now
appear to accept immediate address arguments. Internally, the
assembler generates code to use the reserved %t6
register
to load the immediate address, and then generates the indirect form of
the original instruction using that register. This means you can
replace three lines of assembly code with one, and improve readability
dramatically.
Opcodes with aliased forms come from
the load/store word family
(mov
/ldi
,
mov
/ld
and
mov
/st
),
the load/store byte family
(movb
/ldb
and
movb
/stb
), and
the long jump and procedure call/return family
(jal
,
j
and
call
).
This means you can now write simply call _printf
and the
assembler will worry about generating the three machine instructions
necessary to load the two 8-bit halves of the value
_printf
into a register and then make an indirect linked
jump using that register.
There's a new family of stack pseudo-instructions —
push
and pop
— for saving and restoring
register values.
Now only two CPP macros are used for assembling the included
SMOKE-16 programs: FUNCTION(
name)
and RET
. They implement the prologue and epilogue for
procedures that need the ability to call and be called by other
procedures obeying the SMOKE-16 calling
convention. Note: The prologue macro creates a global
symbol for the procedure name.
The assembler also supports a .rdata
pseudo-section for read-only data, and allows mapping it to either the
data section or the text section. Placing it in the data section is a
good idea for split I&D executables; placing it in the text
section using the '-R' option means it's shareable for other types of
executables.
The linker 'ld' now supports object archives
in a modified a.out file format (LMAGIC). There's a new command 'nm'
to list the contents of SMOKE-16 object files and object
archives. Support for portable 'ar' archives is still to come, and
there's no archive utility 'ar' yet. Instead, object archives are
created using a special '-Z' argument to the linker. Naturally the
linker now supports an archive search path using the standard '-L'
argument, and linking of libraries called
lib
x.a
using the standard
'-lx' argument. The SMOKE-16 standard library 'libc' is now
an object archive, not a monolithic object file as it was in previous
releases, so executables linked with it grow only enough to accomodate
functionality they actually use.
The emulator 'emu' has been improved greatly, especially the
disassembler. It now displays correct immediate word values for
sethi
/movb
sequences, and in many cases is
able to display a useful symbolic name as well. A syntax-coloring
filter script 'emucolor' is also included for those wishing to display
the disassembly in technicolor. Usage in GNU bash: bin/emu
-disassemble
image 2>&1 |
./emucolor
Portability: Symbols and archive member filenames
are now portable across platforms and character sets (they are now
restricted to printable ASCII and a few
control characters.) Although the emulator 'emu' is still
restricted to the host machine's native character encoding for the
system-call interface, the assembler 'as' can be used to produce ASCII
executables even on non-ASCII systems using the '-portable'
argument. The two remaining portability problems problems are the
strings passed through the emulator system-call interface and the set
of errno
values.