Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part ( d ) : Write the function encode _ letter encode _ 1 etter: parameters: one byte, pushed onto the stack by the caller,

Part (d): Write the function encode_letter
encode_1etter:
parameters: one byte, pushed onto the stack by the caller, pass-by-value
return value: 125
This document began by describing a way of encoding letters as LED light patterns,
with the example of "HELLOWORLD" given. Although you're not yet ready to display the
whole message, your task for this part is to take a single upper-case letter and to
convert it into the correct pattern (lights and duration).
Towards the bottom of a2-signalling-asn you will find the label PATTERNS,
followed by an upper-case alphabet - one letter per line - with information on
LED/duration encodings. For example, the first non-comment line below PATTERNS
is:
.dbA**,**..00..,1
which is to be interpreted as follows:
This line is for the letter "A";
LEDS 01,02,05 and 06 are off in this pattern;
LEDS 03 and 04 are on in this pattern;
The lighting pattern is to appear for about one second.
Right below appears this line:
.db "",".o..a.",2
which is to be interpreted as follows:
This line is for the letter "B2;
LEDS 01,03,04, and 06 are off in this pattern;
LEDS 02 and 0405 are on in this pattern;
The lighting pattern is to appear for about one-quarter of a second.
So on and so forth.
The only other entry that requires some special explanation is the very last. It appears
here as something which you may choose to check - i.e. if you are looking for a letter,
but find the dash (*-") then something has gone wrong with the parameter value.
(When testing your code, the evaluators will only use upper-case letters. However,
you cannot be sure how you yourself will accidentally test your code!)
Given the letter pushed onto the stack, your function is to determine the encoding for
the letter as would be given to leds_with_speed (i.e. a byte value), and this returned
in register 225.(That is, you are not to call leds_with_speed from within
encode_letter) Make use the functions you have written earlier in this assignment
to complete the function, as well as other operations. For example, the value returned
in 125 for "A" would be 0b11001100 or excc; the value returned in 125 for ?2B* would
be be1010 or Ex12.
Some code is provided for you at the label test_d which you may use to try out your
work after writing code for these two functions. The video described earlier in this
document shows the expected behavior of test_d.
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

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions