The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: anuradha on July 20, 2007, 09:54:23 PM

Title: fonts
Post by: anuradha on July 20, 2007, 09:54:23 PM
hi
can any one tell me how to write a programe with different font colors and back grounds????
thanks.
Title: Re: fonts
Post by: ninjarider on July 21, 2007, 12:41:49 AM
look for it in ralph browns interrupt list. looking for int 10h
Title: Re: fonts
Post by: MichaelW on July 21, 2007, 09:28:40 AM
http://www.ctyme.com/intr/int-10.htm
Title: Re: fonts
Post by: anuradha on July 22, 2007, 03:18:02 AM
hi
thanks for replies
but int 10h which fuction??????
thankx
Title: Re: fonts
Post by: MichaelW on July 22, 2007, 06:20:02 AM
It would depend on what you are trying to do. If you are trying to display characters and control the foreground and background colors, then try functions AH=9 or AH=13h.

A quick example:

.model small
.stack
.data
  str1 db "a",1,"b",2,"c",3,"d",4,"e",5,"f",6,"g",7,"h",8
       db "i",9,"j",10,"k",11,"l",12,"m",13,"n",14,"o",15
.code
.startup
    mov ah, 13h     ; function number
    mov al, 11b     ; mode (char-attribute, update cursor)
    mov bh, 0       ; page number
    mov cx, 15      ; length of string
    mov dh, 0       ; start at row 0
    mov dl, 0       ; start at column 0
    push ds         ; es:bp -> string
    pop es
    mov bp, OFFSET str1
    int 10h

    mov ah, 9       ; function number
    mov al, "X"     ; character
    mov bh, 0       ; page number
    mov bl, 14h     ; attribute, red on blue
    mov cx, 4       ; repeat count
    int 10h

    mov ah, 0       ; wait for key press
    int 16h
.exit
end