Macro 2 (Dibuja un marco utilizando LOOP, INT 10, INT 21h para mostrar datos)
Programa que muestra un marco desde la coordenada (Fila1,Columna1) hasta la (Fila2,Columna2)
El programa, utiliza macros. funciona con LOOP. y utiliza la función 02h de la interreucipon 21h
02:15 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. y utiliza la función 02h de la interreucipon 21h
;02:15 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,02h ;Write attributes/characters at cursor position (Int 10/09)
MOV DL,'+' ;Character
INT 21H ;
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,02h ;Write characters only at cursor position (Int 10/0A)
MOV DL,'+' ;Character
INT 21H
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,02h ;Write characters only at cursor position (Int 10/0A)
MOV DL,'+' ;Character
INT 21H
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,02h ;Write characters only at cursor position (Int 10/0A)
MOV DL,'+' ;Character
INT 21H
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,02h ;Write characters only at cursor position (Int 10/0A)
MOV DL,'@' ;Character
INT 21H
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,02h ;Write characters only at cursor position (Int 10/0A)
MOV DL,'@' ;Character
INT 21H
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,02h ;Write characters only at cursor position (Int 10/0A)
MOV DL,'@' ;Character
INT 21H
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,02h ;Write characters only at cursor position (Int 10/0A)
MOV DL,'@' ;Character
INT 21H
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