Macro 1 (Dibuja un marco utilizando LOOP, e INT 10)
Muestra un marco desde la coordenada (Fila1,Columna1) hasta la (Fila2,Columna2)
El programa, utiliza macros. funciona con LOOP. Utiliza especificamente funciones de la interrupcion de Video (10)
02:14 p.m. Miercoles, 18 de Octubre de 2006
;Autor Victor De la Rocha
;URL http://www.mis-algoritmos.com
;Programa que muestra un marco desde la coordenada (Fila1,Columna1) hasta la (Fila2,Columna2)
;El programa, utiliza macros. funciona con LOOP. Utiliza especificamente funciones de la interrupcion de Video (10)
;02:14 p.m. Miercoles, 18 de Octubre de 2006
MARCO MACRO FILA1, COL1, FILA2, COL2
LOCAL LINE_TOP
LOCAL EXIT_TOP
LOCAL LINE_BOTTOM
LOCAL EXIT_BOTTOM
LOCAL LINE_LEFT
LOCAL EXIT_LEFT
LOCAL LINE_RIGHT
LOCAL EXIT_RIGHT
;Recorremos desde COL2 hasta COL1 en FILA1
MOV cl,COL2 ;El contador decrementará desde COL2
LINE_TOP: ;
MOV AH,02h ;Set cursor position (Int 10/02)
MOV DH,fila1 ;Row
MOV DL,cl ;Column
MOV BH,0 ;page number: 0 = in graphics modes
int 10h ;Video (Int 10)
MOV AH,09h ;Write attributes/characters at cursor position (Int 10/09)
MOV AL,'+' ;Character
MOV BH,0 ;Display page
MOV BL,7 ;Color
PUSH CX ;Almacenamos CX en la pila
mov CX,1 ;number of times to write character
INT 10H ;Video (Int 10)
POP CX ;Sacamos CX de la pila
CMP Cl,COL1
je EXIT_TOP
LOOP LINE_TOP ;dec cx;cmp cx,0;jne line_left;
EXIT_TOP:
;Recorremos desde COL2 hasta COL1 en FILA2
MOV cl,col2
LINE_BOTTOM:
MOV AH,02h ;Set cursor position (Int 10/02)
MOV DH,fila2 ;Row
MOV DL,cl ;Column
MOV BH,0 ;page number: 0 = in graphics modes
int 10h ;Video (Int 10)
MOV AH,09h ;Write characters only at cursor position (Int 10/0A)
MOV AL,'+' ;Character
MOV BH,0 ;Display page - alpha mode
MOV BL,7 ;Color
PUSH CX ;Almacenamos CX en la pila
mov CX,1 ;number of times to write character
INT 10H ;Video (Int 10)
POP CX ;Sacamos CX de la pila
CMP Cl,COL1
je EXIT_BOTTOM
LOOP LINE_BOTTOM ;dec cx;cmp cx,0;jne line_left;
EXIT_BOTTOM:
;Recorremos desde FILA2 hasta FILA1 en COL1
MOV cl,FILA2
LINE_LEFT:
MOV AH,02h ;Set cursor position (Int 10/02)
MOV DH,cl ;Row
MOV DL,COL1 ;Column
MOV BH,0 ;page number: 0 = in graphics modes
int 10h ;Video (Int 10)
MOV AH,09h ;Write characters only at cursor position (Int 10/0A)
MOV AL,'+' ;Character
MOV BH,0 ;Display page - alpha mode
MOV BL,7 ;Color
PUSH CX ;Almacenamos CX en la pila
mov CX,1 ;number of times to write character
INT 10H ;Video (Int 10)
POP CX ;Sacamos CX de la pila
CMP Cl,FILA1
je EXIT_LEFT
LOOP LINE_LEFT ;dec cx;cmp cx,0;jne line_left;
EXIT_LEFT:
;Recorremos desde FILA2 hasta FILA1 en COL2
MOV cl,FILA2
LINE_RIGHT:
MOV AH,02h ;Set cursor position (Int 10/02)
MOV DH,cl ;Row
MOV DL,COL2 ;Column
MOV BH,0 ;page number: 0 = in graphics modes
int 10h ;Video (Int 10)
MOV AH,09h ;Write characters only at cursor position (Int 10/0A)
MOV AL,'+' ;Character
MOV BH,0 ;Display page - alpha mode
MOV BL,7 ;Color
PUSH CX ;Almacenamos CX en la pila
mov CX,1 ;number of times to write character
INT 10H ;Video (Int 10)
POP CX ;Sacamos CX de la pila
CMP Cl,FILA1
je EXIT_RIGHT
LOOP LINE_RIGHT ;dec cx;cmp cx,0;jne line_left;
EXIT_RIGHT:
;Dibujamos esquinas
MOV AH,02h ;Set cursor position (Int 10/02)
MOV DH,FILA1 ;Row
MOV DL,COL1 ;Column
MOV BH,0 ;page number: 0 = in graphics modes
int 10h ;Video (Int 10)
MOV AH,09h ;Write characters only at cursor position (Int 10/0A)
MOV AL,'@' ;Character
MOV BH,0 ;Display page - alpha mode
MOV BL,7 ;Color
mov CX,1 ;number of times to write character
INT 10H ;Video (Int 10)
MOV AH,02h ;Set cursor position (Int 10/02)
MOV DH,FILA1 ;Row
MOV DL,COL2 ;Column
MOV BH,0 ;page number: 0 = in graphics modes
int 10h ;Video (Int 10)
MOV AH,09h ;Write characters only at cursor position (Int 10/0A)
MOV AL,'@' ;Character
MOV BH,0 ;Display page - alpha mode
MOV BL,7 ;Color
mov CX,1 ;number of times to write character
INT 10H ;Video (Int 10)
MOV AH,02h ;Set cursor position (Int 10/02)
MOV DH,FILA2 ;Row
MOV DL,COL1 ;Column
MOV BH,0 ;page number: 0 = in graphics modes
int 10h ;Video (Int 10)
MOV AH,09h ;Write characters only at cursor position (Int 10/0A)
MOV AL,'@' ;Character
MOV BH,0 ;Display page - alpha mode
MOV BL,7 ;Color
mov CX,1 ;number of times to write character
INT 10H ;Video (Int 10)
MOV AH,02h ;Set cursor position (Int 10/02)
MOV DH,FILA2 ;Row
MOV DL,COL2 ;Column
MOV BH,0 ;page number: 0 = in graphics modes
int 10h ;Video (Int 10)
MOV AH,09h ;Write characters only at cursor position (Int 10/0A)
MOV AL,'@' ;Character
MOV BH,0 ;Display page - alpha mode
MOV BL,7 ;Color
mov CX,1 ;number of times to write character
INT 10H ;Video (Int 10)
ENDM
CLS MACRO ;Clear Screen
MOV AH, 00H ;Set video mode
MOV AL, 03H ;Video mode 80x25, 8x8, 16, 4, B800, CGA
INT 10H ;Video (Int 10)
ENDM
.model small
.stack
.code
.startup
CLS
MARCO 1,1,22,78
MARCO 5,15,15,25
MARCO 3,3,8,8
MARCO 3,30,18,70
;Enviar cursor a ultima lĂnea
MOV AH,02h ;Set cursor position (Int 10/02)
MOV DX,1700H ;Row & Col
MOV BH,0 ;Page number: 0 = in graphics mode
int 10h
.exit
end