Salto Incondicional:
Programa 1:
Link del archivo: https://drive.google.com/open?id=1-DQmBXt4zwMMy_SHVbD3MjMeNzNYGmWs
Ejecución del programa:
Código:
mov ax, 5 ; set ax to 5.
mov bx, 2 ; set bx to 2.
jmp calc ; go to 'calc'.
back: jmp stop ; go to 'stop'.
calc:
add ax, bx ; add bx to ax.
jmp back ; go 'back'.
stop:
ret ; return to operating system.
Programa 2:
Link del archivo: https://drive.google.com/open?id=14eVu-Y8kEQeQHJnX31bixprpwhz3_NEK
Ejecución del programa:
Código:
include "emu8086.inc"
org 100h
mov al, 25 ; set al to 25.
mov bl, 10 ; set bl to 10.
cmp al, bl ; compare al - bl.
je equal ; jump if al = bl (zf = 1).
printn 'no es igual' ; if it gets here, then al <> bl,
jmp stop ; so print 'n', and jump to stop.
equal: ; if gets here,
printn 'es igual' ; then al = bl, so print 'y'.
stop:
ret ; gets here no matter what.
Programa 3:
Link del video: https://www.youtube.com/watch?v=Ng4YEb2Jtcg
Link del archivo: https://drive.google.com/open?id=1KAqwxazrYtCB5_t8hXgR_P3DNE1yrSRy
Ejecución del programa:
Código:
include 'emu8086.inc'
.model small
.stack
.data
num1 db 8
num2 db 8
num db 'Numeros iguales','$'
msg1 db 'Numero 1 mayor','$'
msg2 db 'Numero 1 mayor','$'
msg3 db 'Numero 2 mayor','$'
.code
main:
mov ax, @data
mov ds, ax
mov al, num1
cmp al, num2
jc mayor2 ;salta si es mayor
jz igual ;salta si son iguales
jnz mayor1 ;salta si es mayor
'Jne es para salta si es mayor o igual'
.exit
igual:
printn 'son iguales'
jmp fin
mayor2:
printn 'Es mayor el numero 2'
jmp fin
mayor1:
printn 'Es mayor el numero 1'
jmp fin
fin:
.exit
Nota: Se pueden ver ejemplos del siguiente tema ciclos condicionales...
Ver pagina: http://jbwyatt.com/253/emu/asm_tutorial_07.html
Ver video: https://www.youtube.com/watch?v=llCG44dzPQM
No hay comentarios.:
Publicar un comentario