SlideShare a Scribd company logo
Instalación de EMU8086
EMU8086
Posee una interfaz de usuario muy amistosa que permite familiarizarse con los fundamentos
de la programación en lenguaje ensamblador(assembler) 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.
http://assembler8086.blogspot.com/2012/10/ejercicios-en-emu-8086.html
Comprobada la forma de ejecución realizar los siguientes programas en base a los códigos
expuestos como ejemplos.
• Ejecutar el programa hola mundo, y debe cambiar los mensajes de pantalla al español.
Compilar un programa en EMU8086 que indique lo siguiente:
Compilar un programa en EMU8086 que indique lo siguiente: Nombre completo del
estudiante, Universidad, Fecha y materia
name "hi-world"
; this example prints out "hello world!"
; by writing directly to video memory.
; in vga memory: first byte is ascii character, byte that follows is character attribute.
; if you change the second byte, you can change the color of
; the character even after it is printed.
; character attribute is 8 bit value,
; high 4 bits set background color and low 4 bits set foreground color.
; hex bin color
;
; 0 0000 black
; 1 0001 blue
; 2 0010 green
; 3 0011 cyan
; 4 0100 red
; 5 0101 magenta
; 6 0110 brown
; 7 0111 light gray
; 8 1000 dark gray
; 9 1001 light blue
; a 1010 light green
; b 1011 light cyan
; c 1100 light red
; d 1101 light magenta
; e 1110 yellow
; f 1111 white
org 100h
; set video mode
mov ax, 3 ; text mode 80x25, 16 colors, 8 pages (ah=0, al=3)
int 10h ; do it!
; cancel blinking and enable all 16 colors:
mov ax, 1003h
mov bx, 0
int 10h
; set segment register:
mov ax, 0b800h
mov ds, ax
; print "hello world"
; first byte is ascii code, second byte is color code.
mov [02h], 'D'
mov [04h], 'i'
mov [06h], 'e'
mov [08h], 'g'
mov [0ah], 'o'
mov [0ch], ','
mov [0eh], 'E'
mov [10h], 'r'
mov [12h], 'a'
mov [14h], 'z'
mov [16h], 'o'
mov [18h], ','
mov [1ah], '1'
mov [1ch], '6'
mov [1eh], '/'
mov [22h], '3'
mov [24h], '/'
mov [26h], '1'
mov [28h], '9'
mov [2ah], '9'
mov [2ch], '5'
mov [2eh], '-'
mov [32h], 'P'
mov [34h], 'U'
mov [36h], 'C'
mov [38h], 'E'
mov [3ah], 'S'
mov [3ch], 'I'
mov [3eh], '-'
mov [42h], 'C'
mov [44h], 'o'
mov [46h], 'm'
mov [48h], 'p'
mov [4ah], 'i'
mov [4ch], 'l'
mov [4eh], 'a'
mov [52h], 'd'
mov [54h], 'o'
mov [56h], 'r'
mov [58h], 'e'
mov [5ah], 's'
; color all characters:
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
; wait for any key press:
mov ah, 0
int 16h
ret
Compilar un programa que permita comparar 2 números del 0 al 9.
name "flags"
org 100h
; this sample shows how cmp instruction sets the flags.
; 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
; (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, "$"
Compilar un programa 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
; 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 4, 7, 8, 2, 1, 10, 9, 7, 22, 100
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.
name "hex-bin"
org 100h
; load binary value:
; (hex: 5h)
mov al, 00000101b
; load hex value:
mov bl, 0ah
; load octal value:
; (hex: 8h)
mov cl, 10o
; 5 + 10 = 15 (0fh)
add al, bl
; 15 - 8 = 7
sub al, cl
; print result in binary:
mov bl, al
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
; wait for any key press:
mov ah, 0
int 16h
ret

More Related Content

What's hot

Presentacion vim
Presentacion vimPresentacion vim
Presentacion vim
Icalia Labs
 
VI Editors
VI EditorsVI Editors
VI Editors
Deivanai
 

What's hot (19)

Presentacion vim
Presentacion vimPresentacion vim
Presentacion vim
 
Config
ConfigConfig
Config
 
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
 
Logging in JavaScript - part-2
Logging in JavaScript - part-2Logging in JavaScript - part-2
Logging in JavaScript - part-2
 
Knee-deep in C++ s... code
Knee-deep in C++ s... codeKnee-deep in C++ s... code
Knee-deep in C++ s... code
 
Cracking for beginners - copy (2)
Cracking for beginners - copy (2)Cracking for beginners - copy (2)
Cracking for beginners - copy (2)
 
How To Beat An Advanced CrackMe
How To Beat An Advanced CrackMeHow To Beat An Advanced CrackMe
How To Beat An Advanced CrackMe
 
Functuon
FunctuonFunctuon
Functuon
 
Sine Wave Generator with controllable frequency displayed on a seven segment ...
Sine Wave Generator with controllable frequency displayed on a seven segment ...Sine Wave Generator with controllable frequency displayed on a seven segment ...
Sine Wave Generator with controllable frequency displayed on a seven segment ...
 
Useless Box
Useless BoxUseless Box
Useless Box
 
JSUG - Scala Lightning Talk by Michael Greifeneder
JSUG - Scala Lightning Talk by Michael GreifenederJSUG - Scala Lightning Talk by Michael Greifeneder
JSUG - Scala Lightning Talk by Michael Greifeneder
 
C++: The Cathedral and the Bizarre
C++: The Cathedral and the BizarreC++: The Cathedral and the Bizarre
C++: The Cathedral and the Bizarre
 
Le wagon javascript for beginners - ARF
Le wagon   javascript for beginners - ARFLe wagon   javascript for beginners - ARF
Le wagon javascript for beginners - ARF
 
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom GregoryExploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
 
CyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation ProcessCyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation Process
 
VI Editors
VI EditorsVI Editors
VI Editors
 
nltkExamples
nltkExamplesnltkExamples
nltkExamples
 
Telegram bots
Telegram botsTelegram bots
Telegram bots
 
Conditional Loops
Conditional LoopsConditional Loops
Conditional Loops
 

Similar to Instalación de emu8086 y compilados

Assembly language
Assembly languageAssembly language
Assembly language
bryle12
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interrupt
Tech_MX
 

Similar to Instalación de emu8086 y compilados (20)

Compiladoresemulador
CompiladoresemuladorCompiladoresemulador
Compiladoresemulador
 
Taller practico emu8086_galarraga
Taller practico emu8086_galarragaTaller practico emu8086_galarraga
Taller practico emu8086_galarraga
 
Assembler
AssemblerAssembler
Assembler
 
Algoritmos ensambladores
Algoritmos ensambladoresAlgoritmos ensambladores
Algoritmos ensambladores
 
Instalación de emu8086
Instalación de emu8086Instalación de emu8086
Instalación de emu8086
 
Chapter 6 Flow control Instructions
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructions
 
BOOTABLE OPERATING SYSTEM PPT
BOOTABLE OPERATING SYSTEM PPTBOOTABLE OPERATING SYSTEM PPT
BOOTABLE OPERATING SYSTEM PPT
 
Brief description of all the interupts
Brief description of all the interuptsBrief description of all the interupts
Brief description of all the interupts
 
Taller Ensambladores
Taller EnsambladoresTaller Ensambladores
Taller Ensambladores
 
Lec06
Lec06Lec06
Lec06
 
Lecture6
Lecture6Lecture6
Lecture6
 
chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructions
 
Assembly language
Assembly languageAssembly language
Assembly language
 
Loop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progamLoop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progam
 
Implementation - Sample Runs
Implementation - Sample RunsImplementation - Sample Runs
Implementation - Sample Runs
 
Introduction to 8088 microprocessor
Introduction to 8088 microprocessorIntroduction to 8088 microprocessor
Introduction to 8088 microprocessor
 
Buy Embedded Systems Projects Online,Buy B tech Projects Online
Buy Embedded Systems Projects Online,Buy B tech Projects OnlineBuy Embedded Systems Projects Online,Buy B tech Projects Online
Buy Embedded Systems Projects Online,Buy B tech Projects Online
 
Rapport
RapportRapport
Rapport
 
Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughter
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interrupt
 

More from Diego Erazo

Teoría de la decisión ejercicios criterios
Teoría de la decisión ejercicios criteriosTeoría de la decisión ejercicios criterios
Teoría de la decisión ejercicios criterios
Diego Erazo
 

More from Diego Erazo (20)

Manual de instalacion de ventsim
Manual de instalacion de ventsimManual de instalacion de ventsim
Manual de instalacion de ventsim
 
Taller 5 factores elementos garantia simulacion
Taller 5 factores elementos garantia simulacionTaller 5 factores elementos garantia simulacion
Taller 5 factores elementos garantia simulacion
 
Vetajas y desventajas de la simulacion
Vetajas y desventajas de la simulacionVetajas y desventajas de la simulacion
Vetajas y desventajas de la simulacion
 
Sistemas complejos
Sistemas complejosSistemas complejos
Sistemas complejos
 
Algoritmo codificador de huffman matlab
Algoritmo codificador de huffman matlabAlgoritmo codificador de huffman matlab
Algoritmo codificador de huffman matlab
 
Algoritmo de entropia matlab
Algoritmo de entropia matlabAlgoritmo de entropia matlab
Algoritmo de entropia matlab
 
La entropía y los sistemas abiertos
La entropía y los sistemas abiertosLa entropía y los sistemas abiertos
La entropía y los sistemas abiertos
 
Leyes de la entropia
Leyes de la entropiaLeyes de la entropia
Leyes de la entropia
 
Manual de instalacion de vegas
Manual de instalacion de vegasManual de instalacion de vegas
Manual de instalacion de vegas
 
Segmentación de imágenes con matlab
Segmentación de imágenes con matlabSegmentación de imágenes con matlab
Segmentación de imágenes con matlab
 
Entropía vs neguentropia
Entropía vs neguentropiaEntropía vs neguentropia
Entropía vs neguentropia
 
Aplicaciones de la ingeniería en sistemas
Aplicaciones de la ingeniería en sistemasAplicaciones de la ingeniería en sistemas
Aplicaciones de la ingeniería en sistemas
 
Operadores morfológicos de imágenes
Operadores morfológicos de imágenesOperadores morfológicos de imágenes
Operadores morfológicos de imágenes
 
La ingenieria en sistemas bajo las tgs
La ingenieria en sistemas bajo las tgsLa ingenieria en sistemas bajo las tgs
La ingenieria en sistemas bajo las tgs
 
Filtrado y realzado de imagenes con matlab
Filtrado y realzado de imagenes con matlabFiltrado y realzado de imagenes con matlab
Filtrado y realzado de imagenes con matlab
 
Teoría de la decisión ejercicios criterios
Teoría de la decisión ejercicios criteriosTeoría de la decisión ejercicios criterios
Teoría de la decisión ejercicios criterios
 
Operaciones digitales con matlab
Operaciones digitales con matlabOperaciones digitales con matlab
Operaciones digitales con matlab
 
Teoría de la decisión consulta criterios
Teoría de la decisión consulta criteriosTeoría de la decisión consulta criterios
Teoría de la decisión consulta criterios
 
Teoria de desicion
Teoria de desicionTeoria de desicion
Teoria de desicion
 
Teoria de los juegos
Teoria de los juegosTeoria de los juegos
Teoria de los juegos
 

Recently uploaded

678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated crops
parmarsneha2
 

Recently uploaded (20)

Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated crops
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 

Instalación de emu8086 y compilados

  • 2.
  • 3.
  • 4. EMU8086 Posee una interfaz de usuario muy amistosa que permite familiarizarse con los fundamentos de la programación en lenguaje ensamblador(assembler) 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. http://assembler8086.blogspot.com/2012/10/ejercicios-en-emu-8086.html Comprobada la forma de ejecución realizar los siguientes programas en base a los códigos expuestos como ejemplos. • Ejecutar el programa hola mundo, y debe cambiar los mensajes de pantalla al español. Compilar un programa en EMU8086 que indique lo siguiente:
  • 5.
  • 6.
  • 7. Compilar un programa en EMU8086 que indique lo siguiente: Nombre completo del estudiante, Universidad, Fecha y materia name "hi-world" ; this example prints out "hello world!" ; by writing directly to video memory. ; in vga memory: first byte is ascii character, byte that follows is character attribute. ; if you change the second byte, you can change the color of ; the character even after it is printed. ; character attribute is 8 bit value, ; high 4 bits set background color and low 4 bits set foreground color. ; hex bin color ; ; 0 0000 black ; 1 0001 blue ; 2 0010 green ; 3 0011 cyan ; 4 0100 red ; 5 0101 magenta ; 6 0110 brown ; 7 0111 light gray ; 8 1000 dark gray ; 9 1001 light blue ; a 1010 light green ; b 1011 light cyan ; c 1100 light red ; d 1101 light magenta ; e 1110 yellow ; f 1111 white
  • 8. org 100h ; set video mode mov ax, 3 ; text mode 80x25, 16 colors, 8 pages (ah=0, al=3) int 10h ; do it! ; cancel blinking and enable all 16 colors: mov ax, 1003h mov bx, 0 int 10h ; set segment register: mov ax, 0b800h mov ds, ax ; print "hello world" ; first byte is ascii code, second byte is color code. mov [02h], 'D' mov [04h], 'i' mov [06h], 'e' mov [08h], 'g' mov [0ah], 'o'
  • 9. mov [0ch], ',' mov [0eh], 'E' mov [10h], 'r' mov [12h], 'a' mov [14h], 'z' mov [16h], 'o' mov [18h], ',' mov [1ah], '1' mov [1ch], '6' mov [1eh], '/' mov [22h], '3' mov [24h], '/' mov [26h], '1' mov [28h], '9' mov [2ah], '9' mov [2ch], '5'
  • 10. mov [2eh], '-' mov [32h], 'P' mov [34h], 'U' mov [36h], 'C' mov [38h], 'E' mov [3ah], 'S' mov [3ch], 'I' mov [3eh], '-' mov [42h], 'C' mov [44h], 'o' mov [46h], 'm' mov [48h], 'p' mov [4ah], 'i' mov [4ch], 'l' mov [4eh], 'a'
  • 11. mov [52h], 'd' mov [54h], 'o' mov [56h], 'r' mov [58h], 'e' mov [5ah], 's' ; color all characters: 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 ; wait for any key press: mov ah, 0 int 16h ret
  • 12. Compilar un programa que permita comparar 2 números del 0 al 9. name "flags" org 100h ; this sample shows how cmp instruction sets the flags. ; 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)
  • 13. ; 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
  • 14. mov ah, -2 mov al, -3 cmp ah, al nop ; (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
  • 15. 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, "$" Compilar un programa que permita sumar 10 valores asignados a un vector. name "calc-sum" org 100h ; directive make tiny com file.
  • 16. ; 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.
  • 17. 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
  • 18. ret ; variables: vector db 4, 7, 8, 2, 1, 10, 9, 7, 22, 100 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:
  • 19. popa ret endp Compilar un programa sugerido por usted, como propuesta adicional. name "hex-bin" org 100h ; load binary value:
  • 20. ; (hex: 5h) mov al, 00000101b ; load hex value: mov bl, 0ah ; load octal value: ; (hex: 8h) mov cl, 10o ; 5 + 10 = 15 (0fh) add al, bl ; 15 - 8 = 7 sub al, cl ; print result in binary: mov bl, al 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:
  • 21. mov dl, 'b' int 21h ; wait for any key press: mov ah, 0 int 16h ret