SlideShare a Scribd company logo
PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA
TRABAJO COMPILADORES EMU8086.
1
Nombre: Johnny Aragón. Fecha: 28 de Abril del 2015.
Pantallas de instalación EMU8086
PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA
TRABAJO COMPILADORES EMU8086.
2
Código Hola mundo en ensamblador.
; "hello, world!" step-by-step char-by-char way...
; this is very similar to what int 21h/9h does behind your eyes.
; instead of $, the string in this example is zero terminated
; (the Microsoft Corporation has selected dollar to terminate the strings for MS-DOS operating
system)
name "hello"
org 100h ; compiler directive to make tiny com file.
; execution starts here, jump over the data string:
jmp start
; data string:
msg db 'Hello, world!', 0
start:
; set the index register:
mov si, 0
next_char:
; get current character:
mov al, msg[si]
; is it zero?
; if so stop printing:
cmp al, 0
je stop
PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA
TRABAJO COMPILADORES EMU8086.
3
; print character in teletype mode:
mov ah, 0eh
int 10h
; update index register by 1:
inc si
; go back to print another char:
jmp next_char
stop: mov ah, 0 ; wait for any key press.
int 16h
; exit here and return control to operating system...
ret
end ; to stop compiler.
this text is not compiled and is not checked for errors,
because it is after the end directive;
however, syntax highlight still works here.
Código Hola mundo en ensamblador en español.
; "hello, world!" step-by-step char-by-char way...
; this is very similar to what int 21h/9h does behind your eyes.
; instead of $, the string in this example is zero terminated
; (the Microsoft Corporation has selected dollar to terminate the strings for MS-DOS operating
system)
PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA
TRABAJO COMPILADORES EMU8086.
4
name "hello"
org 100h ; compiler directive to make tiny com file.
; execution starts here, jump over the data string:
jmp start
; data string:
msg db 'Hela - Mundo!', 0
start:
; set the index register:
mov si, 0
next_char:
; get current character:
mov al, msg[si]
; is it zero?
; if so stop printing:
cmp al, 0
je stop
; print character in teletype mode:
mov ah, 0eh
int 10h
; update index register by 1:
inc si
; go back to print another char:
jmp next_char
stop: mov ah, 0 ; wait for any key press.
int 16h
; exit here and return control to operating system...
ret
end ; to stop compiler.
this text is not compiled and is not checked for errors,
because it is after the end directive;
however, syntax highlight still works here.
PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA
TRABAJO COMPILADORES EMU8086.
5
Código datos completos en ensamblador.
; "hello, world!" step-by-step char-by-char way...
; this is very similar to what int 21h/9h does behind your eyes.
; instead of $, the string in this example is zero terminated
; (the Microsoft Corporation has selected dollar to terminate the strings for MS-DOS operating
system)
name "Johnny Alejandro Aragon Puetate, PUCE-SI, 28/04/2015, Compiladores"
org 100h ; compiler directive to make tiny com file.
; execution starts here, jump over the data string:
jmp start
; data string:
msg db 'Hela - Mundo!', 0
start:
; set the index register:
mov si, 0
next_char:
; get current character:
mov al, msg[si]
; is it zero?
; if so stop printing:
cmp al, 0
je stop
PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA
TRABAJO COMPILADORES EMU8086.
6
; print character in teletype mode:
mov ah, 0eh
int 10h
; update index register by 1:
inc si
; go back to print another char:
jmp next_char
stop: mov ah, 0 ; wait for any key press.
int 16h
; exit here and return control to operating system...
ret
end ; to stop compiler.
this text is not compiled and is not checked for errors,
because it is after the end directive;
however, syntax highlight still works here.
Código comparación de dos números en ensamblador.
name "flags"
org 100h
; this sample shows how cmp instruction sets the flags.
PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA
TRABAJO COMPILADORES EMU8086.
7
; usually cmp instruction is followed by any relative
; jump instruction such as: je, ja, jl, jae...
; it is recommended to click "flags" and "analyze"
; for better visual expirience before stepping through this code.
; (signed/unsigned)
; 4 is equal to 4
mov ah, 4
mov al, 4
cmp ah, al
nop
; (signed/unsigned)
; 4 is above and greater then 3
mov ah, 4
mov al, 3
cmp ah, al
nop
; -5 = 251 = 0fbh
; (signed)
; 1 is greater then -5
mov ah, 1
mov al, -5
cmp ah, al
nop
; (unsigned)
; 1 is below 251
mov ah, 1
mov al, 251
cmp ah, al
nop
; (signed)
; -3 is less then -2
mov ah, -3
mov al, -2
cmp ah, al
nop
; (signed)
; -2 is greater then -3
mov ah, -2
mov al, -3
cmp ah, al
nop
PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA
TRABAJO COMPILADORES EMU8086.
8
; (unsigned)
; 255 is above 1
mov ah, 255
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, '5'
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 "enter a number or any other character to exit: $"
equal_5 db " is five! (equal)", 0Dh,0Ah, "$"
below_5 db " is below five!" , 0Dh,0Ah, "$"
above_5 db " is above five!" , 0Dh,0Ah, "$"
PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA
TRABAJO COMPILADORES EMU8086.
9
Código que permita sumar 10 valores asignados a un vector
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
PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA
TRABAJO COMPILADORES EMU8086.
10
; print result in binary:
mov bl, m
mov cx, 8
print: mov ah, 2 ; print function.
mov dl, '0'
test bl, 11011111b ; 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 -8, 4, 8, 2, 1, 7, 6 ,1, -2, 5
m db 0
print_al proc
cmp al, 0
jne print_al_r
push ax
mov al, '0'
mov ah, 0eh
PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA
TRABAJO COMPILADORES EMU8086.
11
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

