This document contains code examples in EMU8086 assembly language for different programs, including:
1) A "Hello World" program that displays the text in red and yellow colors.
2) A program that displays personal data.
3) Programs that demonstrate number comparisons and determining if a number is greater than, less than, or equal to 7.
4) A program that calculates the sum of 10 numbers in an array.
What are the advantages and disadvantages of membrane structures.pptx
PUCE IBARRA EMU8086 INSTALLATION
1. PONTIFICA UNIVERSIDAD CATOLICA DEL ECUADOR SEDE IBARRA
NOMBRE: MARCO ACOSTA
NIVEL: 5to “SISTEMAS”
FECHA: 15/04/2041
INSTALACION DE EMU8086
Damos clic en siguiente
2. Elegimos la ruta para instalar
Presionamos en instalar
EJEMPLO DE HOLA MUNDO
3. Código del Ejemplo
name "Hola Mundo"
org 100h
mov ax, 3 ; text mode 80x25, 16 colors, 8 pages (ah=0, al=3)
int 10h ; do it!
mov ax, 1003h
mov bx, 0
int 10h
mov ax, 0b800h
mov ds, ax
mov [02h], 'H'
mov [04h], 'O'
mov [06h], 'l'
mov [08h], 'a'
mov [0ah], ','
mov [0ch], 'M'
mov [0eh], 'u'
mov [10h], 'n'
mov [12h], 'd'
mov [14h], 'o'
mov [16h], '!'
mov [18h], '!'
mov cx, 12 ; number of characters.
mov di, 03h ; start from byte after 'h'
c: mov [di], 11101100b ; light red(1100) on yellow(1110)
add di, 2 ; skip over next ascii code in vga memory.
loop c
mov ah, 0
int 16h
ret
7. stop: ret ; stop
msg1 db "Introducir un numero $"
equal_7 db " Igual a 7", 0Dh,0Ah, "$"
below_7 db " Menor que 7" , 0Dh,0Ah, "$"
above_7 db " Mayor que 7" , 0Dh,0Ah, "$"
EJEMPLO SUMA DE 10 NUMEROS
Codigo del Ejemplo
name "Suma"
org 100h ; directive make tiny com file.
mov cx, 10
mov al, 0
mov bx, 0
next: add al, vector[bx]
inc bx
loop next
mov m, al
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
8. mov dl, 'b'
int 21h
mov dl, 0ah ; new line.
int 21h
mov dl, 0dh ; carrige return.
int 21h
mov al, m
call print_al
mov ah, 0
int 16h
ret
vector db 5, 4, 5, 2, 1, 2, 5, 7, 9, 1
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