Respected members: I've been asked to write and run an assembly code to print my name in the middle of a 80X25 Text screen such that, each character in my name will show different background, foreground colors also some characters will be blinking with intense light! the problem is that I can't find the attributes of colored background and intensity stuff. Do u think any of you can help me? and Thanks in advance. here's what I've written so far but unfortunately still missing the colors attributes:

MOV AX, 0B800H
MOV DS, AX
MOV BX,159
MOV AX, 12
MUL BX
ADD AX, 40
MOV SI, AX

MOV [SI], 'F'
INC SI
INC SI
MOV [SI], 'A'
INC SI
INC SI
MOV [SI], 'R'
INC SI
INC SI
MOV [SI], 'E'
INC SI
INC SI
MOV [SI], 'S '
INC SI
INC SI
mov [SI], 'H'
INC SI
INC SI
MOV [SI], 'A'
INC SI
INC SI
MOV [SI], 'S'
INC SI
INC SI
MOV [SI], 'A'
INC SI
INC SI
MOV [SI], 'N'

mov ax, 4c00h
int 21h

The text attribute byte immediately follows the character byte
in video ram.
Text attributes can also be specified with INT 10/09 Write Char
and Attr at hardware cursor.

Here is the format of the text attribute byte:
[HHHHLLLL]
H-High Nibble= Background Color
L-Low Nibble= Foreground Color

mov cx, b800h
mov es, cx
mov ah, 40h ; Red Background Black foreground
mov al, 'A'     ; Character 65
mov [es:0000], ax ; print at X 0 Y 0

To calculate an offset into video ram using zero-based
XY coordinates for 80x25 screen:
(Y*80+X)*2

Notnull pretty much covered it, but made this for you quick.

[org 0100h]

[section .text]

main:
	mov cx,our_message_l	;Load amount of chars to print in CX
	dec cx
	dec cx
	dec cx			;Lower cx by 3 as not to display "13, 10, "$"" on the colored line.
	mov bl,[color]		;Load color value in BL
	mov ah,9		;Function 9x10 - Print char with attribute
	mov al,0		;Null AL so that it does not print chars by default
	int 10h			;Call BIOS and display the colored bit..

		;We can skip 'mov ah,9' as we already have 9 bits in AL
	mov dx,our_message
	int 21h			;Use DOS v-21h to display string

	mov ah,4ch		;Exit routine..
	mov al,0		;Exit with ERRORLEVEL of 0
	int 21h	




[section .data]

color db 64h
our_message db "Hello, world.", 13, 10, "$"
our_message_l EQU $-our_message			;Get message length
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.