More Related Content

What's hot

Emulador emu8086
Emulador emu8086Emulador emu8086
Emulador emu8086
Gabriel Solano
 
Instalación de emu8086
Instalación de emu8086Instalación de emu8086
Instalación de emu8086
Alex Toapanta
 
ICP - Lecture 9
ICP - Lecture 9ICP - Lecture 9
ICP - Lecture 9
hassaanciit
 
Advanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit TestingAdvanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit Testing
Lars Thorup
 
Perl In The Command Line
Perl In The Command LinePerl In The Command Line
Perl In The Command Line
Marcos Rebelo
 
Lecture05(control structure part ii)
Lecture05(control structure part ii)Lecture05(control structure part ii)
Lecture05(control structure part ii)
Dhaka University of Engineering & Technology(DUET)
 
Switch statement mcq
Switch statement  mcqSwitch statement  mcq
Switch statement mcq
Parthipan Parthi
 
Looping in C
Looping in CLooping in C
Looping in C
Prabhu Govind
 
Java Programming: Loops
Java Programming: LoopsJava Programming: Loops
Java Programming: Loops
Karwan Mustafa Kareem
 
Knee-deep in C++ s... code
Knee-deep in C++ s... codeKnee-deep in C++ s... code
Knee-deep in C++ s... code
PVS-Studio
 
Fundamentals of programming finals.ajang
Fundamentals of programming finals.ajangFundamentals of programming finals.ajang
Fundamentals of programming finals.ajang
Jaricka Angelyd Marquez
 
Looping statements in C
Looping statements in CLooping statements in C
Looping statements in C
Jeya Lakshmi
 
2 data and c
2 data and c2 data and c
2 data and c
MomenMostafa
 
Java Programmin: Selections
Java Programmin: SelectionsJava Programmin: Selections
Java Programmin: Selections
Karwan Mustafa Kareem
 
C++ Course - Lesson 1
C++ Course - Lesson 1C++ Course - Lesson 1
C++ Course - Lesson 1
Mohamed Ahmed
 
Cracking for beginners - copy (2)
Cracking for beginners - copy (2)Cracking for beginners - copy (2)
Cracking for beginners - copy (2)
BAHADUR SINGH THAKUR
 
Loops
LoopsLoops
Logging in JavaScript - part-2
Logging in JavaScript - part-2Logging in JavaScript - part-2
Logging in JavaScript - part-2
Ideas2IT Technologies
 
for loop in java
for loop in java for loop in java
for loop in java
Majid Ali
 
Fibonacci Series Program in C++
Fibonacci Series Program in C++Fibonacci Series Program in C++
Fibonacci Series Program in C++
Aditi Bhushan
 

What's hot (20)

Emulador emu8086
Emulador emu8086Emulador emu8086
Emulador emu8086
 
Instalación de emu8086
Instalación de emu8086Instalación de emu8086
Instalación de emu8086
 
ICP - Lecture 9
ICP - Lecture 9ICP - Lecture 9
ICP - Lecture 9
 
Advanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit TestingAdvanced QUnit - Front-End JavaScript Unit Testing
Advanced QUnit - Front-End JavaScript Unit Testing
 
Perl In The Command Line
Perl In The Command LinePerl In The Command Line
Perl In The Command Line
 
