Está en la página 1de 12

Nombre: Alejandro Enríquez

Fecha: 17 – mayo – 2021

Instalación de EMU8086
INTRODUCCION EMU8086

Este emulador posee una interfaz de usuario muy amistosa que permite familiarizarse con los
fundamentos de la programación en lenguaje ensamblador de forma muy intuitiva, aparte de eso
brinda una serie de recursos para ejecutar y depurar los programas. También tiene algunas
desventajas como el de no soportar algunas de las interrupciones más interesantes que posee el
sistema operativo y tampoco puede acceder a los puertos físicos (reales), sino que los emula
usando otros programas que ya están incluidos en su respectiva carpeta.
Ejercicios Propuestos

Ejecutar el programa hola mundo, y debe cambiar los mensajes de pantalla al español

Código
; The easiest way to print out "Hello, World!"
name "hi"
org 100h
jmp start ; jump over data declaration
msg: db "Hola mundo!", 0Dh,0Ah, 24h
start: mov dx, msg ; load offset of msg into dx.
mov ah, 09h ; print function is 9.
int 21h ; do it!
mov ah, 0
int 16h ; wait for any key....
ret ; return to operating system.
Compilar un programa en EMU8086 que indique lo siguiente: Nombre completo del estudiante,
Universidad, Fecha y materia.

Código
; The easiest way to print out "Hello, World!"
name "hi"
org 100h
jmp start ; jump over data declaration
msg: db "EDISON ALEJANDRO ENRIQUEZ TOBAR PUCESI (19 DE ABRIL DE
2018)COMPILADORES", 0Dh,0Ah, 24h
start: mov dx, msg ; load offset of msg into dx.
mov ah, 09h ; print function is 9.
int 21h ; do it!
mov ah, 0
int 16h ; wait for any key....
ret ; return to operating system.
Compilar un programa que permita comparar 2 números del 0 al 9.

Código

.model small
.stack 64
.data
mayor1 Db 'Es mayor','$'
menor1 Db 'Es menor','$'
igual1 Db 'Son iguales','$'
.code
inicio:
mov ah,01
int 21h
mov bl,al
mov ah,01
int 21h
mov cl,al
cmp bl,cl
ja mayor
jb menor
je igual
mayor:
mov ax,@data
mov ds,ax
mov ah,09
mov dx,offset mayor1
int 21h
jmp salir
menor:
mov ax,@data
mov ds,ax
mov ah,09
mov dx,offset menor1
int 21h
jmp salir
igual:
mov ax,@data
mov ds,ax
mov ah,09
mov dx,offset igual1
int 21h
jmp salir
salir:
mov ah,4ch
int 21h
end inicio
Compilar un programa que permita sumar 10 valores asignados a un vector

Código

name "calc-sum"

org 100h ; directive make tiny com file.

; calculate the sum of elements in vector,

; store result in m and print it in binary code.

; number of elements:

mov cx, 10

; al will store the sum:

mov al, 0

; bx is an index:

mov bx, 0

; sum elements:

next: add al, vector[bx]

; next byte:

inc bx

; loop until cx=0:


loop next

; store result in m:

mov m, al

; print result in binary:

mov bl, m

mov cx, 8

print: mov ah, 2 ; print function.

mov dl, '0'

test bl, 10000000b ; test first bit.

jz zero

mov dl, '1'

zero: int 21h

shl bl, 1

loop print

; print binary suffix:

mov dl, 'b'

int 21h

mov dl, 0ah ; new line.

int 21h

mov dl, 0dh ; carrige return.

int 21h

; print result in decimal:

mov al, m

call print_al

; wait for any key press:

mov ah, 0

int 16h

ret

; variables:
vector db 1,2,3,4,5,6,7,8,9,10

m db 0

print_al proc

cmp al, 0

jne print_al_r

push ax

mov al, '0'

mov ah, 0eh

int 10h

pop ax

ret

print_al_r:

pusha

mov ah, 0

cmp ax, 0

je pn_done

mov dl, 10

div dl

call print_al_r

mov al, ah

add al, 30h

mov ah, 0eh

int 10h

jmp pn_done

pn_done:

popa

ret

endp
Compilar un programa sugerido por usted, como propuesta adicional.
Programa que tome tres cadenas, la primera y la tercera representan un número y la
segunda una operación, por ejemplo: “300”, “-“, “100” e imprima el resultado “200”

Código

org 100h ; inicio de programa

include 'emu8086.inc' ;Incluye funciones de libreria emu8086

; DEFINE_SCAN_NUM

; DEFINE_PRINT_STRING

DEFINE_PRINT_NUM

DEFINE_PRINT_NUM_UNS

mov si, 0

mov al, 0

;Convertir primera cadena a numero

cadAnum:

cmp cad1[si], "$"

jz seguir

mov bl, 10

mul bl
sub cad1[si], '0'

add al, cad1[si]

inc si

loop cadAnum

seguir:

mov aux1, al

;Convertir segunda cadena a numero

mov si, 0

mov al, 0

cadAnum2:

cmp cad3[si], "$"

jz seguir2

mov bl, 10

mul bl

sub cad3[si], '0'

add al, cad3[si]

inc si

loop cadAnum2

seguir2:

mov bl, al

mov al, aux1

;realizar operaciones normalmente teniendo ya los dos numeros decimales

cmp cad2, "-"

jz resta

cmp cad2, "+"

jz suma

cmp cad2, "*"

jz multi
cmp cad2, "/"

jz divi

resta:

sub al, bl

jmp fin

suma: add al, bl

jmp fin

multi:

mul bl

jmp fin

divi:

div bl

jmp fin

fin:

mov bx, ax

mov ah,09

lea dx,msg

int 21h

mov ax, bx

call PRINT_NUM

ret

cad1 db "300$"

cad2 db "-"

cad3 db "100$" aux1 db ?

aux2 dw ?

msg dw "El resultado es: $"

También podría gustarte