Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

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

Beoordeling
-
Verkocht
-
Pagina's
18
Cijfer
A
Geüpload op
16-08-2022
Geschreven 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

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

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

Geschreven voor

Vak

Documentinformatie

Geüpload op
16 augustus 2022
Aantal pagina's
18
Geschreven in
2022/2023
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$16.48
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Millenialnurse Freelance Tutor
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
251
Lid sinds
4 jaar
Aantal volgers
147
Documenten
1482
Laatst verkocht
1 week geleden
Genuine Study Guides 2024

Holla me for assistance 24/7.

3.4

37 beoordelingen

5
17
4
4
3
4
2
2
1
10

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen