Each macro must be written so that it does reasonable checking of its argument(s) and generates only the instructions and/or data necessary to do the task with the actual arguments. (Or it may generate an error message, if something is found to be wrong.) You must NOT write the macros so that they always generate all possible instructions that might be used and generate decision instructions to decide between which set of instructions to use. Assembly-time decisions should be made about what to generate, rather than execution-time decisions about what to execute. Below is a detailed description of each macro.
INNUM symbolname
The instructions generated by this macro read an integer from the keyboard; it takes a single argument, symbolname, which is the name of a variable that can hold a signed integer value. The symbolname may be associated with a byte, a word, or a doubleword. The instructions generated for this macro must not leave any registers changed when it finishes.
OUTNUM symbolname
The instructions generated by this macro display an integer on the screen (current cursor position); it takes a single argument, symbolname, which is the name of a variable that holds a signed integer value. The symbolname may be associated with a byte, a word, or a doubleword. The instructions must not leave any register changed when it finishes.
FIND list, value
The instructions generated by this macro are
to search an array (variable name list) until it encounters a number
that is greater than or equal to the specified value. Both
list
and value must refer to memory locations. When the first
array entry is found that is greater than or equal to the
value,
the macro's instructions should place in the EAX register the position
in the array where the value was found. If the first entry
is >= value, return 0 in EAX; if the second is >= value,
return 1, if the third is >= value, return 2, etc. You may
assume that there will be an entry in the list that is >= value.
FIND must work regardless of whether the list and value are
bytes,
words, or double words; however, both list and value
must be of the same type. The result produced is an array index,
not a byte offset.
You may use procedures from Irvine's library freely in your macros. You may assume that anyone using your macros would include IRVINE32.INC, as is done in NEWSURVEY.ASM
Construct yourinitials-macs.inc
so that its source appears in NEWSURVEY.LST, and so that the expanded (generated)
text for each macro appears in NEWSURVEY.LST. Hand in a printout of NEWSURVEY.LST
Print it in landscape format so that there are no wrapped lines - you may
need to reduce the font size to 10 or even 8 to make this happen.
Use of macros tends to make the .LST file wider. Copy yourinitials-macs.inc
to the handin folder on the P: drive for COSC 300.
Extra Credit Possibility:
Make OUTNUM display signed integer values, including
signed bytes, signed words, and signed doublewords so that positive values
have a leading space (and no + sign) and negative values have a leading
minus sign.