Desplaza una palabra arriba y abajo, según la tecla presionada
Funciona con las teclas 1, 2 y 3.
La tecla 1 permite bajar, la 2 subir, y la 13 (Tecla ENTER) salir.
;Autor Victor De la Rocha
;URL http://www.mis-algoritmos.com
.model small
.stack
.data
msg db 'mis-algoritmos.com$'
fle db ?
.code
.startup
;cls
mov ah,00h ;Set video mode
mov al,03h ;mode
int 10h ;Interrupcion de video
;posición
mov ah,02h ;Salida
mov dh,08 ;row
mov dl,02 ;columna
int 10h ;interrupcion de video
;mensaje
mov ah,09h ;Print string
lea dx,msg ;
int 21h ;Interrupcion de DOS
movimiento: ;Determina movimiento a realizar
mov ah,07h ;Direct STDIN input, no echo
int 21h ;interrupcion de DOS
jmp compara ;VERIFICAMOS EL CARACTER INTRODUCIDO
subir:
mov ah,06h ;Scroll page up
mov al,1 ;Number of lines to scroll window (0=blank whole window)
mov bh,01h ;Attibutes to be used on blanked lines
mov cx,0001h ;Ch=00H Cl=01h --> fila, colum -> of upper left corner of window to scroll
mov dx,184fh ;Dh=18H Dl=4f --> fila, colum -> of lower right corner of window
int 10h ;Interrupción de video
jmp movimiento
bajar:
mov ah,07h ;Scroll page down
mov al,1 ;numer of lines to scroll window (0 = blank whole window)
mov bh,02h ;attributes to be used on blanked lines
mov cx,02h ;CH=00 CL=02H --> fila, colum -> of upper left corner of window to scroll
mov dx,184fh ;DH=18H DL=4F --> fila, colum -> of lower right corner of window
int 10h ;Interrupción de video
jmp movimiento ;
compara:
cmp al,13 ;tecla Enter
je salir ;
cmp al,49 ;tecla 1
je bajar ;
cmp al,50 ;tecla 2
je subir ;
salir:
.exit
end