1. ASCII characters

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.

I tried using put_screen_char, but I keep getting the error:

"Slice ends past end of sequence (142 > 2)"

Not sure what I was doing wrong or if I am not allowed to use that func in
80x25 text mode. Some help, please?

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?

Thanks a bunch,

Scott

new topic     » topic index » view message » categorize

2. Re: ASCII characters

Why don't you do something like this:

.
.
.
text_color(color_you_want_the_text)
bk_color(color_you_want_the_background)
position(1,1)
puts(1,single ascii code or sequence of them)
 --Ex. puts(1,185)  OR  puts(1,{185,23,67,110})
.
.
.



=====
It compiled.  The first screen came up.  Ship it.
     --Bill Gates

__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail – Free email you can access from anywhere!
http://mail.yahoo.com/

new topic     » goto parent     » topic index » view message » categorize

3. Re: ASCII characters

Thanks, Mike. That works great...

Scott

----- Original Message -----
From: Mike Hurley <mike_hurley_2 at YAHOO.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, July 09, 2000 7:22 PM
Subject: Re: ASCII characters


> Why don't you do something like this:
>
> .
> .
> .
> text_color(color_you_want_the_text)
> bk_color(color_you_want_the_background)
> position(1,1)
> puts(1,single ascii code or sequence of them)
>  --Ex. puts(1,185)  OR  puts(1,{185,23,67,110})
> .
> .
> .
>
>
>
> =====
> It compiled.  The first screen came up.  Ship it.
>      --Bill Gates
>
> __________________________________________________
> Do You Yahoo!?
> Get Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: ASCII characters

>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 message » categorize

5. Re: ASCII characters

I haven't used this formula in awhile, but I think it is

foreground + (background * 16)

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu