After getting a flash of insight that helped me figure out some 6800-class code I'd dumped, I have been inspired to turn my attention back to some related code I began analyzing but gave up after not understanding how part of it was structured.
Thing is, this particular code also includes a serial number that needs to be compiled into the EPROM. Its range is just wide enough to require 17 bits (so 3 bytes / 24 bits).
Instead of manually calculating the three byte values and plugging them into the source code, I want to define the S/N in the declarations portion of the source code (as there are other options that need to be set as well).
Then, in the actual source code, I would have two statements - one to define the value of the 17th bit, and one to define the value of the lower 16 bits.
How would I go about writing out the calculations? Let's use two different examples I have at hand... one would have S/N 4257, and another would have S/N 80891.