Question 3: (back)

Write a program that generates an ASCII character set chart using the following output format:

        
  | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
--+------------------------------------------------
20|     !  "  #  ...                               
30|  0  1  2  3  ...                               
40|  @  A  B  C  ...                               
50|  P  Q  R  S  ...                               
60|  '  a  b  c  ...                               
70|  p  q  r  s  ...                               

Note that the columns in the table represent the L.O. four bits of the ASCII code, the rows in the table represent the H.O. four bits of the ASCII code. Note: for extra consideration, use the line-drawing graphic characters (see Appendix B) to draw the lines in the table (this option is available only on systems that support the IBM-PC extended chracter set).

program Question3;

#include( "stdlib.hhf" );

static
    cnt: int8;

begin Question3;

    // Header Section
    stdout.put( "  | ");
    mov( 0, al );
    repeat
        stdout.put( " ", al );
        inc( al );
    until( al = 16 );

    stdout.newln();
    stdout.put( "--+-" );
    mov( 0, al );
    repeat
        stdout.put( "---" );
        inc( al );
    until( al = 16 );
    stdout.newln();


    // ASCII Section
    mov( $20, bl );
    repeat
        stdout.put( bl, "| " );
        mov( bl, al );
        mov( 0, cnt );
        repeat
            stdout.put( "  " );
            stdout.putc( al );
            inc( al );
            inc( cnt );
        until( cnt = 16 );

        add( $10, bl );
        stdout.newln();
    until( bl = $80 );

end Question3;