Re: ASCII characters

new topic     » goto parent     » topic index » view thread      » older message » newer message

>From:    Scott Henry <shenry at TCON.NET>

>If I want ASCII character #185, what is the easiest way to print that to the
>screen? I should mention I am working in DOS 32 in an 80x25 graphics mode.

puts( 1, { 185 } )
(if you're not worried about where it gets printed or what color)


>Also when using that func, what is the formula for determining the attribute
>number for a character? For instance, the example from the documentation:

>put_screen_char(1, 1, {'A', 152, 'Z', 131})

>How do you arrive at 152 and 131 in the above? It said something about being
>platform dependent? What are the correct attributes for DOS, for instance?

I don't recognize that procedure...but if it's anything like
display_text_image()
(or like poking to the video memory) then attributes are determined like so:
<BACKGROUND_COLOR> * #10 + <FOREGROUND_COLOR>
So that example would print A in grey on bright blue and Z in cyan on grey.

If you wanted, say, white text on a blue background you would use:

integer att
att = BLUE * #10 + WHITE
put_screen_char( 1, 1, { 185, att } )

(assuming I'm guessing right about what the procedure does)

The reason for doing something like that instead of using text_color() and
bk_color() is that if you use bk_color() it changes the background of the
whole screen and alters the palette, but by using attributes poked in you
can set different background colors for individual characters without
messing up the palette and the rest of the screen.

If the background color is unimportant, I'd just use
[position( <LINE>, <COLUMN> )]
[text_color( <COLOR> )]
puts( 1, <TEXT> )

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu