Skip to content

samueldominguez/sas

Repository files navigation

SAS is a DCPU-16 assembler.
sas stands for simple assembler. It outputs object files which then
are fed into the linker to then generate binary files. Why can't it
generate binary files directly? this is because I needed tools that
would work the way I wanted for systems/kernel development.

The assembler is written entirely in C with yacc and lex for parsing.
Released under the the GPL v2.

To build it simply type "make".

Tested on Linux kernel and Solaris (SunOS). Should compile on all UNIX
operating systems and and on Windows with Mingw/Cygwin (look below for 
testings and help on building). If you have problems building just
submit an issue with specific details and I'll try to help.

It supports multiple assembly files, and always generates 1 object
file. Here are some directives it supports:

DIRECTIVES:
==========

NOTICE:
- 16 bit strings store the character in the least significant byte of
  a word, this is to remain compatible with the LEM line of monitors
  which use the most significant byte for colors

- NULL termination for 16 bit strings means a NULL word is appended
  at the end of the 16 bit string

- NULL termination for 8 bit strings means either:
  - a NULL word is appended at the end of the string if the length of
    the string is even e.g "aa" = 0x6161 0x0000
  - a NULL 8 bit byte is present in the least significant byte of the
    word if the length of the string is odd e.g "aaa" = 0x6161 0x6100


DAT <value>/"<string>", ...	outputs values and _non_ NULL terminated 
				16 bits per ASCII character strings

.asciz "<string>"		outputs NULL terminated 16 bits per ASCII
				character strings

.ascii8 "<string>"		outputs NULL terminated 8 bits per ASCII
				character strings (2 characters packed in a word)

.ascizlen "<string>"		outputs prefixed CHARACTER COUNT word, then
				16 bits per ASCII character strings

.ascii8len "<string>"		outputs prefixed CHARACTER COUNT, then
				8 bits per ASCII character strings

.noasciz "<string>"		outputs 16 bits per ASCII character strings

.noascii8 "<string>"		outputs 8 bits per ASCII character strings

.fill <value> <length>		fills binary with <value> for <length> words

.align <value>			pads with NULL until address % value = 0

.data or
.rodata or
.text or
.bss
				(ignore)
special command line options:

--sof-lib 			symbol only object file generation (SOF)
--org <address>			all symbols are offset <address> IMPORTANT:
				do not specify this later into the linker,
				else double the address will be the expected
				origin of the binary

TODO:
.org <address>			set instruction origin to <address>
.define or
.set or
.equ or
.def
	<symbol> <value>	set <symbol> to <value> (is global)

If you want to contact me, my email is [email protected]
bugs, issues, requests send them through Github.

Testing
-------
It should compile with gcc (or mingw), bison (with Cygwin on Windows,
flex (with Cygwin too on Windows) and make (I think Cygwin has make,
but otherwise just compile manually for Windows).

Tested on Linux kernel 3.16.0-4-amd64:
- gcc 		4.9.2
- bison 	3.0.2
- flex		2.5.39
- make		4.0

Tested on Oracle Solaris (SunOS 5.11) 11.2 i86pc i386:
- gcc		4.8.2
- bison		2.3
- flex		2.5.35
- make		sysV-make

About

dcpu-16 assembler; outputs object files from assembly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published