Category : C Source Code
Archive   : C_TEXT.ZIP
Filename : DRAW_BOX.ASM

 
Output of file : DRAW_BOX.ASM contained in archive : C_TEXT.ZIP

URIGHT EQU 187
ULEFT EQU 201
LRIGHT EQU 188
LLEFT EQU 200
HORIZONTAL EQU 205
VERTICAL EQU 186

_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT

PUBLIC _DRAW_BOX
_DRAW_BOX PROC NEAR
PUSH BP
MOV BP,SP
PUSH DI
PUSH SI
PUSH DS
PUSH ES

MOV BL,[BP+12]
MOV DH,[BP+4]
MOV DL,[BP+6]
CALL GOTO_XY
MOV AL,ULEFT
MOV CX,1

CALL PRINT_CHAR
INC DL
CALL GOTO_XY
MOV CX,[BP+8]
SUB CX,2
MOV AL,HORIZONTAL
CALL PRINT_CHAR
MOV DL,[BP+8]
ADD DL,[BP+6]
DEC DL
CALL GOTO_XY
MOV CX,1
MOV AL,URIGHT
CALL PRINT_CHAR
MOV CX,[BP+10]
SUB CX,2
MOV AL,VERTICAL
DRAW_VERT:
PUSH CX
MOV CX,1
INC DH
MOV DL,[BP+6]
CALL GOTO_XY
CALL PRINT_CHAR
ADD DL,[BP+8]
DEC DL
CALL GOTO_XY
CALL PRINT_CHAR
POP CX
LOOP DRAW_VERT
INC DH
MOV DL,[BP+6]
CALL GOTO_XY
MOV AL,LLEFT
MOV CX,1
CALL PRINT_CHAR
INC DL
CALL GOTO_XY
MOV CX,[BP+8]
SUB CX,2
MOV AL,HORIZONTAL
CALL PRINT_CHAR
ADD DL,[BP+8]
SUB DL,2
CALL GOTO_XY
MOV CX,1
MOV AL,LRIGHT
CALL PRINT_CHAR

POP ES
POP DS
POP SI
POP DI
POP BP
RET
_DRAW_BOX ENDP


PUBLIC PRINT_CHAR
PRINT_CHAR PROC NEAR
PUSH AX
PUSH BX

MOV AH,9 ;Service 9, print character
MOV BH,0 ;Display page 0
INT 10h

POP BX
POP AX
RET
PRINT_CHAR ENDP



PUBLIC GOTO_XY
GOTO_XY PROC NEAR
PUSH AX
PUSH BX


MOV AH,2 ;Service 2, Move cursor
XOR BH,BH ;Page 0
INT 10h

POP BX
POP AX
RET
GOTO_XY ENDP

_TEXT ENDS
END