Macro Preprocessor / NASM Standard Macros
Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.
Learn More
Subtitles of the Movie
You know that whenever you invoke the assembler you need to specify the output format and you can determine what that format is from inside the program by using the Output Format Macro. Notice how this name is formed. This is a pattern you'll see repeated. It begins with two underscore characters and ends with two underscore characters. All the words are in uppercase and the internal separation of words is done by single underscores. You can use the Output Format Macro to detect the type of object that's being output and make any necessary adjustments. For example, this preprocessing code can be used to define the new line character sequence properly, depending on the system that's to receive the object code. A number of version macros exist. They produce the same information in different ways. The first four examples shown here are the major and minor version numbers, the sub-minor version number and the pats level; all as simple numbers being used as initial values for bytes. The version ID is a hex value combining the four into a 32-bit value where each byte is one of the four values listed above. And the version or v-e-r is a character string of base-ten digits separated by periods representing the same values. The file macro is a character string of the completed file name and the line macro is an integer where the value is the current line number in the assembly file. Sometimes you don't need to know the exact format of the output file but you do need to know whether the object is to 16, 32 or 64 bits. The Bits Macro has the value for you. It is an integer with a value of 16, 32 or 64 and there are a few date and time macros that'll give you the date and time that the program is being assembled. The Date Macro produces the date in a standard character-to-string format. In similar fashion, the Time Macro produces the assembly time as a character string in a standard format. Also, in a similar fashion, the Date Number Macro produces the current date in a numeric form so the digits can be easily read to determine the date. Notice that not only is this form easy to read, you can compare two integers and the later date will always be greater and in similar fashion, the time of the assembly can also be expressed as a readable, sortable integer value. And you can get the same styles of time and date values in a universal time by using the same macro names with UTC prepended onto the front. But you need to make sure that these macros exist. If the system the assembler is running on does not provide universal time, these macros simply won't be defined and there is one more time macro. That is the 32-bit integer that is a count of the number of seconds since January the first, 1970. This count is calculated based on the Universal Time unless there is no Universal Time kept on the computer. In that case, the local time is used as if it were Universal Time.
Tutorial Information
| Course: | Assembly Language Programming |
| Author: | Arthur Griffith |
| SKU: | 33995 |
| ISBN: | 1-935320-44-0 |
| Release Date: | 2009-05-28 |
| Duration: | 5.5 hrs / 70 lessons |
| Work Files: |
Yes |
| Captions: | Available on CD and Online University |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 