Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( a ) Write an assembly language function DIGJ.TS which will convert a 2 - digit decimal number into the corresponding 2 individual decimal digits.

(a) Write an assembly language function DIGJ.TS which will convert a 2-digit decimal
number into the corresponding 2 individual decimal digits. The input decimal
mumber is in R10 and the tens digit output is in R11 and the ones digit output
in R12. Assume that there is no division and remainder instruction. You can
invent your own instruction set 2s long as it is reasonebie. [4]
(b) A party room cen ecommodate at most 70 persons. There is a computer-
controlled turnstile in the entrance and exit to count the number of persons
entering and leaxing the party room. The number of persons currently in the
room is displayed on two 7-segment. LEDS in front of the room. The turnstiles
have control and status regislers T1CSR (entrance) and T2CSR (exit) with the
following formal:
Bit 0 Ready bit, the turnstile is reudy
Bit 1 Set this bit to allow turnstile to turn
Bit 2 Set this bit to disallow tumnstile to turn
Bit 3 This bit is 1 when one person has passed tiee turnstile, ard the
turnstile is disellowed automatically.
This bit will reset to zero after reading.
There are 2 buffer registers (daia registers) for the LEDs, LEDBR1(for the tens
digit) and LEDBR2(for the ones digit). If the number of persons in the room is
0, then display empyy on LEDBR1 and displey 0 on LEDBR2. To display empty
on an LED, just write FFFFFFFF to the buffer register.
Write an assembly lawguago program using Programmed I/O to do the following:
Initialization: Allow Entrance turnstile and disallow Exit turnstile. Set
number of persons, n, to 0. Display 0 on the LEDs.
Repeat:
2.1 If n=0 disallow Lxit turnstile, otherwise allow it.
2.2 If n-70 disallow Entrance turnstile, otherwise allow it.
2.3 if someone passes Entrance turnsile:
2.3.1 disallow entrance turnstile
2.3.2nlarrn-1
2.3.3 display n on LED
2.3.4 if n+70 anlow entrance tumstile again
2.4 if someone passes Ex turnstile:
2.4.1 disallow exit turnstile
2.1.2n+n-1
2.1.3 display n on LED
2.4.4 if n0 allow exit turnstile sgain.
P.6 of 7
You can invent your own instruction sct as long as it is reasoneble. You can
also use the function in 5(a) in your program. 10]
(c)(i) Why do we prefer register operands to memory operands for arithmetic/logic
operations? [2]
(ii) What is the advantage of a regular instruction format, i.e. the source and
destination operands are always in the same place in the instruction.
(iii) Explain the difference between axithmetic shift and logical shift.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions