Low ASCII Characters

 BBS: Inland Empire Archive
Date: 12-03-92 (07:00)             Number: 381
From: RAY CARSON                   Refer#: NONE
  To: MIKE KERR                     Recvd: NO  
Subj: Low ASCII Characters           Conf: (2) Quik_Bas

Mike Kerr,

MK> I'm writing a program that requires me to be able to display low-end
MK> ascii characters (0-31).  Unfortunately, these characters are also used
MK> as control codes for line feeds, etc, as most of you know.
MK> How can I display those characters without accessing the control codes?

I posted this message a day or two ago but maybe it didn't make it out
because I still see questions about this. This is one way of displaying
any ASCII character using only QB code.

DEFINT A-Z
DECLARE SUB PrintChar (Row, Column, Fg, Bg, ASCVal)
CLS
X = 0
DO
    CALL PrintChar(5, 5 + X, 15, 1, 7)
    CALL PrintChar(7, 10 + X, 15, 4, 12)
    CALL PrintChar(9, 15 + X, 0, 3, 13)
    X = X + 1
LOOP UNTIL X = 50
END

DEFINT A-Z
'   Display low ASCII value characters.
'
'   Input to SUB:
'       Row ..................... (1 to 25)
'       Column .................. (1 to 80)
'       Fg ............... Foreground color
'       Bg ............... Background color
'       ASCVal ...... ASCII value of character
'
SUB PrintChar (Row, Column, Fg, Bg, ASCVal)

    Offset = ((Row - 1) * 80 + (Column - 1)) * 2
    Attr = (Fg AND 16) * 8 + ((Bg AND 7) * 16) + (Fg AND 15)
    DEF SEG = 0
    Address = PEEK(1040) AND 48
    IF Address = 48 THEN
        MonitorAddress = &HB000
    ELSE
        MonitorAddress = &HB800
    END IF
    DEF SEG = MonitorAddress
    POKE Offset, ASCVal
    POKE Offset + 1, Attr
    DEF SEG

END SUB



--- T.A.G. 2.6c3e Beta
 * Origin: CSI Online - USR/DS - TagScan/TagRAM Alpha Sites... (1:106/3198)
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