Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PROGRAM 7: MultiTap! Multitap is a text entry system for mobile phones which use

ID: 3868564 • Letter: P

Question

PROGRAM 7: MultiTap!

Multitap is a text entry system for mobile phones which uses the repeated pressing of the same key to cycle through the letters for that key. It is based on the following phone keyboard:


Write an HLA Assembly language program that implements the following function:

procedure multitap( myCharacter : byte ); @nodisplay; @noframe;

Your function should return in AX the integer converted value, as shown in the chart above. Be sure to support both the UPPERCASE and lowercase versions of the letters listed above. See the program dialogue shown below.

(Hint: Since we don't know about strings and arrays just yet, your program can safely assume that the data entered will be a single character, which greatly simplifies this problem)
(Further Hint: Since the run-stack doesn't allow for a byte-sized argument to be pushed and popped, you will need to change this function to use a larger, padded argument)

Feed Me: I
in Multi-tap, that's 444

Feed Me: g
in Multi-tap, that's 4

Feed Me: j
in Multi-tap, that's 5

Letter Multitap Value A a 2 B b 22 C c 222 D d 3 E e 33 F f 333 G g 4 H h 44 I i 444 J j 5 K k 55 L l 555 M m 6 N n 66 O o 666 P p 7 Q q 77 R r 777 S s 7777 T t 8 U u 88 V v 888 W w 9 X x 99 Y y 999 Z z 9999 ABC DEF 2 3 GHI JKL MNO 4 PQRS I TUV I(WXYZ 8

Explanation / Answer

code:

program multitapProgram

#include("stdlib.hff")

procedure multitap( myCharacter : byte ); @nodisplay; @noframe;

begin multitap;   

    

     if((myCharacter='a') | (myCharacter='A'))

          mov(2,ax);

     elseif(   (myCharacter='b') | (myCharacter='B'))

          mov(22,ax);  

     elseif(   (myCharacter='c') | (myCharacter='C'))

          mov(222,ax);

     elseif((myCharacter='d') | (myCharacter='D'))

          mov(3,ax);

     elseif(   (myCharacter='e') | (myCharacter='E'))

          mov(33,ax);  

     elseif(   (myCharacter='f') | (myCharacter='F'))

          mov(333,ax);

     elseif((myCharacter='g') | (myCharacter='G'))

          mov(4,ax);

     elseif(   (myCharacter='h') | (myCharacter='H'))

          mov(44,ax);  

     elseif(   (myCharacter='i') | (myCharacter='I'))

          mov(444,ax);

     elseif((myCharacter='j') | (myCharacter='J'))

          mov(5,ax);

     elseif(   (myCharacter='k') | (myCharacter='K'))

          mov(55,ax);  

     elseif(   (myCharacter='l') | (myCharacter='L'))

          mov(555,ax);

     elseif((myCharacter='m') | (myCharacter='M'))

          mov(6,ax);

     elseif(   (myCharacter='n') | (myCharacter='N'))

          mov(66,ax);  

     elseif(   (myCharacter='o') | (myCharacter='O'))

          mov(666,ax);

     elseif((myCharacter='p') | (myCharacter='P'))

          mov(7,ax);

     elseif(   (myCharacter='q') | (myCharacter='Q'))

          mov(77,ax);  

     elseif(   (myCharacter='r') | (myCharacter='R'))

          mov(777,ax);

     elseif((myCharacter='s')) | (myCharacter='S'))

          mov(7777,ax);

     elseif(   (myCharacter='t') | (myCharacter='T'))

          mov(8,ax);   

     elseif(   (myCharacter='u') | (myCharacter='U'))

          mov(88,ax);

     elseif((myCharacter='v') | (myCharacter='V'))

          mov(888,ax);

     elseif(   (myCharacter='w') | (myCharacter='W'))

          mov(9,ax);   

     elseif(   (myCharacter='x') | (myCharacter='X'))

          mov(99,ax);

     elseif(   (myCharacter='y') | (myCharacter='Y'))

          mov(999,ax);

     elseif((myCharacter='z') | (myCharacter='Z'))

          mov(9999,ax);

    

     else

          mov(0,ax);

    

end multitap;

static

     userChar: char;

begin multitapProgram;

     stdout.put("Feed Me:");

     stdin.getc(userChar);

     multitap(userChar);

     stdout.put("in Multi-tap, that's:",ax,nl);

end multitapProgram;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote