Introduction
This document gives a guide to using the assembler system to assembler programs written in the PREASM assembly language.Installing The Assembler
The assembler system is written in Java and so to use it you must have a recent version of the Java runtime system installed. Once this is achieved, you should be able to sucessfully issue the following command :Customizing The Assembler Behaviour
The behaviour of the assembler is changed by the use of the command line options shown below :
| Switch | Default Value | Resulting Behaviour |
| The -source option directs the assembler to read the source code for the PREASM program from the specified file instead of from stdin. | ||
| The -target option directs the assembler to write the assembled object file to the specified file instead of to stdout. | ||
| No optimisations are attempted. | ||
| Only optimisations that are considered safe and stable are attempted. | ||
| All availible optimisations are attempted which may result in some problems in the resulting code. | ||
| Prints a help screen with a brief rundown of availible options. |
Assembler Optimisations
Currently, the PREASM assembler attempts a number of conventional optimisations by employing a peephole optimisation strategy. The extent to which this effects the source program can be controlled using command line options. By default no optimisations are attempted.The user should envoke the assembly optimisation process with care due to the aggressive nature of the system. When attempting to optimise hand written code it is important that the user understands the optimisations carried out and that the target code is verified as correct before execution starts.
An example pitfall that could cause had written assembly code to be incorrectly assembled is one type of MOV folding. If the peephole optimiser comes accross some code which read :

