TRABAJO FINAL ARQUITECTURA DE COMPUTADORES DANIEL CERVANTES CERRO CODIGO: 1053002064 GRUPO: 301302_47 TUTOR: ANYELO
Views 80 Downloads 0 File size 492KB
TRABAJO FINAL ARQUITECTURA DE COMPUTADORES
DANIEL CERVANTES CERRO
CODIGO: 1053002064
GRUPO: 301302_47
TUTOR: ANYELO GERLEY QUINTERO
UNIVERSIDAD NACIONAL ABIERTA Y A DISTANCIA
10/12/18
INTRODUCCION
A continuación, se dará a conocer en funcionamiento del programa emu 8086 por mediante códigos, realizando así un menú con diferentes opciones y la información pertinente del autor que en ese caso sería mi persona.
Objetivos
Presentar por medio de una codificación un menú en el cual se encuentren varias opciones matemáticas. También se encuentre la información del autor con su fecha de realización. Aprender a realizar un código de tipo de lenguaje ensamblador.
Menú que realizar
1. Datos del autor 2. Suma de dos números 3. Resta de dos números 4. Multiplicación de dos números 5. División de dos números 6. Validar si un número es positivo o negativo 7. Salir
1. Documentar perfectamente todo el código. Data segment
mens1 DB 13,10,13,10," MENU --EXAMEN FINAL-- $" mens2 DB 13,10,13,10,"1. DATOS DEL AUTOR $" mens3 DB 13,10,13,10,"DANIELCERVANTES",13,10,"CODIGO 1053002064",13,10,"UNIVERSIDAD NACIONAL Y A DISTANCIA UNAD",13,10,"DICIEMBRE 10/12/2018 $" mens4 DB 13,10,"2. SUMA DE DOS NUMEROS $" mens5 DB 13,10,"3. RESTA DE DOS NUMEROS $" mens6 DB 13,10,"4. MULTIPLICACION DE DOS NUMEROS $" mens7 DB 13,10,"5. DIVISION DE DOS NUMEROS $" mens8 DB 13,10,"6. VALIDAR SI EL NUMERO ES POSITIVO O NEGATIVO $" mens9 DB 13,10,"7. SALIR $" mens10 DB 13,10,13,10,"SELECCIONE UNA OPCION: $" mens11 DB 13,10,13,10,"INGRESE NUMERO: $", mens12 DB 13,10,"EL RESULTADO ES: $" mens13 DB "COCIENTE = $" mens14 DB "RESIDUO = $" result DB 0 quotient DB 0 residue DB 0 numero DB 0 signox DB 0 r2 DB ? ac DB 0
Data ends
pila segment stack
DW 256 DUP (?)
pila ends
code segment
menu proc far
assume cs:code,ds:data,ss:pila push ds xor ax,ax push ax mov ax,data mov ds,ax xor dx,dx mov ax,0600h
mov ah,09h mov dx,offset mens1 int 21h
mov ah,09h mov dx,offset mens2 int 21h
mov ah,09h mov dx,offset mens4 int 21h
mov ah,09h mov dx,offset mens5 int 21h
mov ah,09h mov dx,offset mens6 int 21h
mov ah,09h mov dx,offset mens7 int 21h
mov ah,09h mov dx,offset mens8 int 21h
mov ah,09h mov dx,offset mens9 int 21h
mov ah,09h mov dx,offset mens10 int 21h
;lee
mov ah,01h int 21h
;ajustar el teclado xor ah,ah sub al,30h mov cx,2
;verifica opcion cmp al,1 jz autor
cmp al,2 jz suma
cmp al,3 jz resta
cmp al,4 jz mult
cmp al,5 jz divi
cmp al,6
jz posneg
cmp al,7 jz fin
autor:
mov ah,09h mov dx,offset mens3 int 21h jmp menu
suma:
mov ah,09h mov dx,offset mens11 int 21h
;lee teclado mov ah,01h int 21h
;verificar si es negativo cmp al,2dh je signo
;ajustar teclado sub al,30h
add result,al jmp return1
signo: mov ah,01h int 21h sub al,30h neg al add result,al je return1
return1: loop suma
imp1: cmp result,00 jl imp2
mov ah,02h mov dl,10 int 21h mov ah,02h mov dl,13 int 21h
mov ah,09h mov dx,offset mens12
int 21h jmp imprime
imp2: neg result
mov ah,02h mov dl,10 int 21h mov ah,02h mov dl,13 int 21h
mov ah,09h mov dx,offset mens12 int 21h mov ah,02h mov dl,'-' int 21h jmp imprime
imprime:
mov ah,0 mov al,result mov cl,10
div cl
add al,30h add ah,30h; pasa a decimal mov bl,ah
mov dl,al mov ah,02h int 21h
mov dl,bl mov ah,02h int 21h mov cx,2 jmp menu
resta:
mov ah,09h mov dx,offset mens11 int 21h
;lee teclado mov ah,01h int 21h
;verificando si es negativo cmp al,2dh
je signor
sub al,30h cmp cx,2 je etiqueta1 sub result,al jmp return2
etiqueta1: mov result,al jmp return2
signor: mov ah,01h int 21h sub al,30h neg al cmp cx,2 je etiqueta1 sub result,al je return2
return2: loop resta jmp imp1
mult:
mov ah,09h mov dx,offset mens11 int 21h
;lee teclado mov ah,01h int 21h
;verificando si es negativo cmp al,2dh je signom sub al,30h cmp cx,2 je etiqueta2 mov ah,0 mul result jmp return3
etiqueta2: mov result,al jmp return3
signom: mov ah,01h int 21h sub al,30h neg al
cmp cx,2 je etiqueta2 mov ah,0 mul result jmp return3
return3: loop mult mov result,al jmp imp1
mov signox,0
posneg:
mov ah,09h mov dx,offset mens11 int 21h
;lee teclado mov ah,01h int 21h
;verificar si es negativo cmp al,2dh je signo jmp menu
divi:
mov ah,09h mov dx,offset mens11 int 21h
;lee teclado mov ah,01h int 21h
;verificando si es negativo cmp al,2dh je signod
sub al,30h cmp cx,2 je etiqueta3 cmp al,0 mov ah,0 mov numero,al mov al,result div numero jmp return4
etiqueta3: mov result,al jmp return4
signod: mov ah,01 int 21h sub al,30h inc signox cmp cx,2 je etiqueta3 mov ah,0 mov numero,al mov al,result div numero jmp return4
return4:loop divi mov quotient,al mov residue,ah mov result,al jmp imp3
imp3:
mov ah,02h mov dl,10 int 21h mov ah,02h mov dl,13 int 21h mov ah,09h
mov dx,offset mens12 int 21h jmp imprimedivi
imprimedivi: mov al,result
mov ch,30h add al,ch add ah,ch mov bl,ah
mov ah,9 mov dx,offset mens13 int 21h
cmp signox,1 jz cambio jmp termina
cambio: mov dl,"-" mov ah,02h int 21h mov signox,0
termina: mov dx,0
add quotient,30h mov dl,quotient mov ah,02h int 21h
mov ah,9 mov dx,offset mens14 int 21h
mov dx,0 add residue,30h mov dl,residue mov ah,02h int 21h
jmp menu fin:
ret
menu endp code ends end menu
2. Generar tres capturas por pantalla de la ejecución del programa
Conclusiones
Gracias a este tipo de lenguaje pudimos aprender a realizar un menú la cual nos ayuda a tener varias opciones con que interactuar completamente, también así realizando nuestras operaciones con solo presionar los dos números la cual queremos realizar.
Bibliografías
Universidad Carlos III de Madrid. (12 de 03 de 2016). OpenCourseWare. Recuperado de http://ocw.uc3m.es/ingenieria-informatica/arquitectura-de-computadores-ii/otros-recursos1/or-f-010.-clusters-y-supercomputadores/view Rocabado Moreno, S. H. (2016). Arquitectura y organización de la computadora: microprocesadores y programación assembler (págs. 1- 95). Recuperado de http://bibliotecavirtual.unad.edu.co:2051/login.aspx?direct=true&db=edselb&AN=edselb.1 1200895&lang=es&site=eds-live Soriano Payá, A. (2002). Estructuras de computadores : problemas resueltos. [Alicante]: Digitalia (págs.13 - 50). Recuperado de http://bibliotecavirtual.unad.edu.co:2051/login.aspx?direct=true&db=nlebk&AN=318079& lang=es&site=eds-live