emulador emu8086

8
PONTIFICIA UNIVERSIDAD CATOLICA DEL ECUADOR Alberto Jácome 5to EMULADOR EMU8086 Este emulador porque 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. INSTALACION de Emu8086

Upload: alberto-jacome

Post on 11-Aug-2015

81 views

Category:

Education


2 download

TRANSCRIPT

Page 1: Emulador emu8086

PONTIFICIA UNIVERSIDAD CATOLICA DEL ECUADOR

Alberto Jácome

5to

EMULADOR EMU8086

Este emulador porque 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.

INSTALACION de Emu8086

Page 2: Emulador emu8086
Page 3: Emulador emu8086

EJEMPLOS # 1 HOLA MUNDO

Page 4: Emulador emu8086

Imprimir Nombre Universidad Fecha Materia

; The easiest way to print out "Hello, World!" name "hi" org 100h jmp start ; jump over data declaration msg: db "Pontificia Univerdidad Catolica del Ecuador Sede Ibarra, Luis Alberto Jacome, 28 de abril del 2015, 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.

Page 5: Emulador emu8086

Suma de 10 numeros

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'

Page 6: Emulador emu8086

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, 4, 1, 7, 8, 9 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

Page 7: Emulador emu8086

COMPARAR NUMERO

nop ; (signed) ; -2 is greater then -3 mov ah, -2 mov al, -3 cmp ah, al nop ; (unsigned) ; 255 is above 1 mov ah, 255

Page 8: Emulador emu8086

mov al, 1 cmp ah, al nop ; now a little game: game: mov dx, offset msg1 mov ah, 9 int 21h ; read character in al: mov ah, 1 int 21h cmp al, '0' jb stop cmp al, '9' ja stop cmp al, '9' jb below ja above mov dx, offset equal_5 jmp print below: mov dx, offset below_5 jmp print above: mov dx, offset above_5 print: mov ah, 9 int 21h jmp game ; loop. stop: ret ; stop msg1 db "Ingrese un numero: $" equal_5 db " es igual", 0Dh,0Ah, "$" below_5 db " es menor que 9!" , 0Dh,0Ah, "$" above_5 db " es mayor que 9" , 0Dh,0Ah, "$"