TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: GLENN VERDINS
from: JAMES VAHN
date: 1997-06-15 08:46:00
subject: Re: text attribute

Glenn Verdins wrote:
> How do i write a string to the screen, but being able to specify a text
> attribute? Like the Mov Ah,9 Int 21 function, only with colors?
DOS (int 21) doesn't seem to support it, but you can use int 10 service 13
or direct screen writes. My own feelings are that it is easier to use
direct writes. The color text screen starts at B800:0000 and begins with
the character, the next location (0001) contains the color attribute.
The 80x25 text screen is 2000 characters plus 2000 attributes, for a total
of 4000 memory locations.  
C=character, A=attribute   
CACACACACACACACACACACACA, etc.
Here's an example, cheating a bit in using SPACES for the color 
attribute:
cseg segment
assume cs:cseg
org 100h                   ;CS=DS=ES=SS, COM file.
os equ offset
 _txt struc
     t1 db  "H e l l o   W o r l d ! "
 _txt ends
Begin:
        mov ax,0B800h
        mov es,ax
        mov cx,12
        mov si,os txt.t1
        mov di,160*10
        rep movsw
        int 20h
txt _txt 
cseg ends
end Begin
... The Moon is Waxing Gibbous (73% of Full)
--- ifmail v.2.10-tx8.2
---------------
* Origin: (jvahn@short.circuit.com) (1:346/15.1)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.