// --------------------------------------------------------------------- // bomber.pas — Mad-Pascal, Chapter 2 of the Atari Legacy course // Wojciech "Bocianu" Bociański, Atari Legacy Issue 02 // // !! TRANSCRIBED FROM THE PRINTED LISTING — NOT YET CONFIRMED BY THE // !! AUTHOR. Do not publish this file until Bocianu has sent the // !! original and downloads.verified has been flipped to true in // !! repo-src/resources/mad-pascal-02.toml. // --------------------------------------------------------------------- program bomber; uses atari, joystick; const SCREEN_SIZE = 24*40; var shipPos, bombPos, screenEdge: word; ship: string[3] = ' <>'~; GameOver: boolean = false; procedure DrawShip; var i: byte; begin for i:=0 to 2 do Poke(shipPos+i, Ord(ship[i+1])); end; procedure MoveShip; begin Inc(shipPos); // Move Ship if shipPos = screenEdge then GameOver:=true; // Check if Ship left screen if Peek(shipPos+2) <> 0 then GameOver:=true; // Check if Ship hit a building end; procedure MoveBomb; begin Poke(bombPos, Ord(' '~)); Inc(bombPos, 40); Poke(bombPos, Ord('v'~)); end; procedure DropBomb; begin bombPos := shipPos+3; end; procedure DrawBuildings; var col, row, height: byte; begin for col:=0 to 39 do begin height := 23-Random(12); for row:=24 downto height do Poke(savmsc+(row*40)+col, Ord('"'*~)); end; end; begin FillChar(pointer(savmsc), SCREEN_SIZE, ' '~); // Fill screen with spaces DrawBuildings; shipPos := savmsc; // Set ship position to start of screen screenEdge := savmsc + SCREEN_SIZE; // Get length of screen bombPos := screenEdge; // Bomb starts off screen repeat if rtclok3 and 3 = 0 then MoveShip; // Move Ship if bombPos < screenEdge then begin // Check if Bomb is on Screen if rtclok3 and 1 = 0 then MoveBomb; end else if strig0 = 0 then DropBomb; // Drop Bomb DrawShip; Pause; until GameOver; end.