How the Masm declare Variable?

If I want create my own Assembler, How I do to allocate memory that user declare.

For example: variable byte ? --> What is the masm doing to allocate this byte?


Posted on 2005-07-13 13:33:39 by eike
MASM doesn't declare variables. It only declares "labels".

It's all bookkeeping.

You have a table that records every name that has been mentioned, and whether it has been defiined or not. The table records various properties of each name - macro, equate, code/data label, segment, offset, size, "type", etc.

While code and data are being generated, a location counter is used to indicate where the next byte will be located. The value of the location counter is used to define "addresses" or offsets of a code or data label. If you're generating code or data bytes, you add the bytes and increment the location counter. If you're reserving "variable" space, you only need to increment the location counter. If your object file format doesn't allow gaps in code or data space (any COFF module), you will need to add "fill" bytes when byte generation is resumed.
Posted on 2005-07-13 16:17:32 by tenkey