;Title color string. .model small .data color db 00000001b MyString db " This String is in Color " Row db 10 ; SCREEN is 25x80 Column db 20 StrLength dw 25 .stack 100h .code Program: ; Start Main Program call InitSegs mov cx, 256 redo: call PrintColorString rol Color,1 call delay loop redo call Wait4Key call Exit ; ; ; Start Procedures ; ==== INITSEGS ==== Proc InitSegs ; Setup String Pointers in DS and ES push ax ; SAVE AX to Stack mov ax, @data ; Get address of .DATA segment mov ds,ax ; PUt it in DS mov es,ax ; Put it in ES pop ax ; RESTORE AX from Stack RET EndP InitSegs PROC DELAY push ax bx mov bx, 02000H reload_ax: mov ax, 0FFFFh dec_ax: dec ax jnz dec_ax dec bx jnz reload_ax pop bx ax RET ENDP DELAY ; ==== PRINTCOLORSTRING ==== PROC PrintColorString ; Print a String in Color at ROW,COLUMN on Screen push bp ax bx cx dx ; SAVE bp ax bx cx dx mov ah,13h ; setup for function 13H of INT 10h API mov al, 1 ; Color Attr in BL mov bh, 0 ; Page 0 mov bl, Color ; Color mov cx, StrLength ; Length of String mov dh, Row ; Row mov dl, Column ; Column mov bp, OFFSET Mystring ;Pointer to text INT 10h ; Execute INT 10H API pop dx cx bx ax bp ; RESTORE DX CX BX AX BP from Stack RET ENDP PrintColorString ; ==== WAIT4KEY ==== PROC Wait4Key ; Wait for a key to be pressed push ax ; SAVE AX mov ah,0h ; Setup for function 0 of INT 16h API int 16h ; Execute INT 16H API pop ax ; RESTORE AX from Stack RET ENDP Wait4key ; ==== EXIT ==== PROC exit ; EXIT to DOS push ax ; SAVE AX to Stack mov ah, 4ch ; Setup Function 4ch of INT 21H int 21h ; EXECUTE INT 21H API CALL pop ax ; RESTORE AX RET ENDP exit ; ==== END OF PROCEDURES ==== END Program ; ; ==== END OF MAIN PROGRAM ====