CS1104 Discussion Forum Unit 8 AY2020-T3

CS1104 Discussion Forum Unit 8 AY2020-T3



There are assemblers that are capable of handling macro commands.

Please explain in your own words what a macro command is and provide

an example.

When would you program a macro and when would you program a

subprogram (also called functions, subroutines, methods) 


There are assemblers that are capable of handling macro commands. Part 1: Explain what a macro command is and provide an example

A macro is a named definition block of code. Once defined it can be called by directives. Once the name is created it becomes a convenient alternative to repeating the block of code over and over.

Macroname MACRO [parameter-1, parameter-2, and so on] statement-list


The advantage of using Macros is to make code is the ease of use in following the logic of the source code by replacing a block of code with one meaningful name. It also saves time and works instead of repeating the same long code over and over. Macros are preprocessed before the compilation of an actual program. Macros can be efficiently used to replace or in conjunction with functions. A drawback is there is no built-in datatype checking feature. If there is an error in the macro it will not be checked during a compile.

As simple use line by line to save time @yyy


One could do:

One could do:


In the C programming language uses #define as one its preprocessed directives.

Part 2: When would you program a macro and when would you program a subprogram (also called functions, subroutines, methods)? Macros and subprograms allow us to replace a block of code with a single line that refers to it to eliminate redundancy. A macro does not involve jumping to and from the subprogram body. The reference to the macro is replaced by the macro body itself. There is no need to pass arguments at compile. It performs a direct substitution of code. A preprocessor is implemented. It replaces replacing named constants with their values, macro substitutions, and creates includes as C implements.
A macro body is inserted in the place of each reference. This would increase the size used in memory as it was loaded each time. This could mismatch the variable size and load it multiple times if not implemented properly. C language later utilized macros in all uppercase to differentiate between Macros and functions.
A function would be better used when preprocessing is inappropriate, and all processing is done during compile. This would allow errors to be more transparent to the programmer.
In order to explain this, we need to realize Functions are more like subprograms, or sub-routines with its own methods and procedures to perform a specific task. Macros are time savers, but they do not return a statement. A macro has a higher memory use within a program. A Macro is always local to the program whereas a subprogram can be drawn from outside the program.


Assembly - Macros [Web log post]. (n.d.). ros.

Functions and Subroutines. (n.d.). Retrieved March 18, 2019, from http://www.chem.ox.ac.uk/fortran/subprograms.html 

Nisan, N. & Schocken, S. (2008). The elements of computing systems: Building a modern
computer from rst principles. Cambridge, MA: MIT Press.

Want latest solution of this assignment

Submit Your Assignment Here

AssignmentHippo Features

On Time Delivery

Our motto is deliver assignment on Time. Our Expert writers deliver quality assignments to the students.

Plagiarism Free Work

Get reliable and unique assignments by using our 100% plagiarism-free.

24 X 7 Live Help

Get connected 24*7 with our Live Chat support executives to receive instant solutions for your assignment.

Services For All Subjects

Get Help with all the subjects like: Programming, Accounting, Finance, Engineering, Law and Marketing.

Best Price Guarantee

Get premium service at a pocket-friendly rate at AssignmentHippo


  • Assignment Writing Guide
  • Essay Writing Guide
  • Dissertation Writing Guide
  • Research Paper Writing Guide


  • Accounts
  • Computer Science
  • Economics
  • Engineering

Client Review

I was struggling so hard to complete my marketing assignment on brand development when I decided to finally reach to the experts of this portal. They certainly deliver perfect consistency and the desired format. The content prepared by the experts of this platform was simply amazing. I definitely owe my grades to them.

Tap to Chat
Get instant assignment help