Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

CS 1104 AY T3 Unit 8 Discussion Assignment- University of the People

Rating
-
Sold
-
Pages
18
Grade
A
Uploaded on
16-08-2022
Written in
2022/2023

CS 1104 AY T3 Unit 8 Discussion Assignment- University of the People/CS 1104 AY T3 Unit 8 Discussion Assignment- University of the People/CS 1104 AY T3 Unit 8 Discussion Assignment- University of the People/CS 1104 AY T3 Unit 8 Discussion Assignment- University of the People/CS 1104 AY T3 Unit 8 Discussion Assignment- University of the People

Show more Read less
Institution
Course

Content preview

3/26/2019 CS 1104 - AY2019-T3: Unit 8 Discussion Assignment


HOME CONTACT US RESOURCES LINKS FACULTY




MY COURSES



MENU      

CS 1104 Computer Systems - Term 3, 2018-2019
Home ► My courses ► CS 1104 - AY2019-T3 ► 21 March - 27 March ►
Discussion Forum Unit 8 ► Unit 8 Discussion Assignment

Search forums




Discussion Forum Unit 8
Unit 8 Discussion Assignment
Subscribe




Unit 8 Discussion Assignment
by Onyekwere Oluoha (Instructor) - Wednesday, 30 January 2019, 5:40 AM


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)?


43 words
Permalink | Reply


Re: Unit 8 Discussion Assignment
by Stanislas Mihaljcuk - Thursday, 21 March 2019, 10:48 AM

Macro commands are shortcut words that execute a speci c sequence of other
predetermined commands. As said in TutorialPoint (n.d.):
https://my.uopeople.edu/mod/forum/discuss.php?d=191807 1/18

,3/26/2019
"A macro is a sequence of instructions, assigned by a name and could be used anywhere
CS 1104 - AY2019-T3: Unit 8 Discussion Assignment

in the program."(TutorialPoint, n.d.)

Here is an example from the textbook:

"If you nd this coding style tedious or even peculiar, you should note that friendlier
macro commands like D=D+M[xxx] and GOTO YYY can easily be introduced into the
language, causing Hack assembly code to be more readable as well as about 50 percent
shorter. The trick is to have the assembler translate these macro commands into binary
code e ecting @xxx followed by D=D+M, @YYY followed by 0;JMP, and so on."(Nisan &
Schocken, p. 117, 2008)

Therefore, instead of doing

@xxx
D=D+M


One could do:

D=D+M[xxx]


this would make the tedious task of getting the memory etc. much easier.

You want to use macros when you are repeating a certain simple task that doesn't
involve logic. When you go fetch a memory block to assign to something, this
information doesn't need its own line, it'd be best if you integrate to the operation itself.
However, if you want some logic, usually a longer combination of code then I'd say a
function is better. This is my opinion.

The main di erence between a macro and function is that the former is pre-processed
while the later is compiled. Macros are faster but are more di cult to debug. Type
checking is done on functions and not on macros. (Macros vs Functions, 2018)




References:

Macros vs Functions. (2018, December 21). Retrieved from
https://www.geeksforgeeks.org/macros-vs-functions/
Nisan, N., & Schocken, S. (2008). The elements of computing systems: Building a modern
computer from rst principles. Cambridge Mass.: The MIT Press.

Tutorialspoint.com. (n.d.). Assembly Macros. Retrieved from
https://www.tutorialspoint.com/assembly_programming/assembly_macros.htm


https://my.uopeople.edu/mod/forum/discuss.php?d=191807 2/18

, 3/26/2019 319 words CS 1104 - AY2019-T3: Unit 8 Discussion Assignment


Rate: Rate... Permalink | Show parent | Reply



Re: Unit 8 Discussion Assignment
by Onyekwere Oluoha (Instructor) - Sunday, 24 March 2019, 6:24 AM


Hello Stanislas/Class,

It was nice reading your post. In addition, function could be described as a named unit
of codes or section of a program, which performs a designated task (Saddleback
College, n.d.). Functions are very helpful in that their use make programs much easier
to read, test and debug. A Macro is very similar to a Function, but each has its unique
purpose based on programmer requirements (Mahipal, Phaneendhar & Srinivas, n.d.).
In addition to your list, the following are major di erences between Macros and
Functions:

1. A Function is assembled once and then can be called from any location.
However, the assembler has to copy and compile the Macro whenever invoked
(Bishop's University, n.d.).

2. Macro have some “side e ect” or downsides as compared to Functions, such as
no type checking for incompatible operand and the likes. These could lead to major
complications if not carefully put into consideration while coding. Also, they are
generally more di cult to debug.

3. Macros avoid overhead of return instructions/calls, register shu ing and
argument passing, which are present in Functions.

4. Macros are processed before program compilation, while functions are
compiled directly.

5. Macros are usually faster than functions in execution speed. This could largely
be attributed to the fact that Macros don’t such overheads (like function calls) as is
present in functions.




OLuOHA.




References

Bishop's University (n.d.) “Macro in assembly language” online. Retrieved from:
http://cs.ubishops.ca/ljensen/asm/marros-assembly.html
https://my.uopeople.edu/mod/forum/discuss.php?d=191807 3/18

Written for

Course

Document information

Uploaded on
August 16, 2022
Number of pages
18
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

€14,90
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Millenialnurse Freelance Tutor
Follow You need to be logged in order to follow users or courses
Sold
252
Member since
4 year
Number of followers
147
Documents
1482
Last sold
3 weeks ago
Genuine Study Guides 2024

Holla me for assistance 24/7.

3,4

37 reviews

5
17
4
4
3
4
2
2
1
10

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions