It looks as if
ca65 from the
cc65 suite would do what you need. The
input abstraction is a CharSource with a simple set of functions:
Code:
struct CharSourceFunctions {
void (*MarkStart) (CharSource*); /* Mark the start pos of a token */
void (*NextChar) (CharSource*); /* Read next char from input */
void (*Done) (CharSource*); /* Close input source */
};
So basically you'd need to write a driver for this that sets that up and calls the assembler, similar to how it's
done in main():
Code:
/* Initialize the scanner, open the input file */
InitScanner (InFile);
/* Define the default options */
SetOptions ();
/* Assemble the input */
Assemble ();
(If you follow down through InitScanner you'll see how it sets up the CharSource.) Then you just link your driver against those files and you should be set!