
Step ?:
Step Title     : ASCII chart
File Name      : ascii.txt
Author         : Michael Preslar / E_Maus
Author Note    : Every keycode combo known..
Example Source : none
Date           : September 30th, 1998
Length         : 19 pages

Foreword:
=========
This is a complete ASCII chart. It includes the decramental, hexadecimal,
and binary value of each ASCII value.

Decramental (dec) is "base 10".. aka "x to the power of 10".. Its the method
humans are used to using. It counts like so: 0,1,2..7,8,9 .. 10,11,12..17,18,
19.. 20,21,22 .. 27,28,29.. etc etc..

Hexadecimal (hex) is "base 16".. It counts like so: 00,01,02 .. 0D,0E,0F to
F0,F1,F2 .. FD,FE,FF. The lowest number being 00 the highest being FF.

Binary (bin) is "base 2".. It uses a combination of 1's and 0's to make its
numbers. Each number has 8 numbers.. The lowest is 00000000, and the highest
is 11111111.

The ASCII characters listed here are the visible ones. Let me try to describe
the ones that arent.. Dec 0 is a null character. Dec 9 is a circle. Dec 10
is a small block, half the size and resembling Dec 8. Dec 13 is a single music
note. Dec 13 is also the equivalent to the "enter" key. Dec 32 is a "space" or
the "space bar" key. Dec 255 is what I know as an "inverted space".

The source from the program I used to generate this chart is at the bottom.
The hex and binary functions were taken from SWAG.

Wondering how you can use this chart? 2 ways..
  1) If youre drawing a box or something, instead of grabbing the character
  from TheDraw or something, you can use chr(whatever) where "whatever" is
  the decramental value of the ascii character.
  2) You can cross reference keycodes and the ascii chart to figure out what
  the keys on your keyboard look like to the computer.

Although Its very rare, I have ran across source (most from SWAG) that would
implement its own keyboard handler. Most of the time, when it did, it used
either the hex or binary value of the key. Ive included the hex and bin values
only for that purpose.

Keep in mind that the last 128 ASCII codes (numbers 128 to 255) are specific
to IBM PC's and IBM compatibles.

  Dec (x10)  Hex (x16)  Bin  (x2)  Ascii
