Programa propio de ciclos

Código:

;Programa de ciclo   
;Luis Enrique Garcia Vazquez 

org 100h

.model small
.stack 64
    
.data  
    mensaje db 0ah, 0dh, 'solo puede imprimir el mensaje de 1-3 veces$'
    mensaje1 db 0ah, 0dh, 'imprime mensaje 1 vez$'
    mensaje2 db 0ah, 0dh, 'imprime mensaje 2 veces$'
    mensaje3 db 0ah, 0dh, 'imprime mensaje 3 veces$'
    
.code

inicio:
   lea dx,mensaje   ;imprimir mensaje
 mov ah,9h
 int 21h
  mov ah,08              ;pausa y espera a que el usuario precione una tecla
 int 21h                ;interrupcion para capturar

 cmp al,49       
 je llamar1     
 cmp al,50        
 je llamar2  
 cmp al,51         
 je llamar3  
 jmp fin

fin:
 mov ax,4c00h       ;funcion que termina el programa
 int 21h

llamar1:
call uno

llamar2:
call dos

llamar3:
call tres



uno proc near
mov cx, 1
ciclo:
mov ax, @data
mov ds, ax
mov dx, offset mensaje1
mov ah, 09h
int 21h
loop ciclo
mov ah, 04ch
int 21h  
uno endp

dos proc near
mov cx, 2
ciclo2:
mov ax, @data
mov ds, ax
mov dx, offset mensaje2
mov ah, 09h
int 21h
loop ciclo2
mov ah, 04ch
int 21h  
dos endp   

tres proc near
mov cx, 3
ciclo3:
mov ax, @data
mov ds, ax
mov dx, offset mensaje3
mov ah, 09h
int 21h
loop ciclo3
mov ah, 04ch
int 21h  
tres endp


end inicio

Capturas:

Comentarios

Entradas más populares de este blog

Juego del Gato en Python

EMU8086 - Registro de banderas