Lecture05(control structure part ii)
Lecture05(control structure part ii)Lecture05(control structure part ii)
Lecture05(control structure part ii)
 
Switch statement mcq
Switch statement  mcqSwitch statement  mcq
Switch statement mcq
 
Looping in C
Looping in CLooping in C
Looping in C
 
Java Programming: Loops
Java Programming: LoopsJava Programming: Loops
Java Programming: Loops
 
Knee-deep in C++ s... code
Knee-deep in C++ s... codeKnee-deep in C++ s... code
Knee-deep in C++ s... code
 
Fundamentals of programming finals.ajang
Fundamentals of programming finals.ajangFundamentals of programming finals.ajang
Fundamentals of programming finals.ajang
 
Looping statements in C
Looping statements in CLooping statements in C
Looping statements in C
 
2 data and c
2 data and c2 data and c
2 data and c
 
Java Programmin: Selections
Java Programmin: SelectionsJava Programmin: Selections
Java Programmin: Selections
 
C++ Course - Lesson 1
C++ Course - Lesson 1C++ Course - Lesson 1
C++ Course - Lesson 1
 
Cracking for beginners - copy (2)
Cracking for beginners - copy (2)Cracking for beginners - copy (2)
Cracking for beginners - copy (2)
 
Loops
LoopsLoops
Loops
 
Logging in JavaScript - part-2
Logging in JavaScript - part-2Logging in JavaScript - part-2
Logging in JavaScript - part-2
 
for loop in java
for loop in java for loop in java
for loop in java
 
Fibonacci Series Program in C++
Fibonacci Series Program in C++Fibonacci Series Program in C++
Fibonacci Series Program in C++
 

Similar to Emulador de ensamblador EMU8086

Compiladores emu8086
Compiladores emu8086Compiladores emu8086
Compiladores emu8086
JhOnss KrIollo
 
[ASM]Lab5
[ASM]Lab5[ASM]Lab5
[ASM]Lab5
Nora Youssef
 
Chapter 6 Flow control Instructions
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructions
warda aziz
 
Algoritmos ensambladores
Algoritmos ensambladoresAlgoritmos ensambladores
Algoritmos ensambladores
Maurock Charolastra Muñoz
 
Taller Ensambladores
Taller EnsambladoresTaller Ensambladores
Taller Ensambladores
Christian Morales
 
Marco acosta emu
Marco acosta emuMarco acosta emu
Marco acosta emu
PUCESI
 
Oracle pl sql
Oracle pl sqlOracle pl sql
Oracle pl sql
Durga Rao
 
030 cpp streams
030 cpp streams030 cpp streams
030 cpp streams
Hồ Lợi
 
Emu8086
Emu8086Emu8086
Emu8086
rangarajb2005
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
Mohammed Saleh
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
Mohammed Saleh
 
Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014
Béo Tú
 
Intro to OpenMP
Intro to OpenMPIntro to OpenMP
Intro to OpenMP
jbp4444
 
05 Jo P May 07
05 Jo P May 0705 Jo P May 07
05 Jo P May 07
Ganesh Samarthyam
 
Input-output
Input-outputInput-output
Input-output
neda marie maramo
 
BOOTABLE OPERATING SYSTEM PPT
BOOTABLE OPERATING SYSTEM PPTBOOTABLE OPERATING SYSTEM PPT
BOOTABLE OPERATING SYSTEM PPT
Shahzeb Pirzada
 
Programming basics
Programming basicsProgramming basics
Programming basics
illidari
 
Micro c lab3(ssd)
Micro c lab3(ssd)Micro c lab3(ssd)
Micro c lab3(ssd)
Mashood
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)
yap_raiza
 
Lab manual mp
Lab manual mpLab manual mp
Lab manual mp
HarshitParkar6677
 

Similar to Emulador de ensamblador EMU8086 (20)

Compiladores emu8086
Compiladores emu8086Compiladores emu8086
Compiladores emu8086
 
[ASM]Lab5
[ASM]Lab5[ASM]Lab5
[ASM]Lab5
 
Chapter 6 Flow control Instructions
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructions
 
Algoritmos ensambladores
Algoritmos ensambladoresAlgoritmos ensambladores
Algoritmos ensambladores
 
Taller Ensambladores
Taller EnsambladoresTaller Ensambladores
Taller Ensambladores
 
Marco acosta emu
Marco acosta emuMarco acosta emu
Marco acosta emu
 
Oracle pl sql
Oracle pl sqlOracle pl sql
Oracle pl sql
 
030 cpp streams
030 cpp streams030 cpp streams
030 cpp streams
 
