write a program in MARIE assembly language

Assignment Help Other Subject
Reference no: EM132312193

MARIE and Instruction Set Architecture

Task

Question 1 - MARIE Assembly

In this task you will write a program in MARIE assembly language, to work out if a given year is leap year or not. Leap years are those that are divisible by 4, except the years that are divisible by 100. But the centurial years are leap years if they are divisible by 400. For example 1980 is a leap year because it is divisible by 4 only, 2100 is not a leap year because it is divisible by both 4 and 100, and 2000 is a leap year because it is divisible by 400.

You will do this task in two steps.

(a) Remainder

To work out if a number is exactly divisible by another number, the obvious method is to perform division and look at the remainder. A zero remainder means dividend is exactly divisible by divisor. In this part, you will write a MARIE code for calculating remainder of a division. The following pseudo code implements the algorithm for remainder.

get X
get Y

repeat until X < Y:
X ← X - Y

display X

Your program should implement the above algorithm in MARIE. It will get X (dividend) and Y (divisor) as input from the user, and display the final X value which would be the remainder of division.

(b) Leap Year

In this task you will use the code written in part (a) to find out if a given year is leap year or not. The program will ask user for an input year (e.g. 1996) and work out and display a ‘1' or ‘0' in the output to indicate if given year is leap or not.

An algorithm to determine leap year is given below (with comments). Implement this algorithm in MARIE.

if (year modulo 4 ≠ 0)

 

 

/

if year

is

not divisible

by

4

then output 0 and exit

 

 

/

then it

is

a common year

 

 

else if (year modulo 100

0)

/

if year

is

not divisible

by

100

then output 1 and exit

 

 

/

then it

is

a leap year

 

 

else if (year modulo 100

0)

/

if year

is

not divisible

by

400

then output 0 and exit

 

 

/

then it

is

a common year

 

 

else output 1 and exit 
     /  otherwise it
is a leap year    

As you can see from the pseudo code, the modulo calculation is applied three times to get the final result. You will need to copy the modulo code from part (a) and paste it (and adapt it) 3 times in your program.

Assume that user will always provide valid numbers as input, that is, do not worry about dealing with invalid input data.

Submit two source files for this question as described later.

Question 2 - Instruction Set Architectures

The following instruction needs to be evaluated on different types of architectures.

R = K - (L + M/N) * P

Where R, L, M, N, P are all memory locations (or addresses).

Write assembly programs to evaluate the above expression for the following computer architectures:

(a) One operand instructions

(b) Two operand instructions

(c) Three operand instructions

(d) Zero-address instructions (stack-based)

In addition to usual memory access instructions, assume the following arithmetic instructions are available: ADD, SUBT, DIV, MULT. For some programs you may need to use temporary memory locations. Label those locations as A, B, C... .

Comment every single instruction of your program, explaining what is happening at that step.

Do not attempt to simplify the expression or rearrange its terms. But of course take care of operator precedence (multiplication and division first, followed by addition and division).

Attachment:- MARIE and Instruction Set Architecture.rar

Verified Expert

This is an assignment about MARIE programming language.This is a software-based assignment with specific software called MARIE programming and simulation software.Here given condition is to find the remainder of a division and another is to determine whether a year is a leap year or not. For these conditions, MARIE is written and simulated.Then note down output along with the snapshot of simulation and output.

Reference no: EM132312193

Questions Cloud

Generic business strategy and organizational culture : The focus of this assignment is to assess the strategic dimensions of your own organisation. Generic business strategy, Organizational culture,
Submission for approval of a new position : What 3 pieces of information you may need to supply to management when making a written submission for approval of a new position?
Success of an e-commerce organisation : Which metrics focus on the success of an e-commerce organisation (using websites, social media, mobile, other Web 2.0 applications)
What is meant by off-balance sheet activity : What is meant by off-balance sheet activity?What specific types of off-balance-sheet items would you expect for commercial banks?
write a program in MARIE assembly language : ITC161 - Computer Systems - Charles Sturt University - MARIE and Instruction Set Architecture - write a program in MARIE assembly language, to work out
What daniel will do with a likely net capital gain in this : HA3042 TAXATION LAW HOLMES INSTITUTE Australia- Based on the above information, you are required to determine Daniel Ray’s net capital gain.
Stakeholders of an organization are shareholders : Stakeholders of an organization are shareholders, customers, suppliers, governments, and any other groups with a vested interest in the organization.
Determining the multinational management : In Chapter 9 of Multinational management: A strategic approach (7th ed.), the authors list and describe the seven steps for a successful e-commerce strategy.
How Jacobs score on the least preferred co-worker scale : Case - Big Changes for a Small Hospital. How do you think Jacobs would score on the least preferred co-worker (LPC) scale? Why

Reviews

len2312193

5/27/2019 1:00:32 AM

Criteria HD Being able to write MARIE programs with correct syntax, logic and results. 10 marks Programs run correctly and produce correct outputs. Application of ISA 6 marks Answers are corrects. All steps are correctly shown. Solution is presented in a clear and orderly manner so the reader

len2312193

5/27/2019 1:00:25 AM

Your submission should include a pdf document containing answer to Q2. For Q1, you will submit two MARIE code files. Name them 2a_remainder.mas and 2b_leap.mas. Compress all 3 files into a ZIP archive and upload zip file to EASTS. Rationale This assessment task will work towards assessing the following learning outcome/s: • be able to define and appropriately use computer systems terminologies. • be able to describe the essential elements of computer organisation and discuss how the elements function. • be able to describe the basic instruction set architecture of a simple computer. • be able to discuss various programming tools available and their relationship to the computer architecture and

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd