Motorola Axiom CMD11E1 Guía de usuario Pagina 56

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 101
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 55
56 CHAPTER 4. PROGRAMS
(f) Modify the program so that the output reads some thing like:
v1 = 07
v2 = 1C
v3 = 23
v4 = 46
7. Write a function that will be passed a value in A register. The function
should return 10 times the value passed to it. Use the above function to
write a program that does the following: The program should get a digit
from the user, multiply it by 10 and store the value in a variable called tens.
It should then get a digit from the user and add it to the variable tens and
store it in a variable called DecimalIn. The program should then print the
value in the variable.
8. Use the code you wrote to create a function that will read a two digit decimal
number from the user. Call this function ReadDecimal. Write a program
that will call this function to read a two digit number and store the value
in a variable called DecimalIn. The program should then print the value in
the variable.
9. Type the following C program, run it to see what the output is. Rewrite the
program in assembly language and run it on the HC11. Verify that output
of the assembly program matches the C program.
#include <stdio.h>
char delta, value;
char count;
main() {
value = 0;
delta = 1;
count = 11;
foo:
if (count == 0) goto bar;
printf("%02X", (unsigned) value);
putchar(’,’); putchar(’ ’);
value = value + delta;
delta = delta + 2;
count = count -1;
Vista de pagina 55
1 2 ... 51 52 53 54 55 56 57 58 59 60 61 ... 100 101

Comentarios a estos manuales

Sin comentarios