Programa Emu8086

10
Pontificia Universidad católica del Ecuador Sede Ibarra Wilson Cacuango 5to Sistemas Capturar los pasos de instalación de EMU8086, luego investigar en la web una corta introducción de este aplicativo.

Transcript of Programa Emu8086

Page 1: Programa Emu8086

Pontificia Universidad católica del Ecuador

Sede Ibarra

Wilson Cacuango

5to Sistemas

Capturar los pasos de instalación de EMU8086, luego investigar en la web una corta

introducción de este aplicativo.

Page 2: Programa Emu8086
Page 3: Programa Emu8086
Page 4: Programa Emu8086
Page 5: Programa Emu8086

Una vez revisadas las opciones más importantes de EMU8086, trabajar con la sección de code

Examples e ir revisando los programas ejemplo.

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

.model small

.stack

.data

saludo db "Hola mundo!!!", "$"

.code

Page 6: Programa Emu8086

main proc ;Inicia proceso

mov ax,seg saludo ;hmm ¿seg?

mov ds,ax ;ds = ax = saludo

mov ah,09 ;Function(print string)

lea dx,saludo ;DX = String terminated by "$"

int 21h ;Interruptions DOS Functions

;mensaje en pantalla

mov ax,4c00h ;Function (Quit with exit code (EXIT))

int 21h ;Interruption DOS Functions

main endp ;Termina proceso

end main

Nombre completo del estudiante, Universidad, Fecha y materia.

.model small

.stack

.data

saludo db "Hola mundo!!!", "$"

.code

Page 7: Programa Emu8086

main proc ;Inicia proceso

mov ax,seg saludo ;hmm ¿seg?

mov ds,ax ;ds = ax = saludo

mov ah,09 ;Function(print string)

lea dx,saludo ;DX = String terminated by "$"

int 21h ;Interruptions DOS Functions

;mensaje en pantalla

mov ax,4c00h ;Function (Quit with exit code (EXIT))

int 21h ;Interruption DOS Functions

main endp ;Termina proceso

end main

Compilar un programa que permita comparar 2 números del 0 al 9

Compilar un programa que permita sumar 10 valores asignados a un vector.

Page 8: Programa Emu8086

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

Page 9: Programa Emu8086

; 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 5, 4, 5, 2, 1, 9, 1, 2, 5, 7

Page 10: Programa Emu8086

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