home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / basic / bmag / ascihelp.bas < prev    next >
Encoding:
BASIC Source File  |  1994-05-01  |  2.2 KB  |  43 lines

  1. '─ Area: F-QUICKBASIC ─────────────────────────────────────────────────────────
  2. '  Msg#: 399                                          Date: 28 Apr 94  05:22:25
  3. '  From: Mark Butler                                  Read: Yes    Replied: No 
  4. '    To: Bill White                                   Mark:                     
  5. '  Subj: Help with Ascii
  6. '──────────────────────────────────────────────────────────────────────────────
  7. 'Once upon a time Bill White uttered these sage words to David Cassell:
  8.  
  9. ' Bill, when printing to the console PRINT #1, CHR$(7) works exactly the
  10. ' same as PRINT CHR$(7). That is, you _hear the bell rather than see it on
  11. ' your screen. I think David would like to know how to *literally* print
  12. ' the character symbol to the screen without it taking action (beeping).
  13. ' One way to print unprintable chars is by POKEing them directly into the
  14. ' video segment. Below is an example that prints everything in the ASCII
  15. ' chart that has a literal symbol. Chars 0 and 255 don't have symbols so
  16. ' we won't bother with those and print chars 1 through 254....
  17.  
  18.  
  19.     CLS
  20.  
  21.     DEF SEG = &H40                   ' \
  22.     equip = PEEK(&H10)               ' -First well need to discern
  23.     IF (equip AND 48) = 48 THEN      ' whether we're going to be
  24.         DEF SEG = &HB000             ' poking to a mono card or
  25.     ELSE                             ' a color card and set the
  26.         DEF SEG = &HB800             ' segment accordingly
  27.     END IF                           ' /
  28.  
  29.     x = 1                            ' -we'll start with char$(1)
  30.                                      ' and end with char$(254)
  31.     FOR offset = 0 TO 510 STEP 2     ' -Individual screen offset is
  32.                                      ' arranged as location/attribute
  33.                                      ' so we'll increment by 2s so as
  34.                                      ' to poke X only to the screen
  35.                                      ' location not the color attrib.
  36.         POKE offset, x               ' -Poke char X at the offset.
  37.         x = x + 1                    ' -Increment char by 1
  38.  
  39.     NEXT offset                      ' -do it again
  40.  
  41.     DEF SEG                          ' -restore BASIC segment
  42.  
  43.