home *** CD-ROM | disk | FTP | other *** search
- ;--------------------------------------------------------------------------;
- ; Put_color_str(string, attribute) - String should be a pointer to the ;
- ; string to be printed and attribute should be the attribute byte. If ;
- ; column 79 is reached, the cursor is moved to the next line, if possible .;
- ; Printing stops if row 24, column 79 is reached ;
- ;--------------------------------------------------------------------------;
-
- ASSUME CS:_TEXT
- _TEXT SEGMENT BYTE PUBLIC 'CODE'
- PUBLIC _PUT_COLOR_STR
- _PUT_COLOR_STR PROC NEAR
- PUSH BP
- MOV BP,SP
- PUSH DI
- PUSH SI
- PUSH DS
- PUSH ES
-
- MOV SI,[BP+4] ;Pointer to string
- MOV BL,[BP+6] ;Attribute character
-
- STRING_LOOP:
- LODSB ;Load a character into AL
- CMP AL,0 ;Check for end of string Null char.
- JE END_OF_STRING
- CHAR_PRINT:
- MOV AH,9 ;Service 9, print character
- MOV CX,1 ;Print character 1 time
- MOV BH,0 ;Display page 0
- INT 10h
- MOV AH,3 ;Service 3, get cursor position
- INT 10h
- INC DL ;Increment column
- CMP DL,79 ;Check for end of row
- JBE SAME_ROW ;Not end of row, print on same row
- CMP DH,24 ;Check for row 24
- JE END_OF_STRING ;If row 24, stop printing
- XOR DL,DL ;Move to column 0
- INC DH ;Move to nex row
- SAME_ROW:
- MOV AH,2 ;Service 2, move cursor
- INT 10h
- JMP STRING_LOOP ;Next character
- END_OF_STRING:
- POP ES
- POP DS
- POP SI
- POP DI
- POP BP
- RET
- _PUT_COLOR_STR ENDP
-
- _TEXT ENDS
- END
-