Emu8086
Emu8086Emu8086
Emu8086
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014
 
Intro to OpenMP
Intro to OpenMPIntro to OpenMP
Intro to OpenMP
 
05 Jo P May 07
05 Jo P May 0705 Jo P May 07
05 Jo P May 07
 
Input-output
Input-outputInput-output
Input-output
 
BOOTABLE OPERATING SYSTEM PPT
BOOTABLE OPERATING SYSTEM PPTBOOTABLE OPERATING SYSTEM PPT
BOOTABLE OPERATING SYSTEM PPT
 
Programming basics
Programming basicsProgramming basics
Programming basics
 
Micro c lab3(ssd)
Micro c lab3(ssd)Micro c lab3(ssd)
Micro c lab3(ssd)
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)
 
Lab manual mp
Lab manual mpLab manual mp
Lab manual mp
 

More from Jhon Alexito

Web host ntp
Web host ntpWeb host ntp
Web host ntp
Jhon Alexito
 
Historia de usuario proyecto ntp
Historia de usuario proyecto ntpHistoria de usuario proyecto ntp
Historia de usuario proyecto ntp
Jhon Alexito
 
Trabajo flex byson
Trabajo flex bysonTrabajo flex byson
Trabajo flex byson
Jhon Alexito
 
Análisis sintáctico ascendente descendente
Análisis sintáctico ascendente   descendenteAnálisis sintáctico ascendente   descendente
Análisis sintáctico ascendente descendente
Jhon Alexito
 
Python compiladores
Python compiladoresPython compiladores
Python compiladores
Jhon Alexito
 
Decompiladores
DecompiladoresDecompiladores
Decompiladores
Jhon Alexito
 
Mapa compiladores
Mapa compiladoresMapa compiladores
Mapa compiladores
Jhon Alexito
 
INTRODUCCIÓN COMPILADORES
INTRODUCCIÓN COMPILADORESINTRODUCCIÓN COMPILADORES
INTRODUCCIÓN COMPILADORES
Jhon Alexito
 

More from Jhon Alexito (12)

Web host ntp
Web host ntpWeb host ntp
Web host ntp
 
Historia de usuario proyecto ntp
Historia de usuario proyecto ntpHistoria de usuario proyecto ntp
Historia de usuario proyecto ntp
 
Trabajo flex byson
Trabajo flex bysonTrabajo flex byson
Trabajo flex byson
 
Análisis sintáctico ascendente descendente
Análisis sintáctico ascendente   descendenteAnálisis sintáctico ascendente   descendente
Análisis sintáctico ascendente descendente
 
Python compiladores
Python compiladoresPython compiladores
Python compiladores
 
Decompiladores
DecompiladoresDecompiladores
Decompiladores
 
Mapa compiladores
Mapa compiladoresMapa compiladores
Mapa compiladores
 
Doc1
Doc1Doc1
Doc1
 
Doc1
Doc1Doc1
Doc1
 
Doc1
Doc1Doc1
Doc1
 
Doc1
Doc1Doc1
Doc1
 
INTRODUCCIÓN COMPILADORES
INTRODUCCIÓN COMPILADORESINTRODUCCIÓN COMPILADORES
INTRODUCCIÓN COMPILADORES
 

Recently uploaded

The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
Kavitha Krishnan
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 

Recently uploaded (20)

The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 

