80-Bus News

  

November–December 1982 · Volume 1 · Issue 4

Page 6 of 51

Doctor Dark’s Diary – Episode 13. Pascal Episode.

Well, the new batch of home brew is just about drinkable, so I had better get on with this, before the rot sets in…

Let’s kick off with the “Rory is right” section. He said that P.J.Brown’s new book, “Pascal from BASIC” should be Computer Book of the year, and I agree wholeheartedly. If you have been putting off learning Pascal because you didn’t like the look of the text books that were available, you now have no excuse. I have found a mistake as well, however, on page 100. The equation for the addition of two complex numbers should read:–

(a,b) + (c,d) = (a+c, b+d)

but this is a minor quibble, and anyway the Pascal procedure to do the job is correct, so perhaps we were being tested to see if we were paying attention…

Free procedure number 1.

Yet another version of my favourite way of clearing the screen, which I have now implemented in four different languages, or was it five? Anyway, here is that old chestnut, the spiral screen wipe, yet again…

PROCEDURE spiral(col : colour);
VAR
  lox, hix, loy, hiy, i, j : integer;
BEGIN
  {Set the size of the first box to be drawn.
  lox := 0; hix := 95; loy := 0; hiy := 44;
  REPEAT
    {Draw a box one pixel wide round the screen.}
    BEGIN
      {Line along the top of the screen.}
      FOR i := lox TO hix DO
        BEGIN
          GRAPH(col,i,loy);
          {This line gives a short delay each time it appears.
          There is no reason why it should not itself be a procedure.}
          FOR j := 1 TO 10 DO BEGIN END
        END;
      {Line down the right hand side of the screen.}
      FOR i := loy+1 TO hiy DO
        BEGIN
          GRAPH(col,hix,i);
          FOR j := 1 TO 10 DO BEGIN END
        END;
      {Line backwards across the bottom of the screen.}
      FOR i := hix-1 DOWNTO lox DO
        BEGIN
          GRAPH(col,i,hiy);
          FOR j := 1 TO 10 DO BEGIN END
        END;
      {Upwards line on the left of the screen.}
      FOR i := hiy-1 DOWNTO loy+i DO
        BEGIN
          GRAPH(col,lox,i);
          FOR j:= 1 TO 10 DO BEGIN END
        END;
Page 6 of 51