Quiz 2 Arquitectura 2012 01 Grupo 02

1
UNIVERSIDAD NACIONAL DE COLOMBIA – SEDE MEDELLÍN FACULTAD DE MINAS ESCUELA DE MECATRÓNICA Asignatura: ARQUITECTURA DE COMPUTADORES Grupo: 02 Nota: Examen: SEGUNDO QUIZ Valor: 10% Nombre del estudiante: Documento: Nombre del docente HUGO DE JESÚS MESA YEPES Fecha: 1. (50%) Escribir el código en assembly para los siguientes pseudocódigos. Tenga presente que la función MOD deberá ser implementada por usted. Pseudocódigo Inicio Entero: R[15], i, j, n = 0, s=0, nr=0 Para i = 1 hasta 15 Leer R [i] Fin para Para j = i + 1 hasta 15 Para i = 1 hasta 14 Si R [i] = R[j] n = n+1 s=s+ R[j] si no nr=nr+1 Fin si Fin para Fin para Si n ≠ 0 Mostrar “Existen números repeticiones” Mostrar “La cantidad de números repetidos es”, n Mostrar “La suma de números repetidos es”, s si no Mostrar “No existen números repeticiones” Mostrar “La cantidad total de números es”, nr Fin si Fin 2. (50%) Construya el pseudocódigo y explique que hace el siguiente programa escrito en lenguaje assembly TITLE Scanning an Array (ArryScan.asm) INCLUDE Irvine32.inc .data intArray SWORD 0,0,0,0,1,20,35,- 12,66,4,0 noneMsg BYTE "A non-zero value was not found",0 .code main PROC mov ebx,OFFSET intArray mov ecx,LENGTHOF intArray L1: cmp WORD PTR [ebx],0 jnz found add ebx,2 loop L1 jmp notFound found: movsx eax,WORD PTR [ebx] call WriteInt jmp quit notFound: mov edx,OFFSET noneMsg call WriteString quit: call crlf exit main ENDP END main

description

Quiz de la asignatura Arquitectura de Computadores. La arquitectura de computadores, es la materia que enseña como funciona internamente el computador.

Transcript of Quiz 2 Arquitectura 2012 01 Grupo 02

UNIVERSIDAD NACIONAL DE COLOMBIA SEDE MEDELLNFACULTAD DE MINASESCUELA DE MECATRNICA

Asignatura:ARQUITECTURA DE COMPUTADORESGrupo:02Nota:

Examen:SEGUNDO QUIZValor:10%

Nombre del estudiante:Documento:

Nombre del docenteHUGO DE JESS MESA YEPESFecha:

1. (50%) Escribir el cdigo en assembly para los siguientes pseudocdigos. Tenga presente que la funcin MOD deber ser implementada por usted.PseudocdigoInicioEntero: R[15], i, j, n = 0, s=0, nr=0Para i = 1 hasta 15Leer R [i]Fin paraPara j = i + 1 hasta 15Para i = 1 hasta 14Si R [i] = R[j]n = n+1s=s+ R[j]si nonr=nr+1Fin siFin paraFin paraSi n 0Mostrar Existen nmeros repeticionesMostrar La cantidad de nmeros repetidos es, nMostrar La suma de nmeros repetidos es, ssi noMostrar No existen nmeros repeticionesMostrar La cantidad total de nmeros es, nrFin siFin

2. (50%) Construya el pseudocdigo y explique que hace el siguiente programa escrito en lenguaje assemblyTITLE Scanning an Array (ArryScan.asm)INCLUDE Irvine32.inc.dataintArray SWORD 0,0,0,0,1,20,35,-12,66,4,0noneMsg BYTE "A non-zero value was not found",0.codemain PROCmov ebx,OFFSET intArraymov ecx,LENGTHOF intArrayL1:cmp WORD PTR [ebx],0jnz foundadd ebx,2loop L1jmp notFoundfound:movsx eax,WORD PTR [ebx]call WriteIntjmp quit

notFound:mov edx,OFFSET noneMsgcall WriteStringquit:call crlfexitmain ENDPEND main