tb1/tb12.pas
2012-11-29 23:27:34 -05:00

614 lines
26 KiB
ObjectPascal
Raw Blame History

program TOM_BOMB_EM_AND_INVASION_OF_INANIMATE_OBJECTS;
{by Vincent Weaver....21085-4706}
uses vmwgraph,crt;
{$I c:\pascal\tb1ans.pas}
type screentype = array [0..3999] of byte;
Type Toastinfo = Record { This is format of of each of our }
x,y:integer; { records for the flying toasters }
speed,frame:integer;
active:boolean;
END;
icon = Array [1..30*48] of byte; { This is the size of our pictures }
Virtual = Array [1..64000] of byte; { The size of our Virtual Screen }
VirtPtr = ^Virtual; { Pointer to the virtual screen }
CONST frame1 : icon = (
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,01,01,
01,01,01,01,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,02,02,02,
02,02,02,02,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,03,03,03,
03,03,03,03,03,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,04,04,04,
04,04,04,04,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,05,05,
05,05,05,05,05,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,06,06,06,
06,06,06,06,06,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,05,05,
05,05,05,05,05,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,05,05,
05,05,05,05,05,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,07,07,
7,07,07,07,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,07,07,07,
7,07,07,07,07,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,07,07,07,
7,07,07,07,07,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,07,07,07,
7,07,07,07,07,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,07,07,07,
7,07,07,07,07,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,07,07,07,
7,07,07,07,07,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,07,07,07,
7,07,07,07,07,09,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,09,07,07,07,
7,07,07,07,07,09,09,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,09,09,07,07,07,
7,07,07,07,07,09,09,09,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,09,09,09,07,07,07,
09,09,07,07,07,09,09,09,09,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,07,08,13,14,15,14,15,09,09,09,07,07,07,
08,08,07,07,07,09,09,09,13,14,15,14,15,08,07,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,07,08,09,13,14,15,14,15,09,09,09,07,07,07,
7,07,07,07,07,09,09,09,13,14,15,14,15,09,08,07,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,09,09,09,09,09,09,07,07,07,
10,10,07,07,07,09,09,09,09,09,09,09,09,09,09,08,07,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,07,08,08,08,08,08,08,08,08,08,08,08,08,07,07,07,
11,11,07,07,07,08,08,08,08,08,08,08,08,08,08,08,08,07,00,00,00,00,00,00,
00,00,00,00,00,00,00,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,
12,12,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,18,
17,17,18,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,18,19,
20,20,19,18,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,25,24,
21,21,24,25,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,27,26,25,
22,22,25,27,00,26,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,27,24,
23,23,24,26,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,26,27,
24,27,27,27,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,26,25,26,
26,26,27,25,26,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00);
frame2 : icon = (
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,01,01,
01,01,01,01,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,02,02,02,
02,02,02,02,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,03,03,03,
03,03,03,03,03,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,04,04,04,
04,04,04,04,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,05,05,
05,05,05,05,05,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,06,06,06,
06,06,06,06,06,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,05,05,
05,05,05,05,05,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,05,05,
05,05,05,05,05,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,07,07,
07,07,07,07,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,07,07,07,
07,07,07,07,07,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,07,07,07,
07,07,07,07,07,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,07,07,07,
07,07,07,07,07,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,07,07,07,
07,07,07,07,07,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,07,07,07,
07,07,07,07,07,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,07,07,07,
07,07,07,07,07,09,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,09,07,07,07,
07,07,07,07,07,09,09,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,09,09,07,07,07,
07,07,07,07,07,09,09,09,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,09,09,09,07,07,07,
09,09,07,07,07,09,09,09,09,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,07,08,13,14,15,14,15,09,09,09,07,07,07,
08,08,07,07,07,09,09,09,13,14,15,14,15,08,07,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,07,08,09,13,14,15,14,15,09,09,09,07,07,07,
07,07,07,07,07,09,09,09,13,14,15,14,15,09,08,07,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,09,09,09,09,09,09,07,07,07,
10,10,07,07,07,09,09,09,09,09,09,09,09,09,09,08,07,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,07,08,08,08,08,08,08,08,08,08,08,08,08,07,07,07,
11,11,07,07,07,08,08,08,08,08,08,08,08,08,08,08,08,07,00,00,00,00,00,00,
00,00,00,00,00,00,00,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,
12,12,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,18,
17,17,18,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,18,19,
20,20,19,18,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,25,24,
21,21,25,25,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,27,26,25,
22,22,27,27,00,26,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,27,24,
24,23,23,27,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,26,27,
24,27,27,27,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,26,25,26,
26,26,27,25,26,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00);
frame3 : icon = (
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,01,01,
01,01,01,01,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,02,02,02,
02,02,02,02,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,03,03,03,
03,03,03,03,03,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,04,04,04,
04,04,04,04,04,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,05,05,
05,05,05,05,05,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,06,06,06,
06,06,06,06,06,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,05,05,
05,05,05,05,05,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,05,05,
05,05,05,05,05,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,07,07,
07,07,07,07,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,07,07,07,
07,07,07,07,07,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,07,07,07,
07,07,07,07,07,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,07,07,07,
07,07,07,07,07,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,07,07,07,
07,07,07,07,07,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,07,07,07,
07,07,07,07,07,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,07,07,07,
07,07,07,07,07,09,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,09,07,07,07,
07,07,07,07,07,09,09,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,09,09,07,07,07,
07,07,07,07,07,09,09,09,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,09,09,09,07,07,07,
09,09,07,07,07,09,09,09,09,09,09,09,08,07,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,07,08,13,14,15,14,15,09,09,09,07,07,07,
08,08,07,07,07,09,09,09,13,14,15,14,15,08,07,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,07,08,09,13,14,15,14,15,09,09,09,07,07,07,
07,07,07,07,07,09,09,09,13,14,15,14,15,09,08,07,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,07,08,09,09,09,09,09,09,09,09,09,09,07,07,07,
10,10,07,07,07,09,09,09,09,09,09,09,09,09,09,08,07,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,07,08,08,08,08,08,08,08,08,08,08,08,08,07,07,07,
11,11,07,07,07,08,08,08,08,08,08,08,08,08,08,08,08,07,00,00,00,00,00,00,
00,00,00,00,00,00,00,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,
12,12,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,07,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,18,
17,17,18,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,18,19,
20,20,19,18,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,25,24,
21,21,24,25,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,27,26,25,
22,22,25,27,00,26,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,27,24,
23,23,24,26,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,26,27,
24,27,27,27,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,26,25,26,
26,26,27,25,26,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
);
VAR Virscr : VirtPtr; { Our first Virtual screen }
VirScr2 : VirtPtr; { Our second Virtual screen }
Vaddr : word; { The segment of our virtual screen}
Vaddr2 : Word; { The segment of our 2nd virt. screen}
ourpal : Array [0..255,1..3] of byte; { A virtual pallette }
toaster : Array [1..1] of toastinfo; { The toaster info }
Sound : Pointer;
Check : BOOLEAN;
var grapherror:byte;
temp:array[1..3] of byte;
palf:text;
i,j:byte;
x,y,barpos:integer;
screen:screentype absolute $B800:0000;
ch:char;
function menuread:char;
var chtemp,ch2:char;
begin
repeat until keypressed;
ch2:=#0;
chtemp:=readkey;
if chtemp=chr(0) then ch2:=readkey;
chtemp:=upcase(chtemp);
if (ord(chtemp)<10) and (ord(chtemp)<128) then begin
if ch2='H' then chtemp:='<27>';
if ch2='M' then chtemp:='<27>';
if ch2='P' then chtemp:='<27>';
if ch2='K' then chtemp:='<27>';
end;
menuread:=chtemp;
end;
procedure coolbox(x1,y1,x2,y2:integer);
begin
for i:=0 to 5 do box(x1+i,y1+i,x2-i,y2-i,31-i,vga);
for i:=y1+5 to y2-5 do line(x1+5,i,x2-5,i,7,vga);
end;
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
Procedure ShutDown;
{ This frees the memory used by the virtual screen }
BEGIN
FreeMem (VirScr,64000);
FreeMem (VirScr2,64000);
END;
procedure QUIT;
label menu2;
begin
coolbox(90,75,230,125);
barpos:=0;
outtextxy('QUIT??? ARE YOU',97,82,9,7,vga,false);
outtextxy('ABSOLUTELY SURE?',97,90,9,7,vga,false);
repeat
if barpos=0 then outtextxy('YES-RIGHT NOW!',97,98,150,0,vga,true)
else outtextxy('YES-RIGHT NOW!',97,98,150,7,vga,true);
if barpos=1 then outtextxy('NO--NOT YET.',97,106,150,0,vga,true)
else outtextxy('NO--NOT YET.',97,106,150,7,vga,true);
ch:=menuread;
if (ord(ch)>219) and (ord(ch)<224) then inc(barpos);
if ch='Y' then barpos:=0;
if ch='N' then barpos:=1;
if barpos=2 then barpos:=0;
until ch=#13;
if barpos=1 then goto menu2;
settext;
shutdown;
move(imagedata,screen,4000);
gotoxy(1,23);
halt;
menu2:
end;
Procedure SetUpVirtual;
{ This sets up the memory needed for the virtual screen }
BEGIN
GetMem (VirScr,64000);
vaddr := seg (virscr^);
GetMem (VirScr2,64000);
vaddr2 := seg (virscr2^);
END;
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
Procedure putico(X,Y:Word;VAR sprt : icon;Where:Word); ASSEMBLER;
{ This puts an icon, EXCEPT it's color 0 (black) pixels, onto the screen
"where", at position X,Y }
label
_Redraw, _DrawLoop, _Exit, _LineLoop, _NextLine, _Store, _NoPaint;
asm
push ds
push es
lds si,Sprt
mov ax,X { ax = x }
mov bx,Y { bx = y }
_Redraw:
push ax
mov ax,[where]
mov es,ax
mov ax, bx {; ax = bx x = y}
mov bh, bl {; y = y * 256 bx = bx * 256}
xor bl, bl
shl ax, 1
shl ax, 1
shl ax, 1
shl ax, 1
shl ax, 1
shl ax, 1 {; y = y * 64 ax = ax * 64}
add bx, ax {; y = (y*256) + (Y*64) bx = bx + ax (ie y*320)}
pop ax {; get back our x}
add ax, bx {; finalise location}
mov di, ax
mov dl,30 { dl = height of sprite }
xor ch,ch
mov cl,48 { cx = width of sprite }
cld
push ax
mov ax,cx
_DrawLoop:
push di { store y adr. for later }
mov cx,ax { store width }
_LineLoop:
mov bl,byte ptr [si]
or bl,bl
jnz _Store
_NoPaint:
inc si
inc di
loop _LineLoop
jmp _NextLine
_Store:
movsb
loop _LineLoop
_NextLine:
pop di
dec dl
jz _Exit
add di,320 { di = next line of sprite }
jmp _DrawLoop
_Exit:
pop ax
pop es
pop ds
end;
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
Procedure SetUpScreen;
{ This procedure sets up the static background to be used in the program }
CONST circ : Array [1..5,1..5] of byte =
((00,00,10,00,00),
(00,00,09,00,00),
(10,09,8,09,10),
(00,00,09,00,00),
(00,00,10,00,00));
VAR x,y:integer;
loop1,loop2,loop3:integer;
BEGIN
For loop1:=1 to 200 do BEGIN
x:=random (315);
y:=random (195);
For loop2:=1 to 5 do
For loop3:=1 to 5 do
if circ [loop2,loop3]<>0 then
putpixel (x+loop2,y+loop3,circ [loop2,loop3],vaddr);
END;
flip (vaddr,vga); { Copy the entire screen at vaddr, our virtual screen }
{ on which we have done all our graphics, onto the }
{ screen you see, VGA }
flip (vaddr,vaddr2);
END;
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
Procedure ScreenTrans (x,y:word);
{ This is a small procedure to copy a 30x30 pixel block from coordinates
x,y on the virtual screen to coordinates x,y on the true vga screen }
BEGIN
asm
push ds
push es
mov ax,vaddr
mov es,ax
mov ax,vaddr2
mov ds,ax
mov bx,[X]
mov dx,[Y]
push bx {; and this again for later}
mov bx, dx {; bx = dx}
mov dh, dl {; dx = dx * 256}
xor dl, dl
shl bx, 1
shl bx, 1
shl bx, 1
shl bx, 1
shl bx, 1
shl bx, 1 {; bx = bx * 64}
add dx, bx {; dx = dx + bx (ie y*320)}
pop bx {; get back our x}
add bx, dx {; finalise location}
mov di, bx {; es:di = where to go}
mov si, di
mov al,60
mov bx, 30 { Hight of block to copy }
@@1 :
mov cx, 24 { Width of block to copy divided by 2 }
rep movsw
add di,110h { 320 - 48 = 272 .. or 110 in hex }
add si,110h
dec bx
jnz @@1
pop es
pop ds
end;
{ I wrote this procedure late last night, so it may not be in it's
most optimised state. Sorry :-)}
END;
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
Procedure NewToaster;
{ This adds a new toaster to the screen }
VAR loop1:integer;
BEGIN
loop1:=0;
repeat
inc (loop1);
if not (toaster[loop1].active) then BEGIN
toaster[loop1].x:=36;
toaster[loop1].y:=165;
toaster[loop1].active:=true;
toaster[loop1].frame:=1;
toaster[loop1].speed:=5;
loop1:=10;
END;
until loop1=10;
END;
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
Procedure Fly;
{ This is the procedure where we move and put the toasters }
VAR loop1,loop2:integer;
ch:char;
BEGIN
For loop1:=1 to 10 do
toaster[loop1].active:=FALSE;
ch:=#0;
NewToaster;
Repeat
if keypressed then BEGIN
ch:=readkey;
if ch='+' then inc(toaster[1].x,5);
if ch='-' then dec(toaster[1].x,5); { If '+' is pressed, add a toaster }
end;
for loop1:=1 to 10 do
if toaster[loop1].active then BEGIN
screentrans (toaster[loop1].x,toaster[loop1].y);
{ Restore the backgrond the toaster was over }
{ Move the toaster }
if (toaster[loop1].x<1) or (toaster[loop1].y>170) then BEGIN
toaster[loop1].active:=FALSE;
NewToaster;
END;
{ When toaster reaches the edge of the screen, render it inactive
and bring a new one into existance. }
END;
for loop1:=1 to 10 do
if toaster[loop1].active then BEGIN
CASE toaster [loop1].frame of
1 : putico (toaster[loop1].x,toaster[loop1].y,frame1,vaddr);
3 : putico (toaster[loop1].x,toaster[loop1].y,frame2,vaddr);
2,4 : putico (toaster[loop1].x,toaster[loop1].y,frame3,vaddr);
END;
toaster[loop1].frame:=toaster[loop1].frame+1;
if toaster [loop1].frame=5 then toaster[loop1].frame:=1;
{ Draw all the toasters on the VGA screen }
END;
waitretrace;
flip (vaddr,vga);
until ch=#27;
END;
procedure playthegame;
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
begin
cls(0,vaddr);
SetupScreen; { Draw the background screen to VADDR, then flip it to
the VGA screen }
Fly; { Make the toasters fly around the screen }
{ Free the memory taken up by virtual page }
end;
label picloader,menu;
begin
randomize;
setupvirtual;
fade;
setmcga;
for x:=0 to 40 do begin
pal(100+x,x+20,0,0);
pal(141+x,0,0,x+20);
pal(182+x,0,x+20,0);
end;
fade;
for x:=0 to 40 do begin
line(x+40,45,x+40,45+(2*x),100+x,vga);
line(x+120,45,x+120,45+(2*x),141+x,vga);
line(x+200,45,x+200,45+(2*x),141+x,vga);
line(x+80,125,x+80,125-(2*x),182+x,vga);
line(x+160,125,x+160,125-(2*x),182+x,vga);
end;
for x:=40 downto 0 do begin
line(x+80,45,x+80,125-(2*x),140-x,vga);
line(x+160,45,x+160,125-(2*x),181-x,vga);
line(x+240,45,x+240,125-(2*x),181-x,vga);
line(x+120,125,x+120,45+(2*x),222-x,vga);
line(x+200,125,x+200,45+(2*x),222-x,vga);
end;
unfade;
outtextxy('A VMW SOFTWARE PRODUCTION',60,140,15,15,VGA,false);
y:=0;
repeat until keypressed;
ch:=readkey;
fade;
cls(0,vga);
assign(palf,'pal.tb1');
reset(palf);
for i:=0 to 255 do begin
for j:=1 to 3 do readln(palf,temp[j]);
pal(i,temp[1],temp[2],temp[3]);
end;
close(palf);
fade;
PICLOADER:
grapherror:=loadpicsuperpacked(0,0,vaddr,'tbomb1.tb1');
MENU:
flip(vaddr,vga);
unfade;
repeat until keypressed;
ch:=readkey;
barpos:=0;
outtextxy('F1 HELP',0,190,9,7,vga,false);
coolbox(117,61,199,140);
repeat
if barpos=0 then outtextxy('NEW GAME',123,67,32,0,vga,true)
else outtextxy('NEW GAME',123,67,32,7,vga,true);
if barpos=1 then outtextxy('OPTIONS',123,77,32,0,vga,true)
else outtextxy('OPTIONS',123,77,32,7,vga,true);
if barpos=2 then outtextxy('REGISTER',123,87,32,0,vga,true)
else outtextxy('REGISTER',123,87,32,7,vga,true);
if barpos=3 then outtextxy('LOAD GAME',123,97,32,0,vga,true)
else outtextxy('LOAD GAME',123,97,32,7,vga,true);
if barpos=4 then outtextxy('STORY',123,107,32,0,vga,true)
else outtextxy('STORY',123,107,32,7,vga,true);
if barpos=5 then outtextxy('CREDITS',123,117,32,0,vga,true)
else outtextxy('CREDITS',123,117,32,7,vga,true);
if barpos=6 then outtextxy('QUIT',123,127,32,0,vga,true)
else outtextxy('QUIT',123,127,32,7,vga,true);
ch:=menuread;
if (ord(ch)=222) or (ord(ch)=220) then inc(barpos);
if (ord(ch)=223) or (ord(ch)=221) then dec(barpos);
if ch='N' then barpos:=0;
if ch='O' then barpos:=1;
if ch='R' then barpos:=2;
if ch='L' then barpos:=3;
if ch='S' then barpos:=4;
if ch='C' then barpos:=5;
if ch='Q' then barpos:=6;
if ch=#27 then begin
barpos:=6;
ch:=#13;
end;
if barpos=7 then barpos:=0;
if barpos=-1 then barpos:=6;
until ch=#13;
if barpos=6 then quit;
if barpos=0 then playthegame;
if barpos=0 then goto picloader;
goto menu;
end.