Quote:
I am using the tass64 assembler, and I was hoping to be able to add a number that increments each time I run the assembler to create a binary file, and automatically add the newly incremented number into the binary at a defined place..
I guess the number has to have a range to 0-9999,.. thinking outside the box and further what about stamping the code with date and time,.. or is that a stretch too far,...
Don't know about other assemblers, but HXA has a time$() function that returns the system date and time as a string (which can then be chopped up as desired). It's basically just a wrapper for the TAWK ctime() function (which in turn is probably just a wrapper for the 'C' standard library's ctime() function).
But notice that in essence what happens is that a value is being retrieved that is (a) stored outside the assembler itself and (b) is maintained by "something" outside the assembler as well. Those mechanisms already exist, and accessing them is trivial.
An "assembly number" that increases with each run is like time and date in that it has to be stored and maintained outside the assembler itself. BDD does it with hand-coded macros in the source code, for instance. In any case it's something you'll have to implement yourself. The idea of doing with a batch file or other script language that writes (or reads, slightly alters and then re-writes) an "include" file and then executes the assembler seems a reasonable alternative approach.
Even if an assembler was capable of incrementing a run number by itself, there still would have to be some kind of external persistent storage to let the assembler know what the next value should be. And you'd probably want it to increment each different source file with its own sequence, so if you assembled file "a" and then file "b" and then file "a" again, "a"'s run number would go up by only two instead of three. So there would have to be a way of associating file names and run numbers.
I suppose there could exist something like a getrun$() function that looked for a particular file name (most likely the file name that contains the getrun$() call with a different extension), read it, returned the value and then re-wrote the file with an incremented value. If the file didn't exist, return 1 and write the file with a value of 2. In the source code it would look something like:
Code:
.string getrun$()
and one of BDD's macros would look like:
Code:
romsnum .macro ;ROM "serial number"
.string "20120917"
.string "-"
.string mid$( "00000" getrun$(), -2)
.endm
That expression just concatenates the run number onto a string of "0" characters and then chops off everything but the last two characters, so runs 1-9 come out "01" to "09". Unless they were written that way in the first place, but is a fixed format the best approach?
I dunno. I can see its use, but it's sort of a specialized thing.