Skip to content
bartbes edited this page Mar 2, 2011 · 3 revisions

asm.lua can be required normally. Additionally, it is a runnable module and can be directly run.

As a program, asm.lua takes the name of a TASM source file, and optionally the name of an output file. if no output file is given, it outputs to the same filename with .crap replacing it's original extension: thus test.asm outputs to test.crap. Regardless, it also prints a lua-formatted table of hex digits representing the assembled binary.


As a module, it exposes the following functions:

asm.load(filename)
returns: preparsed-chunk

loads the given file and returns a normalised chunk, suitable for further parsing.

asm.scrub(string)
returns: preparsed-chunk

processes the given string into a pre-parsed chunk, suitable for further parsing.

asm.parse(chunk)
returns: final-bytestring

takes a pre-parsed chunk, and returns a fully-assembled chunk as a string, suitable for saving or loading into a machine.

Clone this wiki locally