Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  The following BASIC program displays all 256 characters along with their
  numeric codes in both decimal and hexadecimal notation. The characters are
  also listed in Figure C-1.

  1000 ' display all the PC characters
  1010 '
  1020 MONOCHROME = 1
  1030 IF MONOCHROME THEN WW = 80 : HH = &HB000
       ELSE WW = 40 : HH = &HB800
  1040 GOSUB 2000                                 ' initialize DS register
  1050 FOR I = 0 TO 255                           ' for all character codes
  1060   GOSUB 3000                               ' display the information
  1070 NEXT I
  1080 PRINT "Done."
  1090 GOSUB 6000
  1092 COLOR 0,0,0
  1095 SYSTEM
  1999 '
  2000 ' initialize
  2010 '
  2020 DEF SEG = HH                               ' set up DS register for poke
  2030 KEY OFF : CLS                              ' set up the screen
  2040 WIDTH WW : COLOR 14,1,1
  2050 FOR I = 1 TO 25 : PRINT : NEXT I
  2060 PRINT " Demonstrating all characters"
  2070 GOSUB 5000                              ' periodic subheading
  2080 RETURN
  2099 '
  3000 ' display character information
  3010 '
  3020 PRINT USING " ###     ";I;
  3030 IF I < 16 THEN PRINT "0";
  3040 PRINT HEX$(I);"          ";
  3050 POKE WW * 2 * 23 + 34, I                ' insert the character
  3060 GOSUB 4000                              ' print any comments
  3070 IF (I MOD 16) < 15 THEN RETURN          ' pause after each 16 characters
  3080 GOSUB 6000
  3090 IF I < 255 THEN GOSUB 5000
  3100 RETURN
  3997 '
  3998 ' character comments
  3999 '
  4000 IF I =   0 THEN PRINT "shows blank";
  4007 IF I =   7 THEN PRINT "beep (bell)";
  4008 IF I =   8 THEN PRINT "backspace";
  4009 IF I =   9 THEN PRINT "tab";
  4010 IF I =  10 THEN PRINT "linefeed";
  4012 IF I =  12 THEN PRINT "page eject";
  4013 IF I =  13 THEN PRINT "carriage return";
  4026 IF I =  26 THEN PRINT "end text file";
  4032 IF I =  32 THEN PRINT "true blank space";
  4255 IF I = 255 THEN PRINT "shows blank";
  4997 PRINT                                    ' finish the line
  4998 RETURN
  4999 '
  5000 ' periodic subheading
  5010 '
  5020 COLOR 15
  5030 PRINT
  5040 PRINT
  5050 PRINT "Decimal - Hex - Char - Comments"
  5060 PRINT
  5070 COLOR 14
  5080 RETURN
  5999 '
  6000 ' pause
  6010 '
  6020 IF INKEY$ <> "" THEN GOTO 6020
  6030 PRINT
  6040 COLOR 2
  6050 PRINT "Press any key to continue..."
  6060 COLOR 14
  6070 IF INKEY$ = "" THEN GOTO 6070
  6080 PRINT
  6090 RETURN


               Number
  Char        Dec  Hex                 Control
  --------------------------------------------------------------------------
                0  00H                 NUL (Null)
                1  01H                 SOH (Start of heading)
  .             2  02H                 STX (Start of text)
  .             3  03H                 ETX (End of text)
  .             4  04H                 EOT (End of transmission)
  .             5  05H                 ENQ (Enquiry)
  .             6  06H                 ACK (Acknowledge)
  .             7  07H                 BEL (Bell)
  .             8  08H                 BS  (Backspace)
                9  09H                 HT  (Horizontal tab)
               10  0AH                 LF   (Linefeed)
               11  0BH                 VT  (Vertical tab)
               12  0CH                 FF  (Formfeed)
               13  0DH                 CR  (Carriage return)
  .            14  0EH                 SO  (Shift out)
               15  0FH                 SI  (Shift in)
  .            16  10H                 DLE (Data link escape)
  .            17  11H                 DC1 (Device control 1)
  .            18  12H                 DC2 (Device control 2)
  .            19  13H                 DC3 (Device control 3)
  .            20  14H                 DC4 (Device control 4)
  .            21  15H                 NAK (Negative acknowledge)
  .            22  16H                 SYN (Synchronous idle)
  .            23  17H                 ETB (End transmission block)
  .            24  18H                 CAN (Cancel)
  .            25  19H                 EM  (End of medium)
               26  1AH                 SUB (Substitute)
  .            27  1BH                 ESC (Escape)
  .            28  1CH                 FS  (File separator)
  .            29  1DH                 GS  (Group separator)
  .            30  1EH                 RS  (Record separator)
               31  1FH                 US  (Unit separator)
               32  20H
  !            33  21H
  "            34  22H
  #            35  23H
  $            36  24H
  %            37  25H
  &            38  26H
  `            39  27H
  (            40  28H
  )            41  29H
  *            42  2AH
  +            43  2BH
  ,            44  2CH
  -            45  2DH
  .            46  2EH
  /            47  2FH
  0            48  30H
  1            49  31H
  2            50  32H
  3            51  33H
  4            52  34H
  5            53  35H
  6            54  36H
  7            55  37H
  8            56  38H
  9            57  39H
  :            58  3AH
  ;            59  3BH
  <            60  3CH
  =            61  3DH
  >            62  3EH
  ?            63  3FH
  @            64  40H
  A            65  41H
  B            66  42H
  C            67  43H
  D            68  44H
  E            69  45H
  F            70  46H
  G            71  47H
  H            72  48H
  I            73  49H
  J            74  4AH
  K            75  4BH
  L            76  4CH
  M            77  4DH
  N            78  4EH
  O            79  4FH
  P            80  50H
  Q            81  51H
  R            82  52H
  S            83  53H
  T            84  54H
  U            85  55H
  V            86  56H
  W            87  57H
  X            88  58H
  Y            89  59H
  Z            90  5AH
  [            91  5BH
  \            92  5CH
  ]            93  5DH
              94  5EH
  _            95  5FH
  `            96  60H
  a            97  61H
  b            98  62H
  c            99  63H
  d           100  64H
  e           101  65H
  f           102  66H
  g           103  67H
  h           104  68H
  i           105  69H
  j           106  6AH
  k           107  6BH
  l           108  6CH
  m           109  6DH
  n           110  6EH
  o           111  6FH
  p           112  70H
  q           113  71H
  r           114  72H
  s           115  73H
  t           116  74H
  u           117  75H
  v           118  76H
  w           119  77H
  x           120  78H
  y           121  79H
  z           122  7AH
  {           123  7BH
  |           124  7CH
  }           125  7DH
  ~           126  7EH
              127  7FH   DEL
  .           128  80H
  .           129  81H
  .           130  82H
  .           131  83H
  .           132  84H
  .           133  85H
  .           134  86H
  .           135  87H
  .           136  88H
  .           137  89H
  .           138  8AH
  .           139  8BH
  .           140  8CH
  .           141  8DH
  .           142  8EH
  .           143  8FH
  .           144  90H
  .           145  91H
  .           146  92H
  .           147  93H
  .           148  94H
  .           149  95H
  .           150  96H
  .           151  97H
  .           152  98H
  .           153  99H
  .           154  9AH
  .           155  9BH
  .           156  9CH
  .           157  9DH
  .           158  9EH
  .           159  9FH
  .           160  A0H
  .           161  A1H
  .           162  A2H
  .           163  A3H
  .           164  A4H
  .           165  A5H
  .           166  A6H
  .           167  A7H
  .           168  A8H
  .           169  A9H
  .           170  AAH
  .           171  ABH
  .           172  ACH
  .           173  ADH
  .           174  AEH
  .           175  AFH
  #           176  B0H
  #           177  B1H
  #           178  B2H
  |           179  B3H
  |           180  B4H
  |           181  B5H
  |           182  B6H
  +           183  B7H
  +           184  B8H
  |           185  B9H
  |           186  BAH
  +           187  BBH
  +           188  BCH
  +           189  BDH
  +           190  BEH
  +           191  BFH
  +           192  C0H
  -           193  C1H
  -           194  C2H
  |           195  C3H
  -           196  C4H
  +           197  C5H
  -           198  C6H
  -           199  C7H
  +           200  C8H
  +           201  C9H
  -           202  CAH
  -           203  CBH
  |           204  CCH
  -           205  CDH
  +           206  CEH
  -           207  CFH
  -           208  D0H
  -           209  D1H
  -           210  D2H
  +           211  D3H
  +           212  D4H
  +           213  D5H
  +           214  D6H
  +           215  D7H
  +           216  D8H
  +           217  D9H
  +           218  DAH
  #           219  DBH
  #           220  DCH
  #           221  DDH
  #           222  DEH
  #           223  DFH
              224  E0H
  .           225  E1H
  .           226  E2H
  .           227  E3H
  .           228  E4H
  .           229  E5H
  .           230  E6H
  .           231  E7H
  .           232  E8H
  .           233  E9H
  .           234  EAH
  .           235  EBH
  .           236  ECH
  .           237  EDH
  .           238  EEH
  .           239  EFH
  .           240  F0H
  .           241  F1H
  .           242  F2H
  .           243  F3H
  .           244  F4H
  .           245  F5H
  .           246  F6H
  .           247  F7H
  .           248  F8H
  .           249  F9H
  .           250  FAH
  .           251  FBH
  .           252  FCH
  .           253  FDH
  .           254  FEH
              255  FFH
  --------------------------------------------------------------------------


  Figure C-1.  The IBM PC and PS/2 family character set.

  The BASIC program is designed to adjust itself to a monochrome or color
  video mode based on the value shown in line 1020: 1 (as shown) indicates a
  monochrome mode; 0 indicates a color mode. The value in line 1020 causes
  the program to set two values:

  .  The location, in screen memory, where the POKE command inserts display
     information

  .  The screen width (40 or 80 columns)

  The POKE statement in line 3050 causes the characters to appear. This
  extra step is necessary because a few characters cannot be displayed by
  the ordinary PRINT statement. See "The First 32 ASCII Characters," page
  483, for an explanation.

  Each of the 256 characters is visually unique, except for ASCII 00H and
  ASCII FFH (decimal 255), which appear the same as the blank-space
  character, CHR$(32).

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson