Bienvenido: Ingresar
location: attachment:inspalabra_ex1.s de WebHome/TrabajosPracticos/PracticoASM4

Adjunto 'inspalabra_ex1.s'

Descargar

   1 .text
   2 .arm
   3 .global _start
   4 _start:
   5         b reset
   6         b loop
   7         b loop
   8         b loop
   9         b loop
  10         nop
  11         b loop
  12         b loop
  13 
  14 /* ==============================
  15 *  CÓDIGO
  16 *  ==============================
  17 */
  18 reset:	mov r1, #VECT1
  19 	mov r2, #VECT2
  20 	add r3, r2,#1
  21 	mov r4, #SALIDA
  22 
  23 @ lee la primera letra de VECT2 y la pasa a mayuscula 
  24         ldrb r5,[r2]
  25         cmp r5,#'a'
  26 	subhs r5, r5, #('a'-'A')
  27 
  28 @ bucle principal
  29 
  30 otro:	ldrb r6, [r1],#1
  31 	cmp r6, #0
  32 	beq salir @ sale al finalizar barrido de VECT1
  33         mov r7,r6 @ copia en r7 el valor leido de VECT1 para no afectarlo con el pase a mayuscula
  34 
  35 	cmp r6, #'a'  @ pasa a mayuscula el valor veido 
  36 	subhs r6, r6, #('a'-'A') 
  37 
  38 	cmp r5, r6    @ compara el valor leido con el primer elemento de VECT2
  39 	strneb r7, [r4], #1 @ si no son iguales guarda el valor leido de VECT1 en SALIDA 
  40 	bleq insertar @ si eran iguales llama a insertar 
  41         b otro 
  42 
  43 
  44 /* ==================================================================================
  45 *  función insertar 
  46 *  copia desde el 2do elemento de VECT2 hasta su final en SALIDA 
  47 *  ==================================================================================*/
  48 insertar:
  49         mov r2,r3     @ guarda en r2 el puntero al segundo elemento de VECT2
  50 insertarotra:
  51 	ldrb r6, [r2],#1
  52 	cmp r6, #0
  53         moveq pc,lr @ en esta linea retorno desde donde fué llamada la funcion (si r6 =  0)	
  54 	strb r6, [r4], #1
  55 	b insertarotra
  56 
  57 @ fin del programa 
  58 salir:  strb r6,[r4],#1 @ copio el null al final de la cadena
  59 loop:   b loop
  60 
  61 /* ==============================
  62 *  CONSTANTES
  63 *  ==============================
  64 */
  65 VECT1:	.asciz "insertar en X la palabra x"
  66 VECT2:	.asciz "xmundo"
  67 SALIDA:	.space 50
  68 	.balign 4
  69 	.end

Archivos adjuntos

Para referirse a los adjuntos de una página, usa attachment:nombredelarchivo, como se muestra abajo en la lista de archivos. NO uses la URL del enlace [get], ya que puede cambiar fácilmente y dejar de funcionar.
  • [obtener | ver] (2019-09-02 11:56:14, 110.6 KB) [[attachment:ARM_Instruction_Set.pdf]]
  • [obtener | ver] (2019-09-02 11:56:14, 1.1 KB) [[attachment:Makefile]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.4 KB) [[attachment:alarma_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.5 KB) [[attachment:alarma_s_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 2.3 KB) [[attachment:anumero1_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 2.9 KB) [[attachment:anumero2_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.6 KB) [[attachment:cadena_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 1.2 KB) [[attachment:cercano_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.8 KB) [[attachment:clave_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 1.4 KB) [[attachment:compara_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 2.2 KB) [[attachment:contarletrasrep_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 1.5 KB) [[attachment:contarrep_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 1.2 KB) [[attachment:criba_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 2.3 KB) [[attachment:extraenum_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 1.2 KB) [[attachment:igualarlargo_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 1.7 KB) [[attachment:inspalabra_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.9 KB) [[attachment:invertir_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.9 KB) [[attachment:may_min_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.6 KB) [[attachment:multip_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.6 KB) [[attachment:potencia_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.8 KB) [[attachment:potencia_ex1.s,v]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.8 KB) [[attachment:prom_vector_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.6 KB) [[attachment:promedio_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.8 KB) [[attachment:promedio_ex1.s,v]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.7 KB) [[attachment:punt_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.8 KB) [[attachment:punt_ex1.s,v]]
  • [obtener | ver] (2019-09-02 11:56:14, 1.9 KB) [[attachment:separa_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 472.2 KB) [[attachment:slides.pdf]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.5 KB) [[attachment:suma100_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.6 KB) [[attachment:suma64_ex1.s]]
  • [obtener | ver] (2019-09-02 11:56:14, 0.8 KB) [[attachment:suma64_ex1.s,v]]
  • [obtener | ver] (2019-09-02 11:56:14, 160.3 KB) [[attachment:tp1.pdf]]
  • [obtener | ver] (2019-09-02 11:56:14, 167.3 KB) [[attachment:tp3.pdf]]
 All files | Selected Files: delete move to page copy to page

No tienes permisos para adjuntar un archivo a esta página.