-------------------------------------------
    0           00      0000:0000     
    1           01      0000:0001    
    2           02      0000:0010    
    3           03      0000:0011    
    4           04      0000:0100    
    5           05      0000:0101    
    6           06      0000:0110    
    7           07      0000:0111    
    8           08      0000:1000    
    9           09      0000:1001
   10           0A      0000:1010
   11           0B      0000:1011    
   12           0C      0000:1100    
   13           0D      0000:1101
   14           0E      0000:1110    
   15           0F      0000:1111    
   16           10      0001:0000    
   17           11      0001:0001    
   18           12      0001:0010    
   19           13      0001:0011    
   20           14      0001:0100    
   21           15      0001:0101    
   22           16      0001:0110    
   23           17      0001:0111    
   24           18      0001:1000    
   25           19      0001:1001    
   26           1A      0001:1010    
   27           1B      0001:1011    
   28           1C      0001:1100    
   29           1D      0001:1101    
   30           1E      0001:1110    
   31           1F      0001:1111    
   32           20      0010:0000
   33           21      0010:0001    !
   34           22      0010:0010    "
   35           23      0010:0011    #
   36           24      0010:0100    $
   37           25      0010:0101    %
   38           26      0010:0110    &
   39           27      0010:0111    '
   40           28      0010:1000    (
   41           29      0010:1001    )
   42           2A      0010:1010    *
   43           2B      0010:1011    +
   44           2C      0010:1100    ,
   45           2D      0010:1101    -
   46           2E      0010:1110    .
   47           2F      0010:1111    /
   48           30      0011:0000    0
   49           31      0011:0001    1
   50           32      0011:0010    2
   51           33      0011:0011    3
   52           34      0011:0100    4
   53           35      0011:0101    5
   54           36      0011:0110    6
   55           37      0011:0111    7
   56           38      0011:1000    8
   57           39      0011:1001    9
   58           3A      0011:1010    :
   59           3B      0011:1011    ;
   60           3C      0011:1100    <
   61           3D      0011:1101    =
   62           3E      0011:1110    >
   63           3F      0011:1111    ?
   64           40      0100:0000    @
   65           41      0100:0001    A
   66           42      0100:0010    B
   67           43      0100:0011    C
   68           44      0100:0100    D
   69           45      0100:0101    E
   70           46      0100:0110    F
   71           47      0100:0111    G
   72           48      0100:1000    H
   73           49      0100:1001    I
   74           4A      0100:1010    J
   75           4B      0100:1011    K
   76           4C      0100:1100    L
   77           4D      0100:1101    M
   78           4E      0100:1110    N
   79           4F      0100:1111    O
   80           50      0101:0000    P
   81           51      0101:0001    Q
   82           52      0101:0010    R
   83           53      0101:0011    S
   84           54      0101:0100    T
   85           55      0101:0101    U
   86           56      0101:0110    V
   87           57      0101:0111    W
   88           58      0101:1000    X
   89           59      0101:1001    Y
   90           5A      0101:1010    Z
   91           5B      0101:1011    [
   92           5C      0101:1100    \
   93           5D      0101:1101    ]
   94           5E      0101:1110    ^
   95           5F      0101:1111    _
   96           60      0110:0000    `
   97           61      0110:0001    a
   98           62      0110:0010    b
   99           63      0110:0011    c
  100           64      0110:0100    d
  101           65      0110:0101    e
  102           66      0110:0110    f
  103           67      0110:0111    g
  104           68      0110:1000    h
  105           69      0110:1001    i
  106           6A      0110:1010    j
  107           6B      0110:1011    k
  108           6C      0110:1100    l
  109           6D      0110:1101    m
  110           6E      0110:1110    n
  111           6F      0110:1111    o
  112           70      0111:0000    p
  113           71      0111:0001    q
  114           72      0111:0010    r
  115           73      0111:0011    s
  116           74      0111:0100    t
  117           75      0111:0101    u
  118           76      0111:0110    v
  119           77      0111:0111    w
  120           78      0111:1000    x
  121           79      0111:1001    y
  122           7A      0111:1010    z
  123           7B      0111:1011    {
  124           7C      0111:1100    |
  125           7D      0111:1101    }
  126           7E      0111:1110    ~
  127           7F      0111:1111    
  128           80      1000:0000    
  129           81      1000:0001    
  130           82      1000:0010    
  131           83      1000:0011    
  132           84      1000:0100    
  133           85      1000:0101    
  134           86      1000:0110    
  135           87      1000:0111    
  136           88      1000:1000    
  137           89      1000:1001    
  138           8A      1000:1010    
  139           8B      1000:1011    
  140           8C      1000:1100    
  141           8D      1000:1101    
  142           8E      1000:1110    
  143           8F      1000:1111    
  144           90      1001:0000    
  145           91      1001:0001    
  146           92      1001:0010    
  147           93      1001:0011    
  148           94      1001:0100    
  149           95      1001:0101    
  150           96      1001:0110    
  151           97      1001:0111    
  152           98      1001:1000    
  153           99      1001:1001    
  154           9A      1001:1010    
  155           9B      1001:1011    
  156           9C      1001:1100    
  157           9D      1001:1101    
  158           9E      1001:1110    
  159           9F      1001:1111    
  160           A0      1010:0000    
  161           A1      1010:0001    
  162           A2      1010:0010    
  163           A3      1010:0011    
  164           A4      1010:0100    
  165           A5      1010:0101    
  166           A6      1010:0110    
  167           A7      1010:0111    
  168           A8      1010:1000    
  169           A9      1010:1001    
  170           AA      1010:1010    
  171           AB      1010:1011    
  172           AC      1010:1100    
  173           AD      1010:1101    
  174           AE      1010:1110    
  175           AF      1010:1111    
  176           B0      1011:0000    
  177           B1      1011:0001    
  178           B2      1011:0010    
  179           B3      1011:0011    
  180           B4      1011:0100    
  181           B5      1011:0101    
  182           B6      1011:0110    
  183           B7      1011:0111    
  184           B8      1011:1000    
  185           B9      1011:1001    
  186           BA      1011:1010    
  187           BB      1011:1011    
  188           BC      1011:1100    
  189           BD      1011:1101    
  190           BE      1011:1110    
  191           BF      1011:1111    
  192           C0      1100:0000    
  193           C1      1100:0001    
  194           C2      1100:0010    
  195           C3      1100:0011    
  196           C4      1100:0100    
  197           C5      1100:0101    
  198           C6      1100:0110    
  199           C7      1100:0111    
  200           C8      1100:1000    
  201           C9      1100:1001    
  202           CA      1100:1010    
  203           CB      1100:1011    
  204           CC      1100:1100    
  205           CD      1100:1101    
  206           CE      1100:1110    
  207           CF      1100:1111    
  208           D0      1101:0000    
  209           D1      1101:0001    
  210           D2      1101:0010    
  211           D3      1101:0011    
  212           D4      1101:0100    
  213           D5      1101:0101    
  214           D6      1101:0110    
  215           D7      1101:0111    
  216           D8      1101:1000    
  217           D9      1101:1001    
  218           DA      1101:1010    
  219           DB      1101:1011    
  220           DC      1101:1100    
  221           DD      1101:1101    
  222           DE      1101:1110    
  223           DF      1101:1111    
  224           E0      1110:0000    
  225           E1      1110:0001    
  226           E2      1110:0010    
  227           E3      1110:0011    
  228           E4      1110:0100    
  229           E5      1110:0101    
  230           E6      1110:0110    
  231           E7      1110:0111    
  232           E8      1110:1000    
  233           E9      1110:1001    
  234           EA      1110:1010    
  235           EB      1110:1011    
  236           EC      1110:1100    
  237           ED      1110:1101    
  238           EE      1110:1110    
  239           EF      1110:1111    
  240           F0      1111:0000    
  241           F1      1111:0001    
  242           F2      1111:0010    
  243           F3      1111:0011    
  244           F4      1111:0100    
  245           F5      1111:0101    
  246           F6      1111:0110    
  247           F7      1111:0111    
  248           F8      1111:1000    
  249           F9      1111:1001    
  250           FA      1111:1010    
  251           FB      1111:1011    
  252           FC      1111:1100    
  253           FD      1111:1101    
  254           FE      1111:1110    
  255           FF      1111:1111    


(* Hex converts a number (num) to Hexadecimal.                      *)
(*    num  is the number to convert                                 *)
(*    nib  is the number of Hexadecimal digits to return            *)
(* Example: Hex(31, 4) returns '001F'                               *)

Function Hex(num: Word; nib: Byte): String; Assembler;
ASM
      PUSHF
      LES  DI, @Result
      XOR  CH, CH
      MOV  CL, nib
      MOV  ES:[DI], CL
      JCXZ @@3
      ADD  DI, CX
      MOV  BX, num
      STD
@@1:  MOV  AL, BL
      AND  AL, $0F
      OR   AL, $30
      CMP  AL, $3A
      JB   @@2
      ADD  AL, $07
@@2:  STOSB
      SHR  BX, 1
      SHR  BX, 1
      SHR  BX, 1
      SHR  BX, 1
      LOOP @@1
@@3:  POPF
End;


(* Binary converts a number (num) to Binary.                        *)
(*    num  is the number to convert                                 *)
(*    bits is the number of Binary digits to return                 *)
(* Example: Binary(31, 16) returns '0000000000011111'               *)

Function Binary(num: Word; bits: Byte): String; Assembler;
ASM
      PUSHF
      LES  DI, @Result
      XOR  CH, CH
      MOV  CL, bits
      MOV  ES:[DI], CL
      JCXZ @@3
      ADD  DI, CX
      MOV  BX, num
      STD
@@1:  MOV  AL, BL
      AND  AL, $01
      OR   AL, $30
      STOSB
      SHR  BX, 1
      LOOP @@1
@@3:  POPF
End;

var w:word;
    tf:text;
    bin:string;

begin
assign(tf,'AsciiLst.txt');
rewrite(tf);
writeln(tf,'  Dec (x10)  Hex (x16)  Bin  (x2)  Ascii');
writeln(tf,'-------------------------------------------');

for w:= 0 to 255 do
begin
bin:=binary(w,8);
insert(':',bin,5);
writeln(tf,w:5,hex(w,2):13,'      ',bin,'    ',chr(w));
end;
close(tf);
end.
