-
Notifications
You must be signed in to change notification settings - Fork 0
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-chunkloads the given file and returns a normalised chunk, suitable for further parsing.
asm.scrub(string)
returns: preparsed-chunkprocesses the given string into a pre-parsed chunk, suitable for further parsing.
asm.parse(chunk)
returns: final-bytestringtakes a pre-parsed chunk, and returns a fully-assembled chunk as a string, suitable for saving or loading into a machine.