Motorola Axiom CMD11E1 Uživatelská příručka Strana 64

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 101
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 63
64 CHAPTER 5. TABLES
Exercise: Type the above program, assemble it, transfer the S19 file to the
68HC11, and run the program with CALL 2100. When the program starts, type
the following text Pack my box with five dozen liquor jugs.
Exercise: The lookup program affects the X and B registers. Modify the func-
tion so that the function initially stores these two registers in the stack, and
restores them before returning. Verify that the program works correctly.
Exercise: Modify the program by adding another table, the table of symmetric
characters: AHIMOTUVWXYimnouvwxy. The program should, in addition to checking
to see if a character is a vowel, it should also check to see if it is a symmetric
character. Run the program and enter the following text: Axiomboard. You
should get an output similar to the following:
done
>c 2100
=====================================
Lab on using Tables
Name: _____________________
This program is an infinite loop!
Hit the reset button to quit
=====================================
A is a vowel and is a symmetric character
x is not a vowel and is a symmetric character
i is a vowel and is a symmetric character
o is a vowel and is a symmetric character
m is not a vowel and is a symmetric character
b is not a vowel and is not a symmetric character
o is a vowel and is a symmetric character
a is a vowel and is not a symmetric character
r is not a vowel and is not a symmetric character
d is not a vowel and is not a symmetric character
5.5.2 Input with validation
Another use of the table lookup is to validate input from the user. Suppose we
want the user to enter a social security number. In this case, we want to make sure
Zobrazit stránku 63
1 2 ... 59 60 61 62 63 64 65 66 67 68 69 ... 100 101

Komentáře k této Příručce

Žádné komentáře