1 Difficulty level, Cat E (Programming Support)
A number of improvements have been made to the perl assembler (tinyasm.pl) for the TinyCPU. These changes have all been made in perl code in the file tinyasm.pl. Two test assembly programs have been designed, one successful assembly and one to demonstrate the error reporting and warnings.
The improved error handling is a step up from the old compiler, which did not offer much support at all to the programmer. The introduction of an ORG directive is more or less a necessity, and the RETI instruction is needed to support interrupts. The improvements have been made by adding pattern matching to the assembler to match more advanced patterns than in the basic version, as well as a simple system for counting and printing errors and warnings. To support the error and warning summary, there is also a line counting system. Below follows a complete list of the improvements:
The assembler now supports decimal and hexadecimal (hex indicated by "h") number formats for adresses and immediate values.
Assembler directive "ORG" changes the current adress being written to.
Empty lines are no longer interpreted as faulty instructions, but instead just ignored.
Support has been added for an instruction for returning from an interrupt.
If the programmes tries to write to the same memory location twice, a warning is given by the assembler.
Immediate values are now written with hash (#) in order to differentiate from memory adresses more easily.
The assembler now checks for missing operands, and gives error reports accordingly.
If the programmer tries to use a faulty operand (e.g. pushi A), such as an adress given as argument to an immediate instruction, the assembler gives an error.
The assembler now accepts the END directive, and puts a HALT instruction where the program ends. Further instructions and data are ignored.
After assembling the given file, a complete error report and warnings list is given to help the programmer.