Re: CHR$(...)

 BBS: Inland Empire Archive
Date: 04-05-92 (12:44)             Number: 192
From: ERIC MILLER                  Refer#: NONE
  To: JOHN GALLAS                   Recvd: NO  
Subj: Re: CHR$(...)                  Conf: (2) Quik_Bas
To put tricky control characters on the screen, you might need to
use a POKE statement to put the character at a specific
place in text video memory.
   This is tricky, because it needs a formula that accounts
for each character having a color value and an ASCII
value.  Also depending on
whether you use monochrome or color, you might need to use a different
routine because mine works for color text in SCREEN 0.  I have no idea
how to print them in grpahics modes.

DEF SEG = &HB800          'Color text memory segment
Ch = ASC(C$)              'Get ASCII value of your character
Addr = (Y - 1) * 160 + (X - 1) * 2   'find location of X,Y
POKE Addr, Ch                        'Place Chr$(Ch) at X,Y

 If you don't catch that, what you have to do is account for
160 bytes per line in text memory (80 * 2) so you multiply
that * Y - 1.  Then add X-1 * 2 to account for the columns across.
That gives you the location of the character.  To change the color,
add 1 to Addr.  I had to find this out myself for writing a program
that places the time at random locations but puts the original text

 Eric Miller

--- QuickBBS 2.75 Ovr
 * Origin: Pretzel Logic BBS 512-497-4552- San Antonio, TX (1:387/401)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET