======================= Using the ULM-Assembler [TOC] ======================= The ULM Assembler consists of three GNU-AWK scripts that can be downloaded with `wget`: ---- SHELL(path=session02,hide) ------------------ rm -f *.awk -------------------------------------------------- ---- SHELL(path=session02/demo) ---------------------- pwd wget http://www.mathematik.uni-ulm.de/~lehn/ulmas1.awk wget http://www.mathematik.uni-ulm.de/~lehn/ulmas2.awk wget http://www.mathematik.uni-ulm.de/~lehn/ulmas3.awk ------------------------------------------------------ Example for an Assembly Program =============================== :import: session02/demo/example.s Run the ULM-Assembler ===================== The three scripts can be connected with _pipelines_: ---- SHELL(path=session02/demo,hostname=heim) ------------------------------ cat example.s | gawk -f ulmas1.awk | gawk -f ulmas2.awk | gawk -f ulmas3.awk ---------------------------------------------------------------------------- You can observe what a single script does as follows: - The first script only expands macros: ---- SHELL(path=session02/demo,hostname=heim) ------------------------------ cat example.s | gawk -f ulmas1.awk ---------------------------------------------------------------------------- - The second script resolves lables: ---- SHELL(path=session02/demo,hostname=heim) ------------------------------ cat example.s | gawk -f ulmas1.awk | gawk -f ulmas2.awk ---------------------------------------------------------------------------- - The third script generates machine code by translating the assembly instructions one-by-one: ---- SHELL(path=session02/demo,hostname=heim) ------------------------------ cat example.s | gawk -f ulmas1.awk | gawk -f ulmas2.awk | gawk -f ulmas3.awk ---------------------------------------------------------------------------- You can store the generated machine code in a file (here 'example.ulm') by redirecting the output: ---- SHELL(path=session02/demo,hostname=heim) -------------------------------------------- cat example.s | gawk -f ulmas1.awk | gawk -f ulmas2.awk | gawk -f ulmas3.awk > example.ulm ------------------------------------------------------------------------------------------ Execute the generated machine code on ULM ========================================= As in the last session we now can run the machine code on the ULM: ---- SHELL(path=session02/demo,hostname=heim) -------------------------------------------- ./ulm -r example.ulm ------------------------------------------------------------------------------------------ :navigate: up -> doc:index next -> doc:session02/page02