PROGRAM BOUNCY; const box : array[0..63] of byte = (0,0,0,0,0,0,0,0, 0,0,1,1,1,1,0,0, 0,1,3,3,3,3,1,0, 0,1,3,3,3,3,1,0, 0,1,3,3,3,3,1,0, 0,1,3,3,3,3,1,0, 0,0,1,1,1,1,0,0, 0,0,0,0,0,0,0,0); var address : byte; CPM22 : integer absolute $BE9B; CPMPlus : integer absolute $FC5A; Procedure mode(mo:byte); begin if (address=$22) then Inline($3A/mo/ $CD/CPM22/ $0E/$BC) else Inline($3A/mo/ $CD/CPMPlus/ $0E/$BC); end; Procedure TxtCurOff; begin if (address=$22) then Inline($CD/CPM22/ $84/$BB) else Inline($CD/CPMPlus/ $84/$BB); end; Procedure TxtCurOn; begin IF (address=$22) then Inline($CD/CPM22/ $81/$BB) else Inline($CD/CPMPlus/ $81/$BB); end; Procedure Draw(Xpos, Ypos : Integer); begin IF (address=$22) then Inline($2A/ypos/ $ED/$5B/xpos/ $CD/CPM22/ $F6/$BB) else Inline($2A/ypos/ $ED/$5B/xpos/ $CD/CPMPlus/ $F6/$BB); end; Procedure Move(Xpos, Ypos : Integer); begin IF (address=$22) then Inline($2A/ypos/ $ED/$5B/xpos/ $CD/CPM22/ $C0/$BB) else Inline($2A/ypos/ $ED/$5B/xpos/ $CD/CPMPlus/ $C0/$BB); end; Procedure resetcolor; begin IF (address=$22) then Inline($CD/CPM22/ $02/$BC) else Inline($CD/CPMPlus/ $02/$BC); end; Procedure grapen(col:byte); begin IF (address=$22) then Inline($3A/col/ $CD/CPM22/ $DE/$BB) else Inline($3A/col/ $CD/CPMPlus/ $DE/$BB); end; Procedure PlotPoint(xpos,ypos:integer); begin IF (address=$22) then Inline($2A/ypos/ $ED/$5B/xpos/ $CD/CPM22/ $EA/$BB) else Inline($2A/ypos/ $ED/$5B/xpos/ $CD/CPMPlus/ $EA/$BB); end; Procedure Frame; begin IF (address=$22) then Inline($CD/CPM22/ $19/$BD) else Inline($CD/CPMPlus/ $19/$BD); end; Procedure CheckCPM; begin IF (BDOS($0C)=34) Then Address:=$22 else Address:=$31; end; { Main Procedures } Procedure DrBox(Size : byte; Xpos, Ypos : integer); var Length, Length2 : Integer; Begin Length2:=0; Size:=16; For Length:=0 to 63 do begin GraPen(Box[Length]); PlotPoint(Xpos + Length2, Ypos + Size); Length2:=Length2+2; if Length2=16 then Begin Length2:=0; Size:=Size-2; end; end; end; Procedure DrawBox; Begin Grapen(2); Move(200,300); Draw(470,300); Draw(470,100); Draw(200,100); Draw(200,300); End; Var Xpos, Xdir, Ypos, Ydir : integer; Width, Length : integer; begin { Main Routine } CheckCPM; ResetColor; Mode(1); DrawBox; Xpos:=205; Ypos:=281; Xdir:=1; Ydir:=-1; Repeat TxtCuroff; Xpos:=Xpos+Xdir; Ypos:=Ypos+Ydir; DrBox(Box[Width],Xpos,Ypos); Case Xpos of 450 : Xdir:=-1; 204 : Xdir:=1; end; Case Ypos of 280 : Ydir:=-1; 104 : Ydir:=1; end; TxtCuroff; Until Keypressed; TxtCurOn; Mode(2); End.