Programa de menú en pantalla
Código en TURBO
Pila segment stack 'stack' ;Segmento de la pila
db 100h dup (?)
Pila ends
datos segment
titulo db 13,10,'MENU PARA CAMBIAR EL FONDO DE PANTALLA ',13,10,'$'
mensaje db 'Presione ENTER para color AQUA ',13,10,'Presione 1 para color AZUL ' ,13,10,'Presione 2 para color MORADO ',13,10,'Presione 3 para color VERDE',13,10,'Presione 4 para color ROJO ',13,10,'Presione 5 para color NARANJA ',13,10,'Para SALIR',' Presione cualquier tecla',13,10,'$'
datos ends
codigo segment ;segmento de codigo
assume cs:codigo, ss:pila, ds:datos
Inicio:
mov ah,0
mov al,3h ; Modo Texto
int 10h ; Interrupcion de Video
mov ax,0600h ; Limpiar Pantalla
mov bh,0fh ; O Color de fondo negro, el color de letra blanco
mov cx,0000h
mov dx,184Fh
int 10h
mov ah,02h
mov bh,00
mov dh,00
mov dl,00
int 10h
;****************************** MOSTRAR MENSAJE
mov ax,datos
mov ds,ax
lea dx,titulo
mov ah,9h
int 21h
lea dx,mensaje
mov ah,9h
int 21h
;****************************** CAPTURA DE TECLAS
mov ah,08 ; Pausa y captura de datos db espera que el usuario presiona una tecla
int 21h
cmp al,13 ; Verifica al presionar ENTER, el cual tiene un codigo ascii 13 en decimal
je llamarAqua ; Salto Condicional jump equals opcion 1 saltar si es igual a la opcion 1
cmp al,49 ; Verifica al presionar 1, el cual tiene un codigo ascii 49 en decimal
je llamarAzul
cmp al,50 ; Ascii 50 = numero 2 compara lo que tiene el regisro ah con el ascii 50 en el reg a1
je llamarMorado ; 2 TIENE UN CODIGO ASCCI 50 EN DECIMAL
cmp al,51
je llamarverde ;3 TIENE UN CODIGO ASCCI 51 EN DECIMAL
cmp al,52
je llamarrojo ;4 TIENE UN CODIGO ASCCI 52 EN DECIMAL
cmp al,53
je llamarnaranja ;5 TIENE UN CODIGO ASCCI 53 EN DECIMAL
jmp fin ; Si no escoge ni ENTER ni 2, Sale del programa
fin: ; Saca el mensaje por pantalla
mov ax,4c00h
int 21h
llamarAqua:
CALL AQUAPROC
llamarAzul:
CALL AZULPROC
llamarMorado:
CALL MORADOPROC
llamarverde:
CALL VERDEPROC
llamarrojo:
CALL ROJOPROC
llamarnaranja:
CALL NARANJAPROC
;******************************
AQUAPROC PROC NEAR
mov ah,0
mov al,3h ; Modo Texto
int 10h ; Interrupcion de video
mov ax,0600h ; Limpiar Pantalla
mov bh,0fh ; Color de fondo negro, f color de letra blanco
mov cx,0000h
mov dx,184Fh
int 10h
mov ah,02h
mov bh,00
mov dh,00
mov dl,00
int 10h
mov ah,06h
mov bh,3fh ;2fh VERDE COLOR AQUA 3,,1 AZUL
mov cx,0000h
mov dx,184fh
int 10h
mov ax,4c00h
int 21h
RET
AQUAPROC ENDP
;*****************************************
AZULPROC PROC NEAR
mov ah,06h
mov bh,1fh ;2fh VERDE ;3 para azul AQUA, 4 para ROJO, 5 morado
mov cx,0000h
mov dx,184fh
int 10h
mov ax,4c00h
int 21h
RET
AZULPROC ENDP
;*****************************************
MORADOPROC PROC NEAR
mov ah,06h
mov bh,5fh ;2fh VERDE ;3 para azul AQUA, 4 para ROJO, 5 morado
mov cx,0000h
mov dx,184fh
int 10h
mov ax,4c00h
int 21h
RET
MORADOPROC ENDP
;**********************************
VERDEPROC PROC NEAR
mov ah,06h
mov bh,2fh ;2fh VERDE ,3 para AQUA, 4 para ROJO, 5 morado
mov cx,0000h
mov dx,184fh
int 10h
mov ax,4c00h
int 21h
RET
VERDEPROC ENDP
;**********************************
ROJOPROC PROC NEAR
mov ah,06h
mov bh,4fh ;2fh VERDE ;3 para azul AQUA, 4 para ROJO, 5 morado
mov cx,0000h
mov dx,184fh
int 10h
mov ax,4c00h
int 21h
RET
ROJOPROC ENDP
;**********************************
NARANJAPROC PROC NEAR
mov ah,06h
mov bh,6fh ;2fh VERDE ;3 para azul AQUA, 4 para ROJO, 5 morado
mov cx,0000h
mov dx,184fh
int 10h
mov ax,4c00h
int 21h
RET
NARANJAPROC ENDP
codigo ends
end inicio ; Podemos Asignar desde se inicia PC
No hay comentarios.:
Publicar un comentario