Emulador de ensamblador EMU8086

  • 1. PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA TRABAJO COMPILADORES EMU8086. 1 Nombre: Johnny Aragón. Fecha: 28 de Abril del 2015. Pantallas de instalación EMU8086
  • 2. PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA TRABAJO COMPILADORES EMU8086. 2 Código Hola mundo en ensamblador. ; "hello, world!" step-by-step char-by-char way... ; this is very similar to what int 21h/9h does behind your eyes. ; instead of $, the string in this example is zero terminated ; (the Microsoft Corporation has selected dollar to terminate the strings for MS-DOS operating system) name "hello" org 100h ; compiler directive to make tiny com file. ; execution starts here, jump over the data string: jmp start ; data string: msg db 'Hello, world!', 0 start: ; set the index register: mov si, 0 next_char: ; get current character: mov al, msg[si] ; is it zero? ; if so stop printing: cmp al, 0 je stop
  • 3. PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA TRABAJO COMPILADORES EMU8086. 3 ; print character in teletype mode: mov ah, 0eh int 10h ; update index register by 1: inc si ; go back to print another char: jmp next_char stop: mov ah, 0 ; wait for any key press. int 16h ; exit here and return control to operating system... ret end ; to stop compiler. this text is not compiled and is not checked for errors, because it is after the end directive; however, syntax highlight still works here. Código Hola mundo en ensamblador en español. ; "hello, world!" step-by-step char-by-char way... ; this is very similar to what int 21h/9h does behind your eyes. ; instead of $, the string in this example is zero terminated ; (the Microsoft Corporation has selected dollar to terminate the strings for MS-DOS operating system)
  • 4. PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA TRABAJO COMPILADORES EMU8086. 4 name "hello" org 100h ; compiler directive to make tiny com file. ; execution starts here, jump over the data string: jmp start ; data string: msg db 'Hela - Mundo!', 0 start: ; set the index register: mov si, 0 next_char: ; get current character: mov al, msg[si] ; is it zero? ; if so stop printing: cmp al, 0 je stop ; print character in teletype mode: mov ah, 0eh int 10h ; update index register by 1: inc si ; go back to print another char: jmp next_char stop: mov ah, 0 ; wait for any key press. int 16h ; exit here and return control to operating system... ret end ; to stop compiler. this text is not compiled and is not checked for errors, because it is after the end directive; however, syntax highlight still works here.
  • 5. PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA TRABAJO COMPILADORES EMU8086. 5 Código datos completos en ensamblador. ; "hello, world!" step-by-step char-by-char way... ; this is very similar to what int 21h/9h does behind your eyes. ; instead of $, the string in this example is zero terminated ; (the Microsoft Corporation has selected dollar to terminate the strings for MS-DOS operating system) name "Johnny Alejandro Aragon Puetate, PUCE-SI, 28/04/2015, Compiladores" org 100h ; compiler directive to make tiny com file. ; execution starts here, jump over the data string: jmp start ; data string: msg db 'Hela - Mundo!', 0 start: ; set the index register: mov si, 0 next_char: ; get current character: mov al, msg[si] ; is it zero? ; if so stop printing: cmp al, 0 je stop
  • 6. PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA TRABAJO COMPILADORES EMU8086. 6 ; print character in teletype mode: mov ah, 0eh int 10h ; update index register by 1: inc si ; go back to print another char: jmp next_char stop: mov ah, 0 ; wait for any key press. int 16h ; exit here and return control to operating system... ret end ; to stop compiler. this text is not compiled and is not checked for errors, because it is after the end directive; however, syntax highlight still works here. Código comparación de dos números en ensamblador. name "flags" org 100h ; this sample shows how cmp instruction sets the flags.
  • 7. PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA TRABAJO COMPILADORES EMU8086. 7 ; usually cmp instruction is followed by any relative ; jump instruction such as: je, ja, jl, jae... ; it is recommended to click "flags" and "analyze" ; for better visual expirience before stepping through this code. ; (signed/unsigned) ; 4 is equal to 4 mov ah, 4 mov al, 4 cmp ah, al nop ; (signed/unsigned) ; 4 is above and greater then 3 mov ah, 4 mov al, 3 cmp ah, al nop ; -5 = 251 = 0fbh ; (signed) ; 1 is greater then -5 mov ah, 1 mov al, -5 cmp ah, al nop ; (unsigned) ; 1 is below 251 mov ah, 1 mov al, 251 cmp ah, al nop ; (signed) ; -3 is less then -2 mov ah, -3 mov al, -2 cmp ah, al nop ; (signed) ; -2 is greater then -3 mov ah, -2 mov al, -3 cmp ah, al nop
  • 8. PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA TRABAJO COMPILADORES EMU8086. 8 ; (unsigned) ; 255 is above 1 mov ah, 255 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, '5' 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 "enter a number or any other character to exit: $" equal_5 db " is five! (equal)", 0Dh,0Ah, "$" below_5 db " is below five!" , 0Dh,0Ah, "$" above_5 db " is above five!" , 0Dh,0Ah, "$"
  • 9. PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA TRABAJO COMPILADORES EMU8086. 9 Código que permita sumar 10 valores asignados a un vector 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
  • 10. PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA TRABAJO COMPILADORES EMU8086. 10 ; print result in binary: mov bl, m mov cx, 8 print: mov ah, 2 ; print function. mov dl, '0' test bl, 11011111b ; 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 -8, 4, 8, 2, 1, 7, 6 ,1, -2, 5 m db 0 print_al proc cmp al, 0 jne print_al_r push ax mov al, '0' mov ah, 0eh
  • 11. PONTIFICIA UNIVERSIDAD DEL ECUADOR - SEDE IBARRA TRABAJO COMPILADORES EMU8086. 11 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