Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DAY 030: _CONTROLCHR
#1
Ever want to be able to see the ASCII characters that do things like eject the printer paper, CHR$(12)? Well with the keyword _CONTROLCHR OFF, you can! And if you act now, because we can't do this all day, we'll throw in _CONTROLCHR$ ON at no extra charge. Just pay separate shipping and handling.

SYNTAX _CONTROLCHR {OFF|ON}

Code: (Select All)
WIDTH 127, 20
_FONT 16
_KEYCLEAR
msg$ = "ASCII CHaracter Chart"
LOCATE 1, _WIDTH \ 2 - LEN(msg$) \ 2
PRINT msg$;
c = 1
_CONTROLCHR OFF
FOR i = 0 TO 255 ' There are 256 ASCII characters.
    i$ = LTRIM$(STR$(i))
    FOR j = 1 TO 2
        IF LEN(i$) < 3 THEN i$ = "0" + i$
    NEXT
    IF i AND i MOD (_HEIGHT - 4) = 0 THEN c = c + 8: LOCATE 3, c
    LOCATE i MOD (_HEIGHT - 4) + 3, c + 1: PRINT i$; " "; CHR$(i);
NEXT
SLEEP

_CONTROLCHR ON
_DELAY .5
FOR i = 1 TO _HEIGHT
    PRINT CHR$(13);
    _DELAY .2
NEXT

So now we have some nice symbols we can print to the screen for our text programs, which without this KEYWORD, would be used for the following...

Code: (Select All)
CTRL + A = CHR$(1)   ?  StartHeader (SOH)    CTRL + B = CHR$(2)   ?  StartText         (STX)
CTRL + C = CHR$(3)   ?  EndText     (ETX)    CTRL + D = CHR$(4)   ?  EndOfTransmit     (EOT)
CTRL + E = CHR$(5)   ?  Enquiry     (ENQ)    CTRL + F = CHR$(6)   ?  Acknowledge       (ACK)
CTRL + G = CHR$(7)   •  Bell        (BEL)    CTRL + H = CHR$(8)   ?  [Backspace]       (BSP)
CTRL + I = CHR$(9)   ?  Horiz.Tab   [Tab]    CTRL + J = CHR$(10)  ?  LineFeed(printer) (LF)
CTRL + K = CHR$(11)  ?  Vert. Tab   (VT)     CTRL + L = CHR$(12)  ?  FormFeed(printer) (FF)
CTRL + M = CHR$(13)  ?  [Enter]     (CR)     CTRL + N = CHR$(14)  ?  ShiftOut          (SO)
CTRL + O = CHR$(15)  ¤  ShiftIn     (SI)     CTRL + P = CHR$(16)  ?  DataLinkEscape    (DLE)
CTRL + Q = CHR$(17)  ?  DevControl1 (DC1)    CTRL + R = CHR$(18)  ?  DeviceControl2    (DC2)
CTRL + S = CHR$(19)  ?  DevControl3 (DC3)    CTRL + T = CHR$(20)  ¶  DeviceControl4    (DC4)
CTRL + U = CHR$(21)  §  NegativeACK (NAK)    CTRL + V = CHR$(22)  ?  Synchronous Idle  (SYN)
CTRL + W = CHR$(23)  ?  EndTXBlock  (ETB)    CTRL + X = CHR$(24)  ?  Cancel            (CAN)
CTRL + Y = CHR$(25)  ?  EndMedium   (EM)     CTRL + Z = CHR$(26)  ?  End Of File(SUB)  (EOF)

Note that PRINT CHR$(7) used t sound a BEEP in QuickBasic and older QB64 versions, but not any longer. I wonder who the dev was who decided to get the BEEP out of QB64?

Pete
Reply


Messages In This Thread
DAY 030: _CONTROLCHR - by Pete - 12-11-2022, 02:13 AM
RE: DAY 030: _CONTROLCHR - by mnrvovrfc - 12-11-2022, 02:37 AM
RE: DAY 030: _CONTROLCHR - by Pete - 12-11-2022, 03:00 AM
RE: DAY 030: _CONTROLCHR - by mnrvovrfc - 12-11-2022, 03:07 AM
RE: DAY 030: _CONTROLCHR - by SMcNeill - 12-11-2022, 11:27 AM
RE: DAY 030: _CONTROLCHR - by vince - 12-11-2022, 12:49 PM



Users browsing this thread: 4 Guest(s)