Motorola Axiom CMD11E1 Guía de usuario Pagina 53

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 101
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 52
4.5. ON YOUR OWN! 53
;v4 = 044;
ldaa #@44
staa v4
;total = v1+v2+v3+v4;
ldaa v1
adda v2
adda v3
adda v4
staa total
;print total as 2 digit hex number
ldaa total
jsr outlhlf
ldaa total
jsr outrhlf
swi
org $3000
v1 rmb 1
v2 rmb 1
v3 rmb 1
v4 rmb 1
total rmb 1
opt s
Modify the C program so that v3 = ’A’; is replaced by v3=getchar();. Run
the C program and type the upper case letter A and press enter. You should
see the same output as before. Now replace the instruction ldaa #’A’ by jsr
inchar and make sure that you equate inchar to $ffcd. Run the assembly above
assembly language program and verify that it behaves the same as the C program.
4.5 On your own!
1. Write an assembly program that does the same as the following C program:
#include <stdio.h>
Vista de pagina 52
1 2 ... 48 49 50 51 52 53 54 55 56 57 58 ... 100 101

Comentarios a estos manuales

Sin comentarios