Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.


stevengreen22stevengreen22 Posts: 4Member
Hi guys,

Before I begin, Uber thanks for any help!!!

So the scenario is that I'm studying for a degree and we've been asked to look into Pascal due to the rigidity of the language.
this is my first taste of programming at this level./

Our current assignment is to reproduce the ASCII table.

This is low level stuff and I'm very new so bear with me.

So fair I have this:

program ASCIITABLE(output);

var i: Integer;
ch: Char;

begin {main program}

writeln ('A to Z in ASCII');

for i := 01 to 127 do
write ( chr(i ));
writeln (' ', i);


writeln ('Press any key to continue' ,ch);
read (ch);


as you can see, fairly basic.
What I'd like is to set the column width and blank fill with spaces so they are all aligned nicely adn to also set up 6 colums for tyhe code to be displayed in.

cna anyone help at all?

huge thanks


  • _Atex__Atex_ Posts: 163Member
    : Our current assignment is to reproduce the ASCII table.
    [code][color=Blue]// Complier FPC v.2.x.x

    {$mode fpc}{$appmode console}

    uses video;

    const hex:array[0..$f] of char='0123456789ABCDEF';

    procedure outchar(x,y:word;attr:byte;ch:char); // Prints a character with a given text attribute @ x,y
    if ((x=0) or (y=0)) then exit;dec(x);dec(y);
    videobuf^[y*screenwidth+x]:=word(attr shl 8) + byte(ch); // direct screen memory write

    var i,j:byte;

    begin initvideo;
    for i:=0 to $f do begin
    outchar(4+i*3,1 ,$0f,hex[i]);
    outchar(1 ,3+i*2,$0f,hex[i]);
    for j:=0 to $f do outchar(4+i*3,3+j*2,$06,chr(i shl 4+j));

Sign In or Register to comment.