BOUNCE.ATR Disk Image
BOUNCE.P shows how to use the GRAPHICS.I, PLOT.I, and DRAWTO.I include files to get a "ball" bouncing around the screen.
What's one the disk?
The disk image includes the various Atari DOS 2.5 files, Kyan Pascal Include files, Kyan Pascal Run-time library, and ...
GRAPHICS.I - Include file
PLOT.I - Include file
DRAWTO.I - Include file
BOUNCE.P - Source code file
P.OUT - Kyan Pascal intermediate file
BOUNCE - Executable file
Source Code
#A
_ORIGIN EQU $4000
#
Program BOUNCE(Input,Output);
Var
x,y : Integer;
dx, dy : Integer;
minX, minY : Integer;
maxX, maxY : Integer;
oldX, oldY : Integer;
i, j : Integer;
#i Graphics.i
#i Plot.i
#i Drawto.i
Procedure Use_Graphics;
Begin
#A
LDA #<_origin
STA $6A
#
End;
Procedure Use_Text;
Begin
#A
LDA #$C0
STA $6A
#
End; (* of the Use_Text procedure *)
Begin
(* Initialize graphics *)
Use_Graphics;
(* GR 3 with text 40x20 *)
Graphics(3);
minX := 0;
minY := 0;
maxX := 39;
maxY := 19;
dx := 1;
dy := 1;
(* Draw a border *)
Plot(minX,minY,1);
Drawto(maxX,minY,1);
Drawto(maxX,maxY,1);
Drawto(minX,maxY,1);
Drawto(minX,minY,1);
(* Start location *)
x := round(maxX / 2);
y := round(maxY / 2);
for i := 1 to 500 do
begin
plot(x,y,2);
oldX := x;
oldY := y;
if (x<=minX+1) or (x>=maxX-1) then
dx := -dx;
if (y<=minY+1) or (y>=maxY-1) then
dy := -dy;
x := x + dx;
y := y + dy;
for j := 1 to 1500 do
begin
(* slow down *);
end;
plot(oldX,oldY,0);
end;
(* Back to text mode *)
Use_Text;
Graphics(0)
End.
No comments:
Post a Comment