Skip to content

Instantly share code, notes, and snippets.

@pamoroso
Last active November 8, 2022 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pamoroso/915e31eaa6d0ab35c774753c10f67c84 to your computer and use it in GitHub Desktop.
Save pamoroso/915e31eaa6d0ab35c774753c10f67c84 to your computer and use it in GitHub Desktop.
Twirling bar animation.

Twirl

A Twirling bar animation.

Developed with Turbo Pascal under CP/M-80 3.0 but should compile and run on any system where Turbo Pascal is available.

Usage

To start the program execute:

A>twirl

Press any key to exit.

Bugs

The pressed key is printed to the terminal when the program exits.

{ Twirling bar animation. Press any key to exit.
Developed with Turbo Pascal under CP/M-80 3.0. Should compile and run on any
system Turbo Pascal supports.
Work in progress. }
{$C-,U-}
program Twirl;
const
Animation = '|/-\|/-\';
NumFrames = 8;
Backspace = #8;
var
Frames : string[NumFrames];
Current : integer;
NotDone : boolean;
Ch : char;
BEGIN
crtinit;
clrscr;
gotoxy(1, 1);
NotDone := true;
while NotDone do
begin
for Current := 1 to NumFrames do
begin
write(Frames[Current]);
write(Backspace);
if keypressed then NotDone := false;
end
end;
{ Clear keyboard buffer. }
while keypressed do
read(kbd, Ch);
crtexit;
clrscr;
gotoxy(1, 1)
END.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment